Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::TreeModelSort Class Reference

A GtkTreeModelSort C++ wrapper class. More...

`#include <xfc/gtk/treemodelsort.hh>`

Inheritance diagram for Xfc::Gtk::TreeModelSort:

List of all members.

## Public Member Functions

Constructors

- TreeModelSort (TreeModel &child_model)
    Constructs a new tree model, with child_model as the child model.
- virtual ~TreeModelSort ()
    Destructor.

Accessors

- GtkTreeModelSort * gtk_tree_model_sort () const
    Get a pointer to the GtkTreeModelSort structure.
- operator GtkTreeModelSort * () const
    Conversion operator; safely converts a TreeModelSort to a GtkTreeModelSort pointer.
- TreeModel * get_model () const
    Returns the model the TreeModelSort is sorting.
- bool iter_is_valid (const TreeIter &iter) const
    Checks if the given iter is a valid iter for this TreeModelSort.

Methods

- Pointer< TreePath > convert_child_path_to_path (const TreePath &child_path)
    Converts child_path to a path relative to the TreeModelSort.
- TreeIter convert_child_iter_to_iter (const TreeIter &child_iter)
    Returns a TreeIter that points to the row in the TreeModelSort that corresponds to the row pointed at by child_iter.
- Pointer< TreePath > convert_path_to_child_path (const TreePath &sorted_path)
    Converts sorted_path to a path on the child model of the TreeModelSort.
- TreeIter convert_iter_to_child_iter (const TreeIter &sorted_iter)
    Returns a TreeIter that points to the row on the model being sorted that corresponds to the row on the TreeModelSort pointed to by sorted_iter.
- void reset_default_sort_func ()
    This resets the default sort function to be in the 'unsorted' state.
- void clear_cache ()
    This method should almost never be called.

## Protected Member Functions

Constructors

- TreeModelSort (GtkTreeModelSort *tree_model, bool owns_reference=true)
    Construct a new TreeModelSort from an existing GtkTreeModelSort.

## Detailed Description

A GtkTreeModelSort C++ wrapper class.

TreeModelSort implements a model that can be sorted.

## Constructor & Destructor Documentation

Xfc::Gtk::TreeModelSort::TreeModelSort | ( | GtkTreeModelSort * | tree_model,
|  | bool | owns_reference = `true`
| ) | `[explicit, protected]`

  | Construct a new TreeModelSort from an existing GtkTreeModelSort. Parameters:
  | tree_model | A pointer to a GtkTreeModelSort.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.
The tree_model can be a newly created GtkTreeModelSort or an existing GtkTreeModelSort (see G::Object::Object).

Xfc::Gtk::TreeModelSort::TreeModelSort | ( | TreeModel & | child_model | ) |

  | Constructs a new tree model, with child_model as the child model. Parameters:
  | child_model | A TreeModel.
TreeModelSort is created with a reference count of 1 that the caller owns.

## Member Function Documentation

void Xfc::Gtk::TreeModelSort::clear_cache | ( |  | ) |

| This method should almost never be called. It clears the TreeModelSort of any cached iterators that haven't been reffed with ref_node(). This might be useful if the child model being sorted 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.

TreeIter Xfc::Gtk::TreeModelSort::convert_child_iter_to_iter | ( | const TreeIter & | child_iter | ) |

  | Returns a TreeIter that points to the row in the TreeModelSort that corresponds to the row pointed at by child_iter. Parameters:
  | child_iter | A valid TreeIter pointing to a row on the child model.
Returns: A TreeIter pointing to the row in the model being sorted.

Pointer<TreePath> Xfc::Gtk::TreeModelSort::convert_child_path_to_path | ( | const TreePath & | child_path | ) |

  | Converts child_path to a path relative to the TreeModelSort. Parameters:
  | child_path | A TreePath to convert.
Returns: A newly allocated TreePath, or null. child_path points to a path in the child model. The returned path will point to the same row in the sorted model. If child_path isn't a valid path on the child model, then null is returned.

TreeIter Xfc::Gtk::TreeModelSort::convert_iter_to_child_iter | ( | const TreeIter & | sorted_iter | ) |

  | Returns a TreeIter that points to the row on the model being sorted that corresponds to the row on the TreeModelSort pointed to by sorted_iter. Parameters:
  | sorted_iter | A valid TreeIter pointing to a row on the TreeModelSort.
Returns: A TreeIter pointing to the row on the model being sorted.

Pointer<TreePath> Xfc::Gtk::TreeModelSort::convert_path_to_child_path | ( | const TreePath & | sorted_path | ) |

  | Converts sorted_path to a path on the child model of the TreeModelSort. Parameters:
  | sorted_path | A TreePath to convert.
Returns: A newly allocated TreePath, or null. sorted_path points to a location in the TreeModelSort. The returned path will point to the same location in the model not being sorted. If sorted_path does not point to a location in the child model, null is returned.

TreeModel* Xfc::Gtk::TreeModelSort::get_model | ( |  | ) | const

| Returns the model the TreeModelSort is sorting. Returns: The "child model" being sorted.

bool Xfc::Gtk::TreeModelSort::iter_is_valid | ( | const TreeIter & | iter | ) | const

  | Checks if the given iter is a valid iter for this TreeModelSort. Parameters:
  | iter | A TreeIter.
Returns: true if the iter is valid, false if the iter is invalid. WARNING: This function is slow. Only use it for debugging and/or testing purposes.

void Xfc::Gtk::TreeModelSort::reset_default_sort_func | ( |  | ) |

| This resets the default sort function to be in the 'unsorted' state. That is, it is in the same order as the child model. It will re-sort the model to be in the same order as the child model only if the TreeModelSort is in 'unsorted' state. Reimplemented from Xfc::Gtk::TreeSortable.

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

- treemodelsort.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3