## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

## Index

Package: Tree_Model_Filter

- Goto spec source

# Description

    package Gtk.Tree_Model_Filter is

A Gtk_Tree_Model_Filter is a tree model which wraps another tree model, and can do the following things:

- Filter specific rows, based on data from a "visible column", a column storing booleans indicating whether the row should be filtered or not, or based on the return value of a "visible function", which gets a model, iter and user_data and returns a boolean indicating whether the row should be filtered or not.

- Modify the "appearance" of the model, using a modify function. This is extremely powerful and allows for just changing some values and also for creating a completely different model based on the given child model.

- Set a different root node, also known as a "virtual root". You can pass in a Gtk_Tree_Path indicating the root node for the filter at construction time.

Binding from C File version 2.8.17

<testgtk>create_tree_filter.adb</testgtk>

# Packages

### Visible_Funcs (generic)

Full description

### Modify_Funcs (generic)

Full description

### 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_Model_Filter_Record,
          Gtk_Tree_Model_Filter);

# Classes

### Gtk_Tree_Model_Filter_Record

- Goto declaration in source

    type Gtk_Tree_Model_Filter_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:

Clear_Cache

- To API doc
- To spec

Convert_Child_Iter_To_Iter

- To API doc
- To spec

Convert_Child_Path_To_Path

- To API doc
- To spec

Convert_Iter_To_Child_Iter

- To API doc
- To spec

Convert_Path_To_Child_Path

- To API doc
- To spec

Get_Model

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

- To API doc
- To spec

Set_Modify_Func

- To API doc
- To spec

Set_Visible_Column

- To API doc
- To spec

Set_Visible_Func

- To API doc
- To spec

# Types

### Gtk_Tree_Model_Filter

- Goto declaration in source

    type Gtk_Tree_Model_Filter is access all Gtk_Tree_Model_Filter_Record'Class;

### Gtk_Tree_Model_Filter_Visible_Func

- Goto declaration in source

    type Gtk_Tree_Model_Filter_Visible_Func is access function
         (Model : access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class;
          Iter  : Gtk.Tree_Model.Gtk_Tree_Iter) return Boolean;

Called for each row in the model to decide whether or not it should be visible. True indicates the row should be made visible. Model is the child model, and Iter points into it.

### Gtk_Tree_Model_Filter_Modify_Func

- Goto declaration in source

    type Gtk_Tree_Model_Filter_Modify_Func is access procedure
         (Model  : access Gtk_Tree_Model_Filter_Record'Class;
          Iter   : Gtk.Tree_Model.Gtk_Tree_Iter;
          Value  : out Glib.Values.GValue;
          Column : Gint);

A function which calculates display values from raw values in the model. It must fill value with the display value for the column column in the row indicated by iter. Since this function is called for each data access, it's not a particularly efficient operation. Value has already been initializes to the right type (ie the one defined in Set_Modify_Func for this column). Iter references the filter model, not the child model. When implementating this procedure, make sure you do not call Get_String, Get_Int,... on Model itself, since that would create a recursion. You must apply all operations to Get_Model (Model), after converting Iter to a Child_Iter through Convert_Iter_To_Child_Iter

# Subprograms & Entries

### Gtk_New

- Goto spec in source

    procedure Gtk_New (Model: out Gtk_Tree_Model_Filter;Child_Model: access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class;Root: Gtk.Tree_Model.Gtk_Tree_Path := null);

### Initialize

- Goto spec in source

    procedure Initialize (Model: access Gtk_Tree_Model_Filter_Record'Class;Child_Model: access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class;Root: Gtk.Tree_Model.Gtk_Tree_Path := null);

Creates a new tree model, with Child_Model as the child_model and Root as the virtual root (or the same root as Child_Model by default).

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

### Get_Model

- Goto spec in source

    function Get_Model (Filter: access Gtk_Tree_Model_Filter_Record) return Gtk.Tree_Model.Gtk_Tree_Model;

Returns a pointer to the child model of Filter.

### Convert_Child_Iter_To_Iter

- Goto spec in source

    procedure Convert_Child_Iter_To_Iter (Filter: access Gtk_Tree_Model_Filter_Record;Filter_Iter: out Gtk.Tree_Model.Gtk_Tree_Iter;Child_Iter: Gtk.Tree_Model.Gtk_Tree_Iter);

Sets Filter_Iter to point to the row in Filter that corresponds to the row pointed at by Child_Iter.

### Convert_Child_Path_To_Path

- Goto spec in source

    function Convert_Child_Path_To_Path (Filter: access Gtk_Tree_Model_Filter_Record;Child_Path: Gtk.Tree_Model.Gtk_Tree_Path) return Gtk.Tree_Model.Gtk_Tree_Path;

Converts Child_Path to a path relative to Filter. That is, Child_Path points to a path in the child model. The returned path will point to the same row in the filtered model. If Child_Path isn't a valid path on the child model, then null is returned. The returned value must be freed with Path_Free.

### Convert_Iter_To_Child_Iter

- Goto spec in source

    procedure Convert_Iter_To_Child_Iter (Filter: access Gtk_Tree_Model_Filter_Record;Child_Iter: out Gtk.Tree_Model.Gtk_Tree_Iter;Filter_Iter: Gtk.Tree_Model.Gtk_Tree_Iter);

Sets Child_Iter to point to the row pointed to by Filter_Iter.

### Convert_Path_To_Child_Path

- Goto spec in source

    function Convert_Path_To_Child_Path (Filter: access Gtk_Tree_Model_Filter_Record;Filter_Path: Gtk.Tree_Model.Gtk_Tree_Path) return Gtk.Tree_Model.Gtk_Tree_Path;

Converts Filter_Path to a path on the child model of Filter. That is, Filter_Path points to a location in Filter. The returned path will point to the same location in the model not being filtered. If Filter_Path does not point to a location in the child model, null is returned. The returned value must be freed with Path_Free.

### Set_Visible_Column

- Goto spec in source

    procedure Set_Visible_Column (Filter: access Gtk_Tree_Model_Filter_Record;Column: Gint);

Sets Column of the child_model to be the column where Filter should look for visibility information. Columns should be a column of type GType_Boolean, where True means that a row is visible, and False if not.

### Set_Visible_Func

- Goto spec in source

    procedure Set_Visible_Func (Filter: access Gtk_Tree_Model_Filter_Record;Func: Gtk_Tree_Model_Filter_Visible_Func);

Sets the visible function used when filtering the Filter to be Func. The function should return True if the given row should be visible and False otherwise. If the condition calculated by the function changes over time (e.g. because it depends on some global parameters), you must call Refilter to keep the visibility information of the model uptodate.

### Refilter

- Goto spec in source

    procedure Refilter (Filter: access Gtk_Tree_Model_Filter_Record);

Emits row_changed for each row in the child model, which causes the filter to re-evaluate whether a row is visible or not.

### Set_Modify_Func

- Goto spec in source

    procedure Set_Modify_Func (Filter: access Gtk_Tree_Model_Filter_Record;Types: Glib.GType_Array;Func: Gtk_Tree_Model_Filter_Modify_Func);

Types can be used to override the column types that will be made visible to the parent model/view. Func is used to specify the modify function. The modify function will get called for *each* data access, the goal of the modify function is to return the data which should be displayed at the location specified using the parameters of the modify function.

### Clear_Cache

- Goto spec in source

    procedure Clear_Cache (Filter: access Gtk_Tree_Model_Filter_Record);

This function should almost never be called. It clears the Filter of any cached iterators that haven't been reffed with Gtk.Tree_Model.Ref_Node. This might be useful if the child model being filtered is static (and doesn't change often) and there has been a lot of unreffed access to nodes. As a side effect of this function, all unrefed iters will be invalid.

### +

- Goto spec in source

    function "+" (Model: access Gtk_Tree_Model_Filter_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_Model_Filter renames Implements_Drag_Source.To_Object;

Converts to and from the Gtk_Tree_Drag_Source interface