FlowBox

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_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

|[<!-- language="plain" --> 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.

class FlowBox : Container , OrientableIF {}

Constructors

this
this(GtkFlowBox* gtkFlowBox, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a GtkFlowBox.

Members

Classes

OnActivateCursorChildDelegateWrapper
class OnActivateCursorChildDelegateWrapper
Undocumented in source.
OnChildActivatedDelegateWrapper
class OnChildActivatedDelegateWrapper
Undocumented in source.
OnMoveCursorDelegateWrapper
class OnMoveCursorDelegateWrapper
Undocumented in source.
OnSelectAllDelegateWrapper
class OnSelectAllDelegateWrapper
Undocumented in source.
OnSelectedChildrenChangedDelegateWrapper
class OnSelectedChildrenChangedDelegateWrapper
Undocumented in source.
OnToggleCursorChildDelegateWrapper
class OnToggleCursorChildDelegateWrapper
Undocumented in source.
OnUnselectAllDelegateWrapper
class OnUnselectAllDelegateWrapper
Undocumented in source.

Functions

addOnActivateCursorChild
gulong addOnActivateCursorChild(void delegate(FlowBox) dlg, ConnectFlags connectFlags)

The ::activate-cursor-child signal is a [keybinding signal]GtkBindingSignal which gets emitted when the user activates the @box.

addOnChildActivated
gulong addOnChildActivated(void delegate(FlowBoxChild, FlowBox) dlg, ConnectFlags connectFlags)

The ::child-activated signal is emitted when a child has been activated by the user.

addOnMoveCursor
gulong addOnMoveCursor(bool delegate(GtkMovementStep, int, FlowBox) dlg, ConnectFlags connectFlags)

The ::move-cursor signal is a [keybinding signal]GtkBindingSignal which gets emitted when the user initiates a cursor movement.

addOnSelectAll
gulong addOnSelectAll(void delegate(FlowBox) dlg, ConnectFlags connectFlags)

The ::select-all signal is a [keybinding signal]GtkBindingSignal which gets emitted to select all children of the box, if the selection mode permits it.

addOnSelectedChildrenChanged
gulong addOnSelectedChildrenChanged(void delegate(FlowBox) dlg, ConnectFlags connectFlags)

The ::selected-children-changed signal is emitted when the set of selected children changes.

addOnToggleCursorChild
gulong addOnToggleCursorChild(void delegate(FlowBox) dlg, ConnectFlags connectFlags)

The ::toggle-cursor-child signal is a [keybinding signal]GtkBindingSignal which toggles the selection of the child that has the focus.

addOnUnselectAll
gulong addOnUnselectAll(void delegate(FlowBox) dlg, ConnectFlags connectFlags)

The ::unselect-all signal is a [keybinding signal]GtkBindingSignal which gets emitted to unselect all children of the box, if the selection mode permits it.

bindModel
void bindModel(ListModelIF model, GtkFlowBoxCreateWidgetFunc createWidgetFunc, void* userData, GDestroyNotify userDataFreeFunc)

Binds @model to @box.

getActivateOnSingleClick
bool getActivateOnSingleClick()

Returns whether children activate on single clicks.

getChildAtIndex
FlowBoxChild getChildAtIndex(int idx)

Gets the nth child in the @box.

getChildAtPos
FlowBoxChild getChildAtPos(int x, int y)

Gets the child in the (@x, @y) position.

getColumnSpacing
uint getColumnSpacing()

Gets the horizontal spacing.

getFlowBoxStruct
GtkFlowBox* getFlowBoxStruct(bool transferOwnership)

Get the main Gtk struct

getHomogeneous
bool getHomogeneous()

Returns whether the box is homogeneous (all children are the same size). See gtk_box_set_homogeneous().

getMaxChildrenPerLine
uint getMaxChildrenPerLine()

Gets the maximum number of children per line.

getMinChildrenPerLine
uint getMinChildrenPerLine()

Gets the minimum number of children per line.

getRowSpacing
uint getRowSpacing()

Gets the vertical spacing.

getSelectedChildren
ListG getSelectedChildren()

Creates a list of all selected children.

getSelectionMode
GtkSelectionMode getSelectionMode()

Gets the selection mode of @box.

getStruct
void* getStruct()

the main Gtk struct as a void*

insert
void insert(Widget widget, int position)

Inserts the @widget into @box at @position.

invalidateFilter
void invalidateFilter()

Updates the filtering for all children.

invalidateSort
void invalidateSort()

Updates the sorting for all children.

selectAll
void selectAll()

Select all children of @box, if the selection mode allows it.

selectChild
void selectChild(FlowBoxChild child)

Selects a single child of @box, if the selection mode allows it.

selectedForeach
void selectedForeach(GtkFlowBoxForeachFunc func, void* data)

Calls a function for each selected child.

setActivateOnSingleClick
void setActivateOnSingleClick(bool single)

If @single is %TRUE, children will be activated when you click on them, otherwise you need to double-click.

setColumnSpacing
void setColumnSpacing(uint spacing)

Sets the horizontal space to add between children. See the #GtkFlowBox:column-spacing property.

setFilterFunc
void setFilterFunc(GtkFlowBoxFilterFunc filterFunc, void* userData, GDestroyNotify destroy)

By 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.

setHadjustment
void setHadjustment(Adjustment adjustment)

Hooks up an adjustment to focus handling in @box. The adjustment is also used for autoscrolling during rubberband selection. See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining the adjustment, and gtk_flow_box_set_vadjustment()for setting the vertical adjustment.

setHomogeneous
void setHomogeneous(bool homogeneous)

Sets the #GtkFlowBox:homogeneous property of @box, controlling whether or not all children of @box are given equal space in the box.

setMaxChildrenPerLine
void setMaxChildrenPerLine(uint nChildren)

Sets the maximum number of children to request and allocate space for in @box’s orientation.

setMinChildrenPerLine
void setMinChildrenPerLine(uint nChildren)

Sets the minimum number of children to line up in @box’s orientation before flowing.

setRowSpacing
void setRowSpacing(uint spacing)

Sets the vertical space to add between children. See the #GtkFlowBox:row-spacing property.

setSelectionMode
void setSelectionMode(GtkSelectionMode mode)

Sets how selection works in @box. See #GtkSelectionMode for details.

setSortFunc
void setSortFunc(GtkFlowBoxSortFunc sortFunc, void* userData, GDestroyNotify destroy)

By setting a sort function on the @box, one can dynamically reorder the children of the box, based on the contents of the children.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
setVadjustment
void setVadjustment(Adjustment adjustment)

Hooks up an adjustment to focus handling in @box. The adjustment is also used for autoscrolling during rubberband selection. See gtk_scrolled_window_get_vadjustment() for a typical way of obtaining the adjustment, and gtk_flow_box_set_hadjustment()for setting the horizontal adjustment.

unselectAll
void unselectAll()

Unselect all children of @box, if the selection mode allows it.

unselectChild
void unselectChild(FlowBoxChild child)

Unselects a single child of @box, if the selection mode allows it.

Mixins

__anonymous
mixin OrientableT!(GtkFlowBox)
Undocumented in source.

Static functions

callBackActivateCursorChild
void callBackActivateCursorChild(GtkFlowBox* flowboxStruct, OnActivateCursorChildDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackActivateCursorChildDestroy
void callBackActivateCursorChildDestroy(OnActivateCursorChildDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackChildActivated
void callBackChildActivated(GtkFlowBox* flowboxStruct, GtkFlowBoxChild* child, OnChildActivatedDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackChildActivatedDestroy
void callBackChildActivatedDestroy(OnChildActivatedDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackMoveCursor
int callBackMoveCursor(GtkFlowBox* flowboxStruct, GtkMovementStep step, int count, OnMoveCursorDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackMoveCursorDestroy
void callBackMoveCursorDestroy(OnMoveCursorDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackSelectAll
void callBackSelectAll(GtkFlowBox* flowboxStruct, OnSelectAllDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackSelectAllDestroy
void callBackSelectAllDestroy(OnSelectAllDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackSelectedChildrenChanged
void callBackSelectedChildrenChanged(GtkFlowBox* flowboxStruct, OnSelectedChildrenChangedDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackSelectedChildrenChangedDestroy
void callBackSelectedChildrenChangedDestroy(OnSelectedChildrenChangedDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackToggleCursorChild
void callBackToggleCursorChild(GtkFlowBox* flowboxStruct, OnToggleCursorChildDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackToggleCursorChildDestroy
void callBackToggleCursorChildDestroy(OnToggleCursorChildDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackUnselectAll
void callBackUnselectAll(GtkFlowBox* flowboxStruct, OnUnselectAllDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackUnselectAllDestroy
void callBackUnselectAllDestroy(OnUnselectAllDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
getType
GType getType()

Variables

gtkFlowBox
GtkFlowBox* gtkFlowBox;

the main Gtk struct

onActivateCursorChildListeners
OnActivateCursorChildDelegateWrapper[] onActivateCursorChildListeners;
Undocumented in source.
onChildActivatedListeners
OnChildActivatedDelegateWrapper[] onChildActivatedListeners;
Undocumented in source.
onMoveCursorListeners
OnMoveCursorDelegateWrapper[] onMoveCursorListeners;
Undocumented in source.
onSelectAllListeners
OnSelectAllDelegateWrapper[] onSelectAllListeners;
Undocumented in source.
onSelectedChildrenChangedListeners
OnSelectedChildrenChangedDelegateWrapper[] onSelectedChildrenChangedListeners;
Undocumented in source.
onToggleCursorChildListeners
OnToggleCursorChildDelegateWrapper[] onToggleCursorChildListeners;
Undocumented in source.
onUnselectAllListeners
OnUnselectAllDelegateWrapper[] onUnselectAllListeners;
Undocumented in source.

Inherited Members

From Container

gtkContainer
GtkContainer* gtkContainer;

the main Gtk struct

getContainerStruct
GtkContainer* getContainerStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
removeAll
void removeAll()

Removes all widgets from the container

getType
GType getType()
add
void add(Widget widget)

Adds @widget to @container. Typically used for simple containers such as #GtkWindow, #GtkFrame, or #GtkButton; for more complicated layout containers such as #GtkBox or #GtkGrid, this function will pick default packing parameters that may not be correct. So consider functions such as gtk_box_pack_start() and gtk_grid_attach() as an alternative to gtk_container_add() in those cases. A widget may be added to only one container at a time; you can’t place the same widget inside two different containers.

checkResize
void checkResize()
childGetProperty
void childGetProperty(Widget child, string propertyName, Value value)

Gets the value of a child property for @child and @container.

childGetValist
void childGetValist(Widget child, string firstPropertyName, void* varArgs)

Gets the values of one or more child properties for @child and @container.

childNotify
void childNotify(Widget child, string childProperty)

Emits a #GtkWidget::child-notify signal for the [child property][child-properties] @child_property on the child.

childNotifyByPspec
void childNotifyByPspec(Widget child, ParamSpec pspec)

Emits a #GtkWidget::child-notify signal for the [child property][child-properties] specified by @pspec on the child.

childSetProperty
void childSetProperty(Widget child, string propertyName, Value value)

Sets a child property for @child and @container.

childSetValist
void childSetValist(Widget child, string firstPropertyName, void* varArgs)

Sets one or more child properties for @child and @container.

childType
GType childType()

Returns the type of the children supported by the container.

forall
void forall(GtkCallback callback, void* callbackData)

Invokes @callback on each direct child of @container, including children that are considered “internal” (implementation details of the container). “Internal” children generally weren’t added by the user of the container, but were added by the container implementation itself.

foreac
void foreac(GtkCallback callback, void* callbackData)

Invokes @callback on each non-internal child of @container. See gtk_container_forall() for details on what constitutes an “internal” child. For all practical purposes, this function should iterate over precisely those child widgets that were added to the container by the application with explicit add() calls.

getBorderWidth
uint getBorderWidth()

Retrieves the border width of the container. See gtk_container_set_border_width().

getChildren
ListG getChildren()

Returns the container’s non-internal children. See gtk_container_forall() for details on what constitutes an "internal" child.

getFocusChain
bool getFocusChain(ListG focusableWidgets)

Retrieves the focus chain of the container, if one has been set explicitly. If no focus chain has been explicitly set, GTK+ computes the focus chain based on the positions of the children. In that case, GTK+ stores %NULL in @focusable_widgets and returns %FALSE.

getFocusChild
Widget getFocusChild()

Returns the current focus child widget inside @container. This is not the currently focused widget. That can be obtained by calling gtk_window_get_focus().

getFocusHadjustment
Adjustment getFocusHadjustment()

Retrieves the horizontal focus adjustment for the container. See gtk_container_set_focus_hadjustment ().

getFocusVadjustment
Adjustment getFocusVadjustment()

Retrieves the vertical focus adjustment for the container. See gtk_container_set_focus_vadjustment().

getPathForChild
WidgetPath getPathForChild(Widget child)

Returns a newly created widget path representing all the widget hierarchy from the toplevel down to and including @child.

getResizeMode
GtkResizeMode getResizeMode()

Returns the resize mode for the container. See gtk_container_set_resize_mode ().

propagateDraw
void propagateDraw(Widget child, Context cr)

When a container receives a call to the draw function, it must send synthetic #GtkWidget::draw calls to all children that don’t have their own #GdkWindows. This function provides a convenient way of doing this. A container, when it receives a call to its #GtkWidget::draw function, calls gtk_container_propagate_draw() once for each child, passing in the @cr the container received.

remove
void remove(Widget widget)

Removes @widget from @container. @widget must be inside @container. Note that @container will own a reference to @widget, and that this may be the last reference held; so removing a widget from its container can destroy that widget. If you want to use @widget again, you need to add a reference to it before removing it from a container, using g_object_ref(). If you don’t want to use @widget again it’s usually more efficient to simply destroy it directly using gtk_widget_destroy() since this will remove it from the container and help break any circular reference count cycles.

resizeChildren
void resizeChildren()
setBorderWidth
void setBorderWidth(uint borderWidth)

Sets the border width of the container.

setFocusChain
void setFocusChain(ListG focusableWidgets)

Sets a focus chain, overriding the one computed automatically by GTK+.

setFocusChild
void setFocusChild(Widget child)

Sets, or unsets if @child is %NULL, the focused child of @container.

setFocusHadjustment
void setFocusHadjustment(Adjustment adjustment)

Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the horizontal alignment. See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining the adjustment and gtk_container_set_focus_vadjustment() for setting the vertical adjustment.

setFocusVadjustment
void setFocusVadjustment(Adjustment adjustment)

Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the vertical alignment. See gtk_scrolled_window_get_vadjustment() for a typical way of obtaining the adjustment and gtk_container_set_focus_hadjustment() for setting the horizontal adjustment.

setReallocateRedraws
void setReallocateRedraws(bool needsRedraws)

Sets the @reallocate_redraws flag of the container to the given value.

setResizeMode
void setResizeMode(GtkResizeMode resizeMode)

Sets the resize mode for the container.

unsetFocusChain
void unsetFocusChain()

Removes a focus chain explicitly set with gtk_container_set_focus_chain().

OnAddDelegateWrapper
class OnAddDelegateWrapper
Undocumented in source.
onAddListeners
OnAddDelegateWrapper[] onAddListeners;
Undocumented in source.
addOnAdd
gulong addOnAdd(void delegate(Widget, Container) dlg, ConnectFlags connectFlags)
callBackAdd
void callBackAdd(GtkContainer* containerStruct, GtkWidget* object, OnAddDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackAddDestroy
void callBackAddDestroy(OnAddDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
OnCheckResizeDelegateWrapper
class OnCheckResizeDelegateWrapper
Undocumented in source.
onCheckResizeListeners
OnCheckResizeDelegateWrapper[] onCheckResizeListeners;
Undocumented in source.
addOnCheckResize
gulong addOnCheckResize(void delegate(Container) dlg, ConnectFlags connectFlags)
callBackCheckResize
void callBackCheckResize(GtkContainer* containerStruct, OnCheckResizeDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackCheckResizeDestroy
void callBackCheckResizeDestroy(OnCheckResizeDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
OnRemoveDelegateWrapper
class OnRemoveDelegateWrapper
Undocumented in source.
onRemoveListeners
OnRemoveDelegateWrapper[] onRemoveListeners;
Undocumented in source.
addOnRemove
gulong addOnRemove(void delegate(Widget, Container) dlg, ConnectFlags connectFlags)
callBackRemove
void callBackRemove(GtkContainer* containerStruct, GtkWidget* object, OnRemoveDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackRemoveDestroy
void callBackRemoveDestroy(OnRemoveDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.
OnSetFocusChildDelegateWrapper
class OnSetFocusChildDelegateWrapper
Undocumented in source.
onSetFocusChildListeners
OnSetFocusChildDelegateWrapper[] onSetFocusChildListeners;
Undocumented in source.
addOnSetFocusChild
gulong addOnSetFocusChild(void delegate(Widget, Container) dlg, ConnectFlags connectFlags)
callBackSetFocusChild
void callBackSetFocusChild(GtkContainer* containerStruct, GtkWidget* object, OnSetFocusChildDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackSetFocusChildDestroy
void callBackSetFocusChildDestroy(OnSetFocusChildDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.

From OrientableIF

getOrientableStruct
GtkOrientable* getOrientableStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getOrientation
GtkOrientation getOrientation()

Retrieves the orientation of the @orientable.

setOrientation
void setOrientation(GtkOrientation orientation)

Sets the orientation of the @orientable.

Meta