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


Xfc::Gtk::TreePath Class Reference

A GtkTreePath C++ wrapper class. More...

#include <xfc/gtk/treemodel.hh>

Inheritance diagram for Xfc::Gtk::TreePath:

Xfc::G::Boxed Xfc::Object Xfc::Trackable List of all members.

Constructors

Public Member Functions

Accessors
Methods

Detailed Description

A GtkTreePath C++ wrapper class.

A tree path is essentially a potential node. It is a location on a tree model that may or may not actually correspond to a node on a specific model. The TreePath can be converted into either a vector of integers or a string. The string form is a list of numbers separated by a colon. Each number refers to the offset at that level. Thus, the path "0" refers to the root node and the path "2:4" refers to the fifth child of the third node.

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.


Constructor & Destructor Documentation

Xfc::Gtk::TreePath::TreePath ( const String path  )  [explicit]

Constructs a new tree path initialized to path, or the root if path is null.

Parameters:
path The string representation of a path.
The path is expected to be a colon separated list of numbers. For example, the string "10:4:0" would create a path of depth 3 pointing to the 11th child of the root node, the 5th child of that 11th child, and the 1st child of that 5th child. The TreePath is created with a reference count of 1 that the caller owns.

Xfc::Gtk::TreePath::TreePath ( int  first_index,
  ... 
) [explicit]

Constructs a new path with first_index and varargs as the indices.

Parameters:
first_index The first integer.
... A list of integers, terminated by -1.
The TreePath is created with a reference count of 1 that the caller owns.

Xfc::Gtk::TreePath::TreePath ( GtkTreePath *  path  )  [explicit]

Constructs a new tree path from an existing GtkTreePath.

Parameters:
path A pointer to a GtkTreePath.
The path can be a newly created GtkTreePath or an existing GtkTreePath. The TreePath object created is a temporary object. It doesn't take over the ownership of GtkTreePath and GtkTreePath is not freed by the destructor. The TreePath is created with a reference count of 1 that the caller owns.

Xfc::Gtk::TreePath::TreePath ( GtkTreePath *  path,
bool  copy 
)

Constructs a new text iterator from an existing GtkTreePath.

Parameters:
path A pointer to a GtkTreePath.
copy Whether the TreePath object should make a copy of GtkTreePath or not.
The path can be a newly created GtkTreePath or an existing GtkTreePath. If copy is true TreePath will make a copy of GtkTreePath. If copy is false TreePath wont make a copy but instead takes over the ownership of GtkTreePath. Either way, the destructor will free GtkTreePath when the TreePath object is destroyed. The TreePath is created with a reference count of 1 that the caller owns. This constructor is used by G::Boxed::wrap() to wrap GtkTreePath objects in a C++ wrapper.

Xfc::Gtk::TreePath::TreePath ( const TreePath src  ) 

Copy constructor.

Parameters:
src The source tree path.


Member Function Documentation

TreePath& Xfc::Gtk::TreePath::operator= ( const TreePath src  ) 

Assignment operator.

Parameters:
src The source tree path.

String Xfc::Gtk::TreePath::to_string (  )  const

Generates a string representation of the path.

This string is a ':' separated list of numbers. For example, "4:10:0:3" would be an acceptable return value for this string.

int Xfc::Gtk::TreePath::compare ( const TreePath other  )  const

Compares two paths.

Parameters:
other A TreePath to compare with.
Returns:
The relative positions of two paths.
If this path appears before other in a tree, then -1 is returned. If other appears before this path, then 1 is returned. If the two nodes are equal, then 0 is returned.

bool Xfc::Gtk::TreePath::is_ancestor ( const TreePath descendant  )  const

Returns true if descendant is a descendant of this path.

Parameters:
descendant Another TreePath.
Returns:
true if descendant is contained inside this path.

bool Xfc::Gtk::TreePath::is_descendant ( const TreePath ancestor  )  const

Returns true if path is a descendant of ancestor.

Parameters:
ancestor Another TreePath.
Returns:
true if ancestor contains path somewhere below it.

void Xfc::Gtk::TreePath::append_index ( int  index  ) 

Appends a new index to the path; as a result, the depth of the path is increased.

Parameters:
index The index.

void Xfc::Gtk::TreePath::prepend_index ( int  index  ) 

Prepends a new index to the path; as a result, the depth of the path is increased.

Parameters:
index The index.

bool Xfc::Gtk::TreePath::prev (  ) 

Moves the path to point to the previous node at the current depth, if it exists.

Returns:
true if the path has a previous node, and the move was made.

bool Xfc::Gtk::TreePath::up (  ) 

Moves the path to point to it's parent node, if it has a parent.

Returns:
true if the path has a parent, and the move was made.


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