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 gtk.grid_view.GridView.enableRubberband.

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.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
GridView self() nothrowReturns `this`, for use in `with` statements.
GridViewGidBuilder builder() static nothrowGet builder for [gtk.grid_view.GridView] Returns: New builder object
bool enableRubberband() @property nothrowGet `enableRubberband` property. Returns: Allow rubberband selection.
void enableRubberband(bool propval) @property nothrowSet `enableRubberband` property. Params: propval = Allow rubberband selection.
gtk.list_item_factory.ListItemFactory factory() @property nothrowGet `factory` property. Returns: Factory for populating list items.
void factory(gtk.list_item_factory.ListItemFactory propval) @property nothrowSet `factory` property. Params: propval = Factory for populating list items.
uint maxColumns() @property nothrowGet `maxColumns` property. Returns: Maximum number of columns per row.
void maxColumns(uint propval) @property nothrowSet `maxColumns` property. Params: propval = Maximum number of columns per row.
uint minColumns() @property nothrowGet `minColumns` property. Returns: Minimum number of columns per row.
void minColumns(uint propval) @property nothrowSet `minColumns` property. Params: propval = Minimum number of columns per row.
gtk.selection_model.SelectionModel model() @property nothrowGet `model` property. Returns: Model for the items displayed.
void model(gtk.selection_model.SelectionModel propval) @property nothrowSet `model` property. Params: propval = Model for the items displayed.
bool singleClickActivate() @property nothrowGet `singleClickActivate` property. Returns: Activate rows on single click and select them on hover.
void singleClickActivate(bool propval) @property nothrowSet `singleClickActivate` property. Params: propval = Activate rows on single click and select them on hover.
gtk.types.ListTabBehavior tabBehavior() @property nothrowGet `tabBehavior` property. Returns: Behavior of the <kbd>Tab</kbd> key
void tabBehavior(gtk.types.ListTabBehavior propval) @property nothrowSet `tabBehavior` property. Params: propval = Behavior of the <kbd>Tab</kbd> key
bool getEnableRubberband() nothrowReturns whether rows can be selected by dragging with the mouse. Returns: true if rubberband selection is enabled
gtk.list_item_factory.ListItemFactory getFactory() nothrowGets the factory that's currently used to populate list items. Returns: The factory in use
uint getMaxColumns() nothrowGets the maximum number of columns that the grid will use. Returns: The maximum number of columns
uint getMinColumns() nothrowGets the minimum number of columns that the grid will use. Returns: The minimum number of columns
gtk.selection_model.SelectionModel getModel() nothrowGets the model that's currently used to read the items displayed. Returns: The model in use
bool getSingleClickActivate() nothrowReturns whether items will be activated on single click and selected on hover. Returns: true if items are activated on single click
gtk.types.ListTabBehavior getTabBehavior() nothrowGets the behavior set for the <kbd>Tab</kbd> key. Returns: The behavior of the <kbd>Tab</kbd> key
void scrollTo(uint pos, gtk.types.ListScrollFlags flags, gtk.scroll_info.ScrollInfo scroll = null) nothrowScrolls to the item at the given position and performs the actions specified in flags.
void setEnableRubberband(bool enableRubberband) nothrowSets whether selections can be changed by dragging with the mouse.
void setFactory(gtk.list_item_factory.ListItemFactory factory = null) nothrowSets the [gtk.list_item_factory.ListItemFactory] to use for populating list items.
void setMaxColumns(uint maxColumns) nothrowSets the maximum number of columns to use.
void setMinColumns(uint minColumns) nothrowSets the minimum number of columns to use.
void setModel(gtk.selection_model.SelectionModel model = null) nothrowSets the model to use.
void setSingleClickActivate(bool singleClickActivate) nothrowSets whether items should be activated on single click and selected on hover.
void setTabBehavior(gtk.types.ListTabBehavior tabBehavior) nothrowSets 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) nothrowConnect to `Activate` signal.
Constructors
this(void * ptr, Flag!"Take" take)
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.

Fluent builder implementation template for gtk.grid_view.GridView

Methods
T enableRubberband(bool propval) nothrowSet `enableRubberband` property. Params: propval = Allow rubberband selection. Returns: Builder instance for fluent chaining
T factory(gtk.list_item_factory.ListItemFactory propval) nothrowSet `factory` property. Params: propval = Factory for populating list items. Returns: Builder instance for fluent chaining
T maxColumns(uint propval) nothrowSet `maxColumns` property. Params: propval = Maximum number of columns per row.
T minColumns(uint propval) nothrowSet `minColumns` property. Params: propval = Minimum number of columns per row. Returns: Builder instance for fluent chaining
T model(gtk.selection_model.SelectionModel propval) nothrowSet `model` property. Params: propval = Model for the items displayed. Returns: Builder instance for fluent chaining
T singleClickActivate(bool propval) nothrowSet `singleClickActivate` property. Params: propval = Activate rows on single click and select them on hover. Returns: Builder instance for fluent chaining
T tabBehavior(gtk.types.ListTabBehavior propval) nothrowSet `tabBehavior` property. Params: propval = Behavior of the <kbd>Tab</kbd> key Returns: Builder instance for fluent chaining

Fluent builder for gtk.grid_view.GridView

Methods
GridView build() nothrowCreate object from builder. Returns: New object