Main Page Widgets Namespaces Book

# Gtk::TreeModelFilter Class Reference
[TreeView Classes]

Inheritance diagram for Gtk::TreeModelFilter:

[legend]
List of all members.

## Public Types

typedef sigc::slot< bool, const TreeModel::const_iterator& > | SlotVisible
| For instance, bool on_visible(const TreeModel::const_iterator& iter); This should return true if the given row should be visible and false otherwise.
typedef sigc::slot< void, const Gtk::TreeModel::iterator&, Glib::ValueBase&, int > | SlotModify
| For instance, void on_modify(const Gtk::TreeModel::iterator& iter, Glib::ValueBase& value, int column); where iter is an iterator to a row in the child model, value is an output parameter in which you must store the value to be used in the parent model's row, column is the column in the parent row whose row value you must provide in the value output paramater.

## Public Member Functions

virtual | ~TreeModelFilter ()
GtkTreeModelFilter* | gobj ()
| Provides access to the underlying C GObject.
const GtkTreeModelFilter* | gobj () const
| Provides access to the underlying C GObject.
GtkTreeModelFilter* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | set_visible_func (const SlotVisible& slot)
| Sets the "visible" callback used when filtering the filter.
void | set_modify_func (const TreeModelColumnRecord& columns, const SlotModify& slot)
void | set_visible_column (const TreeModelColumnBase& column)
| Sets column of the child_model to be the column where filter should look for visibility information.
void | set_visible_column (int column)
| Sets column of the child_model to be the column where filter should look for visibility information.
Glib::RefPtr<TreeModel> | get_model ()
| Returns a pointer to the child model of filter .
Glib::RefPtr<const TreeModel> | get_model () const
| Returns a pointer to the child model of filter .
iterator | convert_child_iter_to_iter (const iterator& child_iter) const
| Gets an iterator that points to the sorted row that corresponds to the child row pointed at by child_iter.
iterator | convert_iter_to_child_iter (const iterator& filter_iter) const
| Gets an iterator that points to the child row that corresponds to the sorted row pointed at by sorted_iter.
Path | convert_child_path_to_path (const Path& child_path)
| Converts child_path to a path relative to filter .
Path | convert_path_to_child_path (const Path& filter_path)
| Converts filter_path to a path on the child model of filter .
void | refilter ()
| Emits ::row_changed for each row in the child model, which causes the filter to re-evaluate whether a row is visible or not.
void | clear_cache ()
| This function should almost never be called.

## Static Public Member Functions

Glib::RefPtr<TreeModelFilter> | create (const Glib::RefPtr<TreeModel>& child_model, const TreeModel::Path& root)
| This creates a TreeModelFilter with child_model as the child model, and root as the virtual root.

## Protected Member Functions

| TreeModelFilter (const Glib::RefPtr<TreeModel>& child_model, const TreeModel::Path& root)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr<Gtk::TreeModelFilter> | wrap (GtkTreeModelFilter* object, bool take_copy=false)

## Member Typedef Documentation

typedef sigc::slot<void, const Gtk::TreeModel::iterator& , Glib::ValueBase& , int > Gtk::TreeModelFilter::SlotModify

| For instance, void on_modify(const Gtk::TreeModel::iterator& iter, Glib::ValueBase& value, int column); where iter is an iterator to a row in the child model, value is an output parameter in which you must store the value to be used in the parent model's row, column is the column in the parent row whose row value you must provide in the value output paramater.

typedef sigc::slot<bool, const TreeModel::const_iterator&> Gtk::TreeModelFilter::SlotVisible

| For instance, bool on_visible(const TreeModel::const_iterator& iter); This should return true if the given row should be visible and false otherwise.

## Constructor & Destructor Documentation

virtual Gtk::TreeModelFilter::~TreeModelFilter | ( |  | ) | `[virtual]`

Gtk::TreeModelFilter::TreeModelFilter | ( | const Glib::RefPtr<TreeModel>& | child_model,
|  | const TreeModel::Path& | root
| ) | `[explicit, protected]`

## Member Function Documentation

void Gtk::TreeModelFilter::clear_cache | ( |  | ) |

| This function should almost never be called. It clears the filter of any cached iterators that haven't been reffed with 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 itters will be invalid. Since: 2.4

iterator Gtk::TreeModelFilter::convert_child_iter_to_iter | ( | const iterator& | child_iter | ) | const

Gets an iterator that points to the sorted row that corresponds to the child row pointed at by child_iter.

Parameters:

  | child_iter | A valid iterator pointing to a row on the child model.

Returns:
  A valid iterator that points to the row in this sorted model.

Path Gtk::TreeModelFilter::convert_child_path_to_path | ( | const Path& | child_path | ) |

Converts child_path to a path relative to filter .

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, then `0` is returned.

Parameters:

  | child_path | A Gtk::TreePath to convert.

Returns:
  A newly allocated Gtk::TreePath, or `0`.

Since: 2.4.

iterator Gtk::TreeModelFilter::convert_iter_to_child_iter | ( | const iterator& | filter_iter | ) | const

Gets an iterator that points to the child row that corresponds to the sorted row pointed at by sorted_iter.

Parameters:

  | filter_iter | A valid iterator pointing to a row on the sorted model.

Returns:
  A valid iterator that points to the row in the child model.

Path Gtk::TreeModelFilter::convert_path_to_child_path | ( | const Path& | filter_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, `0` is returned.

Parameters:

  | filter_path | A Gtk::TreePath to convert.

Returns:
  A newly allocated Gtk::TreePath, or `0`.

Since: 2.4.

Glib::RefPtr<TreeModelFilter> Gtk::TreeModelFilter::create | ( | const Glib::RefPtr<TreeModel>& | child_model,
|  | const TreeModel::Path& | root
| ) | `[static]`

| This creates a TreeModelFilter with child_model as the child model, and root as the virtual root. You can use set_visible_func(), set_visible_column() and/or set_modify_func() to change the mapping of child model to parent model.

Glib::RefPtr<const TreeModel> Gtk::TreeModelFilter::get_model | ( |  | ) | const

Returns a pointer to the child model of filter .

Returns:
  A pointer to a Gtk::TreeModel.

Since: 2.4.

Glib::RefPtr<TreeModel> Gtk::TreeModelFilter::get_model | ( |  | ) |

Returns a pointer to the child model of filter .

Returns:
  A pointer to a Gtk::TreeModel.

Since: 2.4.

const GtkTreeModelFilter* Gtk::TreeModelFilter::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C GObject. Reimplemented from Gtk::TreeModel.

GtkTreeModelFilter* Gtk::TreeModelFilter::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C GObject. Reimplemented from Gtk::TreeModel.

GtkTreeModelFilter* Gtk::TreeModelFilter::gobj_copy | ( |  | ) |

| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

void Gtk::TreeModelFilter::refilter | ( |  | ) |

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

void Gtk::TreeModelFilter::set_modify_func | ( | const TreeModelColumnRecord& | columns,
|  | const SlotModify& | slot
| ) |

void Gtk::TreeModelFilter::set_visible_column | ( | int | column | ) |

Sets column of the child_model to be the column where filter 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.

Since: 2.4

Parameters:

  | column | A `int` which is the column containing the visible information.

void Gtk::TreeModelFilter::set_visible_column | ( | const TreeModelColumnBase& | column | ) |

Sets column of the child_model to be the column where filter 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.

Since: 2.4

Parameters:

  | column | A `int` which is the column containing the visible information.

void Gtk::TreeModelFilter::set_visible_func | ( | const SlotVisible& | slot | ) |

Sets the "visible" callback used when filtering the filter.

The callback function should return true if the given row should be visible and false otherwise.

Parameters:

  | slot | A callback slot which determines whether the row should be visible.

## Friends And Related Function Documentation

Glib::RefPtr<Gtk::TreeModelFilter> wrap | ( | GtkTreeModelFilter* | object,
|  | bool | take_copy = `false`
| ) | `[related]`

Parameters:

  | object | The C instance
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- treemodelfilter.h