DiaCanvasGroupable

Name

DiaCanvasGroupable -- Interface for groupable classes.

Synopsis



struct      DiaCanvasGroupable;
gboolean    dia_canvas_groupable_add        (DiaCanvasItem *group,
                                             DiaCanvasItem *item);
gboolean    dia_canvas_groupable_remove     (DiaCanvasItem *group,
                                             DiaCanvasItem *item);
void        dia_canvas_groupable_add_construction
                                            (DiaCanvasItem *group,
                                             DiaCanvasItem *item);
void        dia_canvas_groupable_remove_destruction
                                            (DiaCanvasItem *group,
                                             DiaCanvasItem *item);
gboolean    dia_canvas_groupable_get_iter   (DiaCanvasItem *group,
                                             DiaCanvasIter *iter);
gboolean    dia_canvas_groupable_next       (DiaCanvasItem *group,
                                             DiaCanvasIter *iter);
DiaCanvasItem* dia_canvas_groupable_value   (DiaCanvasItem *group,
                                             DiaCanvasIter *iter);
gint        dia_canvas_groupable_length     (DiaCanvasItem *group);
gint        dia_canvas_groupable_pos        (DiaCanvasItem *group,
                                             DiaCanvasItem *item);

Description

Details

struct DiaCanvasGroupable

struct DiaCanvasGroupable
{
	GTypeInterface g_iface;

	/* Signals */
	/**
	 * add:
	 * @group:
	 * @item:
	 *
	 * Add an item to the DiaCanvasGroupable object. This method should
	 * take care of setting item->parent and item->canvas.
	 *
	 * Return value: TRUE if the item is added, FALSE otherwise.
	 **/
	gboolean (* add)	(DiaCanvasItem *group, DiaCanvasItem *item);
	gboolean (* remove)	(DiaCanvasItem *group, DiaCanvasItem *item);
	
	/* Callbacks */
	gboolean (* get_iter)	(DiaCanvasItem *group, DiaCanvasIter *iter);
	gboolean (* next)	(DiaCanvasItem *group, DiaCanvasIter *iter);

	DiaCanvasItem* (* value) (DiaCanvasItem *group, DiaCanvasIter *iter);

	gint	(* length)	(DiaCanvasItem *group);
	gint	(* pos)		(DiaCanvasItem *group,  DiaCanvasItem *item);
};

DiaCanvasItems supporting this interface can have child objects in them which will be displayed on the DiaCanvasView as a seperate object.


dia_canvas_groupable_add ()

gboolean    dia_canvas_groupable_add        (DiaCanvasItem *group,
                                             DiaCanvasItem *item);

Append an item to the groupable object. This is done by emiting the 'add' signal. The group should add the item (or not) and return TRUE or FALSE. The group should not worry about any attributes that need to be set on the item, since this method takes care of that.

This function also creates a weak reference from the item to its parent and from the item to the canvas. If one of them is destroyed, their reference is set to NULL automatically.

group :

item :

Returns :

TRUE if the addition was successful, FALSE otherwise.


dia_canvas_groupable_remove ()

gboolean    dia_canvas_groupable_remove     (DiaCanvasItem *group,
                                             DiaCanvasItem *item);

Remove item from the groupable object. This is done by emiting the 'remove' signal. If the signal returns with TRUE, the item -> group relationship is removed. The group should only care about removing it's reference to the item.

group :

item :

Returns :

TRUE if the removal was successful, FALSE otherwise.


dia_canvas_groupable_add_construction ()

void        dia_canvas_groupable_add_construction
                                            (DiaCanvasItem *group,
                                             DiaCanvasItem *item);

This function can be used to add child items during the construction of an object. This function fixes the item -> group relationship.

group :

item :


dia_canvas_groupable_remove_destruction ()

void        dia_canvas_groupable_remove_destruction
                                            (DiaCanvasItem *group,
                                             DiaCanvasItem *item);

This function can be used during the dipose phase of the destruction. The item is properly disconnected from the parent. Note that this function should be used when dia_canvas_groupable_add_construction() is used to connect item to group.

This function should only be used in DiaCanvasItem deriviates.

group :

item :


dia_canvas_groupable_get_iter ()

gboolean    dia_canvas_groupable_get_iter   (DiaCanvasItem *group,
                                             DiaCanvasIter *iter);

Get an iterator for the groupable object. This works the same as the text iterator and the tree iterator in GTK+. You can get the actual item by calling dia_canvas_groupable_value(). The iterator can be set to the next item with dia_canvas_groupable_next().

group :

iter :

iterator, must already exist in memory.

Returns :

FALSE if no iterator is set, TRUE otherwise.


dia_canvas_groupable_next ()

gboolean    dia_canvas_groupable_next       (DiaCanvasItem *group,
                                             DiaCanvasIter *iter);

Make the iterator point to the next item.

group :

iter :

Returns :

TRUE if the iterator points to a valif object, FALSE otherwise.


dia_canvas_groupable_value ()

DiaCanvasItem* dia_canvas_groupable_value   (DiaCanvasItem *group,
                                             DiaCanvasIter *iter);

Retrieve the value pointer to by the iterator.

group :

iter :

Returns :

The DiaCanvasItem pointed to by the iterator.


dia_canvas_groupable_length ()

gint        dia_canvas_groupable_length     (DiaCanvasItem *group);

Get the amount of items the groupable object holds.

group :

Returns :

-1 on error.


dia_canvas_groupable_pos ()

gint        dia_canvas_groupable_pos        (DiaCanvasItem *group,
                                             DiaCanvasItem *item);

Get the position of item in the group.

group :

item :

Returns :

Position of item, -1 on error.