|
Etk_Container
Detailed Description
An Etk_Container is a widget that can contain other widgets.
Etk_Container is an abstract class which offers methods to add or remove children to the inheriting container:
- etk_container_add() calls the child_add() method of the inheriting container. For example, etk_container_add() on a bin will call etk_bin_child_set(), and etk_container_add() on a box will call etk_box_append() with default packing settings. But most of the time, you will rather have to call directly the appropriate function of the container's API in order to have more control on the packing settings. For instance, you'll have to call directly etk_box_append() with the ETK_BOX_END parameter to pack a child at the end of a box since etk_container_add() would only pack the child at the start of the box (default behavior).
- etk_container_remove() unparents the given widget, which will result in calling the child_remove() method of the container containing the removed widget.
You can also get the list of the container's children with etk_container_children_get() and checks if a widget is a child of the container with etk_container_is_child().
Note that when a container is destroyed, all its children are automatically destroyed too. If you want to avoid that, before destroying the container, you can call etk_container_remove_all().
- Object Hierarchy:
-
- Signals:
- "child-added": Emitted when a child has been added to the container
Callback: Etk_Bool callback(Etk_Container *container, Etk_Widget *child, void *data)
container: the container connected to the callbackchild: the child which has been addeddata: the user data set when the callback has been connected to the signal
- "child-removed": Emitted when a child has been removed from the container
Callback: Etk_Bool callback(Etk_Container *container, Etk_Widget *child, void *data)
container: the container connected to the callbackchild: the child which has been removeddata: the user data set when the callback has been connected to the signal
- Properties:
- "border-width": The amount of space left around the inside of the container
Type: IntegerAccess: Read/WriteDefault Value: 0
|
Data Structures |
struct | Etk_Container |
| [Widget] A widget that can contain other widgets More...
|
Defines |
#define | ETK_CONTAINER_TYPE (etk_container_type_get()) |
#define | ETK_CONTAINER(obj) (ETK_OBJECT_CAST((obj), ETK_CONTAINER_TYPE, Etk_Container)) |
#define | ETK_IS_CONTAINER(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_CONTAINER_TYPE)) |
Functions |
void | etk_container_add (Etk_Container *container, Etk_Widget *widget) |
| Adds a child to the container.
|
void | etk_container_remove (Etk_Widget *widget) |
| Removes a child from its container. It is equivalent to etk_widget_parent_set(widget, NULL).
|
void | etk_container_remove_all (Etk_Container *container) |
| Unpacks all the children of the container.
|
void | etk_container_border_width_set (Etk_Container *container, int border_width) |
| Sets the border width of a container. The border width is the amount of space left around the inside of the container. To add free space around the outside of a container, you can use etk_widget_padding_set().
|
int | etk_container_border_width_get (Etk_Container *container) |
| Gets the border width of the container.
|
Eina_List * | etk_container_children_get (Etk_Container *container) |
| Gets the list of the children of the container. It simply calls the "childrend_get()" method of the container.
|
Etk_Bool | etk_container_is_child (Etk_Container *container, Etk_Widget *widget) |
| Gets whether the widget is a child of the container.
|
void | etk_container_for_each (Etk_Container *container, void(*for_each_cb)(Etk_Widget *child)) |
| Calls for_each_cb(child) for each child of the container.
|
void | etk_container_for_each_data (Etk_Container *container, void(*for_each_cb)(Etk_Widget *child, void *data), void *data) |
| Calls for_each_cb(child, data) for each child of the container.
|
void | etk_container_child_space_fill (Etk_Widget *child, Etk_Geometry *child_space, Etk_Bool hfill, Etk_Bool vfill, float xalign, float yalign) |
| A utility function that resizes the given space according to the specified fill-policy. It is mainly used by container implementations.
|
Define Documentation
#define ETK_CONTAINER_TYPE (etk_container_type_get()) |
Gets the type of a container
#define ETK_CONTAINER |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_CONTAINER_TYPE, Etk_Container)) |
#define ETK_IS_CONTAINER |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_CONTAINER_TYPE)) |
Function Documentation
Adds a child to the container.
- Parameters:
-
| container | a container |
| widget | the widget to add |
Removes a child from its container. It is equivalent to etk_widget_parent_set(widget, NULL).
- Parameters:
-
| widget | the widget to remove |
Unpacks all the children of the container.
- Parameters:
-
void etk_container_border_width_set |
( |
Etk_Container * |
container, |
|
|
int |
border_width | |
|
) |
| | |
Sets the border width of a container. The border width is the amount of space left around the inside of the container. To add free space around the outside of a container, you can use etk_widget_padding_set().
- Parameters:
-
| container | a container |
| border_width | the border width to set |
- See also:
- etk_widget_padding_set()
Gets the border width of the container.
- Parameters:
-
- Returns:
- Returns the border width of the container
Eina_List * etk_container_children_get |
( |
Etk_Container * |
container |
) |
|
Gets the list of the children of the container. It simply calls the "childrend_get()" method of the container.
- Parameters:
-
- Returns:
- Returns the list of the container's children
- Note:
- The returned list will have to be freed with eina_list_free() when you no longer need it
Gets whether the widget is a child of the container.
- Parameters:
-
| container | a container |
| widget | the widget you want to check if it is a child of the container |
- Returns:
- Returns ETK_TRUE if the widget is a child of the container, ETK_FALSE otherwise
Calls for_each_cb(child) for each child of the container.
- Parameters:
-
| container | the container |
| for_each_cb | the function to call |
void etk_container_for_each_data |
( |
Etk_Container * |
container, |
|
|
void(*)(Etk_Widget *child, void *data) |
for_each_cb, |
|
|
void * |
data | |
|
) |
| | |
Calls for_each_cb(child, data) for each child of the container.
- Parameters:
-
| container | the container |
| for_each_cb | the function to call |
| data | the data to pass as the second argument of for_each_cb() |
void etk_container_child_space_fill |
( |
Etk_Widget * |
child, |
|
|
Etk_Geometry * |
child_space, |
|
|
Etk_Bool |
hfill, |
|
|
Etk_Bool |
vfill, |
|
|
float |
xalign, |
|
|
float |
yalign | |
|
) |
| | |
A utility function that resizes the given space according to the specified fill-policy. It is mainly used by container implementations.
- Parameters:
-
| child | a child |
| child_space | the allocated space for the child. It will be modified according to the fill options |
| hfill | if hfill == ETK_TRUE, the child will fill the space horizontally |
| vfill | if vfill == ETK_TRUE, the child will fill the space vertically |
| xalign | the horizontal alignment of the child widget in the child space (has no effect if hfill is ETK_TRUE) |
| yalign | the vertical alignment of the child widget in the child space (has no effect if vfill is ETK_TRUE) |
|
|