Ewl_Box: The Box Layout Container.
Detailed Description
Defines the Ewl_Box class used for laying out Ewl_Widget's in a horizontal or vertical line.
- Remarks:
- Inherits from Ewl_Container.
Tutorial
The Ewl_Box provides a simple linear layout container. There are a few options to control the layout characteristics, but much of the layout is dependent on the child widget settings. The first option encountered is the orientation, which is either horizontal or vertical. Both orientations are implemented within the same box widget, and is set with ewl_box_orientation_set, but shortcuts exist in the form of ewl_hbox_new and ewl_vbox_new. The default orientation is horizontal.
Ewl_Widget *box; box = ewl_hbox_new(); ewl_widget_show(box);
After creating the box, children are added with the standard container calls common to most containers. For example, a label and entry would be added as follows.
ewl_container_child_append(EWL_CONTAINER(box), label); ewl_container_child_append(EWL_CONTAINER(box), entry);
This would result in a label followed by the entry laid out horizontally.
Data Structures | |
struct | Ewl_Box |
Inherits from an Ewl_Container to provide layout facilities for child widgets placed inside. More... | |
Defines | |
#define | EWL_BOX(box) ((Ewl_Box *) box) |
#define | EWL_BOX_IS(w) (ewl_widget_type_is(EWL_WIDGET(w), EWL_BOX_TYPE)) |
#define | EWL_BOX_TYPE "box" |
Typedefs | |
typedef struct Ewl_Box | Ewl_Box |
Functions | |
void | ewl_box_cb_child_hide (Ewl_Container *c, Ewl_Widget *w) |
void | ewl_box_cb_child_homogeneous_resize (Ewl_Container *c, Ewl_Widget *w, int size, Ewl_Orientation o) |
void | ewl_box_cb_child_homogeneous_show (Ewl_Container *c, Ewl_Widget *w) |
void | ewl_box_cb_child_resize (Ewl_Container *c, Ewl_Widget *w, int size, Ewl_Orientation o) |
void | ewl_box_cb_child_show (Ewl_Container *c, Ewl_Widget *w) |
void | ewl_box_cb_configure (Ewl_Widget *w, void *ev_data, void *user_data) |
void | ewl_box_cb_configure_homogeneous (Ewl_Widget *w, void *ev_data, void *user_data) |
unsigned int | ewl_box_homogeneous_get (Ewl_Box *b) |
Retrieves the layout of the box. | |
void | ewl_box_homogeneous_set (Ewl_Box *b, unsigned int h) |
Change the homogeneous layout of the box, setting TRUE will give all children the same size. | |
int | ewl_box_init (Ewl_Box *box) |
Initialize the box to starting values. | |
Ewl_Widget * | ewl_box_new (void) |
Allocate and initialize a new box with given orientation. | |
Ewl_Orientation | ewl_box_orientation_get (Ewl_Box *b) |
Retrieves the orientation of the box. | |
void | ewl_box_orientation_set (Ewl_Box *b, Ewl_Orientation o) |
Change the specified box's orientation. | |
void | ewl_box_spacing_set (Ewl_Box *b, int spacing) |
Changes the spacing between the objects in the box. | |
Ewl_Widget * | ewl_hbox_new (void) |
Allocate and initialize a new box with horizontal orientation. | |
Ewl_Widget * | ewl_vbox_new (void) |
Allocate and initialize a new box with vertical orientation. |
Define Documentation
#define EWL_BOX | ( | box | ) | ((Ewl_Box *) box) |
Typecast a pointer to an Ewl_Box pointer.
Referenced by ewl_border_init(), ewl_border_label_position_set(), ewl_box_cb_child_hide(), ewl_box_cb_child_homogeneous_resize(), ewl_box_cb_child_homogeneous_show(), ewl_box_cb_child_resize(), ewl_box_cb_child_show(), ewl_box_cb_configure(), ewl_box_cb_configure_homogeneous(), ewl_button_init(), ewl_calendar_init(), ewl_colorpicker_init(), ewl_combo_init(), ewl_dialog_action_position_set(), ewl_dialog_init(), ewl_filelist_init(), ewl_filelist_multi_select_preview_get(), ewl_filelist_selected_file_preview_get(), ewl_filelist_view_widget_fetch(), ewl_filepicker_init(), ewl_floater_init(), ewl_hbox_new(), ewl_icon_init(), ewl_menu_cb_configure(), ewl_menubar_init(), ewl_menubar_orientation_get(), ewl_menubar_orientation_set(), ewl_mvc_init(), ewl_notebook_init(), ewl_notebook_tabbar_homogeneous_get(), ewl_notebook_tabbar_homogeneous_set(), ewl_notebook_tabbar_position_set(), ewl_scrollbar_cb_scroll_start(), ewl_scrollbar_init(), ewl_scrollbar_orientation_get(), ewl_scrollbar_orientation_set(), ewl_shadow_init(), ewl_statusbar_init(), ewl_stock_init(), ewl_tree_view_freebox_init(), ewl_tree_view_init(), ewl_tree_view_scrolled_init(), and ewl_vbox_new().
#define EWL_BOX_IS | ( | w | ) | (ewl_widget_type_is(EWL_WIDGET(w), EWL_BOX_TYPE)) |
Returns TRUE if the widget is an Ewl_Box, FALSE otherwise
#define EWL_BOX_TYPE "box" |
- Widget Theme Keys:
- /box/file
- Widget Theme Keys:
- /box/group
Referenced by ewl_box_cb_child_hide(), ewl_box_cb_child_homogeneous_resize(), ewl_box_cb_child_resize(), ewl_box_cb_child_show(), ewl_box_cb_configure(), ewl_box_cb_configure_homogeneous(), ewl_box_homogeneous_get(), ewl_box_homogeneous_set(), ewl_box_init(), ewl_box_orientation_get(), ewl_box_orientation_set(), and ewl_box_spacing_set().
Typedef Documentation
The box widget is an Ewl_Container and lays out Ewl_Widget's either horizontally or vertically.
Function Documentation
void ewl_box_cb_child_hide | ( | Ewl_Container * | c, | |
Ewl_Widget * | w | |||
) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BOX, EWL_BOX_TYPE, ewl_container_child_count_visible_get(), ewl_container_largest_prefer(), EWL_OBJECT, ewl_object_preferred_h_get(), ewl_object_preferred_inner_h_get(), ewl_object_preferred_inner_h_set(), ewl_object_preferred_inner_w_get(), ewl_object_preferred_inner_w_set(), ewl_object_preferred_w_get(), EWL_ORIENTATION_HORIZONTAL, EWL_ORIENTATION_VERTICAL, EWL_WIDGET_TYPE, orientation, and spacing.
Referenced by ewl_box_homogeneous_set(), and ewl_box_init().
void ewl_box_cb_child_homogeneous_resize | ( | Ewl_Container * | c, | |
Ewl_Widget * | w, | |||
int | size, | |||
Ewl_Orientation | o | |||
) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BOX, ewl_box_cb_child_homogeneous_show(), EWL_BOX_TYPE, and ewl_container_largest_prefer().
Referenced by ewl_box_homogeneous_set().
void ewl_box_cb_child_homogeneous_show | ( | Ewl_Container * | c, | |
Ewl_Widget * | w | |||
) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BOX, ewl_container_child_count_visible_get(), ewl_container_largest_prefer(), EWL_CONTAINER_TYPE, EWL_OBJECT, ewl_object_preferred_inner_h_set(), ewl_object_preferred_inner_w_set(), EWL_ORIENTATION_HORIZONTAL, EWL_ORIENTATION_VERTICAL, PREFERRED_H, and PREFERRED_W.
Referenced by ewl_box_cb_child_homogeneous_resize(), and ewl_box_homogeneous_set().
void ewl_box_cb_child_resize | ( | Ewl_Container * | c, | |
Ewl_Widget * | w, | |||
int | size, | |||
Ewl_Orientation | o | |||
) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BOX, EWL_BOX_TYPE, ewl_container_largest_prefer(), EWL_OBJECT, EWL_ORIENTATION_HORIZONTAL, Ewl_Box_Orientation::pref_fill_set, PREFERRED_H, and PREFERRED_W.
Referenced by ewl_box_homogeneous_set(), and ewl_box_init().
void ewl_box_cb_child_show | ( | Ewl_Container * | c, | |
Ewl_Widget * | w | |||
) |
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BOX, EWL_BOX_TYPE, ewl_container_child_count_visible_get(), EWL_OBJECT, ewl_object_preferred_h_get(), ewl_object_preferred_inner_h_get(), ewl_object_preferred_inner_h_set(), ewl_object_preferred_inner_w_get(), ewl_object_preferred_inner_w_set(), ewl_object_preferred_w_get(), EWL_ORIENTATION_HORIZONTAL, and EWL_WIDGET_TYPE.
Referenced by ewl_box_homogeneous_set(), ewl_box_init(), and ewl_box_orientation_set().
void ewl_box_cb_configure | ( | Ewl_Widget * | w, | |
void * | ev_data, | |||
void * | user_data | |||
) |
References alloca(), CURRENT_H, CURRENT_W, CURRENT_X, CURRENT_Y, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, EWL_BOX, EWL_BOX_TYPE, EWL_CONTAINER, ewl_container_child_count_visible_get(), EWL_ORIENTATION_HORIZONTAL, and orientation.
Referenced by ewl_box_homogeneous_set(), ewl_box_init(), and ewl_tree_node_init().
void ewl_box_cb_configure_homogeneous | ( | Ewl_Widget * | w, | |
void * | ev_data, | |||
void * | user_data | |||
) |
References CURRENT_H, CURRENT_W, CURRENT_X, CURRENT_Y, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, EWL_BOX, EWL_BOX_TYPE, EWL_CONTAINER, ewl_container_child_count_visible_get(), ewl_object_place(), EWL_ORIENTATION_HORIZONTAL, orientation, spacing, and VISIBLE.
Referenced by ewl_box_homogeneous_set().
unsigned int ewl_box_homogeneous_get | ( | Ewl_Box * | b | ) |
Retrieves the layout of the box.
- Parameters:
-
b,: the box to retrieve layout
- Returns:
- Returns the homogeneous layout value of the box b.
References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_BOX_TYPE, and homogeneous.
Referenced by ewl_notebook_tabbar_homogeneous_get().
void ewl_box_homogeneous_set | ( | Ewl_Box * | b, | |
unsigned int | h | |||
) |
Change the homogeneous layout of the box, setting TRUE will give all children the same size.
- Parameters:
-
b,: the box to change homogeneous layout h,: the boolean value to change the layout mode to
- Returns:
- Returns no value. If the box is set to be homogeneous (TRUE) it will give all children the same size. By default the box is inhomogeneous.
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, ewl_box_cb_child_hide(), ewl_box_cb_child_homogeneous_resize(), ewl_box_cb_child_homogeneous_show(), ewl_box_cb_child_resize(), ewl_box_cb_child_show(), ewl_box_cb_configure(), ewl_box_cb_configure_homogeneous(), EWL_BOX_TYPE, ewl_callback_append(), EWL_CALLBACK_CONFIGURE, ewl_callback_del(), EWL_CONTAINER, ewl_container_child_count_visible_get(), ewl_container_hide_notify_set(), ewl_container_largest_prefer(), ewl_container_resize_notify_set(), ewl_container_show_notify_set(), ewl_container_sum_prefer(), EWL_OBJECT, ewl_object_preferred_inner_h_set(), ewl_object_preferred_inner_w_set(), EWL_ORIENTATION_HORIZONTAL, EWL_ORIENTATION_VERTICAL, EWL_WIDGET, ewl_widget_configure(), homogeneous, orientation, PREFERRED_H, PREFERRED_W, and spacing.
Referenced by ewl_dialog_init(), and ewl_notebook_tabbar_homogeneous_set().
int ewl_box_init | ( | Ewl_Box * | b | ) |
Initialize the box to starting values.
- Parameters:
-
b,: the box to initialize
- Returns:
- Returns no value. Responsible for setting up default values and callbacks within a box structure.
References DCHECK_PARAM_PTR_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, ewl_box_cb_child_hide(), ewl_box_cb_child_resize(), ewl_box_cb_child_show(), ewl_box_cb_configure(), EWL_BOX_TYPE, ewl_callback_append(), EWL_CALLBACK_CONFIGURE, ewl_callback_del(), EWL_CALLBACK_FOCUS_OUT, EWL_CONTAINER, ewl_container_cb_container_focus_out(), ewl_container_hide_notify_set(), ewl_container_init(), ewl_container_resize_notify_set(), ewl_container_show_notify_set(), EWL_ORIENTATION_HORIZONTAL, EWL_WIDGET, ewl_widget_appearance_set(), ewl_widget_cb_focus_out(), ewl_widget_destroy(), ewl_widget_focusable_set(), ewl_widget_inherit(), and orientation.
Referenced by ewl_border_init(), ewl_box_new(), ewl_calendar_init(), ewl_colorpicker_init(), ewl_filelist_init(), ewl_filepicker_init(), ewl_floater_init(), ewl_menubar_init(), ewl_mvc_init(), ewl_notebook_init(), ewl_scrollbar_init(), ewl_shadow_init(), ewl_statusbar_init(), ewl_stock_init(), and ewl_tree_view_init().
Ewl_Widget* ewl_box_new | ( | void | ) |
Allocate and initialize a new box with given orientation.
- Returns:
- Returns NULL on failure, or a newly allocated box on success.
References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, ewl_box_init(), EWL_WIDGET, ewl_widget_destroy(), and NEW.
Referenced by ewl_hbox_new(), and ewl_vbox_new().
Ewl_Orientation ewl_box_orientation_get | ( | Ewl_Box * | b | ) |
Retrieves the orientation of the box.
- Parameters:
-
b,: the box to retrieve orientation
- Returns:
- Returns the orientation value of the box b.
References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_BOX_TYPE, and orientation.
Referenced by ewl_menu_cb_configure(), ewl_menubar_orientation_get(), ewl_scrollbar_cb_scroll_start(), ewl_scrollbar_orientation_get(), and ewl_scrollbar_orientation_set().
void ewl_box_orientation_set | ( | Ewl_Box * | b, | |
Ewl_Orientation | o | |||
) |
Change the specified box's orientation.
- Parameters:
-
b,: the box to change the orientation o,: the orientation to set for the box
- Returns:
- Returns no value. Changes the orientation of the specified box, and reconfigures it in order for the appearance to be updated.
References Ewl_Container::children, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, ewl_box_cb_child_show(), EWL_BOX_TYPE, EWL_CONTAINER, EWL_OBJECT, ewl_object_preferred_inner_size_set(), EWL_ORIENTATION_HORIZONTAL, EWL_ORIENTATION_VERTICAL, EWL_WIDGET, ewl_widget_appearance_get(), ewl_widget_appearance_set(), ewl_widget_configure(), IF_FREE, orientation, and UNMANAGED.
Referenced by ewl_border_init(), ewl_border_label_position_set(), ewl_button_init(), ewl_calendar_init(), ewl_colorpicker_init(), ewl_combo_init(), ewl_dialog_action_position_set(), ewl_filelist_multi_select_preview_get(), ewl_filelist_selected_file_preview_get(), ewl_filelist_view_widget_fetch(), ewl_filepicker_init(), ewl_floater_init(), ewl_hbox_new(), ewl_icon_init(), ewl_menubar_orientation_set(), ewl_mvc_init(), ewl_notebook_init(), ewl_notebook_tabbar_position_set(), ewl_scrollbar_init(), ewl_scrollbar_orientation_set(), ewl_shadow_init(), ewl_statusbar_init(), ewl_tree_view_freebox_init(), ewl_tree_view_init(), ewl_tree_view_scrolled_init(), and ewl_vbox_new().
void ewl_box_spacing_set | ( | Ewl_Box * | b, | |
int | s | |||
) |
Changes the spacing between the objects in the box.
- Parameters:
-
b,: the box to change the spacing s,: the spacing to put between the child widgets
- Returns:
- Returns no value. Adjust the spacing of the specified box and reconfigure it to change the appearance.
References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_BOX_TYPE, EWL_CONTAINER, ewl_container_child_count_visible_get(), EWL_OBJECT, ewl_object_preferred_inner_h_set(), ewl_object_preferred_inner_w_set(), EWL_ORIENTATION_HORIZONTAL, EWL_WIDGET, ewl_widget_configure(), orientation, PREFERRED_H, PREFERRED_W, and spacing.
Referenced by ewl_icon_init().
Ewl_Widget* ewl_hbox_new | ( | void | ) |
Allocate and initialize a new box with horizontal orientation.
- Returns:
- Returns NULL on failure, or a newly allocated horizontal box on success.
References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, EWL_BOX, ewl_box_new(), ewl_box_orientation_set(), EWL_ORIENTATION_HORIZONTAL, and EWL_WIDGET.
Referenced by ewl_button_init(), ewl_calendar_init(), ewl_colorpicker_init(), ewl_dialog_init(), ewl_filepicker_init(), ewl_menubar_init(), ewl_notebook_init(), ewl_notebook_page_tab_widget_set(), ewl_statusbar_init(), and ewl_tree_column_count_set().
Ewl_Widget* ewl_vbox_new | ( | void | ) |
Allocate and initialize a new box with vertical orientation.
- Returns:
- Returns NULL on failure, or a newly allocated vertical box on success.
References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, EWL_BOX, ewl_box_new(), ewl_box_orientation_set(), EWL_ORIENTATION_VERTICAL, and EWL_WIDGET.
Referenced by ewl_border_init(), ewl_calendar_init(), ewl_colorpicker_init(), ewl_context_menu_container_set(), ewl_dialog_init(), ewl_filelist_multi_select_preview_get(), ewl_filelist_selected_file_preview_get(), ewl_filepicker_init(), ewl_notebook_init(), ewl_scrollpane_init(), and ewl_spinner_init().