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 gio.list_model.ListModel.itemsChanged emission, it stays selected. In particular, this means that changing the sort order of an underlying sort model will preserve the selection.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
SingleSelection self() nothrowReturns `this`, for use in `with` statements.
SingleSelectionGidBuilder builder() static nothrowGet builder for [gtk.single_selection.SingleSelection] Returns: New builder object
bool autoselect() @property nothrowGet `autoselect` property. Returns: If the selection will always select an item.
void autoselect(bool propval) @property nothrowSet `autoselect` property. Params: propval = If the selection will always select an item.
bool canUnselect() @property nothrowGet `canUnselect` property. Returns: If unselecting the selected item is allowed.
void canUnselect(bool propval) @property nothrowSet `canUnselect` property. Params: propval = If unselecting the selected item is allowed.
gobject.types.GType itemType() @property nothrowGet `itemType` property. Returns: The type of items. See [gio.list_model.ListModel.getItemType].
gio.list_model.ListModel model() @property nothrowGet `model` property. Returns: The model being managed.
void model(gio.list_model.ListModel propval) @property nothrowSet `model` property. Params: propval = The model being managed.
uint nItems() @property nothrowGet `nItems` property. Returns: The number of items. See [gio.list_model.ListModel.getNItems].
uint selected() @property nothrowGet `selected` property. Returns: Position of the selected item.
void selected(uint propval) @property nothrowSet `selected` property. Params: propval = Position of the selected item.
gobject.object.ObjectWrap selectedItem() @property nothrowGet `selectedItem` property. Returns: The selected item.
bool getAutoselect() nothrowChecks if autoselect has been enabled or disabled via [gtk.single_selection.SingleSelection.setAutoselect]. Returns: true if autoselect is enabled
bool getCanUnselect() nothrowIf true, [gtk.selection_model.SelectionModel.unselectItem] is supported and allows unselecting the selected item. Returns: true to support unselecting
gio.list_model.ListModel getModel() nothrowGets the model that self is wrapping. Returns: The model being wrapped
uint getSelected() nothrowGets the position of the selected item.
gobject.object.ObjectWrap getSelectedItem() nothrowGets the selected item.
void setAutoselect(bool autoselect) nothrowEnables or disables autoselect.
void setCanUnselect(bool canUnselect) nothrowIf true, unselecting the current item via [gtk.selection_model.SelectionModel.unselectItem] is supported.
void setModel(gio.list_model.ListModel model = null) nothrowSets the model that self should wrap.
void setSelected(uint position) nothrowSelects 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.

Fluent builder implementation template for gtk.single_selection.SingleSelection

Methods
T autoselect(bool propval) nothrowSet `autoselect` property. Params: propval = If the selection will always select an item. Returns: Builder instance for fluent chaining
T canUnselect(bool propval) nothrowSet `canUnselect` property. Params: propval = If unselecting the selected item is allowed. Returns: Builder instance for fluent chaining
T model(gio.list_model.ListModel propval) nothrowSet `model` property. Params: propval = The model being managed. Returns: Builder instance for fluent chaining
T selected(uint propval) nothrowSet `selected` property. Params: propval = Position of the selected item. Returns: Builder instance for fluent chaining
Methods
SingleSelection build() nothrowCreate object from builder. Returns: New object