Ardour  9.0-pre0-582-g084a23a80d
Gtk::TreeModelFilter Class Reference

#include <treemodelfilter.h>

Inheritance diagram for Gtk::TreeModelFilter:
[legend]

Public Types

typedef sigc::slot< bool, const TreeModel::const_iterator & > SlotVisible
 
typedef sigc::slot< void, const Gtk::TreeModel::iterator &, Glib::ValueBase &, int > SlotModify
 
- Public Types inherited from Gtk::TreeModel
typedef TreeModelColumnRecord ColumnRecord
 
typedef TreeNodeChildren Children
 
typedef Children::iterator iterator
 
typedef Children::reverse_iterator reverse_iterator
 
typedef Children::const_iterator const_iterator
 
typedef Children::const_reverse_iterator const_reverse_iterator
 
typedef TreeRow Row
 
typedef TreePath Path
 
typedef TreeRowReference RowReference
 
typedef sigc::slot< bool, const TreeModel::iterator & > SlotForeachIter
 
typedef sigc::slot< bool, const TreeModel::Path & > SlotForeachPath
 
typedef sigc::slot< bool, const TreeModel::Path &, const TreeModel::iterator & > SlotForeachPathAndIter
 

Public Member Functions

virtual ~TreeModelFilter ()
 
GtkTreeModelFiltergobj ()
 Provides access to the underlying C GObject. More...
 
const GtkTreeModelFiltergobj () const
 Provides access to the underlying C GObject. More...
 
GtkTreeModelFiltergobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
void set_visible_func (const SlotVisible &slot)
 
void set_modify_func (const TreeModelColumnRecord &columns, const SlotModify &slot)
 
void set_visible_column (const TreeModelColumnBase &column)
 
void set_visible_column (int column)
 
Glib::RefPtr< TreeModelget_model ()
 
Glib::RefPtr< const TreeModelget_model () const
 
iterator convert_child_iter_to_iter (const iterator &child_iter) const
 
iterator convert_iter_to_child_iter (const iterator &filter_iter) const
 
Path convert_child_path_to_path (const Path &child_path)
 
Path convert_path_to_child_path (const Path &filter_path)
 
Path convert_child_path_to_path (const Path &child_path) const
 
Path convert_path_to_child_path (const Path &filter_path) const
 
void refilter ()
 
void clear_cache ()
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TreeModel > > property_child_model () const
 
Glib::PropertyProxy_ReadOnly< TreeModel::Pathproperty_virtual_root () const
 
- Public Member Functions inherited from Gtk::TreeModel
virtual ~TreeModel ()
 
GtkTreeModelgobj ()
 Provides access to the underlying C GObject. More...
 
const GtkTreeModelgobj () const
 Provides access to the underlying C GObject. More...
 
iterator get_iter (const Path &path)
 
iterator get_iter (const Glib::ustring &path_string)
 
Children children ()
 This returns an STL-like container API, for iterating over the rows. More...
 
Children children () const
 This returns an STL-like container API, for iterating over the rows. More...
 
void foreach_iter (const SlotForeachIter &slot)
 
void foreach_path (const SlotForeachPath &slot)
 
void foreach (const SlotForeachPathAndIter &slot)
 
TreeModelFlags get_flags () const
 
int get_n_columns () const
 
GType get_column_type (int index) const
 
TreeModel::Path get_path (const iterator &iter) const
 
void row_changed (const Path &path, const iterator &iter)
 
void row_inserted (const Path &path, const iterator &iter)
 
void row_has_child_toggled (const Path &path, const iterator &iter)
 
void row_deleted (const Path &path)
 
void rows_reordered (const Path &path, const iterator &iter, const Glib::ArrayHandle< int > &new_order)
 
void rows_reordered (const Path &path, const Glib::ArrayHandle< int > &new_order)
 
void rows_reordered (const Path &path, const iterator &iter, int *new_order)
 
Glib::ustring get_string (const iterator &iter) const
 
Glib::SignalProxy2< void, const TreeModel::Path &, const TreeModel::iterator & > signal_row_changed ()
 
Glib::SignalProxy2< void, const TreeModel::Path &, const TreeModel::iterator & > signal_row_inserted ()
 
Glib::SignalProxy2< void, const TreeModel::Path &, const TreeModel::iterator & > signal_row_has_child_toggled ()
 
Glib::SignalProxy1< void, const TreeModel::Path & > signal_row_deleted ()
 
Glib::SignalProxy3< void, const TreeModel::Path &, const TreeModel::iterator &, int * > signal_rows_reordered ()
 

Static Public Member Functions

static GType get_type () G_GNUC_CONST
 
static Glib::RefPtr< TreeModelFiltercreate (const Glib::RefPtr< TreeModel > &child_model)
 
static Glib::RefPtr< TreeModelFiltercreate (const Glib::RefPtr< TreeModel > &child_model, const TreeModel::Path &virtual_root)
 
- Static Public Member Functions inherited from Gtk::TreeModel
static void add_interface (GType gtype_implementer)
 
static GType get_type () G_GNUC_CONST
 

Protected Member Functions

 TreeModelFilter (const Glib::RefPtr< TreeModel > &child_model)
 
 TreeModelFilter (const Glib::RefPtr< TreeModel > &child_model, const TreeModel::Path &virtual_root)
 
virtual void set_value_impl (const iterator &row, int column, const Glib::ValueBase &value)
 
- Protected Member Functions inherited from Gtk::TreeModel
 TreeModel ()
 
virtual TreeModelFlags get_flags_vfunc () const
 
virtual int get_n_columns_vfunc () const
 
virtual GType get_column_type_vfunc (int index) const
 
virtual bool iter_next_vfunc (const iterator &iter, iterator &iter_next) const
 
virtual bool get_iter_vfunc (const Path &path, iterator &iter) const
 
virtual bool iter_children_vfunc (const iterator &parent, iterator &iter) const
 
virtual bool iter_parent_vfunc (const iterator &child, iterator &iter) const
 
virtual bool iter_nth_child_vfunc (const iterator &parent, int n, iterator &iter) const
 
virtual bool iter_nth_root_child_vfunc (int n, iterator &iter) const
 
virtual bool iter_has_child_vfunc (const iterator &iter) const
 
virtual int iter_n_children_vfunc (const iterator &iter) const
 
virtual int iter_n_root_children_vfunc () const
 
virtual void ref_node_vfunc (const iterator &iter) const
 
virtual void unref_node_vfunc (const iterator &iter) const
 
virtual TreeModel::Path get_path_vfunc (const iterator &iter) const
 
virtual void get_value_vfunc (const iterator &iter, int column, Glib::ValueBase &value) const
 
virtual bool iter_is_valid (const iterator &iter) const
 
virtual void get_value_impl (const iterator &row, int column, Glib::ValueBase &value) const
 
virtual void on_row_changed (const TreeModel::Path &path, const TreeModel::iterator &iter)
 This is a default handler for the signal signal_row_changed(). More...
 
virtual void on_row_inserted (const TreeModel::Path &path, const TreeModel::iterator &iter)
 This is a default handler for the signal signal_row_inserted(). More...
 
virtual void on_row_has_child_toggled (const TreeModel::Path &path, const TreeModel::iterator &iter)
 This is a default handler for the signal signal_row_has_child_toggled(). More...
 
virtual void on_row_deleted (const TreeModel::Path &path)
 This is a default handler for the signal signal_row_deleted(). More...
 
virtual void on_rows_reordered (const TreeModel::Path &path, const TreeModel::iterator &iter, int *new_order)
 This is a default handler for the signal signal_rows_reordered(). More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::TreeModelFilterwrap (GtkTreeModelFilter *object, bool take_copy=false)
 

Detailed Description

Definition at line 55 of file treemodelfilter.h.

Member Typedef Documentation

◆ SlotModify

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.

Definition at line 155 of file treemodelfilter.h.

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

Definition at line 135 of file treemodelfilter.h.

Constructor & Destructor Documentation

◆ ~TreeModelFilter()

virtual Gtk::TreeModelFilter::~TreeModelFilter ( )
virtual

◆ TreeModelFilter() [1/2]

Gtk::TreeModelFilter::TreeModelFilter ( const Glib::RefPtr< TreeModel > &  child_model)
explicitprotected

◆ TreeModelFilter() [2/2]

Gtk::TreeModelFilter::TreeModelFilter ( const Glib::RefPtr< TreeModel > &  child_model,
const TreeModel::Path virtual_root 
)
explicitprotected

Member Function Documentation

◆ clear_cache()

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 iters will be invalid.

◆ convert_child_iter_to_iter()

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_iterA valid iterator pointing to a row on the child model.
Returns
A valid iterator that points to the row in this sorted model.

◆ convert_child_path_to_path() [1/2]

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 or points to a row which is not visible in filter, then 0 is returned.

Parameters
child_pathA Gtk::TreePath to convert.
Returns
A newly allocated Gtk::TreePath, or 0.

◆ convert_child_path_to_path() [2/2]

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

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 or points to a row which is not visible in filter, then 0 is returned.

Parameters
child_pathA Gtk::TreePath to convert.
Returns
A newly allocated Gtk::TreePath, or 0.

◆ convert_iter_to_child_iter()

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_iterA valid iterator pointing to a row on the sorted model.
Returns
A valid iterator that points to the row in the child model.

◆ convert_path_to_child_path() [1/2]

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_pathA Gtk::TreePath to convert.
Returns
A newly allocated Gtk::TreePath, or 0.

◆ convert_path_to_child_path() [2/2]

Path Gtk::TreeModelFilter::convert_path_to_child_path ( const Path filter_path) const

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_pathA Gtk::TreePath to convert.
Returns
A newly allocated Gtk::TreePath, or 0.

◆ create() [1/2]

static Glib::RefPtr<TreeModelFilter> Gtk::TreeModelFilter::create ( const Glib::RefPtr< TreeModel > &  child_model)
static

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

◆ create() [2/2]

static Glib::RefPtr<TreeModelFilter> Gtk::TreeModelFilter::create ( const Glib::RefPtr< TreeModel > &  child_model,
const TreeModel::Path virtual_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.

◆ get_model() [1/2]

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

Returns a pointer to the child model of filter.

Returns
A pointer to a Gtk::TreeModel.

◆ get_model() [2/2]

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.

◆ get_type()

static GType Gtk::TreeModelFilter::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GtkTreeModelFilter* Gtk::TreeModelFilter::gobj ( )
inline

Provides access to the underlying C GObject.

Definition at line 96 of file treemodelfilter.h.

◆ gobj() [2/2]

const GtkTreeModelFilter* Gtk::TreeModelFilter::gobj ( ) const
inline

Provides access to the underlying C GObject.

Definition at line 99 of file treemodelfilter.h.

◆ gobj_copy()

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.

◆ property_child_model()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<TreeModel> > Gtk::TreeModelFilter::property_child_model ( ) const

The model for the filtermodel to filter.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_virtual_root()

Glib::PropertyProxy_ReadOnly< TreeModel::Path > Gtk::TreeModelFilter::property_virtual_root ( ) const

The virtual root (relative to the child model) for this filtermodel.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ refilter()

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.

◆ set_modify_func()

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

Specify columns that will be provided by this model, and a callback that will provide data for these columns based on data in the columns of the child model. The modify function will get called for each data access.

Parameters
columnsColumn types for this model (which will be exposed to the parent model/view).
slotA callback which will be called for each data access.

◆ set_value_impl()

virtual void Gtk::TreeModelFilter::set_value_impl ( const iterator row,
int  column,
const Glib::ValueBase &  value 
)
protectedvirtual

Override and implement this in a derived TreeModel class, so that Row::operator() and Row::set_value() work. You can probably just implement this by calling set_value_vfunc(). Your implementation of set_value_impl() should also call row_changed() after changing the value.

Reimplemented from Gtk::TreeModel.

◆ set_visible_column() [1/2]

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 TYPE_BOOLEAN, where true means that a row is visible, and false if not.

Parameters
columnA int which is the column containing the visible information.

◆ set_visible_column() [2/2]

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 TYPE_BOOLEAN, where true means that a row is visible, and false if not.

Parameters
columnA int which is the column containing the visible information.

◆ set_visible_func()

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
slotA callback slot which determines whether the row should be visible.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gtk::TreeModelFilter > wrap ( GtkTreeModelFilter object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse 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: