Package ch.bailu.gtk.gtk
Class SingleSelection
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gtk.SingleSelection
- All Implemented Interfaces:
PointerInterface
`GtkSingleSelection` is a `GtkSelectionModel` that allows selecting a single
item.
Note that the selection is *persistent* -- if the selected item is removed
and re-added in the same [signal@Gio.ListModel::items-changed] emission, it
stays selected. In particular, this means that changing the sort order of an
underlying sort model will preserve the selection.
item.
Note that the selection is *persistent* -- if the selected item is removed
and re-added in the same [signal@Gio.ListModel::items-changed] emission, it
stays selected. In particular, this means that changing the sort order of an
underlying sort model will preserve the selection.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionSingleSelection
(ListModel model) Creates a new selection to handle @model.SingleSelection
(PointerContainer pointer) -
Method Summary
Modifier and TypeMethodDescriptionImplements interfaceListModel
.Implements interfaceSelectionModel
.boolean
Checks if autoselect has been enabled or disabled via
gtk_single_selection_set_autoselect().boolean
If %TRUE, gtk_selection_model_unselect_item() is supported and allows
unselecting the selected item.static ClassHandler
static int
getModel()
Gets the model that @self is wrapping.static long
static TypeSystem.TypeSize
int
Gets the position of the selected item.Gets the selected item.static long
static TypeSystem.TypeSize
void
setAutoselect
(boolean autoselect) Enables or disables autoselect.void
setCanUnselect
(boolean can_unselect) If %TRUE, unselecting the current item via
gtk_selection_model_unselect_item() is supported.void
Sets the model that @self should wrap.void
setSelected
(int position) Selects the item at the given position.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
-
Constructor Details
-
SingleSelection
-
SingleSelection
Creates a new selection to handle @model.- Parameters:
model
- the `GListModel` to manage
-
-
Method Details
-
getClassHandler
-
getAutoselect
public boolean getAutoselect()Checks if autoselect has been enabled or disabled via
gtk_single_selection_set_autoselect().- Returns:
- %TRUE if autoselect is enabled
-
getCanUnselect
public boolean getCanUnselect()If %TRUE, gtk_selection_model_unselect_item() is supported and allows
unselecting the selected item.- Returns:
- %TRUE to support unselecting
-
getModel
Gets the model that @self is wrapping.- Returns:
- The model being wrapped
-
getSelected
public int getSelected()Gets the position of the selected item.
If no item is selected, %GTK_INVALID_LIST_POSITION is returned.- Returns:
- The position of the selected item
-
getSelectedItem
Gets the selected item.
If no item is selected, %NULL is returned.- Returns:
- The selected item
-
setAutoselect
public void setAutoselect(boolean autoselect) Enables or disables autoselect.
If @autoselect is %TRUE, @self will enforce that an item is always
selected. It will select a new item when the currently selected
item is deleted and it will disallow unselecting the current item.- Parameters:
autoselect
- %TRUE to always select an item
-
setCanUnselect
public void setCanUnselect(boolean can_unselect) If %TRUE, unselecting the current item via
gtk_selection_model_unselect_item() is supported.
Note that setting [property@Gtk.SingleSelection:autoselect] will
cause unselecting to not work, so it practically makes no sense
to set both at the same time the same time.- Parameters:
can_unselect
- %TRUE to allow unselecting
-
setModel
Sets the model that @self should wrap.
If @model is %NULL, @self will be empty.- Parameters:
model
- A `GListModel` to wrap
-
setSelected
public void setSelected(int position) Selects the item at the given position.
If the list does not have an item at @position or
%GTK_INVALID_LIST_POSITION is given, the behavior depends on the
value of the [property@Gtk.SingleSelection:autoselect] property:
If it is set, no change will occur and the old item will stay
selected. If it is unset, the selection will be unset and no item
will be selected.- Parameters:
position
- the item to select or %GTK_INVALID_LIST_POSITION
-
asListModel
Implements interfaceListModel
. Call this to get access to interface functions.- Returns:
ListModel
-
asSelectionModel
Implements interfaceSelectionModel
. Call this to get access to interface functions.- Returns:
SelectionModel
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-