[][src]Trait gtk::TreeModelFilterExt

pub trait TreeModelFilterExt: 'static {
    fn clear_cache(&self);
fn convert_child_iter_to_iter(
        &self,
        child_iter: &TreeIter
    ) -> Option<TreeIter>;
fn convert_child_path_to_path(
        &self,
        child_path: &TreePath
    ) -> Option<TreePath>;
fn convert_iter_to_child_iter(&self, filter_iter: &TreeIter) -> TreeIter;
fn convert_path_to_child_path(
        &self,
        filter_path: &TreePath
    ) -> Option<TreePath>;
fn get_model(&self) -> Option<TreeModel>;
fn refilter(&self);
fn set_visible_column(&self, column: i32);
fn set_visible_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
        &self,
        func: P
    );
fn get_property_child_model(&self) -> Option<TreeModel>; }

Trait containing all TreeModelFilter methods.

Implementors

TreeModelFilter

Required methods

fn clear_cache(&self)

This function should almost never be called. It clears the self of any cached iterators that haven’t been reffed with TreeModel::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 unreffed iters will be invalid.

fn convert_child_iter_to_iter(&self, child_iter: &TreeIter) -> Option<TreeIter>

Sets filter_iter to point to the row in self that corresponds to the row pointed at by child_iter. If filter_iter was not set, false is returned.

filter_iter

An uninitialized TreeIter.

child_iter

A valid TreeIter pointing to a row on the child model.

Returns

true, if filter_iter was set, i.e. if child_iter is a valid iterator pointing to a visible row in child model.

fn convert_child_path_to_path(&self, child_path: &TreePath) -> Option<TreePath>

Converts child_path to a path relative to self. That is, child_path points to a path in the child model. The rerturned path will point to the same row in the filtered model. If child_path isn’t a valid path on the child model or points to a row which is not visible in self, then None is returned.

child_path

A TreePath to convert.

Returns

A newly allocated TreePath, or None.

fn convert_iter_to_child_iter(&self, filter_iter: &TreeIter) -> TreeIter

Sets child_iter to point to the row pointed to by filter_iter.

child_iter

An uninitialized TreeIter.

filter_iter

A valid TreeIter pointing to a row on self.

fn convert_path_to_child_path(&self, filter_path: &TreePath) -> Option<TreePath>

Converts filter_path to a path on the child model of self. That is, filter_path points to a location in self. 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, None is returned.

filter_path

A TreePath to convert.

Returns

A newly allocated TreePath, or None.

fn get_model(&self) -> Option<TreeModel>

Returns a pointer to the child model of self.

Returns

A pointer to a TreeModel.

fn refilter(&self)

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

fn set_visible_column(&self, column: i32)

Sets column of the child_model to be the column where self should look for visibility information. columns should be a column of type G_TYPE_BOOLEAN, where true means that a row is visible, and false if not.

Note that TreeModelFilterExt::set_visible_func or TreeModelFilterExt::set_visible_column can only be called once for a given filter model.

column

A gint which is the column containing the visible information

fn set_visible_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
    &self,
    func: P
)

Sets the visible function used when filtering the self 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 TreeModelFilterExt::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 TreeModelFilterExt::set_visible_func or TreeModelFilterExt::set_visible_column can only be called once for a given filter model.

func

A GtkTreeModelFilterVisibleFunc, the visible function

data

User data to pass to the visible function, or None

destroy

Destroy notifier of data, or None

fn get_property_child_model(&self) -> Option<TreeModel>

Loading content...

Implementors

impl<O: IsA<TreeModelFilter>> TreeModelFilterExt for O[src]

Loading content...