| GOffice Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | ||||
GocItem; GocItemClass; void goc_item_bounds_changed (GocItem *item); void goc_item_destroy (GocItem *item); double goc_item_distance (GocItem *item,double x,double y,GocItem **near_item); void goc_item_draw (GocItem const *item,cairo_t *cr); gboolean goc_item_draw_region (GocItem const *item,cairo_t *cr,double x0,double y0,double x1,double y1); void goc_item_get_bounds (GocItem const *item,double *x0,double *y0,double *x1,double *y1); cairo_operator_t goc_item_get_operator (GocItem *item); GocGroup * goc_item_get_parent (GocItem *item); GdkWindow * goc_item_get_window (GocItem *item); void goc_item_grab (GocItem *item); void goc_item_hide (GocItem *item); void goc_item_invalidate (GocItem *item); gboolean goc_item_is_visible (GocItem *item); void goc_item_lower (GocItem *item,int n); void goc_item_lower_to_bottom (GocItem *item); GocItem * goc_item_new (GocGroup *parent,GType type,const gchar *first_arg_name,...); void goc_item_raise (GocItem *item,int n); void goc_item_raise_to_top (GocItem *item); void goc_item_set (GocItem *item,const gchar *first_arg_name,...); void goc_item_set_operator (GocItem *item,cairo_operator_t op); void goc_item_set_transform (GocItem *item,cairo_matrix_t *m); void goc_item_set_visible (GocItem *item,gboolean visible); void goc_item_show (GocItem *item); void goc_item_ungrab (GocItem *item);
GObject +----GocItem +----GocStyledItem +----GocComponent +----GocGraph +----GocGroup +----GocImage +----GocPixbuf +----GocWidget
typedef struct {
GObjectClass base;
double (*distance) (GocItem *item,
double x, double y, GocItem **near_item);
void (*draw) (GocItem const *item, cairo_t *cr);
gboolean (*draw_region) (GocItem const *item, cairo_t *cr,
double x0, double y0, double x1, double y1);
void (*update_bounds) (GocItem *item);
/* events related functions */
gboolean (*button_pressed) (GocItem *item, int button, double x, double y);
gboolean (*button2_pressed) (GocItem *item, int button, double x, double y);
gboolean (*button_released) (GocItem *item, int button, double x, double y);
gboolean (*motion) (GocItem *item, double x, double y);
gboolean (*enter_notify) (GocItem *item, double x, double y);
gboolean (*leave_notify) (GocItem *item, double x, double y);
void (*realize) (GocItem *item);
void (*unrealize) (GocItem *item);
void (*notify_scrolled) (GocItem *item);
#ifdef GOFFICE_WITH_GTK
gboolean (*key_pressed) (GocItem *item, GdkEventKey* ev);
gboolean (*key_released) (GocItem *item, GdkEventKey* ev);
GdkWindow* (*get_window) (GocItem *item);
} GocItemClass;
The base class for all canvas items.
GObjectClass |
the parent class |
returns the distance between the item and the point defined by
x and y. When the distance is larger than a few pixels, the result is not
relevant, so an approximate value or even G_MAXDOUBLE might be returned.
|
|
| draws the item to the cairo context. | |
draws the item in the region defined by x0, y0, x1 and y1.
Should return TRUE when successfull. If FALSE is returned, draw will be
called. There is no need to implement both methods for an item. Large items
should implement draw_region.
|
|
| updates the bounds stored in GocItem as fields x0, y0, x1,and y1. | |
| callback for a button press event. | |
| callback for a double click event. | |
| callback for a button release event. | |
| callback for a motion event. | |
| callback for an enter notify event. | |
| callback for a leave notify event. | |
| callback for a realizes event. | |
| callback for an unrealize event. | |
| callback for a notify scrolled event. This is useful to reposition children of the GtkLayout parent of the canvas to their new position. | |
| callback for a key press event. | |
| callback for a key release event. | |
| returns theGdkWindow for the item if any. |
void goc_item_bounds_changed (GocItem *item);
This function needs to be called each time the bounds of item change. It
is normally called from inside the implementation of items derived classes.
|
GocItem |
void goc_item_destroy (GocItem *item);
Destroys item, removes it from its parent group and updates the canvas
accordingly.
|
GocItem |
double goc_item_distance (GocItem *item,double x,double y,GocItem **near_item);
Evaluates the distance between the point with canvas coordinates x,y
and the nearest point of item. near_item is set with either item or
its appropriate child.
|
GocItem |
|
horizontal position |
|
vertical position |
|
where to store the nearest item |
Returns : |
the evaluated distance. |
void goc_item_draw (GocItem const *item,cairo_t *cr);
Renders item using cr. There is no need to call this function directly.
Invalidating the item is the way to go.
gboolean goc_item_draw_region (GocItem const *item,cairo_t *cr,double x0,double y0,double x1,double y1);
Renders item using cr, limiting all drawings to the region limited by
x0, y0, x1, and y1. If this function returns FALSE, goc_item_draw
should be called. There is no need to call this function directly.
Invalidating the item is the way to go.
void goc_item_get_bounds (GocItem const *item,double *x0,double *y0,double *x1,double *y1);
Retrieves the bounds of item in canvas coordinates.
|
GocItem |
|
where to store the lowest horizontal bound |
|
where to store the lowest vertical bound |
|
where to store the highest horizontal bound |
|
where to store the highest vertical bound |
cairo_operator_t goc_item_get_operator (GocItem *item);
|
GocItem |
Returns : |
the operator used when drawing the item. |
void goc_item_grab (GocItem *item);
Grabs the item. This function will fail if another item is grabbed.
|
GocItem |
void goc_item_invalidate (GocItem *item);
Force a redraw of item bounding region.
|
GocItem |
void goc_item_lower (GocItem *item,int n);
Lowers item by n steps inside its parent GocGroup (or less if the list
is too short) in the item list so that it is displayed more deeply in the
items stack.
|
GocItem |
|
the rank change |
void goc_item_lower_to_bottom (GocItem *item);
Lowers item to bottom inside its parent GocGroup so that it will be at
least partly hidden by any overlapping item.
|
GocItem |
GocItem * goc_item_new (GocGroup *parent,GType type,const gchar *first_arg_name,...);
Creates a new item of type type in group group. Properties can be
set just the same way they are in g_object_new.
void goc_item_raise (GocItem *item,int n);
Raises item by n steps inside its parent GocGroup (or less if the list
is too short) in the item list so that it is displayed nearer the top of
the items stack.
|
GocItem |
|
the rank change |
void goc_item_raise_to_top (GocItem *item);
Raises item to front so that it becomes the toplevel item inside
its parent GocGroup.
|
GocItem |
void goc_item_set (GocItem *item,const gchar *first_arg_name,...);
Set properties and updates the canvas. Using g_object_set instead would set the properties, but not update the canvas.
void goc_item_set_operator (GocItem *item,cairo_operator_t op);
Set the operator used when drawing the item.
|
GocItem |
|
cairo_operator_t |
void goc_item_set_transform (GocItem *item,cairo_matrix_t *m);
Set the matrix used to transform the item.
|
GocItem |
|
cairo_matrix_t |
void goc_item_set_visible (GocItem *item,gboolean visible);
Either hides or shows item as appropriate..
|
GocItem |
|
whether the item should be visible |