gtk.single_selection

Module for [SingleSelection] class

Types 3

[gtk.single_selection.SingleSelection] is a [gtk.selection_model.SelectionModel] 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.

Methods
GType _gType() @property
SingleSelection self()Returns `this`, for use in `with` statements.
SingleSelectionGidBuilder builder()Get builder for [gtk.single_selection.SingleSelection] Returns: New builder object
bool autoselect() @propertyGet `autoselect` property. Returns: If the selection will always select an item.
void autoselect(bool propval) @propertySet `autoselect` property. Params: propval = If the selection will always select an item.
bool canUnselect() @propertyGet `canUnselect` property. Returns: If unselecting the selected item is allowed.
void canUnselect(bool propval) @propertySet `canUnselect` property. Params: propval = If unselecting the selected item is allowed.
gobject.types.GType itemType() @propertyGet `itemType` property. Returns: The type of items. See [gio.list_model.ListModel.getItemType].
gio.list_model.ListModel model() @propertyGet `model` property. Returns: The model being managed.
void model(gio.list_model.ListModel propval) @propertySet `model` property. Params: propval = The model being managed.
uint nItems() @propertyGet `nItems` property. Returns: The number of items. See [gio.list_model.ListModel.getNItems].
uint selected() @propertyGet `selected` property. Returns: Position of the selected item.
void selected(uint propval) @propertySet `selected` property. Params: propval = Position of the selected item.
gobject.object.ObjectWrap selectedItem() @propertyGet `selectedItem` property. Returns: The selected item.
bool getAutoselect()Checks if autoselect has been enabled or disabled via [gtk.single_selection.SingleSelection.setAutoselect]. Returns: true if autoselect is enabled
bool getCanUnselect()If true, [gtk.selection_model.SelectionModel.unselectItem] is supported and allows unselecting the selected item. Returns: true to support unselecting
gio.list_model.ListModel getModel()Gets the model that self is wrapping. Returns: The model being wrapped
uint getSelected()Gets the position of the selected item.
void setAutoselect(bool autoselect)Enables or disables autoselect.
void setCanUnselect(bool canUnselect)If true, unselecting the current item via [gtk.selection_model.SelectionModel.unselectItem] is supported.
void setModel(gio.list_model.ListModel model = null)Sets the model that self should wrap.
void setSelected(uint position)Selects the item at the given position.
Constructors
this(void * ptr, Flag!"Take" take)
this(gio.list_model.ListModel model = null)Creates a new selection to handle model.
Methods
T autoselect(bool propval)Set `autoselect` property. Params: propval = If the selection will always select an item. Returns: Builder instance for fluent chaining
T canUnselect(bool propval)Set `canUnselect` property. Params: propval = If unselecting the selected item is allowed. Returns: Builder instance for fluent chaining
T model(gio.list_model.ListModel propval)Set `model` property. Params: propval = The model being managed. Returns: Builder instance for fluent chaining
T selected(uint propval)Set `selected` property. Params: propval = Position of the selected item. Returns: Builder instance for fluent chaining

Fluent builder for [gtk.single_selection.SingleSelection]