GooCanvas Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Child Properties |
Synopsis
GooCanvasTableModel; GooCanvasItemModel* goo_canvas_table_model_new (GooCanvasItemModel *parent
,...
);
Object Hierarchy
GObject +----GooCanvasItemModelSimple +----GooCanvasGroupModel +----GooCanvasTableModel
Properties
"column-spacing" gdouble : Read / Write "homogeneous-columns" gboolean : Read / Write "homogeneous-rows" gboolean : Read / Write "horz-grid-line-width" gdouble : Read / Write "row-spacing" gdouble : Read / Write "vert-grid-line-width" gdouble : Read / Write "x-border-spacing" gdouble : Read / Write "y-border-spacing" gdouble : Read / Write
Child Properties
"bottom-padding" gdouble : Read / Write "column" guint : Read / Write "columns" guint : Read / Write "left-padding" gdouble : Read / Write "right-padding" gdouble : Read / Write "row" guint : Read / Write "rows" guint : Read / Write "top-padding" gdouble : Read / Write "x-align" gdouble : Read / Write "x-expand" gboolean : Read / Write "x-fill" gboolean : Read / Write "x-shrink" gboolean : Read / Write "y-align" gdouble : Read / Write "y-expand" gboolean : Read / Write "y-fill" gboolean : Read / Write "y-shrink" gboolean : Read / Write
Description
GooCanvasTableModel is a model for a table container used to lay out other canvas items. It is used in a similar way to how the GtkTable widget is used to lay out GTK+ widgets.
Item models are added to the table using the normal methods, then
goo_canvas_item_model_set_child_properties()
is used to specify how each
child item is to be positioned within the table (i.e. which row and column
it is in, how much padding it should have and whether it should expand or
shrink).
GooCanvasTableModel is a subclass of GooCanvasItemModelSimple and so inherits all of the style properties such as "stroke-color", "fill-color" and "line-width". Setting a style property on a GooCanvasTableModel will affect all children of the GooCanvasTableModel (unless the children override the property setting).
GooCanvasTableModel implements the GooCanvasItemModel interface, so you
can use the GooCanvasItemModel functions such as
goo_canvas_item_model_raise()
and goo_canvas_item_rotate()
, and the
properties such as "visibility" and "pointer-events".
To create a GooCanvasTableModel use goo_canvas_table_model_new()
.
To get or set the properties of an existing GooCanvasTableModel, use
g_object_get()
and g_object_set()
.
Details
GooCanvasTableModel
typedef struct _GooCanvasTableModel GooCanvasTableModel;
The GooCanvasTableModel struct contains private data only.
goo_canvas_table_model_new ()
GooCanvasItemModel* goo_canvas_table_model_new (GooCanvasItemModel *parent
,...
);
Creates a new table model.
|
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.
|
|
optional pairs of property names and values, and a terminating NULL .
|
Returns : |
a new table model. |
Here's an example showing how to create a table with a square, a circle and a triangle in it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
GooCanvasItemModel *table, *square, *circle, *triangle; table = goo_canvas_table_model_new (root, "row-spacing", 4.0, "column-spacing", 4.0, NULL); goo_canvas_item_model_translate (table, 400, 200); square = goo_canvas_rect_model_new (table, 0.0, 0.0, 50.0, 50.0, "fill-color", "red", NULL); goo_canvas_item_model_set_child_properties (table, square, "row", 0, "column", 0, NULL); circle = goo_canvas_ellipse_model_new (table, 0.0, 0.0, 25.0, 25.0, "fill-color", "blue", NULL); goo_canvas_item_model_set_child_properties (table, circle, "row", 0, "column", 1, NULL); triangle = goo_canvas_polyline_model_new (table, TRUE, 3, 25.0, 0.0, 0.0, 50.0, 50.0, 50.0, "fill-color", "yellow", NULL); goo_canvas_item_model_set_child_properties (table, triangle, "row", 0, "column", 2, NULL); |
Property Details
The "column-spacing"
property
"column-spacing" gdouble : Read / Write
The default space between columns.
Allowed values: >= 0
Default value: 0
The "homogeneous-columns"
property
"homogeneous-columns" gboolean : Read / Write
If all columns are the same width.
Default value: FALSE
The "homogeneous-rows"
property
"homogeneous-rows" gboolean : Read / Write
If all rows are the same height.
Default value: FALSE
The "horz-grid-line-width"
property
"horz-grid-line-width" gdouble : Read / Write
The width of the grid line to draw between rows.
Allowed values: >= 0
Default value: 0
The "row-spacing"
property
"row-spacing" gdouble : Read / Write
The default space between rows.
Allowed values: >= 0
Default value: 0
The "vert-grid-line-width"
property
"vert-grid-line-width" gdouble : Read / Write
The width of the grid line to draw between columns.
Allowed values: >= 0
Default value: 0
The "x-border-spacing"
property
"x-border-spacing" gdouble : Read / Write
The amount of spacing between the lefmost and rightmost cells and the border grid line.
Allowed values: >= 0
Default value: 0
Child Property Details
The "bottom-padding"
child property
"bottom-padding" gdouble : Read / Write
Extra space to add below the item.
Allowed values: >= 0
Default value: 0
The "column"
child property
"column" guint : Read / Write
The column to place the item in.
Allowed values: <= 65535
Default value: 0
The "columns"
child property
"columns" guint : Read / Write
The number of columns that the item spans.
Allowed values: <= 65535
Default value: 1
The "left-padding"
child property
"left-padding" gdouble : Read / Write
Extra space to add to the left of the item.
Allowed values: >= 0
Default value: 0
The "right-padding"
child property
"right-padding" gdouble : Read / Write
Extra space to add to the right of the item.
Allowed values: >= 0
Default value: 0
The "row"
child property
"row" guint : Read / Write
The row to place the item in.
Allowed values: <= 65535
Default value: 0
The "rows"
child property
"rows" guint : Read / Write
The number of rows that the item spans.
Allowed values: <= 65535
Default value: 1
The "top-padding"
child property
"top-padding" gdouble : Read / Write
Extra space to add above the item.
Allowed values: >= 0
Default value: 0
The "x-align"
child property
"x-align" gdouble : Read / Write
The horizontal position of the item within its allocated space. 0.0 is left-aligned, 1.0 is right-aligned.
Allowed values: [0,1]
Default value: 0.5
The "x-expand"
child property
"x-expand" gboolean : Read / Write
If the item expands horizontally as the table expands.
Default value: FALSE
The "x-fill"
child property
"x-fill" gboolean : Read / Write
If the item fills all horizontal allocated space.
Default value: FALSE
The "x-shrink"
child property
"x-shrink" gboolean : Read / Write
If the item can shrink smaller than its requested size horizontally.
Default value: FALSE
The "y-align"
child property
"y-align" gdouble : Read / Write
The vertical position of the item within its allocated space. 0.0 is top-aligned, 1.0 is bottom-aligned.
Allowed values: [0,1]
Default value: 0.5
The "y-expand"
child property
"y-expand" gboolean : Read / Write
If the item expands vertically as the table expands.
Default value: FALSE
The "y-fill"
child property
"y-fill" gboolean : Read / Write
If the item fills all vertical allocated space.
Default value: FALSE