GooCanvasText

GooCanvasText — a text item.

Synopsis


#include <goocanvas.h>


            GooCanvasText;

GooCanvasItem* goo_canvas_text_new          (GooCanvasItem *parent,
                                             const char *string,
                                             gdouble x,
                                             gdouble y,
                                             gdouble width,
                                             GtkAnchorType anchor,
                                             const gchar *first_property,
                                             ...);

Object Hierarchy


  GObject
   +----GooCanvasItemSimple
         +----GooCanvasText

Implemented Interfaces

GooCanvasText implements GooCanvasItem.

Properties


  "alignment"            PangoAlignment        : Read / Write
  "anchor"               GtkAnchorType         : Read / Write
  "font"                 gchararray            : Read / Write
  "font-desc"            PangoFontDescription  : Read / Write
  "text"                 gchararray            : Read / Write
  "use-markup"           gboolean              : Read / Write
  "width"                gdouble               : Read / Write
  "x"                    gdouble               : Read / Write
  "y"                    gdouble               : Read / Write

Description

GooCanvasText represents a text item.

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

It also implements the GooCanvasItem interface, so you can use the GooCanvasItem functions such as goo_canvas_item_raise() and goo_canvas_item_rotate().

To create a GooCanvasText use goo_canvas_text_new().

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

To respond to events such as mouse clicks on the text you must connect to the signal handlers of the corresponding GooCanvasTextView objects. (See goo_canvas_view_get_item_view() and GooCanvasView::item-view-created.)

Details

GooCanvasText

typedef struct _GooCanvasText GooCanvasText;

The GooCanvasText struct contains private data only.


goo_canvas_text_new ()

GooCanvasItem* goo_canvas_text_new          (GooCanvasItem *parent,
                                             const char *string,
                                             gdouble x,
                                             gdouble y,
                                             gdouble width,
                                             GtkAnchorType anchor,
                                             const gchar *first_property,
                                             ...);

Creates a new text item.

parent : the parent item, 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.
string : the text to display.
x : the x coordinate of the text.
y : the y coordinate of the text.
width : the width of the text item, or -1 for unlimited width.
anchor : 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.
first_property : the name of the first property to set, or NULL.
... : the remaining property names and values to set, terminated with a NULL.
Returns : a new text item.

Here's an example showing how to create a text item with the bottom right of the text box placed at (500,500):

 GooCanvasItem *text = goo_canvas_text_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 "font" property

  "font"                 gchararray            : Read / Write

The base font to use for the text.

Default value: NULL


The "font-desc" property

  "font-desc"            PangoFontDescription  : Read / Write

The attributes specifying which font to use.


The "text" property

  "text"                 gchararray            : Read / Write

The text to display.

Default value: NULL


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.

Default value: -1


The "x" property

  "x"                    gdouble               : Read / Write

The x coordinate of the text.

Default value: 0


The "y" property

  "y"                    gdouble               : Read / Write

The y coordinate of the text.

Default value: 0