Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- 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
- gridViewNew :: (HasCallStack, MonadIO m, IsSelectionModel a, IsListItemFactory b) => Maybe a -> Maybe b -> m GridView
- 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 ()
- 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 ()
- type C_GridViewActivateCallback = Ptr () -> Word32 -> Ptr () -> IO ()
- type GridViewActivateCallback = Word32 -> IO ()
- afterGridViewActivate :: (IsGridView a, MonadIO m) => a -> GridViewActivateCallback -> m SignalHandlerId
- genClosure_GridViewActivate :: MonadIO m => GridViewActivateCallback -> m (GClosure C_GridViewActivateCallback)
- mk_GridViewActivateCallback :: C_GridViewActivateCallback -> IO (FunPtr C_GridViewActivateCallback)
- noGridViewActivateCallback :: Maybe GridViewActivateCallback
- onGridViewActivate :: (IsGridView a, MonadIO m) => a -> GridViewActivateCallback -> m SignalHandlerId
- wrap_GridViewActivateCallback :: GridViewActivateCallback -> C_GridViewActivateCallback
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 gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe GridView -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe 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, 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 #
:: (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.
new
:: (HasCallStack, MonadIO m, IsSelectionModel a, IsListItemFactory b) | |
=> Maybe a |
|
-> Maybe b |
|
-> m GridView | Returns: a new |
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 #
:: (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 ListItemFactory
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 SelectionModel
to use for
setSingleClickActivate
gridViewSetSingleClickActivate Source #
:: (HasCallStack, MonadIO m, IsGridView a) | |
=> a |
|
-> Bool |
|
-> 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 #
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
.
mk_GridViewActivateCallback :: C_GridViewActivateCallback -> IO (FunPtr C_GridViewActivateCallback) Source #
Generate a function pointer callable from C code, from a C_GridViewActivateCallback
.
noGridViewActivateCallback :: Maybe GridViewActivateCallback Source #
A convenience synonym for
.Nothing
:: Maybe
GridViewActivateCallback
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