gandi_children(3) - Linux man page

Name

Here you could find a brief explanation of how one widget could become a child of another one.

Synopsis

#include <gandi_core.h>

int GANDI_addchild(void *parent, void *child);

int GANDI_count_child(void *w);

bool GANDI_isancestor(void *p, void *c);

bool GANDI_ischild(void *parent, void *child);

int GANDI_remchild(void *parent, void *child);

Description

The core structure of each widget contains two properties wich are important for this document. They are:

void * parent

void ** child

The first one specifies the parent widget. The second one is an array of all children of this widget. The parent is NULL if the widget has no parent. A child is never NULL it always points to an allocated memory area.

There are some specifics if widgets are in a parent/child relationship. If you kill a parent with GANDI_kill_emptywidget (see gandi_widget(3gandi)), then all its children will be killed too. All ancestors of the active widget will be bounded like active too. Whenever you use GANDI_addchild or GANDI_remchild the routines GANDI_add_move_o or GANDI_rem_move_o (see gandi_move(3gandi)) will be called with the same arguments.

int GANDI_addchild(void *parent, void *child);

Forces the child become a child of the parent.

Adds a child into a parent->core->child array, sets up a child->core->parent and calls GANDI_add_move_o. Returns ERR if GANDI_inclist_q (see gandi_list(3gandi)) or GANDI_add_move_o (see gandi_move(3gandi)) fails. Otherwise - OK.

int GANDI_count_child(void *w);

Returns the number of children which the specified widget contains.

bool GANDI_isancestor(void *p, void *c);

Returns TRUE if p is an ancestor of c and FALSE otherwise. One is an ancestor of widget if it is a widget's parent or a parent of widget's parent etc.

bool GANDI_ischild(void *parent, void *child);

Determines whether child is a child of parent, i.e. contained by a parent's children list.

int GANDI_remchild(void *parent, void *child);

Excludes child from the parent's children list.

Tries to remove child from parent->core->child. child->parent will NOT be modified! Then it calls GANDI_rem_move_o (see gandi_move(3gandi)). There are three possibilities of failure, if child was not a child of parent, if realloc(3) returned NULL or if GANDI_rem_move_o returned ERR.

Notes

You are allowed to make a widget a child of its own child. But with the possibility of causing an infinite loop.

See Also

gandi_gandiw(3gandi) gandi_list(3gandi) gandi_move(3gandi) gandi_widget(3gandi) malloc(3)