Créer  Editer  FrontPage  Index  Chercher  Changements  History  RSS  Login

Gtk::TreeModelFilter

class Gtk::TreeModelFilter

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

  • Filter specific rows, based on data from a "visible column", a column storing booleans indicating whether the row should be filtered or not, or based on the return value of a "visible function", which gets a model, iter and user_data and returns a boolean indicating whether the row should be filtered or not.
  • Modify the "appearance" of the model, using a modify function. This is extremely powerful and allows for just changing some values and also for creating a completely different model based on the given child model.
  • Set a different root node, also known as a "virtual root". You can pass in a GtkTreePath indicating the root node for the filter at construction time.

Class Methods

Gtk::TreeModelFilter.new(child_model, root = nil)
Creates a new Gtk::TreeModel, with child_model as the child_model and root as the virtual root. Since 2.4

Instance Methods

set_visible_func{|model, iter| ... }
Sets the visible function as block used when filtering the filter. The block should return true if the given row should be visible and false otherwise. Since 2.4
  • {|model, iter| ... }: A block which decides whether the row indicated by iter is visible. this should return true if the given row should be visible and false otherwise
  • Returns: self
set_modify_func(type1, type2, type3, ...){|model, iter, column| ... }
With the types parameters(type1, type2, type3, ...), you give an array of column types for this model (which will be exposed to the parent model/view). The block will get called for each data access, the goal of the block is to return the data which should be displayed at the location specified using the parameters of the block. Since 2.4
  • types: Object.class value
  • {|model, iter, column| ... }: A block which calculates display values from raw values in the model. It must return the display value for the column in the row indicated by iter. Since this method is called for each data access, it's not a particularly efficient operation.
  • Returns: self
visible_column=(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 TrueClass(true or false), where true means that a row is visible, and false if not. Since 2.4
  • column: A Integer which is the column containing the visible information.
  • Returns: column
set_visible_column(column)
Same as Gtk::TreeModelFilter#visible_column=. Since 2.4
  • column: A Integer which is the column containing the visible information.
  • Returns: self
model
Returns the child model. Since 2.4
convert_child_iter_to_iter(child_iter)
Returns a filter iter pointed to the row in the filter that corresponds to the row pointed at by child_iter. Since 2.4
convert_iter_to_child_iter(filter_iter)
Returns a child iter pointed to the row pointed to by filter_iter. Since 2.4
convert_child_path_to_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 nil is returned. Since 2.4
convert_path_to_child_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, nil is returned. Since 2.4
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
  • Returns: self
clear_cache
This method should almost never be called. It clears the filter of any cached iterators. 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 method, all unreffed iters will be invalid. Since 2.4
  • Returns: self
child_model
Gets the model for the filtermodel to filter. Since 2.4
  • Returns: The model for the filtermodel to filter
child_model=(child_model)
Sets the model for the filtermodel to filter. Since 2.4
  • child_model: The Gtk::TreeModel for the filtermodel to filter
  • Returns: child_model
set_child_model(child_model)
Same as Gtk::TreeModelFilter#child_model=. Since 2.4
  • child_model: The Gtk::TreeModel for the filtermodel to filter
  • Returns: self
virtual_root
Gets the virtual root (relative to the child model) for this filtermodel. Since 2.4
  • Returns: The virtual root (relative to the child model) for this filtermodel
virtual_root=(virtual_root)
Sets the virtual root (relative to the child model) for this filtermodel. Since 2.4
  • virtual_root: The virtual root (relative to the child model) for this filtermodel (Gtk::TreePath)
  • Returns: virtual_root
set_virtual_root(virtual_root)
Same as Gtk::TreeModelFilter#virtual_root=. Since 2.4
  • virtual_root: The virtual root (relative to the child model) for this filtermodel (Gtk::TreePath)
  • Returns: self

Properties

child-model: Gtk::TreeModel (Read/Write)
The model for the filtermodel to filter Since 2.4
virtual-root: Gtk::TreePath (Read/Write)
The virtual root (relative to the child model) for this filtermodel Since 2.4

ChangeLog

  • 2005-05-06 Added - Masao?
Dernière modification:2011/06/24 17:54:07
Mots clef:
Références:[Gtk::TreeModelFilter]