![]() |
![]() |
![]() |
GContainer Reference Manual | ![]() |
---|---|---|---|---|
#include <gcontainer/gcontainer.h> GChildable; GChildableIface; GContainerable* g_childable_get_parent (GChildable *childable); void g_childable_set_parent (GChildable *childable, GContainerable *parent); void g_childable_reparent (GChildable *childable, GContainerable *parent); void g_childable_unparent (GChildable *childable); void g_childable_dispose (GObject *object);
The GChildable interface provides a generic interface for objects that can be children of a GContainerable. It is an interface, so can be implemented by objects at any hierarchy level.
If you prefer to derive your child object from a base class, take a look to GChild, that is the natural implementation of the GChildable interface.
typedef struct { GTypeInterface base_iface; /* Virtual Table */ GContainerable * (*get_parent) (GChildable *childable); void (*set_parent) (GChildable *childable, GContainerable *parent); /* Signals */ void (*parent_set) (GChildable *childable, GContainerable *old_parent); } GChildableIface;
The virtual methods get_parent
and set_parent
must be defined
by all the types which implement this interface.
GTypeInterface base_iface ; |
the base interface. |
get_parent () |
returns the current parent. |
set_parent () |
set the new parent. |
parent_set () |
signal handler for the "parent_set" signals. |
GContainerable* g_childable_get_parent (GChildable *childable);
Gets the parent of childable
.
childable : |
a GChildable |
Returns : | the requested parent, or NULL on errors
|
void g_childable_set_parent (GChildable *childable, GContainerable *parent);
Sets parent
as parent of childable
,
properly handling the references between them.
If childable
has yet a parent, this function returns with a warning.
childable : |
a GChildable |
parent : |
a GContainerable |
void g_childable_reparent (GChildable *childable, GContainerable *parent);
Moves childable
from the old parent to parent
, handling reference
count issues to avoid destroying the object.
childable : |
a GChildable |
parent : |
an object that implements GContainerable |
void g_childable_unparent (GChildable *childable);
Removes the current parent of childable
,
properly handling the references between them.
If childable
has no parent, this function simply returns.
childable : |
a GChildable |
void g_childable_dispose (GObject *object);
Convenience function to be used in the class initialization of objects
implementing the GChildable interface.
g_childable_dispose()
automatically chain up the dispose method of the
parent class of the type in the object
hierarchy which implements
GChildable.
object : |
a GObject implementing GChildable |
"parent"
property"parent" GObject* : Read / Write
The parent of this object. The parent must implement the GContainerable interface.
"parent-set"
signalvoid user_function (GChildable *childable, GObject *old_parent, gpointer user_data) : Run First
A new parent is set and the "parent" property was changed accordling.
childable : |
a GChildable |
old_parent : |
the old parent |
user_data : |
user data set when the signal handler was connected. |