Gtk.Tree_Model_Filter.Set_Visible_Func_User_Data

Entities

Generic formal parameters

Access Types

Subprograms

Description

Destroy

procedure Destroy (Data : in out User_Data_Type)
Parameters
Data

Gtk_Tree_Model_Filter_Visible_Func

type Gtk_Tree_Model_Filter_Visible_Func is access function
  (Model : Gtk.Tree_Model.Gtk_Tree_Model;
   Iter  : Gtk.Tree_Model.Gtk_Tree_Iter;
   Data  : User_Data_Type) return Boolean;

A function which decides whether the row indicated by Iter is visible.

Parameters
Model

the child model of the Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter

Iter

a Gtk.Tree_Model.Gtk_Tree_Iter pointing to the row in Model whose visibility is determined

Data

user data given to Gtk.Tree_Model_Filter.Set_Visible_Func

Return Value

Whether the row indicated by Iter is visible.

Set_Visible_Func

procedure Set_Visible_Func
   (Self : not null access Gtk.Tree_Model_Filter.Gtk_Tree_Model_Filter_Record'Class;
    Func : Gtk_Tree_Model_Filter_Visible_Func;
    Data : User_Data_Type)

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 Gtk.Tree_Model_Filter.Refilter to keep the visibility information of the model up-to-date. Note that Func is called whenever a row is inserted, when it may still be empty. The visible function should therefore take special care of empty rows, like in the example below.

static gboolean
visible_func (GtkTreeModel *model,
              GtkTreeIter  *iter,
              gpointer      data)
{
  // Visible if row is non-empty and first column is "HI"
  gchar *str;
  gboolean visible = FALSE;

  gtk_tree_model_get (model, iter, 0, &str, -1);
  if (str && strcmp (str, "HI") == 0)
    visible = TRUE;
  g_free (str);

  return visible;
}

Note that Gtk.Tree_Model_Filter.Set_Visible_Func or Gtk.Tree_Model_Filter.Set_Visible_Column can only be called once for a given filter model. Since: gtk+ 2.4

Parameters
Self
Func

A Gtk_Tree_Model_Filter_Visible_Func, the visible function

Data

User data to pass to the visible function, or null

User_Data_Type

type User_Data_Type (<>) is private;