type Gtk_Tree_Selection_Record is new GObject_Record with null record;
type Gtk_Tree_Selection is access all Gtk_Tree_Selection_Record'Class;
type Gtk_Tree_Selection_Foreach_Func is access procedure (Model : Gtk.Tree_Model.Gtk_Tree_Model; Path : Gtk.Tree_Model.Gtk_Tree_Path; Iter : Gtk.Tree_Model.Gtk_Tree_Iter);
type Gtk_Tree_Selection_Func is access function (Selection : not null access Gtk_Tree_Selection_Record'Class; Model : Gtk.Tree_Model.Gtk_Tree_Model; Path : Gtk.Tree_Model.Gtk_Tree_Path; Path_Currently_Selected : Boolean) return Boolean;
type Cb_Gtk_Tree_Selection_Void is not null access procedure (Self : access Gtk_Tree_Selection_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
Mode_Property : constant Gtk.Enums.Property_Gtk_Selection_Mode;
Signal_Changed : constant Glib.Signal_Name := "changed";
function Get_Type return Glib.GType;
function Count_Selected_Rows
( | Selection | : not null access Gtk_Tree_Selection_Record) return Gint; |
function Get_Mode
( | Selection | : not null access Gtk_Tree_Selection_Record) return Gtk.Enums.Gtk_Selection_Mode; |
procedure Set_Mode
( | Selection | : not null access Gtk_Tree_Selection_Record; |
The_Type | : Gtk.Enums.Gtk_Selection_Mode); |
procedure Get_Select_Function
( | Selection | : not null access Gtk_Tree_Selection_Record); |
procedure Set_Select_Function
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Func | : Gtk_Tree_Selection_Func); |
procedure Get_Selected
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Model | : out Gtk.Tree_Model.Gtk_Tree_Model; | |
Iter | : out Gtk.Tree_Model.Gtk_Tree_Iter); |
function Get_Tree_View
( | Selection | : not null access Gtk_Tree_Selection_Record) return Gtk.Widget.Gtk_Widget; |
function Get_User_Data
( | Selection | : not null access Gtk_Tree_Selection_Record) return System.Address; |
function Iter_Is_Selected
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Iter | : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean; |
function Path_Is_Selected
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Path | : Gtk.Tree_Model.Gtk_Tree_Path) return Boolean; |
procedure Select_All
( | Selection | : not null access Gtk_Tree_Selection_Record); |
procedure Select_Iter
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Iter | : Gtk.Tree_Model.Gtk_Tree_Iter); |
procedure Select_Path
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Path | : Gtk.Tree_Model.Gtk_Tree_Path); |
procedure Select_Range
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Start_Path | : Gtk.Tree_Model.Gtk_Tree_Path; | |
End_Path | : Gtk.Tree_Model.Gtk_Tree_Path); |
procedure Selected_Foreach
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Func | : Gtk_Tree_Selection_Foreach_Func); |
procedure Unselect_All
( | Selection | : not null access Gtk_Tree_Selection_Record); |
procedure Unselect_Iter
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Iter | : Gtk.Tree_Model.Gtk_Tree_Iter); |
procedure Unselect_Path
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Path | : Gtk.Tree_Model.Gtk_Tree_Path); |
procedure Unselect_Range
( | Selection | : not null access Gtk_Tree_Selection_Record; |
Start_Path | : Gtk.Tree_Model.Gtk_Tree_Path; | |
End_Path | : Gtk.Tree_Model.Gtk_Tree_Path); |
procedure Get_Selected_Rows
( | Selection | : access Gtk_Tree_Selection_Record; |
Model | : out Gtk.Tree_Model.Gtk_Tree_Model; | |
Path_List | : out Gtk.Tree_Model.Gtk_Tree_Path_List.Glist); |
procedure On_Changed
( | Self | : not null access Gtk_Tree_Selection_Record; |
Call | : Cb_Gtk_Tree_Selection_Void; | |
After | : Boolean := False); |
procedure On_Changed
( | Self | : not null access Gtk_Tree_Selection_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
The Gtk.Tree_Selection.Gtk_Tree_Selection object is a helper object to manage the selection for a Gtk.Tree_View.Gtk_Tree_View widget. The Gtk.Tree_Selection.Gtk_Tree_Selection object is automatically created when a new Gtk.Tree_View.Gtk_Tree_View widget is created, and cannot exist independentally of this widget. The primary reason the Gtk.Tree_Selection.Gtk_Tree_Selection objects exists is for cleanliness of code and API. That is, there is no conceptual reason all these functions could not be methods on the Gtk.Tree_View.Gtk_Tree_View widget instead of a separate function.
The Gtk.Tree_Selection.Gtk_Tree_Selection object is gotten from a Gtk.Tree_View.Gtk_Tree_View by calling Gtk.Tree_View.Get_Selection. It can be manipulated to check the selection status of the tree, as well as select and deselect individual rows. Selection is done completely view side. As a result, multiple views of the same model can have completely different selections. Additionally, you cannot change the selection of a row on the model that is not currently displayed by the view without expanding its parents first.
One of the important things to remember when monitoring the selection of a view is that the Gtk.Tree_Selection.Gtk_Tree_Selection::changed signal is mostly a hint. That is, it may only emit one signal when a range of rows is selected. Additionally, it may on occasion emit a Gtk.Tree_Selection.Gtk_Tree_Selection::changed signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).