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 [signalGio.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.
function "+"
(Widget : access Gtk_Single_Selection_Record'Class)
return Glib.List_Model.Glist_Model
function "+"
(Widget : access Gtk_Single_Selection_Record'Class)
return Gtk.Section_Model.Gtk_Section_Model
function "+"
(Widget : access Gtk_Single_Selection_Record'Class)
return Gtk.Selection_Model.Gtk_Selection_Model
function "-"
(Interf : Glib.List_Model.Glist_Model)
return Gtk_Single_Selection
function "-"
(Interf : Gtk.Section_Model.Gtk_Section_Model)
return Gtk_Single_Selection
function "-"
(Interf : Gtk.Selection_Model.Gtk_Selection_Model)
return Gtk_Single_Selection
Autoselect_Property : constant Glib.Properties.Property_Boolean;
If the selection will always select an item.
Can_Unselect_Property : constant Glib.Properties.Property_Boolean;
If unselecting the selected item is allowed.
function Get_Autoselect
(Self : not null access Gtk_Single_Selection_Record) return Boolean
Checks if autoselect has been enabled or disabled via Gtk.Single_Selection.Set_Autoselect.
True if autoselect is enabled
function Get_Can_Unselect
(Self : not null access Gtk_Single_Selection_Record) return Boolean
If True, Gtk.Selection_Model.Unselect_Item is supported and allows unselecting the selected item.
True to support unselecting
function Get_Item
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint) return Glib.Object.GObject
function Get_Item_Type
(Self : not null access Gtk_Single_Selection_Record) return GType
function Get_Model
(Self : not null access Gtk_Single_Selection_Record)
return Glib.List_Model.Glist_Model
Gets the model that Self is wrapping.
The model being wrapped
function Get_N_Items
(Self : not null access Gtk_Single_Selection_Record) return Guint
procedure Get_Section
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint;
Out_Start : out Guint;
Out_End : out Guint)
function Get_Selected
(Self : not null access Gtk_Single_Selection_Record) return Guint
Gets the position of the selected item. If no item is selected, GTK_INVALID_LIST_POSITION is returned.
The position of the selected item
function Get_Selected_Item
(Self : not null access Gtk_Single_Selection_Record)
return Glib.Object.GObject
Gets the selected item. If no item is selected, null is returned.
The selected item
function Get_Selection
(Self : not null access Gtk_Single_Selection_Record)
return Gtk.Bitset.Gtk_Bitset
function Get_Selection_In_Range
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint;
N_Items : Guint) return Gtk.Bitset.Gtk_Bitset
function Get_Type return Glib.GType
procedure Gtk_New
(Self : out Gtk_Single_Selection;
Model : Glib.List_Model.Glist_Model)
Creates a new selection to handle Model. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the GListModel to manage
type Gtk_Single_Selection is access all Gtk_Single_Selection_Record'Class;
function Gtk_Single_Selection_New
(Model : Glib.List_Model.Glist_Model) return Gtk_Single_Selection
Creates a new selection to handle Model.
the GListModel to manage
type Gtk_Single_Selection_Record is new GObject_Record with null record;
package Implements_Glist_Model is new Glib.Types.Implements
(Glib.List_Model.Glist_Model, Gtk_Single_Selection_Record, Gtk_Single_Selection);
package Implements_Gtk_Section_Model is new Glib.Types.Implements
(Gtk.Section_Model.Gtk_Section_Model, Gtk_Single_Selection_Record, Gtk_Single_Selection);
package Implements_Gtk_Selection_Model is new Glib.Types.Implements
(Gtk.Selection_Model.Gtk_Selection_Model, Gtk_Single_Selection_Record, Gtk_Single_Selection);
procedure Initialize
(Self : not null access Gtk_Single_Selection_Record'Class;
Model : Glib.List_Model.Glist_Model)
Creates a new selection to handle Model. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the GListModel to manage
function Is_Selected
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint) return Boolean
Item_Type_Property : constant Glib.Properties.Property_Boxed;
Type: GType The type of items. See [methodGio.ListModel.get_item_type].
procedure Items_Changed
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint;
Removed : Guint;
Added : Guint)
Model_Property : constant Glib.Properties.Property_Boxed;
Type: Gio.List_Model The model being managed.
N_Items_Property : constant Glib.Properties.Property_Uint;
The number of items. See [methodGio.ListModel.get_n_items].
procedure Sections_Changed
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint;
N_Items : Guint)
function Select_All
(Self : not null access Gtk_Single_Selection_Record) return Boolean
function Select_Item
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint;
Unselect_Rest : Boolean) return Boolean
function Select_Range
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint;
N_Items : Guint;
Unselect_Rest : Boolean) return Boolean
Selected_Item_Property : constant Glib.Properties.Property_Object;
Type: Glib.Object.GObject The selected item.
Selected_Property : constant Glib.Properties.Property_Uint;
Position of the selected item.
procedure Selection_Changed
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint;
N_Items : Guint)
procedure Set_Autoselect
(Self : not null access Gtk_Single_Selection_Record;
Autoselect : Boolean)
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.
True to always select an item
procedure Set_Can_Unselect
(Self : not null access Gtk_Single_Selection_Record;
Can_Unselect : Boolean)
If True, unselecting the current item via Gtk.Selection_Model.Unselect_Item is supported. Note that setting [propertyGtk.SingleSelection:autoselect] will cause unselecting to not work, so it practically makes no sense to set both at the same time.
True to allow unselecting
procedure Set_Model
(Self : not null access Gtk_Single_Selection_Record;
Model : Glib.List_Model.Glist_Model)
Sets the model that Self should wrap. If Model is null, Self will be empty.
A GListModel to wrap
procedure Set_Selected
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint)
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 [propertyGtk.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. This also applies if [propertyGtk.SingleSelection:can-unselect] is set to False.
the item to select or GTK_INVALID_LIST_POSITION
function Set_Selection
(Self : not null access Gtk_Single_Selection_Record;
Selected : Gtk.Bitset.Gtk_Bitset;
Mask : Gtk.Bitset.Gtk_Bitset) return Boolean
function Unselect_All
(Self : not null access Gtk_Single_Selection_Record) return Boolean
function Unselect_Item
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint) return Boolean
function Unselect_Range
(Self : not null access Gtk_Single_Selection_Record;
Position : Guint;
N_Items : Guint) return Boolean