_
ModelThe 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.
Widget Hierarchy |
---|
GObject (see section Package Glib.Object)
Gtk_Object (see section Package Gtk.Object)
\___ Gtk_Tree_Model (see section Package Gtk.Tree
|
Signals |
---|
Types |
---|
type Gtk_Tree_Iter is private; | |
| |
type Gtk_Tree_Path is new Glib.C_Proxy; | |
| |
type Gtk_Tree_Row_Reference is new Glib.C_Proxy; | |
| |
type Tree_Model_Flags is mod 2 ** 32; | |
|
Subprograms |
---|
Tree models | ||
function Get_Type return Glib.GType; | ||
Return the internal value associated with a Gtk_Tree_Model.
| ||
function Get_Flags (Model : access Gtk_Tree_Model_Record) return Tree_Model_Flags; | ||
Return a set of flags supported by this interface. The flags | ||
function Get_N_Columns (Tree_Model : access Gtk_Tree_Model_Record) return Gint; | ||
Return the number of columns supported by Tree_Model.
| ||
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.
| ||
Paths manipulation | ||
function Gtk_New (Path : String := "") return Gtk_Tree_Path; | ||
Create a new Gtk_Tree_Path from a path string. | ||
function To_String (Path : Gtk_Tree_Path) return String; | ||
Generate a string representation of the path. | ||
procedure Append_Index (Path : Gtk_Tree_Path; Index : Gint); | ||
Append a new index to a path. | ||
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 | ||
function Get_Depth (Path : Gtk_Tree_Path) return Gint; | ||
Return the current depth of Path.
| ||
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, | ||
procedure Path_Free (Path : Gtk_Tree_Path); | ||
Free the memory allocated for Path.
| ||
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 | ||
function Compare (A, B : Gtk_Tree_Path) return Gint; | ||
Compare two paths. If A appears before B in a tree, then -1 is | ||
procedure Next (Path : Gtk_Tree_Path); | ||
Move the Path to point to the next node at the current depth. In effect, | ||
function Prev (Path : Gtk_Tree_Path) return Boolean; | ||
Move Path to point to the previous node at the current depth, | ||
function Up (Path : Gtk_Tree_Path) return Boolean; | ||
Moves the Path to point to it's parent node, if it has a parent. | ||
procedure Down (Path : Gtk_Tree_Path); | ||
Moves Path to point to the first child of the current path.
| ||
function Is_Ancestor (Path, Descendant : Gtk_Tree_Path) return Boolean; | ||
Return True if Descendant is contained inside Path.
| ||
function Is_Descendant (Path, Ancestor : Gtk_Tree_Path) return Boolean; | ||
Return True if Path is contained inside Ancestor.
| ||
Row_Reference manipulation | ||
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 | ||
function Get_Path (Reference : Gtk_Tree_Row_Reference) return Gtk_Tree_Path; | ||
Return the path that Reference currently points to. | ||
function Valid (Reference : Gtk_Tree_Row_Reference) return Boolean; | ||
Return True if Reference is non null and is still valid.
| ||
procedure Row_Reference_Free (Reference : Gtk_Tree_Row_Reference); | ||
Free the memory occupied by Reference.
| ||
Iterators | ||
??? Need to be able to access the user_data fields, so that new models | ||
procedure Iter_Copy (Source : Gtk_Tree_Iter; Dest : out Gtk_Tree_Iter); | ||
Create a copy of Source.
| ||
procedure Set_Tree_Iter (Val : in out Glib.Values.GValue; Iter : Gtk_Tree_Iter); | ||
Set the value of the given GValue to Iter. | ||
procedure Get_Tree_Iter (Val : Glib.Values.GValue; Iter : out Gtk_Tree_Iter); | ||
Extract the iterator from the given GValue. | ||
function Get_Iter (Tree_Model : access Gtk_Tree_Model_Record; Path : Gtk_Tree_Path) return Gtk_Tree_Iter; | ||
Return an iterator pointing to Path. | ||
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. | ||
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. | ||
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. | ||
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. | ||
function Children (Tree_Model : access Gtk_Tree_Model_Record; Parent : Gtk_Tree_Iter) return Gtk_Tree_Iter; | ||
Return the first child of Parent. | ||
function Has_Child (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter) return Boolean; | ||
Return True if Iter has children, False otherwise.
| ||
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. | ||
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. | ||
function Parent (Tree_Model : access Gtk_Tree_Model_Record; Child : Gtk_Tree_Iter) return Gtk_Tree_Iter; | ||
Return the parent of Child. | ||
procedure Ref_Node (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter); | ||
Let the tree reference the node. | ||
procedure Unref_Node (Tree_Model : access Gtk_Tree_Model_Record; Iter : Gtk_Tree_Iter); | ||
Let the tree unref the node. | ||
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. | ||
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.
| ||
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.
| ||
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.
| ||
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.
| ||
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.
| ||
Signals | ||
procedure Row_Changed (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter); | ||
Emit the "row_changed" signal.
| ||
procedure Row_Inserted (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path; Iter : Gtk_Tree_Iter); | ||
Emit the "row_inserted" signal.
| ||
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.
| ||
procedure Row_Deleted (Tree_Model : access Gtk_Tree_Model_Record'Class; Path : Gtk_Tree_Path); | ||
Emit the "row_has_child_toggled" signal.
| ||
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
|