Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Related Pages

Container: Widgets Holding Other Widgets

Define the Ewl_Container class which inherits from Ewl_Widget and adds the ability to nest Ewl_Widget's inside. More...

Data Structures

struct  Ewl_Container
 Inherits from the Ewl_Widget and expands to allow for placing child widgets within the available space. More...

struct  Ewl_Container
 Inherits from the Ewl_Widget and expands to allow for placing child widgets within the available space. More...


Defines

#define EWL_CONTAINER(widget)   ((Ewl_Container *) widget)
 Typecast a poiner to an Ewl_Container pointer.


Typedefs

typedef Ewl_Container Ewl_Container
 This class inherits from Ewl_Widget and provides the capabilities necessary for nesting other widgets inside.

typedef void(* Ewl_Child_Add )(Ewl_Container *c, Ewl_Widget *w)
 A typedef to shorten the definition of the child_add callbacks.

typedef void(* Ewl_Child_Remove )(Ewl_Container *c, Ewl_Widget *w)
 A typedef to shorten the definition of the child_remove callbacks.

typedef void(* Ewl_Child_Resize )(Ewl_Container *c, Ewl_Widget *w, int size, Ewl_Orientation o)
 A typedef to shorten the definition of the child_resize callbacks.

typedef void(* Ewl_Child_Show )(Ewl_Container *c, Ewl_Widget *w)
 A typedef to shorten the definition of the child_show callbacks.

typedef void(* Ewl_Child_Hide )(Ewl_Container *c, Ewl_Widget *w)
 A typedef to shorten the definition of the child_hide callbacks.

typedef Ewl_Widget *(* Ewl_Container_Iterator )(Ewl_Container *c)
 A typedef to shorten the definition of the child iterator callbacks.


Functions

int ewl_container_init (Ewl_Container *container, char *appearance)
 Initialize a containers default fields and callbacks.

void ewl_container_add_notify_set (Ewl_Container *container, Ewl_Child_Add add)
 Set the function to be called when adding children.

void ewl_container_remove_notify_set (Ewl_Container *container, Ewl_Child_Remove remove)
 Set the function to be called when removing children.

void ewl_container_resize_notify_set (Ewl_Container *container, Ewl_Child_Resize resize)
 Set function to be called when children resize.

void ewl_container_show_notify_set (Ewl_Container *container, Ewl_Child_Show show)
 Set the function to be called when showing children.

void ewl_container_hide_notify_set (Ewl_Container *container, Ewl_Child_Hide show)
 Set the function to be called when hideing children.

void ewl_container_child_append (Ewl_Container *parent, Ewl_Widget *child)
 Add a child at the end of the container.

void ewl_container_child_prepend (Ewl_Container *parent, Ewl_Widget *child)
 Add a child at the beginning of the container.

void ewl_container_child_insert (Ewl_Container *parent, Ewl_Widget *child, int index)
 Add a child at an index of the container.

void ewl_container_child_remove (Ewl_Container *parent, Ewl_Widget *child)
 Remove the specified child from the container.

void ewl_container_child_resize (Ewl_Widget *w, int size, Ewl_Orientation o)
 Notify a container of a child pref size change.

void ewl_container_child_iterate_begin (Ewl_Container *c)
 Prepare the container to iterate over it's children.

Ewl_Widgetewl_container_child_next (Ewl_Container *c)
 Retrieve the next elligible child in a container.

void ewl_container_child_iterator_set (Ewl_Container *c, Ewl_Container_Iterator i)
 Changes the iterator function for a container.

void ewl_container_destroy (Ewl_Container *c)
 Destroy all the sub-children of the container.

void ewl_container_reset (Ewl_Container *c)
 Destroy all children of the container.

void ewl_container_callback_notify (Ewl_Container *c, Ewl_Callback_Type t)
 receive a callback of a child

void ewl_container_callback_intercept (Ewl_Container *c, Ewl_Callback_Type t)
 Receive a callback in place of children.

void ewl_container_callback_nointercept (Ewl_Container *c, Ewl_Callback_Type t)
 Remove a callback interception from children.

Ewl_Widgetewl_container_child_at_get (Ewl_Container *widget, int x, int y)
 Find the child at the given coordinates.

Ewl_Widgetewl_container_child_at_recursive_get (Ewl_Container *widget, int x, int y)
 Find child that intersects coordinates.

int ewl_container_parent_of (Ewl_Widget *c, Ewl_Widget *w)
 Determine if a container is a parent of a widget.

void ewl_container_largest_prefer (Ewl_Container *c, Ewl_Orientation o)
 Set preferred size to widest child.

void ewl_container_sum_prefer (Ewl_Container *c, Ewl_Orientation o)
void ewl_container_child_add_call (Ewl_Container *c, Ewl_Widget *w)
 Triggers the child_add callback for the container c.

void ewl_container_child_remove_call (Ewl_Container *c, Ewl_Widget *w)
 Triggers the child_remove callback for the container c.

void ewl_container_child_show_call (Ewl_Container *c, Ewl_Widget *w)
 Triggers the child_show callback for the container c.

void ewl_container_child_hide_call (Ewl_Container *c, Ewl_Widget *w)
 Triggers the child_hide callback for the container c.

Ewl_Containerewl_container_end_redirect_get (Ewl_Container *c)
 Searches for the last redirected container of the container.

Ewl_Containerewl_container_redirect_get (Ewl_Container *c)
 Retrieves for the redirected container of the container.

void ewl_container_redirect_set (Ewl_Container *c, Ewl_Container *rc)
 Changes the redirected container of the container.


Detailed Description

Define the Ewl_Container class which inherits from Ewl_Widget and adds the ability to nest Ewl_Widget's inside.


Typedef Documentation

typedef void(* Ewl_Child_Add)(Ewl_Container *c, Ewl_Widget *w)
 

A typedef to shorten the definition of the child_add callbacks.

This callback is container specific and is triggered when an Ewl_Widget is added to the Ewl_Container.

typedef void(* Ewl_Child_Hide)(Ewl_Container *c, Ewl_Widget *w)
 

A typedef to shorten the definition of the child_hide callbacks.

This callback is container specific and is triggered when an Ewl_Widget is hidden from the Ewl_Container.

typedef void(* Ewl_Child_Remove)(Ewl_Container *c, Ewl_Widget *w)
 

A typedef to shorten the definition of the child_remove callbacks.

This callback is container specific and is triggered when an Ewl_Widget is removed from the Ewl_Container.

typedef void(* Ewl_Child_Resize)(Ewl_Container *c, Ewl_Widget *w, int size, Ewl_Orientation o)
 

A typedef to shorten the definition of the child_resize callbacks.

This callback is container specific and is triggered when an Ewl_Widget is resized in the Ewl_Container.

typedef void(* Ewl_Child_Show)(Ewl_Container *c, Ewl_Widget *w)
 

A typedef to shorten the definition of the child_show callbacks.

This callback is container specific and is triggered when an Ewl_Widget is shown to the Ewl_Container.

typedef Ewl_Widget*(* Ewl_Container_Iterator)(Ewl_Container *c)
 

A typedef to shorten the definition of the child iterator callbacks.

This callback is container specific and is usually set in the container's init function. This is used to pick the next child in the list of children for the container.


Function Documentation

void ewl_container_add_notify_set Ewl_Container container,
Ewl_Child_Add  add
 

Set the function to be called when adding children.

Parameters:
container: the container to change the add notifier
add: the new add notifier for the container
Returns:
Returns no value.
Changes the add notifier function of container to add.

void ewl_container_callback_intercept Ewl_Container c,
Ewl_Callback_Type  t
 

Receive a callback in place of children.

Parameters:
c: the container to intercept the callback
t: the type of callback to intercept
Returns:
Returns no value.
Marks the callbacks of type t that are directed to children to be triggered on the container c, and not propagated to the receiving child.

void ewl_container_callback_nointercept Ewl_Container c,
Ewl_Callback_Type  t
 

Remove a callback interception from children.

Parameters:
c: the container to remove the interception
t: the type of callback to not intercept
Returns:
Returns no value.
Marks the callbacks of type t that are directed to children to be propagated to the receiving child.

void ewl_container_callback_notify Ewl_Container c,
Ewl_Callback_Type  t
 

receive a callback of a child

Parameters:
c: the container to notify the callback
t: the type of callback to notify
Returns:
Returns no value.
Marks the callbacks of type t that are directed to children to be triggered on the container c, and propagated to the receiving child.

void ewl_container_child_add_call Ewl_Container c,
Ewl_Widget w
 

Triggers the child_add callback for the container c.

Parameters:
c: the container receiving a new child widget
w: the child widget added to the container
Returns:
Returns no value.

void ewl_container_child_append Ewl_Container pc,
Ewl_Widget child
 

Add a child at the end of the container.

Parameters:
pc: the parent container that will hold the child
child: the child to add to the container
Returns:
Returns no value.
Attaches the child to the end of the parent containers child list.

Ewl_Widget* ewl_container_child_at_get Ewl_Container widget,
int  x,
int  y
 

Find the child at the given coordinates.

Parameters:
widget: the searched container
x: the x coordinate to search for
y: the y coordinate to search for
Returns:
Returns the found widget on success, NULL on failure.
The given container is searched to find any child that intersects the given coordinates.

Ewl_Widget* ewl_container_child_at_recursive_get Ewl_Container widget,
int  x,
int  y
 

Find child that intersects coordinates.

Parameters:
widget: the widget to search for intersecting child
x: the x coordinate of the intersection point
y: the y coordinate of the intersection point
Returns:
Returns the intersecting widget on success, NULL on failure.

void ewl_container_child_hide_call Ewl_Container c,
Ewl_Widget w
 

Triggers the child_hide callback for the container c.

Parameters:
c: the container receiving a new child widget
w: the child widget hidden in the container
Returns:
Returns no value.

void ewl_container_child_insert Ewl_Container pc,
Ewl_Widget child,
int  index
 

Add a child at an index of the container.

Parameters:
pc: the parent container that will hold the child
child: the child to add to the container
index: the position in the child list to add the cihld
Returns:
Returns no value.
Attaches the child to the index position of the parent containers child list.

void ewl_container_child_iterate_begin Ewl_Container c  ) 
 

Prepare the container to iterate over it's children.

Parameters:
c: the container to begin iterating over it's children
Returns:
Returns no value.
Notifies the container that it will need to start from the beginning of it's child list. Do not call this if you want to begin iteration where it was last left off, but be warned it's possible this won't be where you expect.

void ewl_container_child_iterator_set Ewl_Container c,
Ewl_Container_Iterator  i
 

Changes the iterator function for a container.

Parameters:
c: the container to change child iterator functions
i: the iterator function for the container
Returns:
Returns no value.
Do not use this unless you know are writing a custom container of your own.

Ewl_Widget* ewl_container_child_next Ewl_Container c  ) 
 

Retrieve the next elligible child in a container.

Parameters:
c: the container to retrieve the next usable child
Returns:
Returns the next valid child on success, NULL on failure.

void ewl_container_child_prepend Ewl_Container pc,
Ewl_Widget child
 

Add a child at the beginning of the container.

Parameters:
pc: the parent container that will hold the child
child: the child to add to the container
Returns:
Returns no value.
Attaches the child to the start of the parent containers child list.

void ewl_container_child_remove Ewl_Container pc,
Ewl_Widget child
 

Remove the specified child from the container.

Parameters:
pc: the container to search for the child to remove
child: the child to remove from the container
Returns:
Returns no value.
Removes the specified child from the container without destroying the child.

void ewl_container_child_remove_call Ewl_Container c,
Ewl_Widget w
 

Triggers the child_remove callback for the container c.

Parameters:
c: the container removing a child widget
w: the child widget removed from the container
Returns:
Returns no value.

void ewl_container_child_resize Ewl_Widget w,
int  size,
Ewl_Orientation  o
 

Notify a container of a child pref size change.

Parameters:
w: the child widget that has had it's preferred size changed
size: the amount of change in size
o: the orientation of the size change
Returns:
Returns no value.

void ewl_container_child_show_call Ewl_Container c,
Ewl_Widget w
 

Triggers the child_show callback for the container c.

Parameters:
c: the container receiving a new child widget
w: the child widget shown in the container
Returns:
Returns no value.

void ewl_container_destroy Ewl_Container c  ) 
 

Destroy all the sub-children of the container.

Parameters:
c: the container to destroy children
Returns:
Returns no value.

Ewl_Container* ewl_container_end_redirect_get Ewl_Container c  ) 
 

Searches for the last redirected container of the container.

Parameters:
c: the container to retrieve it's redirection end container
Returns:
Returns the container children are placed in, NULL if none.

void ewl_container_hide_notify_set Ewl_Container container,
Ewl_Child_Hide  hide
 

Set the function to be called when hideing children.

Parameters:
container: the container to change the hide notifier
hide: the new show notifier for the container
Returns:
Returns no value.
Changes the hide notifier function of container to hide.

int ewl_container_init Ewl_Container c,
char *  appearance
 

Initialize a containers default fields and callbacks.

Parameters:
c: the container to initialize
appearance: the appearance key for this container
Returns:
Returns TRUE on success, otherwise FALSE.
Initializes the default values of the container, this also sets up the widget fields of the container, so the appearance string is necessary.

void ewl_container_largest_prefer Ewl_Container c,
Ewl_Orientation  o
 

Set preferred size to widest child.

Parameters:
c: the container to change preferred size
o: the orientation/direction to prefer the largest widget
Returns:
Returns no value.
This function can be used by any container which wishes to set it's preferred width to that of it's widest child.

int ewl_container_parent_of Ewl_Widget c,
Ewl_Widget w
 

Determine if a container is a parent of a widget.

Parameters:
c: the container to compare against, safe to pass a non-container
w: the widget to check parentage
Returns:
Returns TRUE if c is a parent of w, otherwise returns FALSE.

Ewl_Container* ewl_container_redirect_get Ewl_Container c  ) 
 

Retrieves for the redirected container of the container.

Parameters:
c: the container to retrieve it's redirection container
Returns:
Returns the container children are placed in, NULL if none.

void ewl_container_redirect_set Ewl_Container c,
Ewl_Container rc
 

Changes the redirected container of the container.

Parameters:
c: the container to change it's redirection container
rc: the new container to redirect children to
Returns:
Returns no value.

void ewl_container_remove_notify_set Ewl_Container container,
Ewl_Child_Remove  remove
 

Set the function to be called when removing children.

Parameters:
container: the container to change the add notifier
remove: the new remove notifier for the container
Returns:
Returns no value.
Changes the remove notifier function of container to remove.

void ewl_container_reset Ewl_Container c  ) 
 

Destroy all children of the container.

Parameters:
c: the container to reset
Returns:
Returns no value.
Destroys all the children of the container but not the container itself or internally used widgets.

void ewl_container_resize_notify_set Ewl_Container container,
Ewl_Child_Resize  resize
 

Set function to be called when children resize.

Parameters:
container: the container to change the resize notifier
resize: the new resizenotifier for the container
Returns:
Returns no value.
Changes the resize notifier function of container to resize.

void ewl_container_show_notify_set Ewl_Container container,
Ewl_Child_Show  show
 

Set the function to be called when showing children.

Parameters:
container: the container to change the show notifier
show: the new show notifier for the container
Returns:
Returns no value.
Changes the show notifier function of container to show.

void ewl_container_sum_prefer Ewl_Container c,
Ewl_Orientation  o
 

Parameters:
c: the container to use the child size sum in a specified direction
o: the orientation direction of the sum to use