GridView

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

Constructors

this
this(gtk.selection_model.SelectionModel model, gtk.list_item_factory.ListItemFactory factory)

Creates a new gtk.grid_view.GridView that uses the given factory for mapping items to widgets.

Members

Functions

connectActivate
ulong connectActivate(T callback, Flag!"After" after)

Connect to Activate signal.

getEnableRubberband
bool getEnableRubberband()

Returns whether rows can be selected by dragging with the mouse.

getFactory
gtk.list_item_factory.ListItemFactory getFactory()

Gets the factory that's currently used to populate list items.

getMaxColumns
uint getMaxColumns()

Gets the maximum number of columns that the grid will use.

getMinColumns
uint getMinColumns()

Gets the minimum number of columns that the grid will use.

getModel
gtk.selection_model.SelectionModel getModel()

Gets the model that's currently used to read the items displayed.

getSingleClickActivate
bool getSingleClickActivate()

Returns whether items will be activated on single click and selected on hover.

getTabBehavior
gtk.types.ListTabBehavior getTabBehavior()

Gets the behavior set for the <kbd>Tab</kbd> key.

scrollTo
void scrollTo(uint pos, gtk.types.ListScrollFlags flags, gtk.scroll_info.ScrollInfo scroll)

Scrolls to the item at the given position and performs the actions specified in flags.

setEnableRubberband
void setEnableRubberband(bool enableRubberband)

Sets whether selections can be changed by dragging with the mouse.

setFactory
void setFactory(gtk.list_item_factory.ListItemFactory factory)

Sets the gtk.list_item_factory.ListItemFactory to use for populating list items.

setMaxColumns
void setMaxColumns(uint maxColumns)

Sets the maximum number of columns to use.

setMinColumns
void setMinColumns(uint minColumns)

Sets the minimum number of columns to use.

setModel
void setModel(gtk.selection_model.SelectionModel model)

Sets the model to use.

setSingleClickActivate
void setSingleClickActivate(bool singleClickActivate)

Sets whether items should be activated on single click and selected on hover.

setTabBehavior
void setTabBehavior(gtk.types.ListTabBehavior tabBehavior)

Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.