gtk.flow_box
Module for [FlowBox] class
Types 3
A GtkFlowBox positions child widgets in sequence according to its orientation.
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 GtkFlowBox 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 #GtkScrolledWindow to enable that.
The children of a GtkFlowBox can be dynamically sorted and filtered.
Although a GtkFlowBox must have only #GtkFlowBoxChild children, you can add any kind of widget to it via gtk.container.Container.add, and a GtkFlowBoxChild widget will automatically be inserted between the box and the widget.
Also see #GtkListBox.
GtkFlowBox was added in GTK+ 3.12.
CSS nodes
flowbox
├── flowboxchild
│ ╰── <child>
├── flowboxchild
│ ╰── <child>
┊
╰── [rubberband]GtkFlowBox uses a single CSS node with name flowbox. GtkFlowBoxChild uses a single CSS node with name flowboxchild. For rubberband selection, a subnode with name rubberband is used.
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 (all children are the same size). See [gtk.box.Box.setHomogeneous]. 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 #GList containing the #GtkWidget for each selected child. Free with [glib.list.List.free] when done.gtk.types.SelectionMode getSelectionMode() nothrowGets the selection mode of box. Returns: the #GtkSelectionModevoid 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 setColumnSpacing(uint spacing) nothrowSets the horizontal space to add between children. See the #GtkFlowBox:column-spacing property.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. For instance, to implement a search function that only shows the children matching the search terms.void setHadjustment(gtk.adjustment.Adjustment adjustment) nothrowHooks up an adjustment to focus handling in box. The adjustment is also used for autoscrolling during rubberband selection. See [gtk.scrolled_window.ScrolledWindow.getHadjustment] for a typical way...void setHomogeneous(bool homogeneous) nothrowSets the #GtkFlowBox:homogeneous property of box, controlling 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 setRowSpacing(uint spacing) nothrowSets the vertical space to add between children. See the #GtkFlowBox:row-spacing property.void setSelectionMode(gtk.types.SelectionMode mode) nothrowSets how selection works in box. See #GtkSelectionMode for details.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. The adjustment is also used for autoscrolling during rubberband selection. See [gtk.scrolled_window.ScrolledWindow.getVadjustment] for a typical way...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] : gtk.flow_box.FlowBox)))
&& Parameters!T.length < 4) 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 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