![]() |
![]() |
![]() |
GooCanvas Reference Manual | ![]() |
---|---|---|---|---|
#include <goocanvas.h> GooCanvasItemView; GooCanvasItemViewIface; GooCanvasView* goo_canvas_item_view_get_canvas_view (GooCanvasItemView *view); GooCanvasItemView* goo_canvas_item_view_get_parent_view (GooCanvasItemView *view); void goo_canvas_item_view_set_parent_view (GooCanvasItemView *view, GooCanvasItemView *parent_view); gboolean goo_canvas_item_view_is_container (GooCanvasItemView *view); gint goo_canvas_item_view_get_n_children (GooCanvasItemView *view); GooCanvasItemView* goo_canvas_item_view_get_child (GooCanvasItemView *view, gint child_num); gint goo_canvas_item_view_find_child (GooCanvasItemView *view, GooCanvasItemView *child); void goo_canvas_item_view_request_update (GooCanvasItemView *view); void goo_canvas_item_view_ensure_updated (GooCanvasItemView *view); void goo_canvas_item_view_update (GooCanvasItemView *view, gboolean entire_tree, cairo_t *cr, GooCanvasBounds *bounds); GooCanvasItem* goo_canvas_item_view_get_item (GooCanvasItemView *view); GooCanvasItemView* goo_canvas_item_view_get_item_view_at (GooCanvasItemView *view, gdouble x, gdouble y, cairo_t *cr, gboolean is_pointer_event, gboolean parent_is_visible); void goo_canvas_item_view_get_bounds (GooCanvasItemView *view, GooCanvasBounds *bounds); gboolean goo_canvas_item_view_is_visible (GooCanvasItemView *view); void goo_canvas_item_view_paint (GooCanvasItemView *view, cairo_t *cr, GooCanvasBounds *bounds, gdouble scale); cairo_matrix_t* goo_canvas_item_view_get_transform (GooCanvasItemView *view); void goo_canvas_item_view_set_transform (GooCanvasItemView *view, cairo_matrix_t *matrix); gboolean goo_canvas_item_view_get_combined_transform (GooCanvasItemView *view, cairo_matrix_t *result);
GooCanvasItemView is implemented by GooCanvasImageView, GooCanvasGroupView, GooCanvasPathView, GooCanvasEllipseView, GooCanvasPolylineView, GooCanvasRectView, GooCanvasItemViewSimple and GooCanvasTextView.
"button-press-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventButton *event, gpointer user_data) : Run last "button-release-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventButton *event, gpointer user_data) : Run last "enter-notify-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventCrossing *event, gpointer user_data) : Run last "focus-in-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventFocus *event, gpointer user_data) : Run last "focus-out-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventFocus *event, gpointer user_data) : Run last "grab-broken-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEvent *event, gpointer user_data) : Run last "key-press-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventKey *event, gpointer user_data) : Run last "key-release-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventKey *event, gpointer user_data) : Run last "leave-notify-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventCrossing *event, gpointer user_data) : Run last "motion-notify-event" gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventMotion *event, gpointer user_data) : Run last
GooCanvasItemView defines the interface that item views must implement, and contains methods for operating on item views.
typedef struct _GooCanvasItemView GooCanvasItemView;
GooCanvasItemView is a typedef used for objects that implement the GooCanvasItemView interface.
(There is no actual GooCanvasItemView struct, since it is only an interface. But using 'GooCanvasItemView' is more helpful than using 'GObject'.)
typedef struct { /* Virtual methods that group views should implement. */ GooCanvasView* (* get_canvas_view) (GooCanvasItemView *view); gint (* get_n_children) (GooCanvasItemView *group_view); GooCanvasItemView* (* get_child) (GooCanvasItemView *group_view, gint child_num); void (* request_update) (GooCanvasItemView *view); /* Virtual methods all item views must implement. */ GooCanvasItemView* (* get_parent_view) (GooCanvasItemView *view); void (* set_parent_view) (GooCanvasItemView *view, GooCanvasItemView *parent_view); cairo_matrix_t* (* get_transform) (GooCanvasItemView *view); void (* set_transform) (GooCanvasItemView *view, cairo_matrix_t *matrix); GooCanvasItem* (* get_item) (GooCanvasItemView *view); void (* get_bounds) (GooCanvasItemView *view, GooCanvasBounds *bounds); GooCanvasItemView* (* get_item_view_at) (GooCanvasItemView *view, gdouble x, gdouble y, cairo_t *cr, gboolean is_pointer_event, gboolean parent_is_visible); gboolean (* is_visible) (GooCanvasItemView *view); void (* update) (GooCanvasItemView *view, gboolean entire_tree, cairo_t *cr, GooCanvasBounds *bounds); void (* paint) (GooCanvasItemView *view, cairo_t *cr, GooCanvasBounds *bounds, gdouble scale); /* Signals. */ gboolean (* enter_notify_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventCrossing *event); gboolean (* leave_notify_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventCrossing *event); gboolean (* motion_notify_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventMotion *event); gboolean (* button_press_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventButton *event); gboolean (* button_release_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventButton *event); gboolean (* focus_in_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventFocus *event); gboolean (* focus_out_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventFocus *event); gboolean (* key_press_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventKey *event); gboolean (* key_release_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventKey *event); gboolean (* grab_broken_event) (GooCanvasItemView *view, GooCanvasItemView *target, GdkEventGrabBroken *event); } GooCanvasItemViewIface;
GooCanvasItemViewIFace holds the virtual methods that make up the GooCanvasItemView interface.
GooCanvasView* goo_canvas_item_view_get_canvas_view (GooCanvasItemView *view);
Returns the GooCanvasView containing the given GooCanvasItemView.
view : |
a GooCanvasItemView. |
Returns : | the GooCanvasView. |
GooCanvasItemView* goo_canvas_item_view_get_parent_view (GooCanvasItemView *view);
Returns the parent view of the given GooCanvasItemView.
view : |
a GooCanvasItemView. |
Returns : | the parent view of the item. |
void goo_canvas_item_view_set_parent_view (GooCanvasItemView *view, GooCanvasItemView *parent_view);
Sets the parent view of the given GooCanvasItemView.
view : |
a GooCanvasItemView. |
parent_view : |
the parent view. |
gboolean goo_canvas_item_view_is_container (GooCanvasItemView *view);
Returns TRUE
if the given GooCanvasItemView is a container,
i.e. it may contain children;
view : |
a GooCanvasItemView. |
Returns : | TRUE if the item view is a container.
|
gint goo_canvas_item_view_get_n_children (GooCanvasItemView *view);
Returns the number of children of the given GooCanvasItemView.
view : |
a GooCanvasItemView. |
Returns : | the number of children of the GooCanvasItemView, or 0 if the view is not a container. |
GooCanvasItemView* goo_canvas_item_view_get_child (GooCanvasItemView *view, gint child_num);
Returns the child view at the given index, or NULL
if the item has no
children or the index is out of range.
view : |
a GooCanvasItemView. |
child_num : |
the index of the child within the view, counting from 0. |
Returns : | the child at the given index. |
gint goo_canvas_item_view_find_child (GooCanvasItemView *view, GooCanvasItemView *child);
Gets the index of the child item view, counting from 0.
view : |
a GooCanvasItemView. |
child : |
a child view. |
Returns : | the index of the given child item view. |
void goo_canvas_item_view_request_update (GooCanvasItemView *view);
Requests that an update of the item is scheduled. It will be performed as soon as the application is idle, and before the canvas is redrawn.
view : |
a GooCanvasItemView. |
void goo_canvas_item_view_ensure_updated (GooCanvasItemView *view);
Updates the canvas immediately, if an update is scheduled. This ensures that all item bounds are up-to-date.
view : |
a GooCanvasItemView. |
void goo_canvas_item_view_update (GooCanvasItemView *view, gboolean entire_tree, cairo_t *cr, GooCanvasBounds *bounds);
Updates the item view, if needed, and any children.
view : |
a GooCanvasItemView. |
entire_tree : |
if the entire subtree should be updated. |
cr : |
a cairo context. |
bounds : |
a GooCanvasBounds to return the new bounds in. |
GooCanvasItem* goo_canvas_item_view_get_item (GooCanvasItemView *view);
Returns the item the view is displaying.
view : |
a GooCanvasItemView. |
Returns : | the GooCanvasItem that the view is displaying. |
GooCanvasItemView* goo_canvas_item_view_get_item_view_at (GooCanvasItemView *view, gdouble x, gdouble y, cairo_t *cr, gboolean is_pointer_event, gboolean parent_is_visible);
Gets the item view at the given point.
view : |
a GooCanvasItemView. |
x : |
the x coordinate of the point. |
y : |
the y coordinate of the point. |
cr : |
a cairo contect. |
is_pointer_event : |
TRUE if the "pointer-events" properties of items should
be used to determine which parts of the item are tested.
|
parent_is_visible : |
TRUE if the parent item view is visible (which
implies that all ancestors are also visible).
|
Returns : | the item view found at the given point, or NULL if no item view
was found.
|
void goo_canvas_item_view_get_bounds (GooCanvasItemView *view, GooCanvasBounds *bounds);
Gets the bounds of the item view.
Note that the bounds includes the entire fill and stroke extents of the item view, whether they are painted or not.
view : |
a GooCanvasItemView. |
bounds : |
a GooCanvasBounds to return the bounds in. |
gboolean goo_canvas_item_view_is_visible (GooCanvasItemView *view);
Checks if the item is visible.
This entails checking the item's own visibility setting, as well as those of its ancestors.
Note that this the item may be scrolled off the screen and so may not be actually visible to the user.
view : |
a GooCanvasItemView. |
Returns : | TRUE if the item is visible.
|
void goo_canvas_item_view_paint (GooCanvasItemView *view, cairo_t *cr, GooCanvasBounds *bounds, gdouble scale);
Paints the item view and all children if they intersect the given bounds.
Note that the scale
argument may be different to the current scale in the
GooCanvasView, e.g. when the canvas is being printed.
view : |
a GooCanvasItemView. |
cr : |
a cairo context. |
bounds : |
the bounds that need to be repainted. |
scale : |
the scale to use to determine whether an item should be painted. See GooCanvasItem:visibility-threshold. |
cairo_matrix_t* goo_canvas_item_view_get_transform (GooCanvasItemView *view);
Gets the transformation matrix of an item view.
view : |
a GooCanvasItemView. |
Returns : | the item view's transformation matrix. |
void goo_canvas_item_view_set_transform (GooCanvasItemView *view, cairo_matrix_t *matrix);
Sets the transformation matrix of an item view.
view : |
a GooCanvasItemView. |
matrix : |
the new transformation matrix, or NULL to reset the
transformation to the identity matrix.
|
gboolean goo_canvas_item_view_get_combined_transform (GooCanvasItemView *view, cairo_matrix_t *result);
Gets the total transformation matrix of an item view, which is a combination of the item's transformation and the item view's transformation.
view : |
a GooCanvasItemView. |
result : |
the matrix to store the resulting transform in. |
Returns : | TRUE if there is a transformation. |
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventButton *event, gpointer user_data) : Run last
Emitted when a mouse button is pressed in an item view.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data, with coordinates translated to canvas coordinates. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventButton *event, gpointer user_data) : Run last
Emitted when a mouse button is released in an item view.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data, with coordinates translated to canvas coordinates. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventCrossing *event, gpointer user_data) : Run last
Emitted when the mouse enters an item view.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data, with coordinates translated to canvas coordinates. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventFocus *event, gpointer user_data) : Run last
Emitted when the item receives the keyboard focus.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventFocus *event, gpointer user_data) : Run last
Emitted when the item loses the keyboard focus.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEvent *event, gpointer user_data) : Run last
Emitted when the item view's keyboard or pointer grab was lost unexpectedly.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventKey *event, gpointer user_data) : Run last
Emitted when a key is pressed and the item view has the keyboard focus.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventKey *event, gpointer user_data) : Run last
Emitted when a key is released and the item view has the keyboard focus.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventCrossing *event, gpointer user_data) : Run last
Emitted when the mouse leaves an item view.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data, with coordinates translated to canvas coordinates. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|
gboolean user_function (GooCanvasItemView *view, GooCanvasItemView *target_view, GdkEventMotion *event, gpointer user_data) : Run last
Emitted when the mouse moves within an item view.
view : |
the item view that received the signal. |
target_view : |
the target of the event. |
event : |
the event data, with coordinates translated to canvas coordinates. |
user_data : |
user data set when the signal handler was connected. |
Returns : | TRUE to stop the signal emission, or FALSE to let it
continue.
|