gtk.grid_view
Module for [GridView] class
Types 3
[gtk.grid_view.GridView] presents a large dynamic grid of items.
[gtk.grid_view.GridView] uses its factory to generate one child widget for each visible item and shows them in a grid. The orientation of the grid view determines if the grid reflows vertically or horizontally.
[gtk.grid_view.GridView] allows the user to select items according to the selection characteristics of the model. For models that allow multiple selected items, it is possible to turn on _rubberband selection_, using property@Gtk.GridView:enable-rubberband.
To learn more about the list widget framework, see the
overview.CSS nodes
gridview
├── child[.activatable]
│
├── child[.activatable]
│
┊
╰── [rubberband][gtk.grid_view.GridView] uses a single CSS node with name gridview. Each child uses a single CSS node with name child. If the [gtk.list_item.ListItem.activatable] property is set, the corresponding row will have the .activatable style class. For rubberband selection, a subnode with name rubberband is used.
Accessibility
[gtk.grid_view.GridView] uses the [gtk.types.AccessibleRole.Grid] role, and the items use the [gtk.types.AccessibleRole.GridCell] role.
GridViewGidBuilder builder()Get builder for [gtk.grid_view.GridView] Returns: New builder objectbool enableRubberband() @propertyGet `enableRubberband` property. Returns: Allow rubberband selection.void enableRubberband(bool propval) @propertySet `enableRubberband` property. Params: propval = Allow rubberband selection.gtk.list_item_factory.ListItemFactory factory() @propertyGet `factory` property. Returns: Factory for populating list items.void factory(gtk.list_item_factory.ListItemFactory propval) @propertySet `factory` property. Params: propval = Factory for populating list items.void maxColumns(uint propval) @propertySet `maxColumns` property. Params: propval = Maximum number of columns per row.void minColumns(uint propval) @propertySet `minColumns` property. Params: propval = Minimum number of columns per row.gtk.selection_model.SelectionModel model() @propertyGet `model` property. Returns: Model for the items displayed.void model(gtk.selection_model.SelectionModel propval) @propertySet `model` property. Params: propval = Model for the items displayed.bool singleClickActivate() @propertyGet `singleClickActivate` property. Returns: Activate rows on single click and select them on hover.void singleClickActivate(bool propval) @propertySet `singleClickActivate` property. Params: propval = Activate rows on single click and select them on hover.gtk.types.ListTabBehavior tabBehavior() @propertyGet `tabBehavior` property. Returns: Behavior of the <kbd>Tab</kbd> keyvoid tabBehavior(gtk.types.ListTabBehavior propval) @propertySet `tabBehavior` property. Params: propval = Behavior of the <kbd>Tab</kbd> keybool getEnableRubberband()Returns whether rows can be selected by dragging with the mouse. Returns: true if rubberband selection is enabledgtk.list_item_factory.ListItemFactory getFactory()Gets the factory that's currently used to populate list items. Returns: The factory in useuint getMaxColumns()Gets the maximum number of columns that the grid will use. Returns: The maximum number of columnsuint getMinColumns()Gets the minimum number of columns that the grid will use. Returns: The minimum number of columnsgtk.selection_model.SelectionModel getModel()Gets the model that's currently used to read the items displayed. Returns: The model in usebool getSingleClickActivate()Returns whether items will be activated on single click and selected on hover. Returns: true if items are activated on single clickgtk.types.ListTabBehavior getTabBehavior()Gets the behavior set for the <kbd>Tab</kbd> key. Returns: The behavior of the <kbd>Tab</kbd> keyvoid scrollTo(uint pos, gtk.types.ListScrollFlags flags, gtk.scroll_info.ScrollInfo scroll = null)Scrolls to the item at the given position and performs the actions specified in flags.void setEnableRubberband(bool enableRubberband)Sets whether selections can be changed by dragging with the mouse.void setFactory(gtk.list_item_factory.ListItemFactory factory = null)Sets the [gtk.listitemfactory.ListItemFactory] to use for populating list items.void setMaxColumns(uint maxColumns)Sets the maximum number of columns to use.void setMinColumns(uint minColumns)Sets the minimum number of columns to use.void setModel(gtk.selection_model.SelectionModel model = null)Sets the model to use.void setSingleClickActivate(bool singleClickActivate)Sets whether items should be activated on single click and selected on hover.void setTabBehavior(gtk.types.ListTabBehavior tabBehavior)Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.gulong connectActivate(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] == uint)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.grid_view.GridView)))
&& Parameters!T.length < 3)Connect to `Activate` signal.this(gtk.selection_model.SelectionModel model = null, gtk.list_item_factory.ListItemFactory factory = null)Creates a new [gtk.grid_view.GridView] that uses the given factory for mapping items to widgets.T enableRubberband(bool propval)Set `enableRubberband` property. Params: propval = Allow rubberband selection. Returns: Builder instance for fluent chainingT factory(gtk.list_item_factory.ListItemFactory propval)Set `factory` property. Params: propval = Factory for populating list items. Returns: Builder instance for fluent chainingT maxColumns(uint propval)Set `maxColumns` property. Params: propval = Maximum number of columns per row.T minColumns(uint propval)Set `minColumns` property. Params: propval = Minimum number of columns per row. Returns: Builder instance for fluent chainingT model(gtk.selection_model.SelectionModel propval)Set `model` property. Params: propval = Model for the items displayed. Returns: Builder instance for fluent chainingT singleClickActivate(bool propval)Set `singleClickActivate` property. Params: propval = Activate rows on single click and select them on hover. Returns: Builder instance for fluent chainingT tabBehavior(gtk.types.ListTabBehavior propval)Set `tabBehavior` property. Params: propval = Behavior of the <kbd>Tab</kbd> key Returns: Builder instance for fluent chaining