gi-gtk-4.0.11: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.GridView

Description

GtkGridView presents a large dynamic grid of items.

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

GtkGridView 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 GridView:enableRubberband.

To learn more about the list widget framework, see the overview.

Actions

GtkGridView defines a set of built-in actions:

  • list.activate-item activates the item at given position by emitting the the GridView::activate signal.

CSS nodes

gridview
├── child[.activatable]
│
├── child[.activatable]
│
┊
╰── [rubberband]

GtkGridView uses a single CSS node with name gridview. Each child uses a single CSS node with name child. If the 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

GtkGridView uses the AccessibleRoleGrid role, and the items use the AccessibleRoleGridCell role.

Synopsis

Exported types

newtype GridView Source #

Memory-managed wrapper type.

Constructors

GridView (ManagedPtr GridView) 

class (GObject o, IsDescendantOf GridView o) => IsGridView o Source #

Type class for types which can be safely cast to GridView, for instance with toGridView.

Instances

Instances details
(GObject o, IsDescendantOf GridView o) => IsGridView o Source # 
Instance details

Defined in GI.Gtk.Objects.GridView

toGridView :: (MonadIO m, IsGridView o) => o -> m GridView Source #

Cast to GridView, for types for which this is known to be safe. For general casts, use castTo.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, scrollTo, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updateProperty, updateRelation, updateState, watchClosure.

Getters

getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBorder, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getEnableRubberband, getFactory, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHadjustment, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getHscrollPolicy, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMaxColumns, getMinColumns, getModel, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOrientation, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSingleClickActivate, getSize, getSizeRequest, getStateFlags, getStyleContext, getTabBehavior, getTemplateChild, getTooltipMarkup, getTooltipText, getVadjustment, getValign, getVexpand, getVexpandSet, getVisible, getVscrollPolicy, getWidth.

Setters

setAccessibleParent, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setEnableRubberband, setFactory, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHadjustment, setHalign, setHasTooltip, setHexpand, setHexpandSet, setHscrollPolicy, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMaxColumns, setMinColumns, setModel, setName, setOpacity, setOrientation, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSingleClickActivate, setSizeRequest, setStateFlags, setTabBehavior, setTooltipMarkup, setTooltipText, setVadjustment, setValign, setVexpand, setVexpandSet, setVisible, setVscrollPolicy.

getEnableRubberband

gridViewGetEnableRubberband Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> m Bool

Returns: True if rubberband selection is enabled

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

getFactory

gridViewGetFactory Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> m (Maybe ListItemFactory)

Returns: The factory in use

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

getMaxColumns

gridViewGetMaxColumns Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> m Word32

Returns: The maximum number of columns

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

getMinColumns

gridViewGetMinColumns Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> m Word32

Returns: The minimum number of columns

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

getModel

gridViewGetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> m (Maybe SelectionModel)

Returns: The model in use

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

getSingleClickActivate

gridViewGetSingleClickActivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> m Bool

Returns: True if items are activated on single click

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

getTabBehavior

gridViewGetTabBehavior Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> m ListTabBehavior

Returns: The behavior of the <kbd>Tab</kbd> key

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

Since: 4.12

new

gridViewNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsSelectionModel a, IsListItemFactory b) 
=> Maybe a

model: the model to use

-> Maybe b

factory: The factory to populate items with

-> m GridView

Returns: a new GtkGridView using the given model and factory

Creates a new GtkGridView that uses the given factory for mapping items to widgets.

The function takes ownership of the arguments, so you can write code like

c code

grid_view = gtk_grid_view_new (create_model (),
  gtk_builder_list_item_factory_new_from_resource ("/resource.ui"));

scrollTo

gridViewScrollTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: The gridview to scroll in

-> Word32

pos: position of the item. Must be less than the number of items in the view.

-> [ListScrollFlags]

flags: actions to perform

-> Maybe ScrollInfo

scroll: details of how to perform the scroll operation or Nothing to scroll into view

-> m () 

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

This function works no matter if the gridview is shown or focused. If it isn't, then the changes will take effect once that happens.

Since: 4.12

setEnableRubberband

gridViewSetEnableRubberband Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> Bool

enableRubberband: True to enable rubberband selection

-> m () 

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

setFactory

gridViewSetFactory Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a, IsListItemFactory b) 
=> a

self: a GtkGridView

-> Maybe b

factory: the factory to use

-> m () 

Sets the GtkListItemFactory to use for populating list items.

setMaxColumns

gridViewSetMaxColumns Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> Word32

maxColumns: The maximum number of columns

-> m () 

Sets the maximum number of columns to use.

This number must be at least 1.

If maxColumns is smaller than the minimum set via gridViewSetMinColumns, that value is used instead.

setMinColumns

gridViewSetMinColumns Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> Word32

minColumns: The minimum number of columns

-> m () 

Sets the minimum number of columns to use.

This number must be at least 1.

If minColumns is smaller than the minimum set via gridViewSetMaxColumns, that value is ignored.

setModel

gridViewSetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a, IsSelectionModel b) 
=> a

self: a GtkGridView

-> Maybe b

model: the model to use

-> m () 

Sets the model to use.

This must be a SelectionModel.

setSingleClickActivate

gridViewSetSingleClickActivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> Bool

singleClickActivate: True to activate items on single click

-> m () 

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

setTabBehavior

gridViewSetTabBehavior Source #

Arguments

:: (HasCallStack, MonadIO m, IsGridView a) 
=> a

self: a GtkGridView

-> ListTabBehavior

tabBehavior: The desired tab behavior

-> m () 

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

Since: 4.12

Properties

enableRubberband

Allow rubberband selection.

constructGridViewEnableRubberband :: (IsGridView o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “enable-rubberband” property. This is rarely needed directly, but it is used by new.

getGridViewEnableRubberband :: (MonadIO m, IsGridView o) => o -> m Bool Source #

Get the value of the “enable-rubberband” property. When overloading is enabled, this is equivalent to

get gridView #enableRubberband

setGridViewEnableRubberband :: (MonadIO m, IsGridView o) => o -> Bool -> m () Source #

Set the value of the “enable-rubberband” property. When overloading is enabled, this is equivalent to

set gridView [ #enableRubberband := value ]

factory

Factory for populating list items.

The factory must be for configuring ListItem objects.

clearGridViewFactory :: (MonadIO m, IsGridView o) => o -> m () Source #

Set the value of the “factory” property to Nothing. When overloading is enabled, this is equivalent to

clear #factory

constructGridViewFactory :: (IsGridView o, MonadIO m, IsListItemFactory a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “factory” property. This is rarely needed directly, but it is used by new.

getGridViewFactory :: (MonadIO m, IsGridView o) => o -> m (Maybe ListItemFactory) Source #

Get the value of the “factory” property. When overloading is enabled, this is equivalent to

get gridView #factory

setGridViewFactory :: (MonadIO m, IsGridView o, IsListItemFactory a) => o -> a -> m () Source #

Set the value of the “factory” property. When overloading is enabled, this is equivalent to

set gridView [ #factory := value ]

maxColumns

Maximum number of columns per row.

If this number is smaller than GridView:minColumns, that value is used instead.

constructGridViewMaxColumns :: (IsGridView o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “max-columns” property. This is rarely needed directly, but it is used by new.

getGridViewMaxColumns :: (MonadIO m, IsGridView o) => o -> m Word32 Source #

Get the value of the “max-columns” property. When overloading is enabled, this is equivalent to

get gridView #maxColumns

setGridViewMaxColumns :: (MonadIO m, IsGridView o) => o -> Word32 -> m () Source #

Set the value of the “max-columns” property. When overloading is enabled, this is equivalent to

set gridView [ #maxColumns := value ]

minColumns

Minimum number of columns per row.

constructGridViewMinColumns :: (IsGridView o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “min-columns” property. This is rarely needed directly, but it is used by new.

getGridViewMinColumns :: (MonadIO m, IsGridView o) => o -> m Word32 Source #

Get the value of the “min-columns” property. When overloading is enabled, this is equivalent to

get gridView #minColumns

setGridViewMinColumns :: (MonadIO m, IsGridView o) => o -> Word32 -> m () Source #

Set the value of the “min-columns” property. When overloading is enabled, this is equivalent to

set gridView [ #minColumns := value ]

model

Model for the items displayed.

clearGridViewModel :: (MonadIO m, IsGridView o) => o -> m () Source #

Set the value of the “model” property to Nothing. When overloading is enabled, this is equivalent to

clear #model

constructGridViewModel :: (IsGridView o, MonadIO m, IsSelectionModel a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “model” property. This is rarely needed directly, but it is used by new.

getGridViewModel :: (MonadIO m, IsGridView o) => o -> m (Maybe SelectionModel) Source #

Get the value of the “model” property. When overloading is enabled, this is equivalent to

get gridView #model

setGridViewModel :: (MonadIO m, IsGridView o, IsSelectionModel a) => o -> a -> m () Source #

Set the value of the “model” property. When overloading is enabled, this is equivalent to

set gridView [ #model := value ]

singleClickActivate

Activate rows on single click and select them on hover.

constructGridViewSingleClickActivate :: (IsGridView o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “single-click-activate” property. This is rarely needed directly, but it is used by new.

getGridViewSingleClickActivate :: (MonadIO m, IsGridView o) => o -> m Bool Source #

Get the value of the “single-click-activate” property. When overloading is enabled, this is equivalent to

get gridView #singleClickActivate

setGridViewSingleClickActivate :: (MonadIO m, IsGridView o) => o -> Bool -> m () Source #

Set the value of the “single-click-activate” property. When overloading is enabled, this is equivalent to

set gridView [ #singleClickActivate := value ]

tabBehavior

Behavior of the <kbd>Tab</kbd> key

Since: 4.12

constructGridViewTabBehavior :: (IsGridView o, MonadIO m) => ListTabBehavior -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “tab-behavior” property. This is rarely needed directly, but it is used by new.

getGridViewTabBehavior :: (MonadIO m, IsGridView o) => o -> m ListTabBehavior Source #

Get the value of the “tab-behavior” property. When overloading is enabled, this is equivalent to

get gridView #tabBehavior

setGridViewTabBehavior :: (MonadIO m, IsGridView o) => o -> ListTabBehavior -> m () Source #

Set the value of the “tab-behavior” property. When overloading is enabled, this is equivalent to

set gridView [ #tabBehavior := value ]

Signals

activate

type GridViewActivateCallback Source #

Arguments

 = Word32

position: position of item to activate

-> IO () 

Emitted when a cell has been activated by the user, usually via activating the GtkGridView|list.activate-item action.

This allows for a convenient way to handle activation in a gridview. See ListItem:activatable for details on how to use this signal.

afterGridViewActivate :: (IsGridView a, MonadIO m) => a -> ((?self :: a) => GridViewActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the activate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after gridView #activate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onGridViewActivate :: (IsGridView a, MonadIO m) => a -> ((?self :: a) => GridViewActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the activate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on gridView #activate callback