Package ch.bailu.gtk.gtk
Class GridView
- All Implemented Interfaces:
PointerInterface
`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
[property@Gtk.GridView:enable-rubberband].
To learn more about the list widget framework, see the
[overview](section-list-widget.html).
# 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 [property@Gtk.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 %GTK_ACCESSIBLE_ROLE_GRID role, and the items
use the %GTK_ACCESSIBLE_ROLE_GRID_CELL role.
`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
[property@Gtk.GridView:enable-rubberband].
To learn more about the list widget framework, see the
[overview](section-list-widget.html).
# 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 [property@Gtk.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 %GTK_ACCESSIBLE_ROLE_GRID role, and the items
use the %GTK_ACCESSIBLE_ROLE_GRID_CELL role.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gtk.Widget
Widget.OnDestroy, Widget.OnDestroyNotify, Widget.OnDirectionChanged, Widget.OnHide, Widget.OnKeynavFailed, Widget.OnMap, Widget.OnMnemonicActivate, Widget.OnMoveFocus, Widget.OnQueryTooltip, Widget.OnRealize, Widget.OnShow, Widget.OnStateFlagsChanged, Widget.OnTickCallback, Widget.OnUnmap, Widget.OnUnrealize
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gtk.Widget
SIGNAL_ON_DESTROY, SIGNAL_ON_DIRECTION_CHANGED, SIGNAL_ON_HIDE, SIGNAL_ON_KEYNAV_FAILED, SIGNAL_ON_MAP, SIGNAL_ON_MNEMONIC_ACTIVATE, SIGNAL_ON_MOVE_FOCUS, SIGNAL_ON_QUERY_TOOLTIP, SIGNAL_ON_REALIZE, SIGNAL_ON_SHOW, SIGNAL_ON_STATE_FLAGS_CHANGED, SIGNAL_ON_UNMAP, SIGNAL_ON_UNREALIZE
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionGridView
(SelectionModel model, ListItemFactory factory) Creates a new `GtkGridView` that uses the given @factory for
mapping items to widgets.GridView
(PointerContainer pointer) -
Method Summary
Modifier and TypeMethodDescriptionImplements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.Implements interfaceOrientable
.Implements interfaceScrollable
.static ClassHandler
boolean
Returns whether rows can be selected by dragging with the mouse.Gets the factory that's currently used to populate list items.static int
int
Gets the maximum number of columns that the grid will use.int
Gets the minimum number of columns that the grid will use.getModel()
Gets the model that's currently used to read the items displayed.static long
static TypeSystem.TypeSize
boolean
Returns whether items will be activated on single click and
selected on hover.static long
static TypeSystem.TypeSize
onActivate
(GridView.OnActivate signal) Connect to signal "activate".void
setEnableRubberband
(boolean enable_rubberband) Sets whether selections can be changed by dragging with the mouse.void
setFactory
(ListItemFactory factory) Sets the `GtkListItemFactory` to use for populating list items.void
setMaxColumns
(int max_columns) Sets the maximum number of columns to use.void
setMinColumns
(int min_columns) Sets the minimum number of columns to use.void
setModel
(SelectionModel model) Sets the imodel to use.void
setSingleClickActivate
(boolean single_click_activate) Sets whether items should be activated on single click and
selected on hover.Methods inherited from class ch.bailu.gtk.gtk.Widget
actionSetEnabled, actionSetEnabled, activate, activateAction, activateAction, activateActionVariant, activateActionVariant, activateDefault, addController, addCssClass, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeCssClass, removeMnemonicLabel, removeTickCallback, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipMarkup, setTooltipText, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, snapshotChild, triggerTooltipQuery, unmap, unparent, unrealize, unsetStateFlags
Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_ACTIVATE
- See Also:
-
-
Constructor Details
-
GridView
-
GridView
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
grid_view = gtk_grid_view_new (create_model (),
gtk_builder_list_item_factory_new_from_resource ("/resource.ui"));
```- Parameters:
model
- the model to usefactory
- The factory to populate items with
-
-
Method Details
-
getClassHandler
-
getEnableRubberband
public boolean getEnableRubberband()Returns whether rows can be selected by dragging with the mouse.- Returns:
- %TRUE if rubberband selection is enabled
-
getFactory
Gets the factory that's currently used to populate list items.- Returns:
- The factory in use
-
getMaxColumns
public int getMaxColumns()Gets the maximum number of columns that the grid will use.- Returns:
- The maximum number of columns
-
getMinColumns
public int getMinColumns()Gets the minimum number of columns that the grid will use.- Returns:
- The minimum number of columns
-
getModel
Gets the model that's currently used to read the items displayed.- Returns:
- The model in use
-
getSingleClickActivate
public boolean getSingleClickActivate()Returns whether items will be activated on single click and
selected on hover.- Returns:
- %TRUE if items are activated on single click
-
setEnableRubberband
public void setEnableRubberband(boolean enable_rubberband) Sets whether selections can be changed by dragging with the mouse.- Parameters:
enable_rubberband
- %TRUE to enable rubberband selection
-
setFactory
Sets the `GtkListItemFactory` to use for populating list items.- Parameters:
factory
- the factory to use
-
setMaxColumns
public void setMaxColumns(int max_columns) Sets the maximum number of columns to use.
This number must be at least 1.
If @max_columns is smaller than the minimum set via
[method@Gtk.GridView.set_min_columns], that value is used instead.- Parameters:
max_columns
- The maximum number of columns
-
setMinColumns
public void setMinColumns(int min_columns) Sets the minimum number of columns to use.
This number must be at least 1.
If @min_columns is smaller than the minimum set via
[method@Gtk.GridView.set_max_columns], that value is ignored.- Parameters:
min_columns
- The minimum number of columns
-
setModel
Sets the imodel to use.
This must be a [iface@Gtk.SelectionModel].- Parameters:
model
- the model to use
-
setSingleClickActivate
public void setSingleClickActivate(boolean single_click_activate) Sets whether items should be activated on single click and
selected on hover.- Parameters:
single_click_activate
- %TRUE to activate items on single click
-
onActivate
Connect to signal "activate".
SeeGridView.OnActivate.onActivate(int)
for signal description.
FieldSIGNAL_ON_ACTIVATE
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Overrides:
asAccessible
in classListBase
- Returns:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Overrides:
asBuildable
in classListBase
- Returns:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Overrides:
asConstraintTarget
in classListBase
- Returns:
ConstraintTarget
-
asOrientable
Implements interfaceOrientable
. Call this to get access to interface functions.- Overrides:
asOrientable
in classListBase
- Returns:
Orientable
-
asScrollable
Implements interfaceScrollable
. Call this to get access to interface functions.- Overrides:
asScrollable
in classListBase
- Returns:
Scrollable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-