Pack.boxSourceA box is a Container.container which stacks its children, giving each one more or less space according to its size and properties. Widgets can be stacked horizontally or vertically (depending on the Props.orientation property). The widget has class "vertical" or "horizontal" depending on orientation.
inherit Stk.Container.container_listinherit Stk.Widget.orientedmethod widget_data : Stk.Widget.widget -> 'a option optionb#widget_data w returns Container.child.data data associated to the given child widget w, if w is a child of b and it has data associated.
method widget_index : Stk.Widget.widget -> int optionb#widget_index w returns 0-based index of w in b's children, if w is a child of b.
method children_widgets : Stk.Widget.widget listo#children_widgets returns the list of children widget of o.
method reorder_child : Stk.Widget.widget -> int -> unito#reorder_child w pos moves child widget w to new position pos (if possible).
method get_nth : int option -> ('a option * Stk.Widget.widget) optionbox#get_nth None returns None. box#get_nth (Some n) returns None if n-th child does not exist, or Some (data, child).
method pack : ?pos:int ->
?hexpand:int ->
?vexpand:int ->
?hfill:bool ->
?vfill:bool ->
?data:'a ->
Stk.Widget.widget ->
unito#pack w adds widget w to o. Optional parameters are:
pos indicates a position to insert w; default is to append w to children. If pos < 0, pos indicate a position from the end of the children list.hexpand (resp. vexpand) sets Props.hexpand (resp. Props.vexpand) property of w to the given value.hfill (resp. vfill) sets Props.hfill (resp. Props.vfill) property of w to the given value.data associates the given value to w. All data associated to children must have the same type (this type is the type parameter of class box.To allocate space for children widgets, the following algorithm is applied (here for horizontal packing; for vertical packing, replace width by height and hexpand by vexpand):
o.hexpand value. 0 means that widget does not require more than its minimal width. A positive value p means that the widget requires p shares of the remaining space. The remaining space is divided by the total number of shares and each widget is given as width its minimal width + the width corresponding to its required shares. For example, if three widgets of same minimum size have hexpand values of 3, 2 and 1, the first widget will have half of the available width, the second will have one third and the last on sixth.hfill is true) of just its minimum width (if it is false).method unpack : Stk.Widget.widget -> unito#unpack w removes child widget w from o.