Index

Package: Tree_Sortable

Description

package Gtk.Tree_Sortable is
Gtk.Tree_Sortable.Gtk_Tree_Sortable is an interface to be implemented by tree models which support sorting. The Gtk.Tree_View.Gtk_Tree_View uses the methods provided by this interface to sort the model.

Packages

Set_Default_Sort_Func_User_Data (generic)

Set_Sort_Func_User_Data (generic)

Types

Gtk_Tree_Sortable

type Gtk_Tree_Sortable is new Glib.Types.GType_Interface;

Gtk_Tree_Iter_Compare_Func

type Gtk_Tree_Iter_Compare_Func is access function
     (Model : Gtk.Tree_Model.Gtk_Tree_Model;
      A     : Gtk.Tree_Model.Gtk_Tree_Iter;
      B     : Gtk.Tree_Model.Gtk_Tree_Iter) return Gint;
A GtkTreeIterCompareFunc should return a negative integer, zero, or a positive integer if A sorts before B, A sorts with B, or A sorts after B respectively. If two iters compare as equal, their order in the sorted model is undefined. In order to ensure that the Gtk.Tree_Sortable.Gtk_Tree_Sortable behaves as expected, the GtkTreeIterCompareFunc must define a partial order on the model, i.e. it must be reflexive, antisymmetric and transitive. For example, if Model is a product catalogue, then a compare function for the "price" column could be one which returns 'price_of(A) - price_of(B)'. "model": The Gtk.Tree_Model.Gtk_Tree_Model the comparison is within "a": A Gtk.Tree_Model.Gtk_Tree_Iter in Model "b": Another Gtk.Tree_Model.Gtk_Tree_Iter in Model

Cb_Gtk_Tree_Sortable_Void

type Cb_Gtk_Tree_Sortable_Void is not null access procedure (Self : Gtk_Tree_Sortable);

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
     (Self : access Glib.Object.GObject_Record'Class);

Constants & Global variables

Null_Gtk_Tree_Sortable (Gtk_Tree_Sortable)

Null_Gtk_Tree_Sortable : constant Gtk_Tree_Sortable;

Default_Sort_Column_Id (Glib.Gint)

Default_Sort_Column_Id  : constant Gint := -1;

Unsorted_Sort_Column_Id (Glib.Gint)

Unsorted_Sort_Column_Id : constant Gint := -2;
Two special values for the sort column

Signal_Sort_Column_Changed (Glib.Signal_Name)

Signal_Sort_Column_Changed : constant Glib.Signal_Name := "sort-column-changed";

Subprograms & Entries

Get_Type

function Get_Type return Glib.GType;

Get_Sort_Column_Id

procedure Get_Sort_Column_Id 
(Sortable: Gtk_Tree_Sortable;
Sort_Column_Id: out Gint;
Order: out Gtk.Enums.Gtk_Sort_Type);

Set_Sort_Column_Id

procedure Set_Sort_Column_Id 
(Sortable: Gtk_Tree_Sortable;
Sort_Column_Id: Gint;
Order: Gtk.Enums.Gtk_Sort_Type);

Has_Default_Sort_Func

function Has_Default_Sort_Func 
(Sortable: Gtk_Tree_Sortable) return Boolean;
Returns True if the model has a default sort function. This is used primarily by GtkTreeViewColumns in order to determine if a model can go back to the default state, or not.

Set_Default_Sort_Func

procedure Set_Default_Sort_Func 
(Sortable: Gtk_Tree_Sortable;
Sort_Func: Gtk_Tree_Iter_Compare_Func);
Sets the default comparison function used when sorting to be Sort_Func. If the current sort column id of Sortable is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this function. If Sort_Func is null, then there will be no default comparison function. This means that once the model has been sorted, it can't go back to the default state. In this case, when the current sort column id of Sortable is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. "sort_func": The comparison function

Set_Sort_Func

procedure Set_Sort_Func 
(Sortable: Gtk_Tree_Sortable;
Sort_Column_Id: Gint;
Sort_Func: Gtk_Tree_Iter_Compare_Func);
Sets the comparison function used when sorting to be Sort_Func. If the current sort column id of Sortable is the same as Sort_Column_Id, then the model will sort using this function. "sort_column_id": the sort column id to set the function for "sort_func": The comparison function

Sort_Column_Changed

procedure Sort_Column_Changed 
(Sortable: Gtk_Tree_Sortable);

On_Sort_Column_Changed

procedure On_Sort_Column_Changed 
(Self: Gtk_Tree_Sortable;
Call: Cb_Gtk_Tree_Sortable_Void;
After: Boolean := False);

On_Sort_Column_Changed

procedure On_Sort_Column_Changed 
(Self: Gtk_Tree_Sortable;
Call: Cb_GObject_Void;
Slot: not null access Glib.Object.GObject_Record'Class;
After: Boolean := False);
The ::sort-column-changed signal is emitted when the sort column or sort order of Sortable is changed. The signal is emitted before the contents of Sortable are resorted.