Go to the source code of this file.
Defines | |
#define | WIN_BOX_LEADING -1 |
Alignment to the leading edge (left or top). | |
#define | WIN_BOX_CENTER 0 |
Alignment to the center. | |
#define | WIN_BOX_TRAILING 1 |
Alignment to the trailing edge (right or bottom). | |
#define | WIN_BOX_FILL -2 |
Alignment filling the space to both edges. | |
Functions | |
win_widget_t * | win_box_new (void) |
Creates a new box. | |
win_widget_t * | win_box_new_padding (int xpad, int ypad) |
Creates a new box with cell padding. | |
void | win_box_add (win_widget_t *widget, win_widget_t *child) |
Adds a widget to a box. | |
void | win_box_add_at (win_widget_t *widget, win_widget_t *child, int row, int col) |
Adds a widget to a box at a specific location. | |
void | win_box_add_with (win_widget_t *widget, win_widget_t *child, int row, int col, double xweight, double yweight, int pwidth, int pheight, int align_x, int align_y) |
Adds a widget to a box with specific layout parameters. | |
void | win_box_remove (win_widget_t *widget, win_widget_t *child) |
Removes a widgets from a box. | |
void | win_box_layout (win_widget_t *widget) |
Moves the widgets in this box into their proper position. |
The box widget is an invisible widget, whose purpose is to group other widgets so that they can be added and removed from the window system as a group.
Boxes are also capable of laying out their children according to a grid model. When each widget is added to the box, it can be given a position and a slew of other parameters controlling its layout. Calling win_box_layout will change the positions and sizes of the components in the box to fit the desired layout.
Definition in file winbox.h.
void win_box_add | ( | win_widget_t * | widget, | |
win_widget_t * | child | |||
) |
Adds a widget to a box.
The child widget will be added at location (0, 0) and have defaults for all layout parameters. Typically, this function is used when there is no intent to call win_box_layout.
widget | The box widget. | |
child | The widget to be added. |
void win_box_add_at | ( | win_widget_t * | widget, | |
win_widget_t * | child, | |||
int | row, | |||
int | col | |||
) |
Adds a widget to a box at a specific location.
The child widget will be added at a specific location within the box, with defaults for all other layout parameters. The widget will not physically move, however, until win_box_layout is called.
widget | The box widget. | |
child | The widget to be added. | |
row | The zero-indexed row number to which to add the widget. | |
col | The zero-indexed column number to which to add the widget. |
void win_box_add_with | ( | win_widget_t * | widget, | |
win_widget_t * | child, | |||
int | row, | |||
int | col, | |||
double | xweight, | |||
double | yweight, | |||
int | pwidth, | |||
int | pheight, | |||
int | align_x, | |||
int | align_y | |||
) |
Adds a widget to a box with specific layout parameters.
The child widget will be added at a specific location within the box, with given values for all layout parameters. The widget will not physically move, however, until win_box_layout is called.
widget | The box widget. | |
child | The widget to be added. | |
row | The zero-indexed row number to which to add the widget. | |
col | The zero-indexed column number to which to add the widget. | |
xweight | The widget weight in the x dimension. | |
yweight | The widget weight in the y dimension. | |
pwidth | The effective preferred width (or -1 to ask the widget). | |
pheight | The effective preferred height (or -1 to ask the widget). | |
align_x | The x dimension alignment to be used when there is extra space beyond the preferred size of the widget. Possible values are WIN_BOX_LEADING, WIN_BOX_CENTER, WIN_BOX_TRAILING, and WIN_BOX_FILL. | |
align_y | The y dimension alignment to be used when there is extra space beyond the preferred size of the widget. Possible values are WIN_BOX_LEADING, WIN_BOX_CENTER, WIN_BOX_TRAILING, and WIN_BOX_FILL. |
void win_box_layout | ( | win_widget_t * | widget | ) |
Moves the widgets in this box into their proper position.
The widgets will be moved into a grid formation, according to the layout parameters attached to each widget.
win_widget_t* win_box_new | ( | void | ) |
Creates a new box.
The result of this call is a new box, which can be used to group items onto the page. The box has an initial padding of 0 pixels between cells.
win_widget_t* win_box_new_padding | ( | int | xpad, | |
int | ypad | |||
) |
Creates a new box with cell padding.
The result of this call is a new box, which can be used to group items onto the page. The box will lay out its contents with the given padding between cells in the x and y dimensions.
xpad | The padding between cells in the horizontal direction. | |
ypad | The padding between cells in the vertical direction. |
void win_box_remove | ( | win_widget_t * | widget, | |
win_widget_t * | child | |||
) |
Removes a widgets from a box.
The widget will be removed from the box. If the box does not contain this widget, then the function has no effect.
widget | The box widget. | |
child | The widget to be removed from the box. |