gtk.single_selection
Module for [SingleSelection] class
Types 3
classSingleSelection : gobject.object.ObjectWrap, gio.list_model.ListModel, gtk.section_model.SectionModel, gtk.selection_model.SelectionModel
[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
SingleSelection self()Returns `this`, for use in `with` statements.SingleSelectionGidBuilder builder()Get builder for [gtk.single_selection.SingleSelection] Returns: New builder objectbool 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].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].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 enabledbool getCanUnselect()If true, [gtk.selection_model.SelectionModel.unselectItem] is supported and allows unselecting the selected item. Returns: true to support unselectinggio.list_model.ListModel getModel()Gets the model that self is wrapping. Returns: The model being wrappeduint getSelected()Gets the position of the selected item.gobject.object.ObjectWrap getSelectedItem()Gets 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(gio.list_model.ListModel model = null)Creates a new selection to handle model.classSingleSelectionGidBuilderImpl(T) : gobject.object.ObjectWrapGidBuilderImpl!T, gio.list_model.ListModelGidBuilderImpl!T, gtk.section_model.SectionModelGidBuilderImpl!T, gtk.selection_model.SelectionModelGidBuilderImpl!T
Methods
T autoselect(bool propval)Set `autoselect` property. Params: propval = If the selection will always select an item. Returns: Builder instance for fluent chainingT canUnselect(bool propval)Set `canUnselect` property. Params: propval = If unselecting the selected item is allowed. Returns: Builder instance for fluent chainingT model(gio.list_model.ListModel propval)Set `model` property. Params: propval = The model being managed. Returns: Builder instance for fluent chainingT selected(uint propval)Set `selected` property. Params: propval = Position of the selected item. Returns: Builder instance for fluent chainingFluent builder for [gtk.single_selection.SingleSelection]
Methods