Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
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
- newtype GridView = GridView (ManagedPtr GridView)
- class (GObject o, IsDescendantOf GridView o) => IsGridView o
- toGridView :: (MonadIO m, IsGridView o) => o -> m GridView
- gridViewGetEnableRubberband :: (HasCallStack, MonadIO m, IsGridView a) => a -> m Bool
- gridViewGetFactory :: (HasCallStack, MonadIO m, IsGridView a) => a -> m (Maybe ListItemFactory)
- gridViewGetMaxColumns :: (HasCallStack, MonadIO m, IsGridView a) => a -> m Word32
- gridViewGetMinColumns :: (HasCallStack, MonadIO m, IsGridView a) => a -> m Word32
- gridViewGetModel :: (HasCallStack, MonadIO m, IsGridView a) => a -> m (Maybe SelectionModel)
- gridViewGetSingleClickActivate :: (HasCallStack, MonadIO m, IsGridView a) => a -> m Bool
- gridViewGetTabBehavior :: (HasCallStack, MonadIO m, IsGridView a) => a -> m ListTabBehavior
- gridViewNew :: (HasCallStack, MonadIO m, IsSelectionModel a, IsListItemFactory b) => Maybe a -> Maybe b -> m GridView
- gridViewScrollTo :: (HasCallStack, MonadIO m, IsGridView a) => a -> Word32 -> [ListScrollFlags] -> Maybe ScrollInfo -> m ()
- gridViewSetEnableRubberband :: (HasCallStack, MonadIO m, IsGridView a) => a -> Bool -> m ()
- gridViewSetFactory :: (HasCallStack, MonadIO m, IsGridView a, IsListItemFactory b) => a -> Maybe b -> m ()
- gridViewSetMaxColumns :: (HasCallStack, MonadIO m, IsGridView a) => a -> Word32 -> m ()
- gridViewSetMinColumns :: (HasCallStack, MonadIO m, IsGridView a) => a -> Word32 -> m ()
- gridViewSetModel :: (HasCallStack, MonadIO m, IsGridView a, IsSelectionModel b) => a -> Maybe b -> m ()
- gridViewSetSingleClickActivate :: (HasCallStack, MonadIO m, IsGridView a) => a -> Bool -> m ()
- gridViewSetTabBehavior :: (HasCallStack, MonadIO m, IsGridView a) => a -> ListTabBehavior -> m ()
- constructGridViewEnableRubberband :: (IsGridView o, MonadIO m) => Bool -> m (GValueConstruct o)
- getGridViewEnableRubberband :: (MonadIO m, IsGridView o) => o -> m Bool
- setGridViewEnableRubberband :: (MonadIO m, IsGridView o) => o -> Bool -> m ()
- clearGridViewFactory :: (MonadIO m, IsGridView o) => o -> m ()
- constructGridViewFactory :: (IsGridView o, MonadIO m, IsListItemFactory a) => a -> m (GValueConstruct o)
- getGridViewFactory :: (MonadIO m, IsGridView o) => o -> m (Maybe ListItemFactory)
- setGridViewFactory :: (MonadIO m, IsGridView o, IsListItemFactory a) => o -> a -> m ()
- constructGridViewMaxColumns :: (IsGridView o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getGridViewMaxColumns :: (MonadIO m, IsGridView o) => o -> m Word32
- setGridViewMaxColumns :: (MonadIO m, IsGridView o) => o -> Word32 -> m ()
- constructGridViewMinColumns :: (IsGridView o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getGridViewMinColumns :: (MonadIO m, IsGridView o) => o -> m Word32
- setGridViewMinColumns :: (MonadIO m, IsGridView o) => o -> Word32 -> m ()
- clearGridViewModel :: (MonadIO m, IsGridView o) => o -> m ()
- constructGridViewModel :: (IsGridView o, MonadIO m, IsSelectionModel a) => a -> m (GValueConstruct o)
- getGridViewModel :: (MonadIO m, IsGridView o) => o -> m (Maybe SelectionModel)
- setGridViewModel :: (MonadIO m, IsGridView o, IsSelectionModel a) => o -> a -> m ()
- constructGridViewSingleClickActivate :: (IsGridView o, MonadIO m) => Bool -> m (GValueConstruct o)
- getGridViewSingleClickActivate :: (MonadIO m, IsGridView o) => o -> m Bool
- setGridViewSingleClickActivate :: (MonadIO m, IsGridView o) => o -> Bool -> m ()
- constructGridViewTabBehavior :: (IsGridView o, MonadIO m) => ListTabBehavior -> m (GValueConstruct o)
- getGridViewTabBehavior :: (MonadIO m, IsGridView o) => o -> m ListTabBehavior
- setGridViewTabBehavior :: (MonadIO m, IsGridView o) => o -> ListTabBehavior -> m ()
- type GridViewActivateCallback = Word32 -> IO ()
- afterGridViewActivate :: (IsGridView a, MonadIO m) => a -> ((?self :: a) => GridViewActivateCallback) -> m SignalHandlerId
- onGridViewActivate :: (IsGridView a, MonadIO m) => a -> ((?self :: a) => GridViewActivateCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
Eq GridView Source # | |
GObject GridView Source # | |
Defined in GI.Gtk.Objects.GridView | |
ManagedPtrNewtype GridView Source # | |
Defined in GI.Gtk.Objects.GridView toManagedPtr :: GridView -> ManagedPtr GridView # | |
TypedObject GridView Source # | |
Defined in GI.Gtk.Objects.GridView | |
HasParentTypes GridView Source # | |
Defined in GI.Gtk.Objects.GridView | |
IsGValue (Maybe GridView) Source # | Convert |
Defined in GI.Gtk.Objects.GridView | |
type ParentTypes GridView Source # | |
Defined in GI.Gtk.Objects.GridView type ParentTypes GridView = '[ListBase, Widget, Object, Accessible, Buildable, ConstraintTarget, Orientable, Scrollable] |
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
(GObject o, IsDescendantOf GridView o) => IsGridView o Source # | |
Defined in GI.Gtk.Objects.GridView |
toGridView :: (MonadIO m, IsGridView o) => o -> m GridView Source #
Methods
Click to display all available methods, including inherited ones
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 #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether rows can be selected by dragging with the mouse.
getFactory
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> m (Maybe ListItemFactory) | Returns: The factory in use |
Gets the factory that's currently used to populate list items.
getMaxColumns
gridViewGetMaxColumns Source #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> m Word32 | Returns: The maximum number of columns |
Gets the maximum number of columns that the grid will use.
getMinColumns
gridViewGetMinColumns Source #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> m Word32 | Returns: The minimum number of columns |
Gets the minimum number of columns that the grid will use.
getModel
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> m (Maybe SelectionModel) | Returns: The model in use |
Gets the model that's currently used to read the items displayed.
getSingleClickActivate
gridViewGetSingleClickActivate Source #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether items will be activated on single click and selected on hover.
getTabBehavior
gridViewGetTabBehavior Source #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsSelectionModel a, IsListItemFactory b) | |
=> Maybe a |
|
-> Maybe b |
|
-> m GridView | Returns: a new |
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
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> Word32 |
|
-> [ListScrollFlags] |
|
-> Maybe ScrollInfo |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether selections can be changed by dragging with the mouse.
setFactory
:: (HasCallStack, MonadIO m, IsGridView a, IsListItemFactory b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the GtkListItemFactory
to use for populating list items.
setMaxColumns
gridViewSetMaxColumns Source #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> Word32 |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> Word32 |
|
-> 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
:: (HasCallStack, MonadIO m, IsGridView a, IsSelectionModel b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the model to use.
This must be a SelectionModel
.
setSingleClickActivate
gridViewSetSingleClickActivate Source #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether items should be activated on single click and selected on hover.
setTabBehavior
gridViewSetTabBehavior Source #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> ListTabBehavior |
|
-> 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 #
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