gtk.flow_box
Module for [FlowBox] class
Types 3
A gtk.flow_box.FlowBox puts child widgets in reflowing grid.
For instance, with the horizontal orientation, the widgets will be arranged from left to right, starting a new row under the previous row when necessary. Reducing the width in this case will require more rows, so a larger height will be requested.
Likewise, with the vertical orientation, the widgets will be arranged from top to bottom, starting a new column to the right when necessary. Reducing the height will require more columns, so a larger width will be requested.
The size request of a gtk.flow_box.FlowBox alone may not be what you expect; if you need to be able to shrink it along both axes and dynamically reflow its children, you may have to wrap it in a gtk.scrolled_window.ScrolledWindow to enable that.
The children of a gtk.flow_box.FlowBox can be dynamically sorted and filtered.
Although a gtk.flow_box.FlowBox must have only gtk.flow_box_child.FlowBoxChild children, you can add any kind of widget to it via gtk.flow_box.FlowBox.insert, and a gtk.flow_box_child.FlowBoxChild widget will automatically be inserted between the box and the widget.
Also see gtk.list_box.ListBox.
CSS nodes
flowbox
├── flowboxchild
│ ╰── <child>
├── flowboxchild
│ ╰── <child>
┊
╰── [rubberband]gtk.flow_box.FlowBox uses a single CSS node with name flowbox. gtk.flow_box_child.FlowBoxChild uses a single CSS node with name flowboxchild. For rubberband selection, a subnode with name rubberband is used.
Accessibility
gtk.flow_box.FlowBox uses the gtk.types.AccessibleRole.Grid role, and gtk.flow_box_child.FlowBoxChild uses the gtk.types.AccessibleRole.GridCell role.
FlowBoxGidBuilder builder() static nothrowGet builder for [gtk.flow_box.FlowBox] Returns: New builder objectbool activateOnSingleClick() @property nothrowGet `activateOnSingleClick` property. Returns: Determines whether children can be activated with a single click, or require a double-click.void activateOnSingleClick(bool propval) @property nothrowSet `activateOnSingleClick` property. Params: propval = Determines whether children can be activated with a single click, or require a double-click.uint columnSpacing() @property nothrowGet `columnSpacing` property. Returns: The amount of horizontal space between two children.void columnSpacing(uint propval) @property nothrowSet `columnSpacing` property. Params: propval = The amount of horizontal space between two children.bool homogeneous() @property nothrowGet `homogeneous` property. Returns: Determines whether all children should be allocated the same size.void homogeneous(bool propval) @property nothrowSet `homogeneous` property. Params: propval = Determines whether all children should be allocated the same size.uint maxChildrenPerLine() @property nothrowGet `maxChildrenPerLine` property. Returns: The maximum amount of children to request space for consecutively in the given orientation.void maxChildrenPerLine(uint propval) @property nothrowSet `maxChildrenPerLine` property. Params: propval = The maximum amount of children to request space for consecutively in the given orientation.uint minChildrenPerLine() @property nothrowGet `minChildrenPerLine` property. Returns: The minimum number of children to allocate consecutively in the given orientation.void minChildrenPerLine(uint propval) @property nothrowSet `minChildrenPerLine` property. Params: propval = The minimum number of children to allocate consecutively in the given orientation.uint rowSpacing() @property nothrowGet `rowSpacing` property. Returns: The amount of vertical space between two children.void rowSpacing(uint propval) @property nothrowSet `rowSpacing` property. Params: propval = The amount of vertical space between two children.gtk.types.SelectionMode selectionMode() @property nothrowGet `selectionMode` property. Returns: The selection mode used by the flow box.void selectionMode(gtk.types.SelectionMode propval) @property nothrowSet `selectionMode` property. Params: propval = The selection mode used by the flow box.void bindModel(gio.list_model.ListModel model, gtk.types.FlowBoxCreateWidgetFunc createWidgetFunc) nothrowBinds model to box.bool getActivateOnSingleClick() nothrowReturns whether children activate on single clicks. Returns: true if children are activated on single click, false otherwisegtk.flow_box_child.FlowBoxChild getChildAtPos(int x, int y) nothrowGets the child in the (`x`, `y`) position.bool getHomogeneous() nothrowReturns whether the box is homogeneous. Returns: true if the box is homogeneous.uint getMaxChildrenPerLine() nothrowGets the maximum number of children per line. Returns: the maximum number of children per lineuint getMinChildrenPerLine() nothrowGets the minimum number of children per line. Returns: the minimum number of children per linegtk.flow_box_child.FlowBoxChild[] getSelectedChildren() nothrowCreates a list of all selected children. Returns: A [glib.list.List] containing the [gtk.widget.Widget] for each selected child. Free with [glib.list.List.free] when done.gtk.types.SelectionMode getSelectionMode() nothrowGets the selection mode of box. Returns: the [gtk.types.SelectionMode]void selectChild(gtk.flow_box_child.FlowBoxChild child) nothrowSelects a single child of box, if the selection mode allows it.void selectedForeach(gtk.types.FlowBoxForeachFunc func) nothrowCalls a function for each selected child.void setActivateOnSingleClick(bool single) nothrowIf single is true, children will be activated when you click on them, otherwise you need to double-click.void setFilterFunc(gtk.types.FlowBoxFilterFunc filterFunc = null) nothrowBy setting a filter function on the box one can decide dynamically which of the children to show.void setHadjustment(gtk.adjustment.Adjustment adjustment) nothrowHooks up an adjustment to focus handling in box.void setHomogeneous(bool homogeneous) nothrowSets whether or not all children of box are given equal space in the box.void setMaxChildrenPerLine(uint nChildren) nothrowSets the maximum number of children to request and allocate space for in box’s orientation.void setMinChildrenPerLine(uint nChildren) nothrowSets the minimum number of children to line up in box’s orientation before flowing.void setSortFunc(gtk.types.FlowBoxSortFunc sortFunc = null) nothrowBy setting a sort function on the box, one can dynamically reorder the children of the box, based on the contents of the children.void setVadjustment(gtk.adjustment.Adjustment adjustment) nothrowHooks up an adjustment to focus handling in box.void unselectChild(gtk.flow_box_child.FlowBoxChild child) nothrowUnselects a single child of box, if the selection mode allows it.gulong connectActivateCursorChild(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.flow_box.FlowBox)))
&& Parameters!T.length < 2) nothrowConnect to `ActivateCursorChild` signal.gulong connectChildActivated(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.flow_box_child.FlowBoxChild)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.flow_box.FlowBox)))
&& Parameters!T.length < 3) nothrowConnect to `ChildActivated` signal.gulong connectMoveCursor(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.MovementStep)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == int)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] == bool)))
&& (Parameters!T.length < 4 || (ParameterStorageClassTuple!T[3] == ParameterStorageClass.none && is(Parameters!T[3] == bool)))
&& (Parameters!T.length < 5 || (ParameterStorageClassTuple!T[4] == ParameterStorageClass.none && is(Parameters!T[4] : gtk.flow_box.FlowBox)))
&& Parameters!T.length < 6) nothrowConnect to `MoveCursor` signal.gulong connectSelectAll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.flow_box.FlowBox)))
&& Parameters!T.length < 2) nothrowConnect to `SelectAll` signal.gulong connectSelectedChildrenChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.flow_box.FlowBox)))
&& Parameters!T.length < 2) nothrowConnect to `SelectedChildrenChanged` signal.gulong connectToggleCursorChild(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.flow_box.FlowBox)))
&& Parameters!T.length < 2) nothrowConnect to `ToggleCursorChild` signal.gulong connectUnselectAll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.flow_box.FlowBox)))
&& Parameters!T.length < 2) nothrowConnect to `UnselectAll` signal.Fluent builder implementation template for gtk.flow_box.FlowBox
T acceptUnpairedRelease(bool propval) nothrowT activateOnSingleClick(bool propval) nothrowSet `activateOnSingleClick` property. Params: propval = Determines whether children can be activated with a single click, or require a double-click. Returns: Builder instance for fluent chainingT columnSpacing(uint propval) nothrowSet `columnSpacing` property. Params: propval = The amount of horizontal space between two children. Returns: Builder instance for fluent chainingT homogeneous(bool propval) nothrowSet `homogeneous` property. Params: propval = Determines whether all children should be allocated the same size. Returns: Builder instance for fluent chainingT maxChildrenPerLine(uint propval) nothrowSet `maxChildrenPerLine` property. Params: propval = The maximum amount of children to request space for consecutively in the given orientation. Returns: Builder instance for fluent chainingT minChildrenPerLine(uint propval) nothrowSet `minChildrenPerLine` property. Params: propval = The minimum number of children to allocate consecutively in the given orientation.T rowSpacing(uint propval) nothrowSet `rowSpacing` property. Params: propval = The amount of vertical space between two children. Returns: Builder instance for fluent chainingT selectionMode(gtk.types.SelectionMode propval) nothrowSet `selectionMode` property. Params: propval = The selection mode used by the flow box. Returns: Builder instance for fluent chainingFluent builder for gtk.flow_box.FlowBox