Package ch.bailu.gtk.gtk
Class ColumnView
- All Implemented Interfaces:
PointerInterface
`GtkColumnView` presents a large dynamic list of items using multiple columns
with headers.
`GtkColumnView` uses the factories of its columns to generate a cell widget for
each column, for each visible item and displays them together as the row for
this item.
The [property@Gtk.ColumnView:show-row-separators] and
[property@Gtk.ColumnView:show-column-separators] properties offer a simple way
to display separators between the rows or columns.
`GtkColumnView` 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.ColumnView:enable-rubberband].
The column view supports sorting that can be customized by the user by
clicking on column headers. To set this up, the `GtkSorter` returned by
[method@Gtk.ColumnView.get_sorter] must be attached to a sort model for the
data that the view is showing, and the columns must have sorters attached to
them by calling [method@Gtk.ColumnViewColumn.set_sorter]. The initial sort
order can be set with [method@Gtk.ColumnView.sort_by_column].
The column view also supports interactive resizing and reordering of
columns, via Drag-and-Drop of the column headers. This can be enabled or
disabled with the [property@Gtk.ColumnView:reorderable] and
[property@Gtk.ColumnViewColumn:resizable] properties.
To learn more about the list widget framework, see the
[overview](section-list-widget.html).
# CSS nodes
```
columnview[.column-separators][.rich-list][.navigation-sidebar][.data-table]
├── header
│ ├── <column header>
┊ ┊
│ ╰── <column header>
│
├── listview
│
┊
╰── [rubberband]
```
`GtkColumnView` uses a single CSS node named columnview. It may carry the
.column-separators style class, when [property@Gtk.ColumnView:show-column-separators]
property is set. Header widgets appear below a node with name header.
The rows are contained in a `GtkListView` widget, so there is a listview
node with the same structure as for a standalone `GtkListView` widget.
If [property@Gtk.ColumnView:show-row-separators] is set, it will be passed
on to the list view, causing its CSS node to carry the .separators style class.
For rubberband selection, a node with name rubberband is used.
The main columnview node may also carry style classes to select
the style of [list presentation](section-list-widget.html#list-styles):
.rich-list, .navigation-sidebar or .data-table.
# Accessibility
`GtkColumnView` uses the %GTK_ACCESSIBLE_ROLE_TREE_GRID role, header title
widgets are using the %GTK_ACCESSIBLE_ROLE_COLUMN_HEADER role. The row widgets
are using the %GTK_ACCESSIBLE_ROLE_ROW role, and individual cells are using
the %GTK_ACCESSIBLE_ROLE_GRID_CELL role
with headers.
`GtkColumnView` uses the factories of its columns to generate a cell widget for
each column, for each visible item and displays them together as the row for
this item.
The [property@Gtk.ColumnView:show-row-separators] and
[property@Gtk.ColumnView:show-column-separators] properties offer a simple way
to display separators between the rows or columns.
`GtkColumnView` 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.ColumnView:enable-rubberband].
The column view supports sorting that can be customized by the user by
clicking on column headers. To set this up, the `GtkSorter` returned by
[method@Gtk.ColumnView.get_sorter] must be attached to a sort model for the
data that the view is showing, and the columns must have sorters attached to
them by calling [method@Gtk.ColumnViewColumn.set_sorter]. The initial sort
order can be set with [method@Gtk.ColumnView.sort_by_column].
The column view also supports interactive resizing and reordering of
columns, via Drag-and-Drop of the column headers. This can be enabled or
disabled with the [property@Gtk.ColumnView:reorderable] and
[property@Gtk.ColumnViewColumn:resizable] properties.
To learn more about the list widget framework, see the
[overview](section-list-widget.html).
# CSS nodes
```
columnview[.column-separators][.rich-list][.navigation-sidebar][.data-table]
├── header
│ ├── <column header>
┊ ┊
│ ╰── <column header>
│
├── listview
│
┊
╰── [rubberband]
```
`GtkColumnView` uses a single CSS node named columnview. It may carry the
.column-separators style class, when [property@Gtk.ColumnView:show-column-separators]
property is set. Header widgets appear below a node with name header.
The rows are contained in a `GtkListView` widget, so there is a listview
node with the same structure as for a standalone `GtkListView` widget.
If [property@Gtk.ColumnView:show-row-separators] is set, it will be passed
on to the list view, causing its CSS node to carry the .separators style class.
For rubberband selection, a node with name rubberband is used.
The main columnview node may also carry style classes to select
the style of [list presentation](section-list-widget.html#list-styles):
.rich-list, .navigation-sidebar or .data-table.
# Accessibility
`GtkColumnView` uses the %GTK_ACCESSIBLE_ROLE_TREE_GRID role, header title
widgets are using the %GTK_ACCESSIBLE_ROLE_COLUMN_HEADER role. The row widgets
are using the %GTK_ACCESSIBLE_ROLE_ROW role, and individual cells are using
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
ConstructorDescriptionColumnView
(SelectionModel model) Creates a new `GtkColumnView`.ColumnView
(PointerContainer pointer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendColumn
(ColumnViewColumn column) Appends the @column to the end of the columns in @self.Implements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.Implements interfaceScrollable
.static ClassHandler
Gets the list of columns in this column view.boolean
Returns whether rows can be selected by dragging with the mouse.static int
getModel()
Gets the model that's currently used to read the items displayed.static long
static TypeSystem.TypeSize
boolean
Returns whether columns are reorderable.boolean
Returns whether the list should show separators
between columns.boolean
Returns whether the list should show separators
between rows.boolean
Returns whether rows will be activated on single click and
selected on hover.Returns a special sorter that reflects the users sorting
choices in the column view.static long
static TypeSystem.TypeSize
void
insertColumn
(int position, ColumnViewColumn column) Inserts a column at the given position in the columns of @self.onActivate
(ColumnView.OnActivate signal) Connect to signal "activate".void
removeColumn
(ColumnViewColumn column) Removes the @column from the list of columns of @self.void
setEnableRubberband
(boolean enable_rubberband) Sets whether selections can be changed by dragging with the mouse.void
setModel
(SelectionModel model) Sets the model to use.void
setReorderable
(boolean reorderable) Sets whether columns should be reorderable by dragging.void
setShowColumnSeparators
(boolean show_column_separators) Sets whether the list should show separators
between columns.void
setShowRowSeparators
(boolean show_row_separators) Sets whether the list should show separators
between rows.void
setSingleClickActivate
(boolean single_click_activate) Sets whether rows should be activated on single click and
selected on hover.void
sortByColumn
(ColumnViewColumn column, int direction) Sets the sorting of the view.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
-
ColumnView
-
ColumnView
Creates a new `GtkColumnView`.
You most likely want to call [method@Gtk.ColumnView.append_column]
to add columns next.- Parameters:
model
- the list model to use
-
-
Method Details
-
getClassHandler
-
appendColumn
Appends the @column to the end of the columns in @self.- Parameters:
column
- a `GtkColumnViewColumn` that hasn't been added to a `GtkColumnView` yet
-
getColumns
Gets the list of columns in this column view.
This list is constant over the lifetime of @self and can be used to
monitor changes to the columns of @self by connecting to the
::items-changed signal.- Returns:
- The list managing the columns
-
getEnableRubberband
public boolean getEnableRubberband()Returns whether rows can be selected by dragging with the mouse.- Returns:
- %TRUE if rubberband selection is enabled
-
getModel
Gets the model that's currently used to read the items displayed.- Returns:
- The model in use
-
getReorderable
public boolean getReorderable()Returns whether columns are reorderable.- Returns:
- %TRUE if columns are reorderable
-
getShowColumnSeparators
public boolean getShowColumnSeparators()Returns whether the list should show separators
between columns.- Returns:
- %TRUE if the list shows column separators
-
getShowRowSeparators
public boolean getShowRowSeparators()Returns whether the list should show separators
between rows.- Returns:
- %TRUE if the list shows separators
-
getSingleClickActivate
public boolean getSingleClickActivate()Returns whether rows will be activated on single click and
selected on hover.- Returns:
- %TRUE if rows are activated on single click
-
getSorter
Returns a special sorter that reflects the users sorting
choices in the column view.
To allow users to customizable sorting by clicking on column
headers, this sorter needs to be set on the sort model underneath
the model that is displayed by the view.
See [method@Gtk.ColumnViewColumn.set_sorter] for setting up
per-column sorting.
Here is an example:
```c
gtk_column_view_column_set_sorter (column, sorter);
gtk_column_view_append_column (view, column);
sorter = g_object_ref (gtk_column_view_get_sorter (view)));
model = gtk_sort_list_model_new (store, sorter);
selection = gtk_no_selection_new (model);
gtk_column_view_set_model (view, selection);
```- Returns:
- the `GtkSorter` of @self
-
insertColumn
Inserts a column at the given position in the columns of @self.
If @column is already a column of @self, it will be repositioned.- Parameters:
position
- the position to insert @column atcolumn
- the `GtkColumnViewColumn` to insert
-
removeColumn
Removes the @column from the list of columns of @self.- Parameters:
column
- a `GtkColumnViewColumn` that's part of @self
-
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
-
setModel
Sets the model to use.
This must be a [iface@Gtk.SelectionModel].- Parameters:
model
- the model to use
-
setReorderable
public void setReorderable(boolean reorderable) Sets whether columns should be reorderable by dragging.- Parameters:
reorderable
- whether columns should be reorderable
-
setShowColumnSeparators
public void setShowColumnSeparators(boolean show_column_separators) Sets whether the list should show separators
between columns.- Parameters:
show_column_separators
- %TRUE to show column separators
-
setShowRowSeparators
public void setShowRowSeparators(boolean show_row_separators) Sets whether the list should show separators
between rows.- Parameters:
show_row_separators
- %TRUE to show row separators
-
setSingleClickActivate
public void setSingleClickActivate(boolean single_click_activate) Sets whether rows should be activated on single click and
selected on hover.- Parameters:
single_click_activate
- %TRUE to activate items on single click
-
sortByColumn
Sets the sorting of the view.
This function should be used to set up the initial sorting.
At runtime, users can change the sorting of a column view
by clicking on the list headers.
This call only has an effect if the sorter returned by
[method@Gtk.ColumnView.get_sorter] is set on a sort model,
and [method@Gtk.ColumnViewColumn.set_sorter] has been called
on @column to associate a sorter with the column.
If @column is %NULL, the view will be unsorted.- Parameters:
column
- the `GtkColumnViewColumn` to sort bydirection
- the direction to sort in
-
onActivate
Connect to signal "activate".
SeeColumnView.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 classWidget
- Returns:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Overrides:
asBuildable
in classWidget
- Returns:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Overrides:
asConstraintTarget
in classWidget
- Returns:
ConstraintTarget
-
asScrollable
Implements interfaceScrollable
. Call this to get access to interface functions.- Returns:
Scrollable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-