Class

Gtk.FlowBox

Description [src]

final class Gtk.FlowBox : Gtk.Widget {
  /* No available fields */
}

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_flow_box_insert(), and a GtkFlowBoxChild widget will automatically be inserted between the box and the widget.

Also see GtkListBox.

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.

Accessibility

GtkFlowBox uses the #GTK_ACCESSIBLE_ROLE_GRID role, and GtkFlowBoxChild uses the #GTK_ACCESSIBLE_ROLE_GRID_CELL role.

Ancestors

Constructors

gtk_flow_box_new

Creates a GtkFlowBox.

Instance methods

gtk_flow_box_bind_model

Binds model to box.

gtk_flow_box_get_activate_on_single_click

Returns whether children activate on single clicks.

gtk_flow_box_get_child_at_index

Gets the nth child in the box.

gtk_flow_box_get_child_at_pos

Gets the child in the (x, y) position. Both x and y are assumed to be relative to the origin of box.

gtk_flow_box_get_column_spacing

Gets the horizontal spacing.

gtk_flow_box_get_homogeneous

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

gtk_flow_box_get_max_children_per_line

Gets the maximum number of children per line.

gtk_flow_box_get_min_children_per_line

Gets the minimum number of children per line.

gtk_flow_box_get_row_spacing

Gets the vertical spacing.

gtk_flow_box_get_selected_children

Creates a list of all selected children.

gtk_flow_box_get_selection_mode

Gets the selection mode of box.

gtk_flow_box_insert

Inserts the widget into box at position.

gtk_flow_box_invalidate_filter

Updates the filtering for all children.

gtk_flow_box_invalidate_sort

Updates the sorting for all children.

gtk_flow_box_remove

Removes a child from box.

gtk_flow_box_select_all

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

gtk_flow_box_select_child

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

gtk_flow_box_selected_foreach

Calls a function for each selected child.

gtk_flow_box_set_activate_on_single_click

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

gtk_flow_box_set_column_spacing

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

gtk_flow_box_set_filter_func

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.

gtk_flow_box_set_hadjustment

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.

gtk_flow_box_set_homogeneous

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

gtk_flow_box_set_max_children_per_line

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

gtk_flow_box_set_min_children_per_line

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

gtk_flow_box_set_row_spacing

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

gtk_flow_box_set_selection_mode

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

gtk_flow_box_set_sort_func

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

gtk_flow_box_set_vadjustment

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.

gtk_flow_box_unselect_all

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

gtk_flow_box_unselect_child

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

Methods inherited from GtkWidget (159)
Methods inherited from GtkBuildable (1)

Properties

Gtk.FlowBox:accept-unpaired-release
No description available.
Gtk.FlowBox:activate-on-single-click

Determines whether children can be activated with a single click, or require a double-click.

Gtk.FlowBox:column-spacing

The amount of horizontal space between two children.

Gtk.FlowBox:homogeneous

Determines whether all children should be allocated the same size.

Gtk.FlowBox:max-children-per-line

The maximum amount of children to request space for consecutively in the given orientation.

Gtk.FlowBox:min-children-per-line

The minimum number of children to allocate consecutively in the given orientation.

Gtk.FlowBox:row-spacing

The amount of vertical space between two children.

Gtk.FlowBox:selection-mode

The selection mode used by the flow box.

Properties inherited from GtkAccessible (1)
Properties inherited from GtkOrientable (1)

Signals

Gtk.FlowBox::activate-cursor-child

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

Gtk.FlowBox::child-activated

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

Gtk.FlowBox::move-cursor

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

Gtk.FlowBox::select-all

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

Gtk.FlowBox::selected-children-changed

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

Gtk.FlowBox::toggle-cursor-child

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

Gtk.FlowBox::unselect-all

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