Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Public Types | Public Member Functions
Xfc::Gtk::TreeModelFilter Class Reference

A GtkTreeModelFilter C++ wrapper class. More...

#include <xfc/gtk/treemodelfilter.hh>

Inheritance diagram for Xfc::Gtk::TreeModelFilter:
Xfc::G::Object Xfc::Gtk::TreeModel Xfc::Gtk::TreeDragSource Xfc::G::TypeInstance Xfc::G::TypeInterface Xfc::G::TypeInterface Xfc::Trackable Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable

List of all members.

Public Types

Public Member Functions

Constructors


Detailed Description

A GtkTreeModelFilter C++ wrapper class.

A TreeModelFilter is a tree model which wraps another tree model, and can do the following things:

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Member Typedef Documentation

typedef sigc::slot<void, const TreeModel&, const TreeIter&, G::Value&, int> Xfc::Gtk::TreeModelFilter::ModifySlot

Signature of the callback slot which calculates display values from raw values in the model.

Example: Method signature for ModifySlot.

< void method(const TreeModel& model, const TreeIter& iter, G::Value& value, int column);
< // model: The Gtk::TreeModelFilter.
< // iter: A Gtk::TreeIter pointing to the row whose display values are determined.
< // value: A G::Value already initialized with the correct type for the specifed column. 
< // column: The column whose display value is determined. 
<

The slot must fill the G::Value with the display value for the specified column in the row indicated by TreeIter. Since this slot is called for each data access, it's not a particularly efficient operation.

typedef sigc::slot<bool, const TreeModel&, const TreeIter&> Xfc::Gtk::TreeModelFilter::VisibleSlot

Signature of the callback slot which decides whether the row indicated by TreeIter is visible.

Example: Method signature for VisibleSlot.

< bool method(const TreeModel& model, const TreeIter& iter);
< // model: The Gtk::TreeModelFilter.
< // iter: A Gtk::TreeIter pointing to the row whose visibility is determined.
< // return: Whether the row indicated by iter is visible.
<

Constructor & Destructor Documentation

Xfc::Gtk::TreeModelFilter::TreeModelFilter ( GtkTreeModelFilter *  filter,
bool  owns_reference = true 
) [explicit, protected]

Construct a new TreeModelFilter from an existing GtkTreeModelFilter.

Parameters:
filterA pointer to a GtkTreeModelFilter.
owns_referenceSet false if the initial reference count is floating, set true if it's not.

The filter can be a newly created GtkTreeModelFilter or an existing GtkTreeModelFilter (see G::Object::Object).

Xfc::Gtk::TreeModelFilter::TreeModelFilter ( TreeModel child_model,
const TreePath root = 0 
)

Constructs a new TreeModelFilter, with child_model as the child_model and root as the virtual root.

Parameters:
child_modelA Gtk::TreeModel.
rootA Gtk::TreePath or null.

TreeModelFilter is created with a reference count of 1 that the caller owns.


Member Function Documentation

This method 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 become invalid.

Returns a TreeIter that points to the row in the TreeModelFilter that corresponds to the row pointed at by child_iter.

Parameters:
child_iterA valid TreeIter pointing to a row on the child model.
Returns:
A TreeIter pointing to the row in the model being filtered.

Converts child_path to a path relative to the TreeModelFilter.

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

The returned path will point to the same row in the filtered model. If child_path isn't a valid path on the child model, then null is returned.

Returns a TreeIter that points to the row on the child model that corresponds to the row pointed to by filter_iter.

Parameters:
filter_iterA valid TreeIter pointing to a row in the TreeModelFilter.
Returns:
A TreeIter pointing to the row in the child model.

Converts filter_path to a path in the child model of the TreeModelFilter.

Parameters:
filter_pathA TreePath to convert.
Returns:
A newly allocated TreePath, or null.

The returned path will point to the same row in the filtered model. If child_path isn't a valid path in the child model, then null is returned.

Gets a pointer to the child model of the filter.

Returns:
The child model of the filter.

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

void Xfc::Gtk::TreeModelFilter::set_modify_func ( int  n_columns,
const GType  types[],
const ModifySlot slot 
)

With the n_columns and types parameters, you give an array of column types for this model (which will be exposed to the parent model/view).

Parameters:
n_columnsThe number of columns in the filter model.
typesThe GTypes of the columns.
slotA Gtk::TreeModelFilter::ModifySlot, the modify callack function.

The modify slot will get called for each data access, the goal of the modify slot is to return the data which should be displayed at the location specified using the parameters of the modify slot.

Sets column of the filter's child model to be the column where the filter should look for visibility information.

Parameters:
columnAn integer which is the column containing the visible information.

The columns should be a column of type G_TYPE_BOOLEAN, where true means that a row is visible, and false if not.

Sets the visible function used when filtering the filter to be slot.

Parameters:
slotA Gtk::TreeModelFilter::VisibleSlot, the visible callack function.

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


The documentation for this class was generated from the following file:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC