## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

## Index

Package: Tree_Model

- Goto spec source

# Description

    package Gtk.Tree_Model is

The type Gtk_Tree_Model defined in this model defines an abstract interface to represent sets of data that will be displayed in a Gtk_Tree_View.

Various default implementations are provided in the Gtk.Tree_Store and Gtk.List_Store packages.

Data are considered as being organized into a tree-like structure.

This package also defines a number of other types to manipulate these models: A Gtk_Tree_Path is a textual pointer to a specific row/node in the model. It is a column separate list of numbers, that indicate the index of the child they point to.

For instance, "10:4:0" would points to the first (0) child of the fifth (4) child of the eleventh child of the root. The depth of this path is 3.

A Gtk_Tree_Iter is similar to a path, but is a direct pointer to the actual data. It is also more efficient to use than paths.

A Gtk_Row_Reference is an object that tracks model changes, so that it always refere to the same row. A Gtk_Tree_Path refers to a position in the model, not a fixed row.

Binding from C File version 2.8.17

# Packages

### Gtk_Tree_Path_List (new Glib.Glist.Generic_List)

    package Gtk_Tree_Path_List is new Glib.Glist.Generic_List (Gtk_Tree_Path);

# Classes

### Gtk_Tree_Model_Record

- Goto declaration in source
- Goto full declaration in source

    type Gtk_Tree_Model_Record is new Glib.Object.GObject_Record
         with private;

#### Ancestors:

Glib.Object.GObject_Record

#### Immediate Children:

Gtk.List_Store.Gtk_List_Store_Record
Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter_Record
Gtk.Tree_Model_Sort.Gtk_Tree_Model_Sort_Record
Gtk.Tree_Store.Gtk_Tree_Store_Record
Gtkada.Abstract_Tree_Model.Gtk_Abstract_Tree_Model_Record

#### Primitive operations:

Children

- To API doc
- To spec

Foreach

- To API doc
- To spec

Get_Address

- To API doc
- To spec

Get_Boolean

- To API doc
- To spec

Get_C_Proxy

- To API doc
- To spec

Get_Column_Type

- To API doc
- To spec

Get_Flags

- To API doc
- To spec

Get_Int

- To API doc
- To spec

Get_Iter

- To API doc
- To spec

Get_Iter_First

- To API doc
- To spec

Get_Iter_From_String

- To API doc
- To spec

Get_N_Columns

- To API doc
- To spec

Get_Object

- To API doc
- To spec

Get_Path

- To API doc
- To spec

Get_String

- To API doc
- To spec

Get_String_From_Iter

- To API doc
- To spec

Get_Value

- To API doc
- To spec

Glib.Object.Deallocate

- To API doc
- To spec

(Inherited)
Glib.Object.Get_Type

- To API doc
- To spec

(Inherited)
Glib.Object.Notify

- To API doc
- To spec

(Inherited)
Glib.Object.Ref

- To API doc
- To spec

(Inherited)
Glib.Object.Ref_Sink

- To API doc
- To spec

(Inherited)
Glib.Object.Unref

- To API doc
- To spec

(Inherited)
Gtk_New

- To API doc
- To spec

Has_Child

- To API doc
- To spec

N_Children

- To API doc
- To spec

Next

- To API doc
- To spec

Nth_Child

- To API doc
- To spec

Parent

- To API doc
- To spec

Ref_Node

- To API doc
- To spec

Unref_Node

- To API doc
- To spec

# Types

### Gtk_Tree_Model

- Goto declaration in source

    type Gtk_Tree_Model is access all Gtk_Tree_Model_Record'Class;

This is an abstract interface

### Gtk_Tree_Path

- Goto declaration in source

    type Gtk_Tree_Path is new Glib.C_Proxy;

### Gtk_Tree_Iter

- Goto declaration in source
- Goto full declaration in source

    type Gtk_Tree_Iter is private;

### Tree_Model_Flags

- Goto declaration in source

    type Tree_Model_Flags is mod 2 ** 32;

### Gtk_Tree_Model_Foreach_Func

- Goto declaration in source

    type Gtk_Tree_Model_Foreach_Func is access function
         (Model     : access Gtk_Tree_Model_Record'Class;
          Path      : Gtk_Tree_Path;
          Iter      : Gtk_Tree_Iter;
          User_Data : System.Address) return Boolean;

### Gtk_Tree_Row_Reference

- Goto declaration in source

    type Gtk_Tree_Row_Reference is new Glib.C_Proxy;

# Constants & Global variables

### Tree_Model_Iters_Persist

- Goto declaration in source

(Tree_Model_Flags)

    Tree_Model_Iters_Persist : constant Tree_Model_Flags;

### Tree_Model_List_Only

- Goto declaration in source

(Tree_Model_Flags)

    Tree_Model_List_Only     : constant Tree_Model_Flags;

### Null_Iter

- Goto declaration in source
- Goto full declaration in source

(Gtk_Tree_Iter)

    Null_Iter : constant Gtk_Tree_Iter;

### Signal_Row_Changed

- Goto declaration in source

(Glib.Signal_Name)

    Signal_Row_Changed           : constant Glib.Signal_Name :=
                                        "row_changed";

### Signal_Row_Inserted

- Goto declaration in source

(Glib.Signal_Name)

    Signal_Row_Inserted          : constant Glib.Signal_Name :=
                                        "row_inserted";

### Signal_Row_Has_Child_Toggled

- Goto declaration in source

(Glib.Signal_Name)

    Signal_Row_Has_Child_Toggled : constant Glib.Signal_Name :=
                                        "row_has_child_toggled";

### Signal_Row_Deleted

- Goto declaration in source

(Glib.Signal_Name)

    Signal_Row_Deleted           : constant Glib.Signal_Name :=
                                        "row_deleted";

### Signal_Rows_Reordered

- Goto declaration in source

(Glib.Signal_Name)

    Signal_Rows_Reordered        : constant Glib.Signal_Name :=
                                        "rows_reordered";

# Subprograms & Entries

### Get_Type

- Goto spec in source
- Goto body in source

    function Get_Type return Glib.GType;

Return the internal value associated with a Gtk_Tree_Model.

### Get_Flags

- Goto spec in source

    function Get_Flags (Model: access Gtk_Tree_Model_Record) return Tree_Model_Flags;

Return a set of flags supported by this interface. The flags supported should not change during the lifecycle of the tree_model. The flags should not change in the lifetime of the model.

### Get_N_Columns

- Goto spec in source

    function Get_N_Columns (Tree_Model: access Gtk_Tree_Model_Record) return Gint;

Return the number of columns supported by Tree_Model.

### Get_Column_Type

- Goto spec in source

    function Get_Column_Type (Tree_Model: access Gtk_Tree_Model_Record;Index: Gint) return GType;

Return the type of the Index-th column in the model.

### Foreach

- Goto spec in source

    procedure Foreach (Model: access Gtk_Tree_Model_Record;Func: Gtk_Tree_Model_Foreach_Func;User_Data: System.Address);

Calls func on each node in model in a depth-first fashion. If func returns True, then the tree ceases to be walked, and Foreach returns.

### Gtk_New

- Goto spec in source

    function Gtk_New (Path: String := "") return Gtk_Tree_Path;

Create a new Gtk_Tree_Path from a path string. Path should have the format described above, like "10:4:0". If it is the empty string, then a Gtk_Tree_Path of depth 0 is returned. The memory allocated for the path must be freed explicitely by calling Path_Free below.

### Gtk_New_First

- Goto spec in source
- Goto body in source

    function Gtk_New_First return Gtk_Tree_Path;

Return a new path pointed to the first row in the model. The string representation is "0"

### Path_Get_Type

- Goto spec in source
- Goto body in source

    function Path_Get_Type return Glib.GType;

Return the internal type used for Gtk_Tree_Path

### To_String

- Goto spec in source

    function To_String (Path: Gtk_Tree_Path) return String;

Generate a string representation of the path. This string is a colon-separated list of numbers, as described above.

### Get_Tree_Path

- Goto spec in source

    function Get_Tree_Path (Val: Glib.Values.GValue) return Gtk_Tree_Path;

Extract the path from the given GValue.

### Append_Index

- Goto spec in source
- Goto body in source

    procedure Append_Index (Path: Gtk_Tree_Path;Index: Gint);

Append a new index to a path. As a result, the depth of the path is increased. See Path_Up for the opposite operation.

### Prepend_Index

- Goto spec in source
- Goto body in source

    procedure Prepend_Index (Path: Gtk_Tree_Path;Index: Gint);

Prepend a new index to a path. As a result, the depth of the path is increased.

### Get_Depth

- Goto spec in source
- Goto body in source

    function Get_Depth (Path: Gtk_Tree_Path) return Gint;

Return the current depth of Path.

### Get_Indices

- Goto spec in source

    function Get_Indices (Path: Gtk_Tree_Path) return Glib.Gint_Array;

Return the list of indices from the path. This is an array of integers, each representing a node in a tree, as described in the path format.

### Path_Free

- Goto spec in source
- Goto body in source

    procedure Path_Free (Path: Gtk_Tree_Path);

Free the memory allocated for Path.

### Copy

- Goto spec in source
- Goto body in source

    function Copy (Path: Gtk_Tree_Path) return Gtk_Tree_Path;

Create a new Gtk_Tree_Path as a copy of Path. The memory allocated for the new path must be freed by a call to Path_Free.

### Compare

- Goto spec in source
- Goto body in source

    function Compare (A, B: Gtk_Tree_Path) return Gint;

Compare two paths. If A appears before B in a tree, then -1 is returned. If B appears before A, then 1 is returned. If the two nodes are equal, then 0 is returned.

### Next

- Goto spec in source

    procedure Next (Path: Gtk_Tree_Path);

Move the Path to point to the next node at the current depth. In effect, it increments the last indice of the path. Note that the path might become invalid if there is no more node at this depth.

### Prev

- Goto spec in source

    function Prev (Path: Gtk_Tree_Path) return Boolean;

Move Path to point to the previous node at the current depth, if it exists. Return True if Path has a previous node, and the move was made. If it returns False, then Path has not been changed.

### Up

- Goto spec in source

    function Up (Path: Gtk_Tree_Path) return Boolean;

Moves the Path to point to it's parent node, if it has a parent. Return True if Path has a parent, and the move was made. In practice, the depth of Path is decreased by 1.

### Down

- Goto spec in source
- Goto body in source

    procedure Down (Path: Gtk_Tree_Path);

Moves Path to point to the first child of the current path.

### Is_Ancestor

- Goto spec in source

    function Is_Ancestor (Path, Descendant: Gtk_Tree_Path) return Boolean;

Return True if Descendant is contained inside Path.

### Is_Descendant

- Goto spec in source

    function Is_Descendant (Path, Ancestor: Gtk_Tree_Path) return Boolean;

Return True if Path is contained inside Ancestor.

### Convert

- Goto spec in source

    function Convert is new Ada.Unchecked_Conversion (Gtk_Tree_Path, System.Address);

### Convert

- Goto spec in source

    function Convert is new Ada.Unchecked_Conversion (System.Address, Gtk_Tree_Path);

### Gtk_New

- Goto spec in source

    function Gtk_New (Model: access Gtk_Tree_Model_Record;Path: Gtk_Tree_Path) return Gtk_Tree_Row_Reference;

Create a row reference based on Path. This reference will keep pointing to the node pointed to by Path, so long as it exists. It listens to all signals on model, and updates it's path appropriately. If Path isn't a valid path in Model, then null is returned.

### Row_Reference_Get_Type

- Goto spec in source
- Goto body in source

    function Row_Reference_Get_Type return Glib.GType;

Return the internal type used for row reference.

### Get_Path

- Goto spec in source

    function Get_Path (Reference: Gtk_Tree_Row_Reference) return Gtk_Tree_Path;

Return the path that Reference currently points to. null is returned if Reference is no longer valid. The caller must free the returned path.

### Valid

- Goto spec in source

    function Valid (Reference: Gtk_Tree_Row_Reference) return Boolean;

Return True if Reference is non null and is still valid.

### Row_Reference_Copy

- Goto spec in source
- Goto body in source

    function Row_Reference_Copy (Ref: Gtk_Tree_Row_Reference) return Gtk_Tree_Row_Reference;

Return a newly allocated copy of Ref

### Row_Reference_Free

- Goto spec in source
- Goto body in source

    procedure Row_Reference_Free (Reference: Gtk_Tree_Row_Reference);

Free the memory occupied by Reference.

### Get_Model

- Goto spec in source

    function Get_Model (Reference: Gtk_Tree_Row_Reference) return Gtk_Tree_Model;

Returns the model which Reference is monitoring in order to appropriately the path.

### =

- Goto spec in source

    function "=" (Left: Gtk_Tree_Iter;Right: Gtk_Tree_Iter) return Boolean;

### Iter_Get_Type

- Goto spec in source
- Goto body in source

    function Iter_Get_Type return Glib.GType;

Return the internal type used for iterators

### Iter_Copy

- Goto spec in source
- Goto body in source

    procedure Iter_Copy (Source: Gtk_Tree_Iter;Dest: out Gtk_Tree_Iter);

Create a copy of Source. You can also copy tree iters simply by using the ":=" Ada construct.

### Set_Tree_Iter

- Goto spec in source
- Goto body in source

    procedure Set_Tree_Iter (Val: in out Glib.Values.GValue;Iter: Gtk_Tree_Iter);

Set the value of the given GValue to Iter. Note that Iter is stored by reference, which means no copy of Iter is made. Iter should remain allocated as long as Val is being used.

### Get_Tree_Iter

- Goto spec in source

    procedure Get_Tree_Iter (Val: Glib.Values.GValue;Iter: out Gtk_Tree_Iter);

Extract the iterator from the given GValue. Note that the iterator returned is a copy of the iterator referenced by the give GValue. Modifying the iterator returned does not modify the iterator referenced by the GValue.

### Get_Tree_Iter

- Goto spec in source

    function Get_Tree_Iter (Val: Glib.Values.GValue) return Gtk_Tree_Iter;

Extract the iterator from the given GValue.

### To_Address

- Goto spec in source

    function To_Address (Iter: Gtk_Tree_Iter) return System.Address;

Return address of the specified iterator.

### Get_Iter

- Goto spec in source

    function Get_Iter (Tree_Model: access Gtk_Tree_Model_Record;Path: Gtk_Tree_Path) return Gtk_Tree_Iter;

Return an iterator pointing to Path. Null_Iter is returned if Path was invalid or no iterator could be set.

### Get_Iter_From_String

- Goto spec in source

    function Get_Iter_From_String (Tree_Model: access Gtk_Tree_Model_Record;Path_String: String) return Gtk_Tree_Iter;

Return an iterator pointing to Path_String. Null_Iter is returned if Path was invalid or no iterator could be set.

### Get_String_From_Iter

- Goto spec in source

    function Get_String_From_Iter (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter) return String;

Generates a string representation of the iter. This string is a ':' separated list of numbers. For example, "4:10:0:3" would be an acceptable return value for this string.

### Get_Iter_First

- Goto spec in source

    function Get_Iter_First (Tree_Model: access Gtk_Tree_Model_Record) return Gtk_Tree_Iter;

Return an iterator pointing to the root of Tree_Model. Null_Iter is returned if Tree_Model is empty.

### Get_Path

- Goto spec in source

    function Get_Path (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter) return Gtk_Tree_Path;

Return a newly created Gtk_Tree_Path referenced by Iter. This path must be freed with Path_Free.

### Next

- Goto spec in source

    procedure Next (Tree_Model: access Gtk_Tree_Model_Record;Iter: in out Gtk_Tree_Iter);

Sets Iter to point to the node following it at the current level. If there is none, Iter is set to Null_Iter.

### Children

- Goto spec in source

    function Children (Tree_Model: access Gtk_Tree_Model_Record;Parent: Gtk_Tree_Iter) return Gtk_Tree_Iter;

Return the first child of Parent. If Parent has no children, return Null_Iter. Parent will remain a valid node after this function has been called.

### Has_Child

- Goto spec in source

    function Has_Child (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter) return Boolean;

Return True if Iter has children, False otherwise.

### N_Children

- Goto spec in source

    function N_Children (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter := Null_Iter) return Gint;

Return the number of children that Iter has. As a special case, if Iter is Null_Iter, then the number of toplevel nodes is returned.

### Nth_Child

- Goto spec in source

    function Nth_Child (Tree_Model: access Gtk_Tree_Model_Record;Parent: Gtk_Tree_Iter;N: Gint) return Gtk_Tree_Iter;

Return the child of Parent, using the given index. The First index is 0. If Index is too big, or Parent has no children, return Null_Iter. If Parent is Null_Iter, then the nth root node is set.

### Parent

- Goto spec in source

    function Parent (Tree_Model: access Gtk_Tree_Model_Record;Child: Gtk_Tree_Iter) return Gtk_Tree_Iter;

Return the parent of Child. If Child is at the toplevel, and doesn't have a parent, then Null_Iter is returned.

### Ref_Node

- Goto spec in source

    procedure Ref_Node (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter);

Let the tree reference the node. This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons. This function is primarily meant as a way for views to let caching model know when nodes are being displayed (and hence, whether or not to cache that node). For example, a file-system based model would not want to keep the entire file-hierarchy in memory, just the sections that are currently being displayed by every current view.

### Unref_Node

- Goto spec in source

    procedure Unref_Node (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter);

Let the tree unref the node. This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons. For more information on what this means, please see Tree_Model_Ref_Node. Please note that nodes that are deleted are not unreferenced.

### Get_Value

- Goto spec in source

    procedure Get_Value (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter;Column: Gint;Value: out Glib.Values.GValue);

Get a value from the model, at column Column and line Iter. Value must be freed by the caller.

### Get_Int

- Goto spec in source

    function Get_Int (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter;Column: Gint) return Gint;

Get the int value of one cell in the row referenced by Iter.

### Get_Boolean

- Goto spec in source

    function Get_Boolean (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter;Column: Gint) return Boolean;

Get the boolean value of one cell in the row referenced by Iter.

### Get_Object

- Goto spec in source

    function Get_Object (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter;Column: Gint) return Glib.Object.GObject;

Get the object value of one cell in the row referenced by Iter.

### Get_C_Proxy

- Goto spec in source

    function Get_C_Proxy (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter;Column: Gint) return Glib.C_Proxy;

Get the address value of one cell in the row referenced by Iter.

### Get_String

- Goto spec in source

    function Get_String (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter;Column: Gint) return UTF8_String;

Get the string stored at a specific location in the model.

### Get_Address

- Goto spec in source

    function Get_Address (Tree_Model: access Gtk_Tree_Model_Record;Iter: Gtk_Tree_Iter;Column: Gint) return System.Address;

Get the pointer stored at a specific location in the model.

### Row_Changed

- Goto spec in source

    procedure Row_Changed (Tree_Model: access Gtk_Tree_Model_Record'Class;Path: Gtk_Tree_Path;Iter: Gtk_Tree_Iter);

Emit the "row_changed" signal.

### Row_Inserted

- Goto spec in source

    procedure Row_Inserted (Tree_Model: access Gtk_Tree_Model_Record'Class;Path: Gtk_Tree_Path;Iter: Gtk_Tree_Iter);

Emit the "row_inserted" signal.

### Row_Has_Child_Toggled

- Goto spec in source

    procedure Row_Has_Child_Toggled (Tree_Model: access Gtk_Tree_Model_Record'Class;Path: Gtk_Tree_Path;Iter: Gtk_Tree_Iter);

Emit the "row_has_child_toggled" signal.

### Row_Deleted

- Goto spec in source

    procedure Row_Deleted (Tree_Model: access Gtk_Tree_Model_Record'Class;Path: Gtk_Tree_Path);

Emit the "row_has_child_toggled" signal.

### Rows_Reordered

- Goto spec in source

    procedure Rows_Reordered (Tree_Model: access Gtk_Tree_Model_Record'Class;Path: Gtk_Tree_Path;Iter: Gtk_Tree_Iter;New_Order: Gint_Array);

Emit the "rows_reordered" signal