## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

## Index

Package: Tree_Store

- Goto spec source

# Description

    package Gtk.Tree_Store is

This package implements a specific model to store your data in. It is basically similar to a small database, in that each field can contain any number of columns.

Each column can contain a different type of data, specified when the model is created.

Adding new values in the model is done as in the example at the end.

Binding from C File version 2.8.17

# Packages

### Generic_Set (generic)

Full description

### Implements_Tree_Sortable (new Glib.Types.Implements)

    package Implements_Tree_Sortable is new Glib.Types.Implements
         (Gtk.Tree_Sortable.Gtk_Tree_Sortable,
          Gtk_Tree_Store_Record,
          Gtk_Tree_Store);

### Implements_Drag_Source (new Glib.Types.Implements)

    package Implements_Drag_Source is new Glib.Types.Implements
         (Gtk.Tree_Dnd.Gtk_Tree_Drag_Source,
          Gtk_Tree_Store_Record,
          Gtk_Tree_Store);

### Implements_Drag_Dest (new Glib.Types.Implements)

    package Implements_Drag_Dest is new Glib.Types.Implements
         (Gtk.Tree_Dnd.Gtk_Tree_Drag_Dest,
          Gtk_Tree_Store_Record,
          Gtk_Tree_Store);

# Classes

### Gtk_Tree_Store_Record

- Goto declaration in source

    type Gtk_Tree_Store_Record is
         new Gtk.Tree_Model.Gtk_Tree_Model_Record with null record;

#### Ancestors:

Gtk.Tree_Model.Gtk_Tree_Model_Record
Glib.Object.GObject_Record

#### Primitive operations:

Append

- To API doc
- To spec

Clear

- 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.Tree_Model.Children

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Foreach

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Address

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Boolean

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_C_Proxy

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Column_Type

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Flags

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Int

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Iter

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Iter_First

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Iter_From_String

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_N_Columns

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Object

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Path

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_String

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_String_From_Iter

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Get_Value

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Gtk_New

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Has_Child

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.N_Children

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Next

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Nth_Child

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Parent

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Ref_Node

- To API doc
- To spec

(Inherited)
Gtk.Tree_Model.Unref_Node

- To API doc
- To spec

(Inherited)
Insert

- To API doc
- To spec

Insert_After

- To API doc
- To spec

Insert_Before

- To API doc
- To spec

Is_Ancestor

- To API doc
- To spec

Iter_Depth

- To API doc
- To spec

Iter_Is_Valid

- To API doc
- To spec

Move_After

- To API doc
- To spec

Move_Before

- To API doc
- To spec

Prepend

- To API doc
- To spec

Remove

- To API doc
- To spec

Reorder

- To API doc
- To spec

Set

- To API doc
- To spec

Set

- To API doc
- To spec

Set

- To API doc
- To spec

Set

- To API doc
- To spec

Set

- To API doc
- To spec

Set

- To API doc
- To spec

Set_Column_Types

- To API doc
- To spec

Set_Value

- To API doc
- To spec

Swap

- To API doc
- To spec

# Types

### Gtk_Tree_Store

- Goto declaration in source

    type Gtk_Tree_Store is access all Gtk_Tree_Store_Record'Class;

# Subprograms & Entries

### Gtk_New

- Goto spec in source

    procedure Gtk_New (Tree_Store: out Gtk_Tree_Store;Types: GType_Array);

Create a new tree store using Types to fill the columns.

### Initialize

- Goto spec in source

    procedure Initialize (Tree_Store: access Gtk_Tree_Store_Record'Class;Types: GType_Array);

Internal initialization function. See the section "Creating your own widgets" in the documentation.

### Get_Type

- Goto spec in source
- Goto body in source

    function Get_Type return Glib.GType;

Return the internal value associated with this widget.

### Set_Column_Types

- Goto spec in source

    procedure Set_Column_Types (Tree_Store: access Gtk_Tree_Store_Record;Types: GType_Array);

This function is meant primarily for GObjects that inherit from Gtk_Tree_Store, and should only be used when constructing a new Gtk_Tree_Store. It will not function after a row has been added, or a method on the Gtk_Tree_Model interface is called.

### Set_Value

- Goto spec in source

    procedure Set_Value (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Column: Gint;Value: Glib.Values.GValue);

Set a new value in the model. The value is added in the column Column, and in the line Iter. This is the most general of the Set procedures, since it allows you to control what should be done when the cell is freed (useful for instance for reference-controlled types). In particular, you would create a GValue of a special type derived from Boxed (see Glib.Value.Set_Boxed). The type of the column must be of the type stored in the GValue itself. Referencing the example given for Set_Boxed, this would be the value in "Typ".

### Set

- Goto spec in source

    procedure Set (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Column: Gint;Value: UTF8_String);

Same as Generic_Set, but tailored to use with a string.

### Set

- Goto spec in source

    procedure Set (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Column: Gint;Value: Boolean);

Same as Generic_Set, but tailored to use with a boolean.

### Set

- Goto spec in source

    procedure Set (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Column: Gint;Value: Gint);

Same as Generic_Set, but tailored to use with an integer.

### Set

- Goto spec in source

    procedure Set (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Column: Gint;Value: Glib.C_Proxy);

Same as Generic_Set, but tailored for Gdk types.

### Set

- Goto spec in source

    procedure Set (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Column: Gint;Address: System.Address);

Same as Generic_Set, for a generic address

### Set

- Goto spec in source

    procedure Set (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Column: Gint;Value: Glib.Object.GObject);

Same as Generic_Set, but tailored to objects/widgets.

### Remove

- Goto spec in source

    procedure Remove (Tree_Store: access Gtk_Tree_Store_Record;Iter: in out Gtk.Tree_Model.Gtk_Tree_Iter);

Remove Iter from Tree_Store. After being removed, Iter is set to Null_Iter.

### Insert

- Goto spec in source

    procedure Insert (Tree_Store: access Gtk_Tree_Store_Record;Iter: in out Gtk.Tree_Model.Gtk_Tree_Iter;Parent: Gtk.Tree_Model.Gtk_Tree_Iter;Position: Gint);

Create a new row at Position. If parent is non-null, then the row will be made a child of Parent. Otherwise, the row will be created at the toplevel. If Position is larger than the number of rows at that level, then the new row will be inserted to the end of the list. Iter will be changed to point to this new row. The row will be empty before this function is called. To fill in values, you need to call Set_Value.

### Insert_Before

- Goto spec in source

    procedure Insert_Before (Tree_Store: access Gtk_Tree_Store_Record;Iter: in out Gtk.Tree_Model.Gtk_Tree_Iter;Parent: Gtk.Tree_Model.Gtk_Tree_Iter;Sibling: Gtk.Tree_Model.Gtk_Tree_Iter);

Insert a new row before Sibling. If Sibling is Null_Iter, then the row will be appended to the beginning of the Parent's children. If Parent and Sibling are Null_Iter, then the row will be appended to the toplevel. If both Sibling and Parent are set, then Parent must be the parent of Sibling. When Sibling is set, Parent is optional. Iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call Set_Value.

### Insert_After

- Goto spec in source

    procedure Insert_After (Tree_Store: access Gtk_Tree_Store_Record;Iter: in out Gtk.Tree_Model.Gtk_Tree_Iter;Parent: Gtk.Tree_Model.Gtk_Tree_Iter;Sibling: Gtk.Tree_Model.Gtk_Tree_Iter);

Insert a new row after Sibling. If Sibling is Null_Iter, then the row will be prepended to the beginning of the Parent's children. If Parent and Sibling are Null_Iter, then the row will be prepended to the toplevel. If both Sibling and Parent are set, then Parent must be the parent of Sibling. When Sibling is set, Parent is optional. Iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call Set_Value.

### Prepend

- Goto spec in source

    procedure Prepend (Tree_Store: access Gtk_Tree_Store_Record;Iter: in out Gtk.Tree_Model.Gtk_Tree_Iter;Parent: Gtk.Tree_Model.Gtk_Tree_Iter);

Prepend a new row to Tree_Store. If Parent is non-null, then it will prepend the new row before the first child of Parent, otherwise it will prepend a row to the top level. Iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call Set_Value. The efficiency of this procedure is O(N).

### Append

- Goto spec in source

    procedure Append (Tree_Store: access Gtk_Tree_Store_Record;Iter: in out Gtk.Tree_Model.Gtk_Tree_Iter;Parent: Gtk.Tree_Model.Gtk_Tree_Iter);

Append a new row to Tree_Store. If Parent is non-null, then it will append the new row after the last child of Parent, otherwise it will append a row to the top level. Iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call Set_Value. The efficiency of this procedure is O(N^2).

### Is_Ancestor

- Goto spec in source

    function Is_Ancestor (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Descendant: Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean;

Return True if Iter is an ancestor of Descendant. That is, Iter is the parent (or grandparent or great-grandparent) of Descendant.

### Iter_Depth

- Goto spec in source

    function Iter_Depth (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter) return Gint;

Returns the depth of Iter. This will be 0 for anything on the root level, 1 for anything down a level, etc.

### Iter_Is_Valid

- Goto spec in source

    function Iter_Is_Valid (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean;

WARNING: This function is slow. Only use it for debugging and/or testing purposes. Checks if the given iter is a valid iter for Tree_Store.

### Move_After

- Goto spec in source

    procedure Move_After (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Position: Gtk.Tree_Model.Gtk_Tree_Iter);

Moves the row pointed to by Iter to the position after Position. Iter and Position should be in the same level. Note that this function only works with unsorted stores. If Position is Null_Iter, Iter will be moved to the start of the level.

### Move_Before

- Goto spec in source

    procedure Move_Before (Tree_Store: access Gtk_Tree_Store_Record;Iter: Gtk.Tree_Model.Gtk_Tree_Iter;Position: Gtk.Tree_Model.Gtk_Tree_Iter);

Moves the row pointed to by Iter to the position before Position. Iter and Position should be in the same level. Note that this function only works with unsorted stores. If Position is Null_Iter, Iter will be

### Clear

- Goto spec in source

    procedure Clear (Tree_Store: access Gtk_Tree_Store_Record);

Removes all rows from Tree_Store

### Reorder

- Goto spec in source

    procedure Reorder (Tree_Store: access Gtk_Tree_Store_Record;Parent: Gtk.Tree_Model.Gtk_Tree_Iter;New_Order: Glib.Gint_Array);

Reorders the children of Parent to follow the order indicated by New_order. Note that this function only works with unsorted stores. New order is an array of integers mapping the new position of each child to its old position before the re-ordering, i.e. New_order[newpos] = oldpos If Parent is Null_Iter, it also reorders the root nodes

### Swap

- Goto spec in source

    procedure Swap (Tree_Store: access Gtk_Tree_Store_Record;A: Gtk.Tree_Model.Gtk_Tree_Iter;B: Gtk.Tree_Model.Gtk_Tree_Iter);

Swaps the rows pointed to by A and B (in the same level). Note that this function only works with unsorted stores.

### Freeze_Sort

- Goto spec in source

    function Freeze_Sort (Tree: access Gtk.Tree_Store.Gtk_Tree_Store_Record'Class) return Gint;

Freeze the sorting in the tree view, and returns the current sort_column_id, which should be used when thawing. (See Thaw_Sort)

### Thaw_Sort

- Goto spec in source

    procedure Thaw_Sort (Tree: access Gtk.Tree_Store.Gtk_Tree_Store_Record'Class;Column_Id: Gint);

Thaw a frozen tree_view. Column_Id should be the value returned by the corresponding call to Freeze_Sort.

### +

- Goto spec in source

    function "+" (Model: access Gtk_Tree_Store_Record'Class) return Gtk.Tree_Sortable.Gtk_Tree_Sortable renames Implements_Tree_Sortable.To_Interface;

### -

- Goto spec in source

    function "-" (Sortable: Gtk.Tree_Sortable.Gtk_Tree_Sortable) return Gtk_Tree_Store renames Implements_Tree_Sortable.To_Object;

Converts to and from the Gtk_Tree_Sortable interface

### +

- Goto spec in source

    function "+" (Model: access Gtk_Tree_Store_Record'Class) return Gtk.Tree_Dnd.Gtk_Tree_Drag_Source renames Implements_Drag_Source.To_Interface;

### -

- Goto spec in source

    function "-" (Drag_Source: Gtk.Tree_Dnd.Gtk_Tree_Drag_Source) return Gtk_Tree_Store renames Implements_Drag_Source.To_Object;

Converts to and from the Gtk_Tree_Drag_Source interface

### +

- Goto spec in source

    function "+" (Model: access Gtk_Tree_Store_Record'Class) return Gtk.Tree_Dnd.Gtk_Tree_Drag_Dest renames Implements_Drag_Dest.To_Interface;

### -

- Goto spec in source

    function "-" (Drag_Dest: Gtk.Tree_Dnd.Gtk_Tree_Drag_Dest) return Gtk_Tree_Store renames Implements_Drag_Dest.To_Object;

Converts to and from the Gtk_Tree_Drag_Source interface