Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Box


Detailed Description

The Etk_Box widget is a container that can contain several children packed in one direction (horizontal or vertical).

Etk_Box is the base class for Etk_HBox and Etk_VBox: in an Etk_HBox, the children are packed horizontally, and in an Etk_VBox, the children are packed vertically.
You can pack a child in two different groups of widgets: the start-group and the end-group. The children of the start-group are packed at the start of the box (left for the hbox, top for the vbox) and the children of the end-group are packed at the end of the box (right for the hbox, bottom for the vbox).
Widgets can be packed with the functions etk_box_prepend(), etk_box_append(), etk_box_insert() and etk_box_insert_at().

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Container
        • Etk_Box
          • Etk_HBox
          • Etk_VBox
Properties:
  • "homogeneous": Whether or not the children of the box take up the same amount of space
    • Type: Boolean
    • Access: Read/Write
    • Default Value: ETK_FALSE
  • "spacing": The amount of space between two children
    • Type: Integer
    • Access: Read/Write
    • Default Value: 0


Data Structures

struct  Etk_Box
 [Widget] An abstract class for a box More...
struct  Etk_HBox
 [Widget] A box in which the children are packed horizontally More...
struct  Etk_VBox
 [Widget] A box in which the children are packed vertically More...

Defines

#define ETK_BOX_TYPE   (etk_box_type_get())
#define ETK_BOX(obj)   (ETK_OBJECT_CAST((obj), ETK_BOX_TYPE, Etk_Box))
#define ETK_IS_BOX(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_BOX_TYPE))
#define ETK_HBOX_TYPE   (etk_hbox_type_get())
#define ETK_HBOX(obj)   (ETK_OBJECT_CAST((obj), ETK_HBOX_TYPE, Etk_HBox))
#define ETK_IS_HBOX(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_HBOX_TYPE))
#define ETK_VBOX_TYPE   (etk_vbox_type_get())
#define ETK_VBOX(obj)   (ETK_OBJECT_CAST((obj), ETK_VBOX_TYPE, Etk_VBox))
#define ETK_IS_VBOX(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_VBOX_TYPE))

Enumerations

enum  Etk_Box_Group {
  ETK_BOX_START,
  ETK_BOX_END
}
 The two groups where the children can be packed: the start-group and the end-group. More...
enum  Etk_Box_Fill_Policy {
  ETK_BOX_NONE = 0,
  ETK_BOX_EXPAND = 1 << 0,
  ETK_BOX_FILL = 1 << 1,
  ETK_BOX_EXPAND_FILL = ETK_BOX_EXPAND | ETK_BOX_FILL,
  ETK_BOX_SHRINK_OPPOSITE = 1 << 2
}
 Describes how a child of the box expands and fills the space. More...

Functions

Etk_Widget * etk_hbox_new (Etk_Bool homogeneous, int spacing)
 Creates a new hbox.
Etk_Widget * etk_vbox_new (Etk_Bool homogeneous, int spacing)
 Creates a new vbox.
void etk_box_prepend (Etk_Box *box, Etk_Widget *child, Etk_Box_Group group, Etk_Box_Fill_Policy fill_policy, int padding)
 Packs a widget at the start of one of the two child-groups of the box.
void etk_box_append (Etk_Box *box, Etk_Widget *child, Etk_Box_Group group, Etk_Box_Fill_Policy fill_policy, int padding)
 Packs a widget at the end of one of the two child-groups of the box.
void etk_box_insert (Etk_Box *box, Etk_Widget *child, Etk_Box_Group group, Etk_Widget *after, Etk_Box_Fill_Policy fill_policy, int padding)
 Packs a widget after another widget, in one of the two child-groups of the box.
void etk_box_insert_at (Etk_Box *box, Etk_Widget *child, Etk_Box_Group group, int pos, Etk_Box_Fill_Policy fill_policy, int padding)
 Packs a widget at a given position, in one of the two child-groups of the box.
Etk_Widget * etk_box_child_get_at (Etk_Box *box, Etk_Box_Group group, int pos)
 Gets the child at a given position in the box.
void etk_box_child_position_set (Etk_Box *box, Etk_Widget *child, Etk_Box_Group group, int pos)
 Changes the position of a child of the box.
Etk_Bool etk_box_child_position_get (Etk_Box *box, Etk_Widget *child, Etk_Box_Group *group, int *pos)
 Gets the position of a child of the box.
void etk_box_child_packing_set (Etk_Box *box, Etk_Widget *child, Etk_Box_Fill_Policy fill_policy, int padding)
 Changes the packing settings of a child of the box.
Etk_Bool etk_box_child_packing_get (Etk_Box *box, Etk_Widget *child, Etk_Box_Fill_Policy *fill_policy, int *padding)
 Gets the packing settings of a child of the box.
void etk_box_spacing_set (Etk_Box *box, int spacing)
 Sets the amount of free space between two cells.
int etk_box_spacing_get (Etk_Box *box)
 Gets the amount of free space between two cells.
void etk_box_homogeneous_set (Etk_Box *box, Etk_Bool homogeneous)
 Sets whether or not all the cells of the box should have the same size.
Etk_Bool etk_box_homogeneous_get (Etk_Box *box)
 Gets whether or not all the cells of the box have the same size.


Define Documentation

#define ETK_BOX_TYPE   (etk_box_type_get())

Gets the type of a box

#define ETK_BOX ( obj   )     (ETK_OBJECT_CAST((obj), ETK_BOX_TYPE, Etk_Box))

Casts the object to an Etk_Box

Referenced by etk_dialog_action_area_homogeneous_get(), etk_dialog_action_area_homogeneous_set(), etk_dialog_pack_button_in_action_area(), etk_dialog_pack_in_main_area(), etk_dialog_pack_widget_in_action_area(), etk_toolbar_append(), etk_toolbar_insert_at(), and etk_toolbar_prepend().

#define ETK_IS_BOX ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_BOX_TYPE))

Checks if the object is an Etk_Box

#define ETK_HBOX_TYPE   (etk_hbox_type_get())

Gets the type of a hbox

Referenced by etk_hbox_new().

#define ETK_HBOX ( obj   )     (ETK_OBJECT_CAST((obj), ETK_HBOX_TYPE, Etk_HBox))

Casts the object to an Etk_HBox

#define ETK_IS_HBOX ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_HBOX_TYPE))

Checks if the object is an Etk_HBox

#define ETK_VBOX_TYPE   (etk_vbox_type_get())

Gets the type of a vbox

Referenced by etk_vbox_new().

#define ETK_VBOX ( obj   )     (ETK_OBJECT_CAST((obj), ETK_VBOX_TYPE, Etk_VBox))

Casts the object to an Etk_VBox

#define ETK_IS_VBOX ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_VBOX_TYPE))

Checks if the object is an Etk_VBox


Enumeration Type Documentation

enum Etk_Box_Group

The two groups where the children can be packed: the start-group and the end-group.

Enumerator:
ETK_BOX_START  The start-group of children: the children in this group are displayed at the start (left or top) of the box
ETK_BOX_END  The end-group of children: the children in this group are displayed at the end (right or bottom) of the box

enum Etk_Box_Fill_Policy

Describes how a child of the box expands and fills the space.

Enumerator:
ETK_BOX_NONE  The child does not fill or expand
ETK_BOX_EXPAND  The cell containing the child will expand to take all the available space
ETK_BOX_FILL  The child will fill all the available space in its cell
ETK_BOX_EXPAND_FILL  Equivalent to ETK_BOX_EXPAND | ETK_BOX_FILL
ETK_BOX_SHRINK_OPPOSITE  The child will shrink in the opposite direction of the box (i.e the child will shrink vertically for an Etk_HBox, and horizontally for an Etk_VBox)


Function Documentation

Etk_Widget * etk_hbox_new ( Etk_Bool  homogeneous,
int  spacing 
)

Creates a new hbox.

Parameters:
homogeneous if homogeneous == ETK_TRUE, all the cells of the box will have the same size
spacing the amount of space between two cells

References ETK_HBOX_TYPE, and etk_widget_new().

Referenced by etk_toolbar_orientation_set().

Etk_Widget * etk_vbox_new ( Etk_Bool  homogeneous,
int  spacing 
)

Creates a new vbox.

Parameters:
homogeneous if homogeneous == ETK_TRUE, all the cells of the box will have the same size
spacing the amount of space between two cells

References ETK_VBOX_TYPE, and etk_widget_new().

Referenced by etk_toolbar_orientation_set().

void etk_box_prepend ( Etk_Box *  box,
Etk_Widget *  child,
Etk_Box_Group  group,
Etk_Box_Fill_Policy  fill_policy,
int  padding 
)

Packs a widget at the start of one of the two child-groups of the box.

Parameters:
box a box
child the widget to pack
group the group where to pack the child
fill_policy the fill-policy of the child, it indicates how it should fill its cell
padding the amount of free space on the two sides of the child, in pixels

Referenced by etk_toolbar_prepend().

void etk_box_append ( Etk_Box *  box,
Etk_Widget *  child,
Etk_Box_Group  group,
Etk_Box_Fill_Policy  fill_policy,
int  padding 
)

Packs a widget at the end of one of the two child-groups of the box.

Parameters:
box a box
child the widget to pack
group the group where to pack the child
fill_policy the fill-policy of the child, it indicates how it should fill its cell
padding the amount of free space on the two sides of the child, in pixels

References last_cell.

Referenced by etk_dialog_pack_button_in_action_area(), etk_dialog_pack_in_main_area(), etk_dialog_pack_widget_in_action_area(), and etk_toolbar_append().

void etk_box_insert ( Etk_Box *  box,
Etk_Widget *  child,
Etk_Box_Group  group,
Etk_Widget *  after,
Etk_Box_Fill_Policy  fill_policy,
int  padding 
)

Packs a widget after another widget, in one of the two child-groups of the box.

Parameters:
box a box
child the widget to pack
group the group where to pack the child
after the child after which child will be packed. If after is NULL, child will be packed at the start of the group
fill_policy the fill-policy of the child, it indicates how it should fill its cell
padding the amount of free space on the two sides of the child, in pixels
Warning:
after has to be packed in group, or the function will have no effect

void etk_box_insert_at ( Etk_Box *  box,
Etk_Widget *  child,
Etk_Box_Group  group,
int  pos,
Etk_Box_Fill_Policy  fill_policy,
int  padding 
)

Packs a widget at a given position, in one of the two child-groups of the box.

Parameters:
box a box
child the widget to pack
group the group where to pack the child
pos the position where to pack child (starting from 0). If pos <= 0, child will be packed at the start of the child-group, and if pos is greater than the number of children in the group, it will be packed at the end
fill_policy the fill-policy of the child, it indicates how it should fill its cell
padding the amount of free space on the two sides of the child, in pixels

References cells_count, and last_cell.

Referenced by etk_box_child_position_set(), and etk_toolbar_insert_at().

Etk_Widget * etk_box_child_get_at ( Etk_Box *  box,
Etk_Box_Group  group,
int  pos 
)

Gets the child at a given position in the box.

Parameters:
box a box
group the group in which the child you want to get is packed
pos the position of the child you want to get (starting from 0)
Returns:
Returns the child at the given position, or NULL if there no childat this position

void etk_box_child_position_set ( Etk_Box *  box,
Etk_Widget *  child,
Etk_Box_Group  group,
int  pos 
)

Changes the position of a child of the box.

Parameters:
box a box
child the child you want to change the position of
group the group in which the child will be repacked
pos the position where to repack child (starting from 0). If pos <= 0, child will be packed at the start of the child-group, and if pos is greater than the number of children in the group, it will be packed at the end

References etk_box_insert_at(), and etk_widget_parent_set().

Etk_Bool etk_box_child_position_get ( Etk_Box *  box,
Etk_Widget *  child,
Etk_Box_Group *  group,
int *  pos 
)

Gets the position of a child of the box.

Parameters:
box a box
child the child you want to get the position of
group the location where to store the group in which the child is
pos the location where to store the position of the child
Returns:
Returns ETK_TRUE on success, or ETK_FALSE if child is not a child of the box

References first_cell.

void etk_box_child_packing_set ( Etk_Box *  box,
Etk_Widget *  child,
Etk_Box_Fill_Policy  fill_policy,
int  padding 
)

Changes the packing settings of a child of the box.

Parameters:
box a box
child a child of the box. If child is not packed in the box, this function has no effect
fill_policy the new fill-policy of the child
padding the new amount of free space on the two sides of the child, in pixels

References ETK_WIDGET, and etk_widget_size_recalc_queue().

Etk_Bool etk_box_child_packing_get ( Etk_Box *  box,
Etk_Widget *  child,
Etk_Box_Fill_Policy *  fill_policy,
int *  padding 
)

Gets the packing settings of a child of the box.

Parameters:
box a box
child a child of the box
fill_policy the location where to store the fill-policy of the child
padding the location where to store the padding of the child
Returns:
Returns ETK_TRUE on success, or ETK_FALSE if child is not a child of the box

void etk_box_spacing_set ( Etk_Box *  box,
int  spacing 
)

Sets the amount of free space between two cells.

Parameters:
box a box
spacing the new amount of free space between two cells, in pixels

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

int etk_box_spacing_get ( Etk_Box *  box  ) 

Gets the amount of free space between two cells.

Parameters:
box a box
Returns:
Returns the amount of free space between two cells, in pixels

References spacing.

void etk_box_homogeneous_set ( Etk_Box *  box,
Etk_Bool  homogeneous 
)

Sets whether or not all the cells of the box should have the same size.

Parameters:
box a box
homogeneous if homogeneous is ETK_TRUE, all the cells will have the same size

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

Referenced by etk_dialog_action_area_homogeneous_set().

Etk_Bool etk_box_homogeneous_get ( Etk_Box *  box  ) 

Gets whether or not all the cells of the box have the same size.

Parameters:
box a box
Returns:
Returns ETK_TRUE if the box is homogeneous, ETK_FALSE otherwise

References homogeneous.

Referenced by etk_dialog_action_area_homogeneous_get().