|  |  |  | libccc Reference Manual |  | 
|---|---|---|---|---|
#include <ccc.h>
                    CcItem;
                    CcItemClass;
void                cc_item_class_add_view_data         (gpointer item_class,
                                                         gsize view_data_size);
gpointer            cc_item_get_view_data               (CcItem const*self,
                                                         CcView const*view,
                                                         GType type);
CcItem*             cc_item_new                         (void);
void                cc_item_append                      (CcItem *self,
                                                         CcItem *child);
void                cc_item_dirty                       (CcItem *self,
                                                         CcView const*view,
                                                         CcDRect dirty_region);
gdouble             cc_item_distance                    (CcItem *self,
                                                         CcView const*view,
                                                         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);
void                cc_item_lower                       (CcItem *child,
                                                         CcItem *parent);
void                cc_item_lower_to_bottom             (CcItem *child,
                                                         CcItem *parent);
void                cc_item_raise                       (CcItem *child,
                                                         CcItem *parent);
void                cc_item_raise_to_top                (CcItem *child,
                                                         CcItem *parent);
void                cc_item_set_position                (CcItem *child,
                                                         CcItem *parent,
                                                         gint position);
enum                CcItemFlags;
#define             CC_ITEM_FLAGS                       (i)
#define             CC_ITEM_DISPOSED                    (i)
#define             CC_ITEM_GRID_ALIGNED                (i)
#define             CC_ITEM_SET_FLAGS                   (i,m)
#define             CC_ITEM_UNSET_FLAGS                 (i,m)
#define             CC_ITEM_CAN_FOCUS                   (i)
void                (*CcItemFunc)                       (CcItem *item,
                                                         CcView *view,
                                                         gpointer data);
void                cc_item_add_view                    (CcItem *self,
                                                         CcView *view);
void                cc_item_bounds_changed              (CcItem *self,
                                                         CcView const*view);
GType               cc_item_flags_get_type              (void);
void                cc_item_foreach_view                (CcItem *self,
                                                         CcItemFunc func,
                                                         gpointer data);
CcDRectconst*       cc_item_get_all_bounds              (CcItem const*self,
                                                         CcView const*view);
void                cc_item_grab_focus                  (CcItem *self,
                                                         CcView *view);
gboolean            cc_item_is_child_of                 (CcItem const*child,
                                                         CcItem const*parent);
void                cc_item_remove_view                 (CcItem *self,
                                                         CcView *view);
void                cc_item_update_bounds               (CcItem *self,
                                                         gpointer data);
void                cc_item_update_bounds_for_view      (CcItem *self,
                                                         CcView *view);
  GObject
   +----GInitiallyUnowned
         +----CcItem
               +----CcCamera
               +----CcShape
               +----CcPixbuf
               +----CcSimpleItem
"all-bounds-changed" "button-press-event" : Run Last "button-release-event" : Run Last "dirty" "enter-notify-event" : Run Last "event" : Run Last "focus" : Run Last "focus-enter" : Run Last "focus-leave" : Run Last "item-added" : Run Last "item-removed" : Run Last "key-press-event" : Run Last "key-release-event" : Run Last "leave-notify-event" : Run Last "motion-notify-event" : Run Last "view-register" : Run First "view-unregister" : Run Last
typedef struct {
	GInitiallyUnownedClass base_class;
	/* vtable */
	gdouble (*distance)             (CcItem         * self,
					 CcView const   * view,
				         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);
	void     (*item_added)          (CcItem          * self,
					 gint              position,
					 CcItem          * child);
	void     (*item_removed)        (CcItem          * self,
					 gint              position,
					 CcItem          * child);
	void     (*view_register)       (CcItem          * self,
					 CcView          * view);
	void     (*view_unregister)     (CcItem          * self,
					 CcView          * view);
} CcItemClass;
void                cc_item_class_add_view_data         (gpointer item_class,
                                                         gsize view_data_size);
Registers the size of view data for a certain item class. See also the section called “View-Specific Data”.
| item_class: | a CcItemClass | 
| view_data_size: | the size to be allocated for the view data | 
gpointer cc_item_get_view_data (CcItem const*self, CcView const*view, GType type);
Get a pointer to the view data for view in self. See also
the section called “View-Specific Data”.
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, CcView const*view, CcDRect dirty_region);
Let emit a signal to tell view that it needs to be redrawn.
gdouble cc_item_distance (CcItem *self, CcView const*view, 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 | 
void cc_item_lower_to_bottom (CcItem *child, CcItem *parent);
Lowers child to be displayed behind all the other children of parent.
void cc_item_raise_to_top (CcItem *child, CcItem *parent);
Raises an child to the top. It will be displayed over all of the other
children of parent.
void cc_item_set_position (CcItem *child, CcItem *parent, gint position);
Changes the position of child relative to parent.
typedef enum {
	CC_CAN_FOCUS          = 1 << 1,
	CC_DISPOSED           = 1 << 2,
	CC_GRID_ALIGNED       = 1 << 3,
} CcItemFlags;
#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_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 cc_item_add_view (CcItem *self, CcView *view);
Registers a view at the item. The item and its children can now set up data for this view.
This function should not be called by application code. Use
cc_item_view_register() instead.
void cc_item_bounds_changed (CcItem *self, CcView const*view);
| self: | |
| view: | 
void cc_item_foreach_view (CcItem *self, CcItemFunc func, gpointer data);
| self: | |
| func: | |
| data: | 
CcDRectconst* cc_item_get_all_bounds (CcItem const*self, CcView const*view);
Get the bounds of self as it would e displayed by view (including all of its children).
gboolean cc_item_is_child_of (CcItem const*child, CcItem const*parent);
Find out whether child is a child of parent.
void cc_item_remove_view (CcItem *self, CcView *view);
Unregisters a view at the item. The item and the children can now free data kept for this view.
This function should not be called by application code. Use
cc_item_view_unregister() instead.
void user_function (CcItem *self, CcView *view, CcDRect *box, gpointer user_data)
This signal gets emitted when the total bounding box of an item changed. See also Bounds Handling.
gboolean user_function (CcItem *self, CcView *view, GdkEventButton *event, gpointer user_data) : Run Last
This signal gets emitted when a mouse button got pressed on top of an element.
gboolean user_function (CcItem *self, CcView *view, GdkEventButton *event, gpointer user_data) : Run Last
This signal gets emitted when a mouse button got released on top of an item.
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) : Run Last
This signal gets emitted when the mouse pointer enters an item.
gboolean user_function (CcItem *self, CcView *view, GdkEvent *event, gpointer user_data) : Run Last
This signal catches all events before they are distributes into more specified signals.
gboolean user_function (CcItem *self, CcView *view, GtkDirectionType dir, gpointer user_data) : Run Last
This signal gets emitted when a focus event on the view happended to let focus-handling happen.
gboolean user_function (CcItem *self, CcView *view, GdkEvent *event, gpointer user_data) : Run Last
This signal gets emitted when the focus enters this item.
gboolean user_function (CcItem *self, CcView *view, GdkEvent *event, gpointer user_data) : Run Last
This signal gets emitted when the focus leaves this item.
void user_function (CcItem *self, gint position, CcItem *child, gpointer user_data) : Run Last
This signal gets emitted when an element is added to another element.
| self: | a CcItem | 
| position: | the new index of the child | 
| child: | the child | 
| user_data: | user data set when the signal handler was connected. | 
void user_function (CcItem *self, gint position, CcItem *child, gpointer user_data) : Run Last
This signal gets emitted when an element is removed from another element.
| self: | a CcItem | 
| position: | the former index of the child | 
| child: | the child | 
| user_data: | user data set when the signal handler was connected. | 
gboolean user_function (CcItem *self, CcView *view, GdkEventKey *event, gpointer user_data) : Run Last
This signal gets emitted when a key gets pressed.
gboolean user_function (CcItem *self, CcView *view, GdkEventKey *event, gpointer user_data) : Run Last
This signal gets emitted when a key gets released.
gboolean user_function (CcItem *self, CcView *view, GdkEventCrossing *event, gpointer user_data) : Run Last
This signal gets emitted when the mouse pointer leaves an element.
gboolean user_function (CcItem *self, CcView *view, GdkEventMotion *event, gpointer user_data) : Run Last
This signal gets emitted when the pointer (mouse cursor) moves while being over this item.
void user_function (CcItem *self, CcView *view, gpointer user_data) : Run First
Registeres the view for this item. This signal can be used to create view-specific data for the CcItem. Take a look at CcText to see how this can be used.