Gtk.Tree_Sortable.Set_Sort_Func_User_Data

Entities

Generic formal parameters

Access Types

Subprograms

Description

Destroy

procedure Destroy (Data : in out User_Data_Type)
Parameters
Data

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;
   User_Data : User_Data_Type) return Glib.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).

Parameters
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

User_Data

Data passed when the compare func is assigned e.g. by Gtk.Tree_Sortable.Set_Sort_Func

Return Value

a negative integer, zero or a positive integer depending on whether A sorts before, with or after B

Set_Sort_Func

procedure Set_Sort_Func
   (Sortable       : Gtk.Tree_Sortable.Gtk_Tree_Sortable;
    Sort_Column_Id : Glib.Gint;
    Sort_Func      : Gtk_Tree_Iter_Compare_Func;
    User_Data      : User_Data_Type)

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.

Parameters
Sortable
Sort_Column_Id

the sort column id to set the function for

Sort_Func

The comparison function

User_Data

User data to pass to Sort_Func, or null

User_Data_Type

type User_Data_Type (<>) is private;