manpagez: man pages & more
html files: goocanvas
Home | html | info | man

GooCanvasPolylineModel

GooCanvasPolylineModel — a model for polyline items (a series of lines with optional arrows).

Synopsis

                    GooCanvasPolylineModel;
GooCanvasItemModel* goo_canvas_polyline_model_new       (GooCanvasItemModel *parent,
                                                         gboolean close_path,
                                                         gint num_points,
                                                         ...);
GooCanvasItemModel* goo_canvas_polyline_model_new_line  (GooCanvasItemModel *parent,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         ...);

Object Hierarchy

  GObject
   +----GooCanvasItemModelSimple
         +----GooCanvasPolylineModel

Implemented Interfaces

GooCanvasPolylineModel implements GooCanvasItemModel.

Properties

  "arrow-length"             gdouble               : Read / Write
  "arrow-tip-length"         gdouble               : Read / Write
  "arrow-width"              gdouble               : Read / Write
  "close-path"               gboolean              : Read / Write
  "end-arrow"                gboolean              : Read / Write
  "height"                   gdouble               : Read / Write
  "points"                   GooCanvasPoints*      : Read / Write
  "start-arrow"              gboolean              : Read / Write
  "width"                    gdouble               : Read / Write
  "x"                        gdouble               : Read / Write
  "y"                        gdouble               : Read / Write

Description

GooCanvasPolylineModel represents a model for polyline items, which are a series of one or more lines, with optional arrows at either end.

It is a subclass of GooCanvasItemModelSimple and so inherits all of the style properties such as "stroke-color", "fill-color" and "line-width".

It also implements the GooCanvasItemModel interface, so you can use the GooCanvasItemModel functions such as goo_canvas_item_model_raise() and goo_canvas_item_model_rotate().

To create a GooCanvasPolylineModel use goo_canvas_polyline_model_new(), or goo_canvas_polyline_model_new_line() for a simple line between two points.

To get or set the properties of an existing GooCanvasPolylineModel, use g_object_get() and g_object_set().

To respond to events such as mouse clicks on the polyline you must connect to the signal handlers of the corresponding GooCanvasPolyline objects. (See goo_canvas_get_item() and "item-created".)

Details

GooCanvasPolylineModel

typedef struct _GooCanvasPolylineModel GooCanvasPolylineModel;

The GooCanvasPolylineModel struct contains private data only.


goo_canvas_polyline_model_new ()

GooCanvasItemModel* goo_canvas_polyline_model_new       (GooCanvasItemModel *parent,
                                                         gboolean close_path,
                                                         gint num_points,
                                                         ...);

Creates a new polyline model.

parent :

the parent model, or NULL. If a parent is specified, it will assume ownership of the item, and the item will automatically be freed when it is removed from the parent. Otherwise call g_object_unref() to free it.

close_path :

if the last point should be connected to the first.

num_points :

the number of points in the polyline.

... :

the pairs of coordinates for each point in the line, followed by optional pairs of property names and values, and a terminating NULL.

Returns :

a new polyline model.

Here's an example showing how to create a filled triangle with vertices at (100,100), (300,100), and (200,300).

1
2
3
4
5
6
7
8
GooCanvasItemModel *polyline = goo_canvas_polyline_model_new (mygroup, TRUE, 3,
                                                              100.0, 100.0,
                                                              300.0, 100.0,
                                                              200.0, 300.0,
                                                              "stroke-color", "red",
                                                              "line-width", 5.0,
                                                              "fill-color", "blue",
                                                              NULL);


goo_canvas_polyline_model_new_line ()

GooCanvasItemModel* goo_canvas_polyline_model_new_line  (GooCanvasItemModel *parent,
                                                         gdouble x1,
                                                         gdouble y1,
                                                         gdouble x2,
                                                         gdouble y2,
                                                         ...);

Creates a new polyline model with a single line.

parent :

the parent model, or NULL.

x1 :

the x coordinate of the start of the line.

y1 :

the y coordinate of the start of the line.

x2 :

the x coordinate of the end of the line.

y2 :

the y coordinate of the end of the line.

... :

optional pairs of property names and values, and a terminating NULL.

Returns :

a new polyline model.

Here's an example showing how to create a line from (100,100) to (300,300).

1
2
3
4
5
6
GooCanvasItemModel *polyline = goo_canvas_polyline_model_new_line (mygroup,
                                                                   100.0, 100.0,
                                                                   300.0, 300.0,
                                                                   "stroke-color", "red",
                                                                   "line-width", 5.0,
                                                                   NULL);

Property Details

The "arrow-length" property

  "arrow-length"             gdouble               : Read / Write

The length of the arrows, as a multiple of the line width.

Allowed values: >= 0

Default value: 5


The "arrow-tip-length" property

  "arrow-tip-length"         gdouble               : Read / Write

The length of the arrow tip, as a multiple of the line width.

Allowed values: >= 0

Default value: 4


The "arrow-width" property

  "arrow-width"              gdouble               : Read / Write

The width of the arrows, as a multiple of the line width.

Allowed values: >= 0

Default value: 4


The "close-path" property

  "close-path"               gboolean              : Read / Write

If the last point should be connected to the first.

Default value: FALSE


The "end-arrow" property

  "end-arrow"                gboolean              : Read / Write

If an arrow should be displayed at the end of the polyline.

Default value: FALSE


The "height" property

  "height"                   gdouble               : Read / Write

The height of the polyline.

Allowed values: >= 0

Default value: 0


The "points" property

  "points"                   GooCanvasPoints*      : Read / Write

The array of points.


The "start-arrow" property

  "start-arrow"              gboolean              : Read / Write

If an arrow should be displayed at the start of the polyline.

Default value: FALSE


The "width" property

  "width"                    gdouble               : Read / Write

The width of the polyline.

Allowed values: >= 0

Default value: 0


The "x" property

  "x"                        gdouble               : Read / Write

The x coordinate of the left-most point of the polyline.

Default value: 0


The "y" property

  "y"                        gdouble               : Read / Write

The y coordinate of the top-most point of the polyline.

Default value: 0

© manpagez.com 2000-2017
Individual documents may contain additional copyright information.