GooCanvas Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
Synopsis
GooCanvasTextModel; GooCanvasItemModel* goo_canvas_text_model_new (GooCanvasItemModel *parent
,const char *string
,gdouble x
,gdouble y
,gdouble width
,GtkAnchorType anchor
,...
);
Properties
"alignment" PangoAlignment : Read / Write "anchor" GtkAnchorType : Read / Write "ellipsize" PangoEllipsizeMode : Read / Write "height" gdouble : Read / Write "text" gchar* : Read / Write "use-markup" gboolean : Read / Write "width" gdouble : Read / Write "wrap" PangoWrapMode : Read / Write "x" gdouble : Read / Write "y" gdouble : Read / Write
Description
GooCanvasTextModel represents a model for text items.
It is a subclass of GooCanvasItemModelSimple and so inherits all of the style properties such as "fill-color".
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 GooCanvasTextModel use goo_canvas_text_model_new()
.
To get or set the properties of an existing GooCanvasTextModel, use
g_object_get()
and g_object_set()
.
To respond to events such as mouse clicks on the text item you must connect
to the signal handlers of the corresponding GooCanvasText objects.
(See goo_canvas_get_item()
and "item-created".)
Details
GooCanvasTextModel
typedef struct _GooCanvasTextModel GooCanvasTextModel;
The GooCanvasTextModel struct contains private data only.
goo_canvas_text_model_new ()
GooCanvasItemModel* goo_canvas_text_model_new (GooCanvasItemModel *parent
,const char *string
,gdouble x
,gdouble y
,gdouble width
,GtkAnchorType anchor
,...
);
Creates a new text 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.
|
|
the text to display. |
|
the x coordinate of the text. |
|
the y coordinate of the text. |
|
the width of the text item, or -1 for unlimited width. |
|
the position of the text relative to the given x and y
coordinates. For example an anchor of GDK_ANCHOR_NW will result in the
top-left of the text being placed at the given x and y coordinates.
An anchor of GDK_ANCHOR_CENTER will result in the center of the text being
placed at the x and y coordinates.
|
|
optional pairs of property names and values, and a terminating NULL .
|
Returns : |
a new text model. |
Here's an example showing how to create a text item with the bottom right of the text box placed at (500,500):
1 2 3 |
GooCanvasItemModel *text = goo_canvas_text_model_new (mygroup, "Hello World", 500.0, 500.0, 200.0, GTK_ANCHOR_SE, "fill-color", "blue", NULL); |
Property Details
The "alignment"
property
"alignment" PangoAlignment : Read / Write
How to align the text.
Default value: PANGO_ALIGN_LEFT
The "anchor"
property
"anchor" GtkAnchorType : Read / Write
How to position the text relative to the given x and y coordinates.
Default value: GTK_ANCHOR_NORTH_WEST
The "ellipsize"
property
"ellipsize" PangoEllipsizeMode : Read / Write
The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.
Default value: PANGO_ELLIPSIZE_NONE
The "height"
property
"height" gdouble : Read / Write
The height to use to layout the text, or -1 to let the text use as much vertical space as needed.
Default value: -1
The "use-markup"
property
"use-markup" gboolean : Read / Write
Whether to parse PangoMarkup in the text, to support different styles.
Default value: FALSE
The "width"
property
"width" gdouble : Read / Write
The width to use to layout the text, or -1 to let the text use as much horizontal space as needed.
Default value: -1
The "wrap"
property
"wrap" PangoWrapMode : Read / Write
The preferred method of wrapping the string if a width has been set.
Default value: PANGO_WRAP_WORD