gi-gtk-4.0.4: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.GridView

Description

GtkGridView is a widget to present a view into 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:enable-rubberband.

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

CSS nodes

plain code

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

GtkGridView uses a single CSS node with name gridview. Each child uses a single CSS node with name child. For rubberband selection, a subnode with name rubberband is used.

Accessibility

GtkGridView uses the GTK_ACCESSIBLE_ROLE_GRID role, and the items use the GTK_ACCESSIBLE_ROLE_GRID_CELL role.

Synopsis

Exported types

newtype GridView Source #

Memory-managed wrapper type.

Constructors

GridView (ManagedPtr GridView) 

Instances

Instances details
Eq GridView Source # 
Instance details

Defined in GI.Gtk.Objects.GridView

GObject GridView Source # 
Instance details

Defined in GI.Gtk.Objects.GridView

ManagedPtrNewtype GridView Source # 
Instance details

Defined in GI.Gtk.Objects.GridView

Methods

toManagedPtr :: GridView -> ManagedPtr GridView

TypedObject GridView Source # 
Instance details

Defined in GI.Gtk.Objects.GridView

Methods

glibType :: IO GType

HasParentTypes GridView Source # 
Instance details

Defined in GI.Gtk.Objects.GridView

IsGValue (Maybe GridView) Source #

Convert GridView to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.GridView

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe GridView -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe GridView)

type ParentTypes GridView Source # 
Instance details

Defined in GI.Gtk.Objects.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, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, 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, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateProperty, updateRelation, updateState, watchClosure.

Getters

getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBorder, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getEnableRubberband, getFactory, 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, getNextSibling, getOpacity, getOrientation, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSingleClickActivate, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getVadjustment, getValign, getVexpand, getVexpandSet, getVisible, getVscrollPolicy, getWidth.

Setters

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, setTooltipMarkup, setTooltipText, setVadjustment, setValign, setVexpand, setVexpandSet, setVisible, setVscrollPolicy.

getEnableRubberband

gridViewGetEnableRubberband Source #

Arguments

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

self: a GridView

-> 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 GridView

-> 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 GridView

-> 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 GridView

-> 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 GridView

-> 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 ListView

-> m Bool

Returns: True if items are activated on single click

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

new

gridViewNew Source #

Arguments

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

model: the model to use, or Nothing

-> Maybe b

factory: The factory to populate items with, or Nothing

-> m GridView

Returns: a new GridView using the given model and factory

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

The function takes ownership of the arguments, so you can write code like `` grid_view = gtk_grid_view_new (create_model (), gtk_builder_list_item_factory_new_from_resource ("/resource.ui")); ``

setEnableRubberband

gridViewSetEnableRubberband Source #

Arguments

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

self: a GridView

-> 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 GridView

-> Maybe b

factory: the factory to use or Nothing for none

-> m () 

Sets the ListItemFactory to use for populating list items.

setMaxColumns

gridViewSetMaxColumns Source #

Arguments

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

self: a GridView

-> 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 GridView

-> 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 GridView

-> Maybe b

model: the model to use or Nothing for none

-> m () 

Sets the SelectionModel to use for

setSingleClickActivate

gridViewSetSingleClickActivate Source #

Arguments

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

self: a GridView

-> Bool

singleClickActivate: True to activate items on single click

-> m () 

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

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

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 GtkGridView:min-columns, 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 ]

Signals

activate

type C_GridViewActivateCallback = Ptr () -> Word32 -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type GridViewActivateCallback Source #

Arguments

 = Word32

position: position of item to activate

-> IO () 

The activate signal is 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 GtkListItem:activatable for details on how to use this signal.

afterGridViewActivate :: (IsGridView a, MonadIO m) => 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

genClosure_GridViewActivate :: MonadIO m => GridViewActivateCallback -> m (GClosure C_GridViewActivateCallback) Source #

Wrap the callback into a GClosure.

onGridViewActivate :: (IsGridView a, MonadIO m) => 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