Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

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:
  • Etk_Object
    • Etk_Widget
      • Etk_Container
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 callback
      • child: the child which has been added
      • data: 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 callback
      • child: the child which has been removed
      • data: 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: Integer
    • Access: Read/Write
    • Default 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.
Evas_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

Referenced by etk_toolbar_type_get().

#define ETK_CONTAINER ( obj   )     (ETK_OBJECT_CAST((obj), ETK_CONTAINER_TYPE, Etk_Container))

Casts the object to an Etk_Container

Referenced by etk_button_style_set(), etk_canvas_object_remove(), etk_combobox_build(), etk_scrolled_view_add_with_viewport(), etk_toolbar_orientation_set(), etk_toolbar_stock_size_set(), etk_toolbar_style_set(), etk_tooltips_init(), and etk_tooltips_pop_up().

#define ETK_IS_CONTAINER ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_CONTAINER_TYPE))

Checks if the object is an Etk_Container


Function Documentation

void etk_container_add ( Etk_Container *  container,
Etk_Widget *  widget 
)

Adds a child to the container.

Parameters:
container a container
widget the widget to add

References child_add.

Referenced by etk_combobox_build(), etk_scrolled_view_add_with_viewport(), etk_tooltips_init(), and etk_tooltips_pop_up().

void etk_container_remove ( Etk_Widget *  widget  ) 

Removes a child from its container. It is equivalent to etk_widget_parent_set(widget, NULL).

Parameters:
widget the widget to remove

References etk_widget_parent_set().

Referenced by etk_bin_child_set(), etk_container_remove_all(), etk_paned_child1_set(), and etk_paned_child2_set().

void etk_container_remove_all ( Etk_Container *  container  ) 

Unpacks all the children of the container.

Parameters:
container a container

References etk_container_children_get(), etk_container_remove(), and ETK_WIDGET.

Referenced by etk_button_style_set().

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()

References border_width, ETK_OBJECT, etk_object_notify(), ETK_WIDGET, and etk_widget_size_recalc_queue().

int etk_container_border_width_get ( Etk_Container *  container  ) 

Gets the border width of the container.

Parameters:
container a container
Returns:
Returns the border width of the container

References border_width.

Evas_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:
container a container
Returns:
Returns the list of the container's children
Note:
The returned list will have to be freed with evas_list_free() when you no longer need it

References children_get.

Referenced by etk_container_for_each(), etk_container_for_each_data(), etk_container_is_child(), etk_container_remove_all(), etk_toolbar_orientation_set(), etk_toolbar_stock_size_set(), and etk_toolbar_style_set().

Etk_Bool etk_container_is_child ( Etk_Container *  container,
Etk_Widget *  widget 
)

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

References etk_container_children_get().

void etk_container_for_each ( Etk_Container *  container,
void(*)(Etk_Widget *child)  for_each_cb 
)

Calls for_each_cb(child) for each child of the container.

Parameters:
container the container
for_each_cb the function to call

References etk_container_children_get(), and ETK_WIDGET.

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()

References etk_container_children_get(), and ETK_WIDGET.

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)

References ETK_CLAMP, etk_widget_size_request(), Etk_Size::h, Etk_Geometry::h, Etk_Size::w, Etk_Geometry::w, Etk_Geometry::x, and Etk_Geometry::y.