gtkmm: Gtk::TreeModelFilter Class Reference
#include <gtkmm/treemodelfilter.h>
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. More... | |
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);. More... | |
Public Types inherited from Glib::Object | |
typedef void(*)(gpointer data | DestroyNotify) |
Public Types inherited from sigc::trackable | |
typedef internal::func_destroy_notify | func_destroy_notify |
Public Types inherited from sigc::notifiable | |
typedef internal::func_destroy_notify | func_destroy_notify |
Public Types inherited from Gtk::TreeModel | |
enum | Flags { Flags::ITERS_PERSIST = 1 << 0, Flags::LIST_ONLY = 1 << 1 } |
These flags indicate various properties of a Gtk::TreeModel. More... | |
typedef TreeModelColumnRecord | ColumnRecord |
typedef TreeNodeChildren | Children |
typedef TreeNodeConstChildren | ConstChildren |
typedef Children::iterator | iterator |
typedef ConstChildren::const_iterator | const_iterator |
typedef TreeConstRow | ConstRow |
typedef TreeRow | Row |
typedef TreePath | Path |
typedef TreeRowReference | RowReference |
typedef sigc::slot< bool(const TreeModel::iterator&)> | SlotForeachIter |
The type of callback slot used by foreach_iter(). More... | |
typedef sigc::slot< bool(const TreeModel::Path&)> | SlotForeachPath |
The type of callback slot used by foreach_path(). More... | |
typedef sigc::slot< bool(const TreeModel::Path&, const TreeModel::iterator&)> | SlotForeachPathAndIter |
The type of callback slot used by foreach(). More... | |
Public Member Functions | |
TreeModelFilter (TreeModelFilter&& src) noexcept | |
TreeModelFilter& | operator= (TreeModelFilter&& src) noexcept |
~TreeModelFilter () noexcept override | |
GtkTreeModelFilter* | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkTreeModelFilter* | gobj () const |
Provides access to the underlying C GObject. More... | |
GtkTreeModelFilter* | gobj_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) |
Sets the "visible" callback used when filtering the filter. More... | |
void | 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. More... | |
void | set_visible_column (const TreeModelColumnBase& column) |
Sets column of the child_model to be the column where filter should look for visibility information. More... | |
void | set_visible_column (int column) |
Sets column of the child_model to be the column where filter should look for visibility information. More... | |
Glib::RefPtr< TreeModel > | get_model () |
Returns a pointer to the child model of filter. More... | |
Glib::RefPtr< const TreeModel > | get_model () const |
Returns a pointer to the child model of filter. More... | |
iterator | convert_child_iter_to_iter (const iterator& child_iter) |
Gets an iterator that points to the filtered row that corresponds to the child row pointed at by child_iter. More... | |
const_iterator | convert_child_iter_to_iter (const const_iterator& child_iter) const |
Gets an iterator that points to the filtered row that corresponds to the child row pointed at by child_iter. More... | |
iterator | convert_iter_to_child_iter (const iterator& filter_iter) |
Gets an iterator that points to the child row that corresponds to the filtered row pointed at by sorted_iter. More... | |
const_iterator | convert_iter_to_child_iter (const const_iterator& filter_iter) const |
Gets an iterator that points to the child row that corresponds to the filtered row pointed at by sorted_iter. More... | |
Path | convert_child_path_to_path (const Path& child_path) const |
Converts child_path to a path relative to filter. More... | |
Path | convert_path_to_child_path (const Path& filter_path) const |
Converts filter_path to a path on the child model of filter. More... | |
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. More... | |
void | clear_cache () |
This function should almost never be called. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TreeModel > > | property_child_model () const |
The model for the filtermodel to filter. More... | |
Glib::PropertyProxy_ReadOnly< TreeModel::Path > | property_virtual_root () const |
The virtual root (relative to the child model) for this filtermodel. More... | |
Public Member Functions inherited from Glib::Object | |
Object (const Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&src) noexcept | |
Object & | operator= (Object &&src) noexcept |
void * | get_data (const QueryQuark &key) |
void | set_data (const Quark &key, void *data) |
void | set_data (const Quark &key, void *data, DestroyNotify notify) |
void | remove_data (const QueryQuark &quark) |
void * | steal_data (const QueryQuark &quark) |
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false) |
Public Member Functions inherited from Glib::ObjectBase | |
ObjectBase (const ObjectBase &)=delete | |
ObjectBase & | operator= (const ObjectBase &)=delete |
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value) |
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const |
void | set_property (const Glib::ustring &property_name, const PropertyType &value) |
void | get_property (const Glib::ustring &property_name, PropertyType &value) const |
PropertyType | get_property (const Glib::ustring &property_name) const |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot) |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot) |
void | freeze_notify () |
void | thaw_notify () |
virtual void | reference () const |
virtual void | unreference () const |
GObject * | gobj () |
const GObject * | gobj () const |
GObject * | gobj_copy () const |
Public Member Functions inherited from sigc::trackable | |
trackable () noexcept | |
trackable (const trackable &src) noexcept | |
trackable (trackable &&src) noexcept | |
~trackable () | |
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const |
void | notify_callbacks () |
trackable & | operator= (const trackable &src) |
trackable & | operator= (trackable &&src) noexcept |
void | remove_destroy_notify_callback (notifiable *data) const |
Public Member Functions inherited from Gtk::TreeModel | |
TreeModel (TreeModel&& src) noexcept | |
TreeModel& | operator= (TreeModel&& src) noexcept |
~TreeModel () noexcept override | |
GtkTreeModel* | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkTreeModel* | gobj () const |
Provides access to the underlying C GObject. More... | |
iterator | get_iter (const Path& path) |
Returns a valid iterator pointing to path. More... | |
const_iterator | get_iter (const Path& path) const |
Returns a valid iterator pointing to path. More... | |
iterator | get_iter (const Glib::ustring& path_string) |
Returns a valid iterator pointing to path_string. More... | |
const_iterator | get_iter (const Glib::ustring& path_string) const |
Returns a valid iterator pointing to path_string. More... | |
Children | children () |
This returns an STL-like container API, for iterating over the rows. More... | |
const ConstChildren | children () const |
This returns an STL-like container API, for iterating over the rows. More... | |
void | foreach_iter (const SlotForeachIter& slot) |
Calls a callback of type SlotForeachIter on each node in the model in a depth-first fashion. More... | |
void | foreach_path (const SlotForeachPath& slot) |
Calls a callback of type SlotForeachPath on each node in the model in a depth-first fashion. More... | |
void | foreach (const SlotForeachPathAndIter& slot) |
Calls a callback of type SlotForeachPathAndIter on each node in the model in a depth-first fashion. More... | |
Flags | get_flags () const |
Returns a set of flags supported by this interface. More... | |
int | get_n_columns () const |
Returns the number of columns supported by tree_model. More... | |
GType | get_column_type (int index) const |
Returns the type of the column. More... | |
TreeModel::Path | get_path (const const_iterator& iter) const |
Returns a Gtk::TreePath referenced by iter. More... | |
void | row_changed (const Path& path, const const_iterator& iter) |
Emits the Gtk::TreeModel::signal_row_changed() signal on tree_model. More... | |
void | row_inserted (const Path& path, const const_iterator& iter) |
Emits the Gtk::TreeModel::signal_row_inserted() signal on tree_model. More... | |
void | row_has_child_toggled (const Path& path, const const_iterator& iter) |
Emits the Gtk::TreeModel::signal_row_has_child_toggled() signal on tree_model. More... | |
void | row_deleted (const Path& path) |
Emits the Gtk::TreeModel::signal_row_deleted() signal on tree_model. More... | |
void | rows_reordered (const Path& path, const const_iterator& iter, const std::vector< int >& new_order) |
Emits the "rows_reordered" signal on the tree model. More... | |
void | rows_reordered (const Path& path, const std::vector< int >& new_order) |
Emits the "rows_reordered" signal on the tree model. More... | |
void | rows_reordered (const Path& path, const const_iterator& iter, int* new_order) |
Emits the Gtk::TreeModel::signal_rows_reordered() signal on tree_model. More... | |
Glib::ustring | get_string (const const_iterator& iter) const |
Generates a string representation of the iter. More... | |
Glib::SignalProxy< void(const TreeModel::Path&, const TreeModel::iterator&)> | signal_row_changed () |
Glib::SignalProxy< void(const TreeModel::Path&, const TreeModel::iterator&)> | signal_row_inserted () |
Glib::SignalProxy< void(const TreeModel::Path&, const TreeModel::iterator&)> | signal_row_has_child_toggled () |
Glib::SignalProxy< void(const TreeModel::Path&)> | signal_row_deleted () |
Glib::SignalProxy< void(const TreeModel::Path&, const TreeModel::iterator&, int*)> | signal_rows_reordered () |
Public Member Functions inherited from Glib::Interface | |
Interface () | |
Interface (Interface &&src) noexcept | |
Interface & | operator= (Interface &&src) noexcept |
Interface (const Glib::Interface_Class &interface_class) | |
Interface (GObject *castitem) | |
~Interface () noexcept override | |
Interface (const Interface &)=delete | |
Interface & | operator= (const Interface &)=delete |
GObject * | gobj () |
const GObject * | gobj () const |
Public Member Functions inherited from Gtk::TreeDragSource | |
TreeDragSource (TreeDragSource&& src) noexcept | |
TreeDragSource& | operator= (TreeDragSource&& src) noexcept |
~TreeDragSource () noexcept override | |
GtkTreeDragSource* | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkTreeDragSource* | gobj () const |
Provides access to the underlying C GObject. More... | |
bool | row_draggable (const TreeModel::Path& path) const |
Asks the Gtk::TreeDragSource whether a particular row can be used as the source of a DND operation. More... | |
Glib::RefPtr< Gdk::ContentProvider > | drag_data_get (const TreeModel::Path& path) const |
Asks the Gtk::TreeDragSource to return a Gdk::ContentProvider representing the row at path. More... | |
bool | drag_data_delete (const TreeModel::Path& path) |
Asks the Gtk::TreeDragSource to delete the row at path, because it was moved somewhere else via drag-and-drop. More... | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
static Glib::RefPtr< TreeModelFilter > | create (const Glib::RefPtr< TreeModel >& child_model) |
This creates a TreeModelFilter with child_model as the child model. More... | |
static Glib::RefPtr< TreeModelFilter > | create (const Glib::RefPtr< TreeModel >& child_model, const TreeModel::Path& virtual_root) |
This creates a TreeModelFilter with child_model as the child model, and root as the virtual root. More... | |
Static Public Member Functions inherited from Gtk::TreeModel | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
Static Public Member Functions inherited from Gtk::TreeDragSource | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
Protected Member Functions | |
TreeModelFilter (const Glib::RefPtr< TreeModel >& child_model) | |
TreeModelFilter (const Glib::RefPtr< TreeModel >& child_model, const TreeModel::Path& virtual_root) | |
void | set_value_impl (const iterator& row, int column, const Glib::ValueBase& value) override |
Override and implement this in a derived TreeModel class, so that Row::operator() and Row::set_value() work. More... | |
Protected Member Functions inherited from Glib::Object | |
Object () | |
Object (const Glib::ConstructParams &construct_params) | |
Object (GObject *castitem) | |
~Object () noexcept override | |
Protected Member Functions inherited from Glib::ObjectBase | |
ObjectBase () | |
ObjectBase (const char *custom_type_name) | |
ObjectBase (const std::type_info &custom_type_info) | |
ObjectBase (ObjectBase &&src) noexcept | |
ObjectBase & | operator= (ObjectBase &&src) noexcept |
virtual | ~ObjectBase () noexcept=0 |
void | initialize (GObject *castitem) |
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper) |
Protected Member Functions inherited from Gtk::TreeModel | |
TreeModel () | |
You should derive from this class to use it. More... | |
virtual Flags | 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 |
Override and implement this in a derived TreeModel class. More... | |
virtual bool | get_iter_vfunc (const Path& path, iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual bool | iter_children_vfunc (const iterator& parent, iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual bool | iter_parent_vfunc (const iterator& child, iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual bool | iter_nth_child_vfunc (const iterator& parent, int n, iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual bool | iter_nth_root_child_vfunc (int n, iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual bool | iter_has_child_vfunc (const const_iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual int | iter_n_children_vfunc (const const_iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual int | iter_n_root_children_vfunc () const |
Override and implement this in a derived TreeModel class. More... | |
virtual void | ref_node_vfunc (const iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual void | unref_node_vfunc (const iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual TreeModel::Path | get_path_vfunc (const const_iterator& iter) const |
Override and implement this in a derived TreeModel class. More... | |
virtual void | get_value_vfunc (const const_iterator& iter, int column, Glib::ValueBase& value) const |
Override and implement this in a derived TreeModel class. More... | |
virtual void | get_value_impl (const const_iterator& iter, 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... | |
Protected Member Functions inherited from Gtk::TreeDragSource | |
TreeDragSource () | |
You should derive from this class to use it. More... | |
virtual bool | row_draggable_vfunc (const TreeModel::Path& path) const |
virtual Glib::RefPtr< Gdk::ContentProvider > | drag_data_get_vfunc (const TreeModel::Path& path) const |
virtual bool | drag_data_delete_vfunc (const TreeModel::Path& path) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gtk::TreeModelFilter > | wrap (GtkTreeModelFilter* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Related Functions inherited from Gtk::TreeModel | |
Glib::RefPtr< Gtk::TreeModel > | wrap (GtkTreeModel* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Related Functions inherited from Gtk::TreeDragSource | |
Glib::RefPtr< Gtk::TreeDragSource > | wrap (GtkTreeDragSource* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
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
|
noexcept |
|
overridenoexcept |
|
explicitprotected |
|
explicitprotected |
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 iters will be invalid.
Gets an iterator that points to the filtered 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 filtered model.
const_iterator Gtk::TreeModelFilter::convert_child_iter_to_iter | ( | const const_iterator& | child_iter | ) | const |
Gets an iterator that points to the filtered 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 filtered model.
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 nullptr
is returned.
- Parameters
-
child_path A Gtk::TreePath to convert.
- Returns
- A newly allocated Gtk::TreePath, or
nullptr
.
Gets an iterator that points to the child row that corresponds to the filtered row pointed at by sorted_iter.
- Parameters
-
filter_iter A valid iterator pointing to a row on the filtered model.
- Returns
- A valid iterator that points to the row in the child model.
const_iterator Gtk::TreeModelFilter::convert_iter_to_child_iter | ( | const const_iterator& | filter_iter | ) | const |
Gets an iterator that points to the child row that corresponds to the filtered row pointed at by sorted_iter.
- Parameters
-
filter_iter A valid iterator pointing to a row on the filtered model.
- Returns
- A valid iterator that points to the row in the child model.
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, nullptr
is returned.
- Parameters
-
filter_path A Gtk::TreePath to convert.
- Returns
- A newly allocated Gtk::TreePath, or
nullptr
.
|
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.
|
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<TreeModel> Gtk::TreeModelFilter::get_model | ( | ) |
Returns a pointer to the child model of filter.
- Returns
- A pointer to a Gtk::TreeModel.
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.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
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.
|
noexcept |
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.
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.
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.
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
-
columns Column types for this model (which will be exposed to the parent model/view). slot A callback which will be called for each data access.
|
overrideprotectedvirtual |
Override and implement this in a derived TreeModel class, so that Row::operator() and Row::set_value() work.
Your implementation of set_value_impl() should call row_changed() after changing the value.
Reimplemented from Gtk::TreeModel.
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.
Note that set_visible_func() or set_visible_column() can only be called once for a given filter model.
- Parameters
-
column A #int which is the column containing the visible information.
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.
Note that set_visible_func() or set_visible_column() can only be called once for a given filter model.
- 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
|
related |
A Glib::wrap() method for this object.
- 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.