| libccc Reference Manual |
|---|
Canvas ItemsCanvas Items — |
CcItem;
CcItemClass;
CcItem* cc_item_new (void);
void cc_item_append (CcItem *self,
CcItem *child);
void cc_item_dirty (CcItem *self);
gdouble cc_item_distance (CcItem *self,
gdouble x,
gdouble y,
CcItem **found);
void cc_item_insert (CcItem *self,
CcItem *child,
gint position);
void cc_item_remove (CcItem *self,
CcItem *child);
void cc_item_render (CcItem *self,
CcView *view,
cairo_t *cr);
void cc_item_set_grid_aligned (CcItem *self,
gboolean grid_aligned);
enum CcItemFlags;
#define CC_ITEM_FLAGS (i)
#define CC_ITEM_DISPOSED (i)
#define CC_ITEM_GRID_ALIGNED (i)
#define CC_ITEM_NO_SEARCH_CHILDREN (i)
#define CC_ITEM_SET_FLAGS (i,m)
#define CC_ITEM_UNSET_FLAGS (i,m)
"all-bounds-changed" void user_function (CcItem *ccitem, CcView *arg1, CcDRect *arg2, gpointer user_data); "button-press-event" gboolean user_function (CcItem *self, CcView *view, GdkEventButton *event, gpointer user_data); "button-release-event" gboolean user_function (CcItem *self, CcView *view, GdkEventButton *event, gpointer user_data); "dirty" void user_function (CcItem *self, CcView *dirty_region, CcDRect *arg2, gpointer user_data); "enter-notify-event" gboolean user_function (CcItem *self, CcView *view, GdkEventCrossing *event, gpointer user_data); "event" gboolean user_function (CcItem *self, CcView *view, GdkEvent *event, gpointer user_data); "focus" gboolean user_function (CcItem *self, CcView *view, GtkDirectionType dir, gpointer user_data); "focus-enter" gboolean user_function (CcItem *ccitem, CcView *arg1, GdkEvent *event, gpointer user_data); "focus-leave" gboolean user_function (CcItem *ccitem, CcView *arg1, GdkEvent *event, gpointer user_data); "key-press-event" gboolean user_function (CcItem *ccitem, CcView *arg1, GdkEventKey *event, gpointer user_data); "key-release-event" gboolean user_function (CcItem *ccitem, CcView *arg1, GdkEventKey *event, gpointer user_data); "leave-notify-event" gboolean user_function (CcItem *self, CcView *view, GdkEventCrossing *event, gpointer user_data); "motion-notify-event" gboolean user_function (CcItem *self, CcView *view, GdkEventMotion *event, gpointer user_data);
typedef struct {
GInitiallyUnownedClass base_class;
/* vtable */
gdouble (*distance) (CcItem * self,
gdouble x,
gdouble y,
CcItem **found);
void (*notify_child_bounds) (CcItem * self,
CcItem * child,
CcView * view,
CcDRect const * all_bounds);
void (*render) (CcItem * self,
CcView * view,
cairo_t * cr);
void (*update_bounds) (CcItem * self,
CcView const * view,
gpointer user_data);
/* signals */
gboolean (*button_press_event) (CcItem * self,
CcView * view,
GdkEventButton * event);
gboolean (*button_release_event)(CcItem * self,
CcView * view,
GdkEventButton * event);
gboolean (*enter_notify_event) (CcItem * self,
CcView * view,
GdkEventCrossing* event);
gboolean (*event) (CcItem * self,
CcView * view,
GdkEvent * event);
gboolean (*focus) (CcItem * self,
CcView * view,
GtkDirectionType dir);
gboolean (*focus_enter) (CcItem * self,
CcView * view,
GdkEventFocus * event);
gboolean (*focus_leave) (CcItem * self,
CcView * view,
GdkEventFocus * focus);
gboolean (*key_press_event) (CcItem * item,
CcView * view,
GdkEventKey * event);
gboolean (*key_release_event) (CcItem * item,
CcView * view,
GdkEventKey * event);
gboolean (*leave_notify_event) (CcItem * self,
CcView * view,
GdkEventCrossing* event);
gboolean (*motion_notify_event) (CcItem * self,
CcView * view,
GdkEventMotion * event);
} CcItemClass;
CcItem* cc_item_new (void);
Create a new CcItem that can be used to group several items together.
| Returns : | a new CcItem. |
void cc_item_append (CcItem *self, CcItem *child);
Insert an item at the end of this item. A CcItem can serve as a container for several items.
void cc_item_dirty (CcItem *self);
Let emit a signal to tell all the views that it needs to be redrawn.
self : |
a CcItem |
gdouble cc_item_distance (CcItem *self, gdouble x, gdouble y, CcItem **found);
Calculates the distance from self to (x,y). If (x,y) is within self or
one of its children found is set to the matching element.
void cc_item_insert (CcItem *self, CcItem *child, gint position);
Inserts child at position into self.
void cc_item_remove (CcItem *self, CcItem *child);
Removes child from self. Does nothing if child was not a child of self
or if child is a child of one of self's children.
void cc_item_render (CcItem *self, CcView *view, cairo_t *cr);
Renders self to cr which is supposed to be a cairo context of view as
the transformation matrix of view will be used for rendering.
void cc_item_set_grid_aligned (CcItem *self, gboolean grid_aligned);
Sets self to be rendered grid-aligned if grid_aligned is TRUE, sets it to
be allowed to render fuzzyly if FALSE.
self : |
a CcItem |
grid_aligned : |
a gboolean |
typedef enum {
CC_CAN_FOCUS = 1 << 1,
CC_DISPOSED = 1 << 2,
CC_GRID_ALIGNED = 1 << 3,
CC_NO_SEARCH_CHILDREN = 1 << 4
} CcItemFlags;
CC_CAN_FOCUS |
|
CC_DISPOSED |
specifies whether dispose has already been run on an item. |
CC_GRID_ALIGNED |
specifies whether an item should be rendered to match an existing grid. |
CC_NO_SEARCH_CHILDREN |
specifies whether calls like cc_item_distance()
should be forwarded to children.
|
#define CC_ITEM_FLAGS(i) (CC_ITEM(i)->flags)
Get the flags which are set on the CcItem i.
i : |
a CcItem |
#define CC_ITEM_DISPOSED(i) ((CC_ITEM_FLAGS(i) & CC_DISPOSED) != 0)
Queries the CcItem i whether it has the CC_DISPOSED flag set. This is
very useful in the dispose handler for the GObject derived types. This flag
gets set automatically if you chain up your dispose calls correctly.
i : |
a CcItem |
#define CC_ITEM_GRID_ALIGNED(i) ((CC_ITEM_FLAGS(i) & CC_GRID_ALIGNED) != 0)
Queries the CcItem i whether it has the CC_GRID_ALIGNED flag set.
i : |
a CcItem |
#define CC_ITEM_NO_SEARCH_CHILDREN(i) ((CC_ITEM_FLAGS(i) & CC_NO_SEARCH_CHILDREN) != 0)
Queries the CcItem i whether it has the CC_NO_SEARCH_CHILDEN flag set.
i : |
a CcItem |
#define CC_ITEM_SET_FLAGS(i,m) G_STMT_START{ (CC_ITEM_FLAGS(i) |= (m)); }G_STMT_END
Sets on i the CcItemFlags that have been specified in m.
i : |
a CcItem |
m : |
a CcItemFlags mask |
#define CC_ITEM_UNSET_FLAGS(i,m) G_STMT_START{ (CC_ITEM_FLAGS(i) &= ~(m)); }G_STMT_END
Unsets from i the CcItemFlags that have been specified in m.
i : |
a CcItem |
m : |
a CcItemFlags mask |
void user_function (CcItem *ccitem, CcView *arg1, CcDRect *arg2, gpointer user_data);
ccitem : |
the object which received the signal. |
arg1 : |
|
arg2 : |
|
user_data : |
user data set when the signal handler was connected. |
gboolean user_function (CcItem *self, CcView *view, GdkEventButton *event, gpointer user_data);
This signal gets emitted when a mouse button got pressed on top of an element.
self : |
a CcItem |
view : |
the CcView which emitted this event |
event : |
a GdkEventButton with coordinates translated to canvas coordinates. |
user_data : |
user data set when the signal handler was connected. |
| Returns : |
TRUE to stop other signal handlers from being called.
|
gboolean user_function (CcItem *self, CcView *view, GdkEventButton *event, gpointer user_data);
This signal gets emitted when a mouse button got released on top of an item.
self : |
a CcItem |
view : |
the CcView which emitted this event |
event : |
a GdkEventButton with coordinates translated to canvas coordinates |
user_data : |
user data set when the signal handler was connected. |
| Returns : |
TRUE to stop other signal handlers from being called.
|
void user_function (CcItem *self, CcView *dirty_region, CcDRect *arg2, gpointer user_data);
This signal gets emitted when an item changes. It's used to request redraws of the affected items.
gboolean user_function (CcItem *self, CcView *view, GdkEventCrossing *event, gpointer user_data);
This signal gets emitted when the mouse pointer enters an item.
self : |
a CcItem |
view : |
the CcView which emitted this event |
event : |
a GdkEventCrossing with x and y coordinates translated into canvas coordinates |
user_data : |
user data set when the signal handler was connected. |
| Returns : |
TRUE to stop other signal handlers from being invoked.
|
gboolean user_function (CcItem *self, CcView *view, GdkEvent *event, gpointer user_data);
This signal catches all events before they are distributes into more specified signals.
self : |
a CcItem |
view : |
the CcView which emitted this event |
event : |
the event that got emitted (with canvas coordinates) |
user_data : |
user data set when the signal handler was connected. |
| Returns : |
TRUE to stop other signal handlers from being called.
|
gboolean user_function (CcItem *self, CcView *view, GtkDirectionType dir, gpointer user_data);
This signal gets emitted when a focus event on the view happended to let focus-handling happen.
self : |
a CcItem |
view : |
a CcView |
dir : |
the focus direction |
user_data : |
user data set when the signal handler was connected. |
| Returns : |
TRUE to stop other signal handlers from being called (such
as the one which lets the focus leave the canvas view)
|
gboolean user_function (CcItem *ccitem, CcView *arg1, GdkEvent *event, gpointer user_data);
ccitem : |
the object which received the signal. |
arg1 : |
|
event : |
|
user_data : |
user data set when the signal handler was connected. |
| Returns : |
gboolean user_function (CcItem *ccitem, CcView *arg1, GdkEvent *event, gpointer user_data);
ccitem : |
the object which received the signal. |
arg1 : |
|
event : |
|
user_data : |
user data set when the signal handler was connected. |
| Returns : |
gboolean user_function (CcItem *ccitem, CcView *arg1, GdkEventKey *event, gpointer user_data);
ccitem : |
the object which received the signal. |
arg1 : |
|
event : |
|
user_data : |
user data set when the signal handler was connected. |
| Returns : |
gboolean user_function (CcItem *ccitem, CcView *arg1, GdkEventKey *event, gpointer user_data);
ccitem : |
the object which received the signal. |
arg1 : |
|
event : |
|
user_data : |
user data set when the signal handler was connected. |
| Returns : |
gboolean user_function (CcItem *self, CcView *view, GdkEventCrossing *event, gpointer user_data);
This signal gets emitted when the mouse pointer leaves an element.
self : |
a CcItem |
view : |
the CcView which emitted this event |
event : |
a GdkEventCrossing |
user_data : |
user data set when the signal handler was connected. |
| Returns : |
TRUE to stop other signal handlers from being invoked.
|
gboolean user_function (CcItem *self, CcView *view, GdkEventMotion *event, gpointer user_data);
This signal gets emitted when the pointer (mouse cursor) moves while being over this item.
self : |
a CcItem |
view : |
the CcView which emitted this event |
event : |
the event that got emitted (with canvas coordinates) |
user_data : |
user data set when the signal handler was connected. |
| Returns : |
TRUE to stop other signal handlers from being called.
|
| << Canvas Items | Rectangles >> |