Gtk.Tree_Sortable

Entities

Simple Types

Access Types

Subtypes

Constants

Subprograms

Description

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.

"+"

function "+" (W : Gtk_Tree_Sortable) return Gtk_Tree_Sortable
Parameters
W
Return Value

Cb_GObject_Void

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

Cb_Gtk_Tree_Sortable_Void

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

Default_Sort_Column_Id

Default_Sort_Column_Id  : constant Gint := -1;

Two special values for the sort column

Get_Sort_Column_Id

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

Fills in Sort_Column_Id and Order with the current sort column and the order. It returns True unless the Sort_Column_Id is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.

Parameters
Sortable
Sort_Column_Id

The sort column id to be filled in

Order

The Gtk.Enums.Gtk_Sort_Type to be filled in

Get_Type

function Get_Type return Glib.GType
Return Value

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 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

Return Value

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

Gtk_Tree_Sortable

type Gtk_Tree_Sortable is new Glib.Types.GType_Interface;

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.

Parameters
Sortable
Return Value

True, if the model has a default sort function

Null_Gtk_Tree_Sortable

Null_Gtk_Tree_Sortable : constant Gtk_Tree_Sortable;

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.

Parameters
Self
Call
Slot
After

On_Sort_Column_Changed

procedure On_Sort_Column_Changed
   (Self  : Gtk_Tree_Sortable;
    Call  : Cb_Gtk_Tree_Sortable_Void;
    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.

Parameters
Self
Call
After

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.

Parameters
Sortable
Sort_Func

The comparison function

Set_Get_Sort_Column_Id

procedure Set_Get_Sort_Column_Id
  (Self    : Tree_Sortable_Interface_Descr;
   Handler : Virtual_Get_Sort_Column_Id)
Parameters
Self
Handler

Set_Has_Default_Sort_Func

procedure Set_Has_Default_Sort_Func
  (Self    : Tree_Sortable_Interface_Descr;
   Handler : Virtual_Has_Default_Sort_Func)
Parameters
Self
Handler

Set_Set_Default_Sort_Func

procedure Set_Set_Default_Sort_Func
  (Self    : Tree_Sortable_Interface_Descr;
   Handler : Virtual_Set_Default_Sort_Func)
Parameters
Self
Handler

Set_Set_Sort_Column_Id

procedure Set_Set_Sort_Column_Id
  (Self    : Tree_Sortable_Interface_Descr;
   Handler : Virtual_Set_Sort_Column_Id)
Parameters
Self
Handler

Set_Set_Sort_Func

procedure Set_Set_Sort_Func
  (Self    : Tree_Sortable_Interface_Descr;
   Handler : Virtual_Set_Sort_Func)
Parameters
Self
Handler

Set_Sort_Column_Changed

procedure Set_Sort_Column_Changed
  (Self    : Tree_Sortable_Interface_Descr;
   Handler : Virtual_Sort_Column_Changed)

See Glib.Object.Add_Interface

Parameters
Self
Handler

Set_Sort_Column_Id

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

Sets the current sort column to be Sort_Column_Id. The Sortable will resort itself to reflect this change, after emitting a Gtk.Tree_Sortable.Gtk_Tree_Sortable::sort-column-changed signal. Sort_Column_Id may either be a regular column id, or one of the following special values:

will be used, if it is set

Parameters
Sortable
Sort_Column_Id

the sort column id to set

Order

The sort order of the column

Set_Sort_Func

procedure Set_Sort_Func
   (Sortable       : Gtk_Tree_Sortable;
    Sort_Column_Id : Glib.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.

Parameters
Sortable
Sort_Column_Id

the sort column id to set the function for

Sort_Func

The comparison function

Signal_Sort_Column_Changed

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

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.

Sort_Column_Changed

procedure Sort_Column_Changed (Sortable : Gtk_Tree_Sortable)

Emits a Gtk.Tree_Sortable.Gtk_Tree_Sortable::sort-column-changed signal on Sortable.

Parameters
Sortable

Tree_Sortable_Interface_Descr

subtype Tree_Sortable_Interface_Descr is Glib.Object.Interface_Description;

Unsorted_Sort_Column_Id

Unsorted_Sort_Column_Id : constant Gint := -2;

Two special values for the sort column

Virtual_Get_Sort_Column_Id

type Virtual_Get_Sort_Column_Id is access function
  (Sortable       : Gtk_Tree_Sortable;
   Sort_Column_Id : access Glib.Gint;
   Order          : access Gtk.Enums.Gtk_Sort_Type) return Glib.Gboolean;

Fills in Sort_Column_Id and Order with the current sort column and the order. It returns True unless the Sort_Column_Id is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.

Parameters
Sortable
Sort_Column_Id

The sort column id to be filled in

Order

The Gtk.Enums.Gtk_Sort_Type to be filled in

Return Value

True if the sort column is not one of the special sort column ids.

Virtual_Has_Default_Sort_Func

type Virtual_Has_Default_Sort_Func is access function (Sortable : Gtk_Tree_Sortable) return Glib.Gboolean;

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.

Parameters
Sortable
Return Value

True, if the model has a default sort function

Virtual_Set_Default_Sort_Func

type Virtual_Set_Default_Sort_Func is access procedure
  (Sortable  : Gtk_Tree_Sortable;
   Sort_Func : System.Address;
   User_Data : System.Address;
   Destroy   : Glib.G_Destroy_Notify_Address);

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.

Parameters
Sortable
Sort_Func

The comparison function

User_Data

User data to pass to Sort_Func, or null

Destroy

Destroy notifier of User_Data, or null

Virtual_Set_Sort_Column_Id

type Virtual_Set_Sort_Column_Id is access procedure
  (Sortable       : Gtk_Tree_Sortable;
   Sort_Column_Id : Glib.Gint;
   Order          : Gtk.Enums.Gtk_Sort_Type);

Sets the current sort column to be Sort_Column_Id. The Sortable will resort itself to reflect this change, after emitting a Gtk.Tree_Sortable.Gtk_Tree_Sortable::sort-column-changed signal. Sort_Column_Id may either be a regular column id, or one of the following special values:

will be used, if it is set

Parameters
Sortable
Sort_Column_Id

the sort column id to set

Order

The sort order of the column

Virtual_Set_Sort_Func

type Virtual_Set_Sort_Func is access procedure
  (Sortable       : Gtk_Tree_Sortable;
   Sort_Column_Id : Glib.Gint;
   Sort_Func      : System.Address;
   User_Data      : System.Address;
   Destroy        : Glib.G_Destroy_Notify_Address);

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

Destroy

Destroy notifier of User_Data, or null

Virtual_Sort_Column_Changed

type Virtual_Sort_Column_Changed is access procedure (Sortable : Gtk_Tree_Sortable);

Emits a Gtk.Tree_Sortable.Gtk_Tree_Sortable::sort-column-changed signal on Sortable.

Parameters
Sortable