It derives from <GObject>.
A selection model that allows selecting a single item.
Note that the selection is persistent – if the selected item is
removed and re-added in the same list-model:items-changed emission, it stays
selected. In particular, this means that changing the sort order of an
underlying sort model will preserve the selection.
If the selection will always select an item.
Its value is a boolean.
Set it with (set! (single-selection:autoselect self) value).
If unselecting the selected item is allowed.
Its value is a boolean.
Set it with (set! (single-selection:can-unselect self) value).
The type of items. See list-model:get-item-type.
Its value is a class, or a GType number.
It is read only.
The model being managed.
Its value is a <GListModel>, or #f.
Set it with (set! (single-selection:model self) value).
The number of items. See list-model:get-n-items.
Its value is an unsigned 32-bit integer.
It is read only.
Position of the selected item.
Its value is an unsigned 32-bit integer.
Set it with (set! (single-selection:selected self) value).
The selected item.
Its value is a <GObject>, or #f.
It is read only.
Checks if autoselect has been enabled or disabled via
single-selection:set-autoselect.
Passed: a <GtkSingleSelection>.
Returned: a boolean.
#t if autoselect is enabled
If #t, selection-model:unselect-item? is supported and allows
unselecting the selected item.
Passed: a <GtkSingleSelection>.
Returned: a boolean.
#t to support unselecting
Gets the model that self is wrapping.
Passed: a <GtkSingleSelection>.
Returned: a <GListModel>, or #f.
The model being wrapped
Gets the position of the selected item.
If no item is selected, GTK_INVALID_LIST_POSITION is returned.
Passed: a <GtkSingleSelection>.
Returned: an unsigned 32-bit integer.
The position of the selected item
Gets the selected item.
If no item is selected, #f is returned.
Passed: a <GtkSingleSelection>.
Returned: a <GObject>, or #f.
The selected item
Creates a new selection to handle model.
Passed, or left out: a <GListModel>, or
#f.
the <GListModel> to manage
Returned: a <GtkSingleSelection>.
a new <GtkSingleSelection>
Enables or disables autoselect.
If autoselect is #t, 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.
Passed: a <GtkSingleSelection>.
Passed: a boolean.
#t to always select an item
If #t, unselecting the current item via selection-model:unselect-item? is supported.
Note that setting single-selection:autoselect will cause unselecting to not
work, so it practically makes no sense to set both at the same time.
Passed: a <GtkSingleSelection>.
Passed: a boolean.
#t to allow unselecting
Sets the model that self should wrap.
If model is #f, self will be empty.
Passed: a <GtkSingleSelection>.
Passed, or left out: a <GListModel>, or
#f.
A <GListModel> to wrap
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 single-selection: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. This also
applies if single-selection:can-unselect is set to #f.
Passed: a <GtkSingleSelection>.
Passed: an unsigned 32-bit integer.
the item to select or GTK_INVALID_LIST_POSITION