gtk4::prelude

Trait TreeModelFilterExt

Source
pub trait TreeModelFilterExt: IsA<TreeModelFilter> + 'static {
    // Provided methods
    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 model(&self) -> 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 child_model(&self) -> Option<TreeModel> { ... }
}
👎Deprecated: Since 4.10
Expand description

Trait containing all TreeModelFilter methods.

§Implementors

TreeModelFilter

Provided Methods§

Source

fn clear_cache(&self)

👎Deprecated: Since 4.10

This function should almost never be called. It clears the @self 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 unreffed iters will be invalid.

§Deprecated since 4.10
Source

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

👎Deprecated: Since 4.10

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.

§Deprecated since 4.10
§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.

§filter_iter

An uninitialized TreeIter

Source

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

👎Deprecated: Since 4.10

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.

§Deprecated since 4.10
§child_path

A TreePath to convert.

§Returns

A newly allocated TreePath

Source

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

👎Deprecated: Since 4.10

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

§Deprecated since 4.10
§filter_iter

A valid TreeIter pointing to a row on @self.

§Returns
§child_iter

An uninitialized TreeIter

Source

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

👎Deprecated: Since 4.10

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.

§Deprecated since 4.10
§filter_path

A TreePath to convert.

§Returns

A newly allocated TreePath

Source

fn model(&self) -> TreeModel

👎Deprecated: Since 4.10

Returns a pointer to the child model of @self.

§Deprecated since 4.10
§Returns

A pointer to a TreeModel

Source

fn refilter(&self)

👎Deprecated: Since 4.10

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

§Deprecated since 4.10
Source

fn set_visible_column(&self, column: i32)

👎Deprecated: Since 4.10

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

§Deprecated since 4.10
§column

A int which is the column containing the visible information

Source

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

👎Deprecated: Since 4.10

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

⚠️ The following code is in C ⚠️

static gboolean
visible_func (GtkTreeModel *model,
              GtkTreeIter  *iter,
              gpointer      data)
{
  // Visible if row is non-empty and first column is “HI”
  char *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.

§Deprecated since 4.10
§func

A GtkTreeModelFilterVisibleFunc, the visible function

Source

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

👎Deprecated: Since 4.10

The child model of the tree model filter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§