## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

## Index

Package: Tree_Sortable

- Goto spec source

# Description

    package Gtk.Tree_Sortable is

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

Binding from C File version 2.8.17

# Packages

### Compare_Funcs (generic)

</doc_ignore>
Full description

# Types

### Gtk_Tree_Sortable

- Goto declaration in source

    type Gtk_Tree_Sortable is new Glib.Types.GType_Interface;

### Gtk_Tree_Iter_Compare_Func

- Goto declaration in source

    type Gtk_Tree_Iter_Compare_Func is access function
         (Model : access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class;
          A     : Gtk.Tree_Model.Gtk_Tree_Iter;
          B     : Gtk.Tree_Model.Gtk_Tree_Iter) return Gint;

A Gtk_Tree_Iter_Compare_Func 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 behaves as expected, the Gtk_Tree_Iter_Compare_Func 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).

# Constants & Global variables

### Default_Sort_Column_Id

- Goto declaration in source

(Glib.Gint)

    Default_Sort_Column_Id  : constant Gint := -1;

### Unsorted_Sort_Column_Id

- Goto declaration in source

(Glib.Gint)

    Unsorted_Sort_Column_Id : constant Gint := -2;

Two special values for the sort column

### Signal_Sort_Column_Changed

- Goto declaration in source

(Glib.Signal_Name)

    Signal_Sort_Column_Changed : constant Glib.Signal_Name :=
                                      "sort_column_changed";

# Subprograms & Entries

### Get_Type

- Goto spec in source
- Goto body in source

    function Get_Type return Glib.GType;

Returns the internal type used for a Gtk_Tree_Sortable

### Set_Sort_Column_Id

- Goto spec in source
- Goto body in source

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

### Get_Sort_Column_Id

- Goto spec in source

    procedure Get_Sort_Column_Id (Sortable: Gtk_Tree_Sortable;Sort_Column_Id: out Gint;Order: out 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 sort_column_changed signal. If Sort_Column_Id is Default_Sort_Column_Id, then the default sort function will be used, if it is set.

### Set_Default_Sort_Func

- Goto spec in source

    procedure Set_Default_Sort_Func (Sortable: Gtk_Tree_Sortable;Sort_Func: Gtk_Tree_Iter_Compare_Func);

### Has_Default_Sort_Func

- Goto spec in source

    function Has_Default_Sort_Func (Sortable: Gtk_Tree_Sortable) return Boolean;

Sets the default comparison function used when sorting to be Sort_Func. If the current sort column id of Sortable is 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 Default_Sort_Column_Id, the model will be unsorted.

### Set_Sort_Func

- Goto spec in source

    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_Changed

- Goto spec in source
- Goto body in source

    procedure Sort_Column_Changed (Sortable: Gtk_Tree_Sortable);

Emits sort_column_changed signal