gtktreemodel

Name

gtktreemodel -- 

Synopsis


#include <gtk/gtk.h>


#define     GTK_TREE_MODEL_GET_IFACE        (obj)
struct      GtkTreeIter;
struct      GtkTreePath;
struct      GtkTreeModel;
struct      GtkTreeModelIface;
enum        GtkTreeModelFlags;
GtkTreePath* gtk_tree_path_new              (void);
GtkTreePath* gtk_tree_path_new_from_string  (gchar *path);
gchar*      gtk_tree_path_to_string         (GtkTreePath *path);
GtkTreePath* gtk_tree_path_new_root         (void);
void        gtk_tree_path_append_index      (GtkTreePath *path,
                                             gint index);
void        gtk_tree_path_prepend_index     (GtkTreePath *path,
                                             gint index);
gint        gtk_tree_path_get_depth         (GtkTreePath *path);
gint*       gtk_tree_path_get_indices       (GtkTreePath *path);
void        gtk_tree_path_free              (GtkTreePath *path);
GtkTreePath* gtk_tree_path_copy             (GtkTreePath *path);
gint        gtk_tree_path_compare           (const GtkTreePath *a,
                                             const GtkTreePath *b);
void        gtk_tree_path_next              (GtkTreePath *path);
gboolean    gtk_tree_path_prev              (GtkTreePath *path);
gboolean    gtk_tree_path_up                (GtkTreePath *path);
void        gtk_tree_path_down              (GtkTreePath *path);
GtkTreeIter* gtk_tree_iter_copy             (GtkTreeIter *iter);
void        gtk_tree_iter_free              (GtkTreeIter *iter);
GtkTreeModelFlags gtk_tree_model_get_flags  (GtkTreeModel *tree_model);
gint        gtk_tree_model_get_n_columns    (GtkTreeModel *tree_model);
GType       gtk_tree_model_get_column_type  (GtkTreeModel *tree_model,
                                             gint index);
gboolean    gtk_tree_model_get_iter         (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             GtkTreePath *path);
GtkTreePath* gtk_tree_model_get_path        (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);
void        gtk_tree_model_get_value        (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             gint column,
                                             GValue *value);
gboolean    gtk_tree_model_iter_next        (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);
gboolean    gtk_tree_model_iter_children    (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             GtkTreeIter *parent);
gboolean    gtk_tree_model_iter_has_child   (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);
gint        gtk_tree_model_iter_n_children  (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);
gboolean    gtk_tree_model_iter_nth_child   (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             GtkTreeIter *parent,
                                             gint n);
gboolean    gtk_tree_model_iter_parent      (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             GtkTreeIter *child);
void        gtk_tree_model_ref_node         (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);
void        gtk_tree_model_unref_node       (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);

Description

Details

GTK_TREE_MODEL_GET_IFACE()

#define GTK_TREE_MODEL_GET_IFACE(obj)  ((GtkTreeModelIface *)g_type_interface_peek (((GTypeInstance *)GTK_TREE_MODEL (obj))->g_class, GTK_TYPE_TREE_MODEL))

obj : 


struct GtkTreeIter

struct GtkTreeIter
{
  gint stamp;
  gpointer user_data;
  gpointer user_data2;
  gpointer user_data3;
};


struct GtkTreePath

struct GtkTreePath;


struct GtkTreeModel

struct GtkTreeModel;


struct GtkTreeModelIface

struct GtkTreeModelIface
{
  GTypeInterface g_iface;

  /* Signals */
  void         (* range_changed)     (GtkTreeModel *tree_model,
				      GtkTreePath  *start_path,
				      GtkTreeIter  *start_iter,
				      GtkTreePath  *end_path,
				      GtkTreeIter  *end_iter);
  void         (* inserted)          (GtkTreeModel *tree_model,
				      GtkTreePath  *path,
				      GtkTreeIter  *iter);
  void         (* has_child_toggled) (GtkTreeModel *tree_model,
				      GtkTreePath  *path,
				      GtkTreeIter  *iter);
  void         (* deleted)           (GtkTreeModel *tree_model,
				      GtkTreePath  *path);
  void         (* reordered)         (GtkTreeModel *tree_model,
				      GtkTreePath  *path,
				      GtkTreeIter  *iter,
				      gint         *new_order);

  /* Virtual Table */
  GtkTreeModelFlags (* get_flags)  (GtkTreeModel *tree_model);   

  gint         (* get_n_columns)   (GtkTreeModel *tree_model);
  GType        (* get_column_type) (GtkTreeModel *tree_model,
				    gint          index);
  gboolean     (* get_iter)        (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter,
				    GtkTreePath  *path);
  GtkTreePath *(* get_path)        (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter);
  void         (* get_value)       (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter,
				    gint          column,
				    GValue       *value);
  gboolean     (* iter_next)       (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter);
  gboolean     (* iter_children)   (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter,
				    GtkTreeIter  *parent);
  gboolean     (* iter_has_child)  (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter);
  gint         (* iter_n_children) (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter);
  gboolean     (* iter_nth_child)  (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter,
				    GtkTreeIter  *parent,
				    gint          n);
  gboolean     (* iter_parent)     (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter,
				    GtkTreeIter  *child);
  void         (* ref_node)        (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter);
  void         (* unref_node)      (GtkTreeModel *tree_model,
				    GtkTreeIter  *iter);
};


enum GtkTreeModelFlags

typedef enum
{
  GTK_TREE_MODEL_ITERS_PERSIST = 1 << 0
} GtkTreeModelFlags;


gtk_tree_path_new ()

GtkTreePath* gtk_tree_path_new              (void);

Creates a new GtkTreePath.

Returns : A newly created GtkTreePath.


gtk_tree_path_new_from_string ()

GtkTreePath* gtk_tree_path_new_from_string  (gchar *path);

Creates a new GtkTreePath initialized to path. 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.

path : The string representation of a path.
Returns : A newly created GtkTreePath.


gtk_tree_path_to_string ()

gchar*      gtk_tree_path_to_string         (GtkTreePath *path);

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.

path : A GtkTreePath
Returns : A newly allocated string. Must be freed with g_free.


gtk_tree_path_new_root ()

GtkTreePath* gtk_tree_path_new_root         (void);

Creates a new root GtkTreePath. The string representation of this path is "0"

Returns : A new GtkTreePath.


gtk_tree_path_append_index ()

void        gtk_tree_path_append_index      (GtkTreePath *path,
                                             gint index);

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

path : A GtkTreePath.
index : The index.


gtk_tree_path_prepend_index ()

void        gtk_tree_path_prepend_index     (GtkTreePath *path,
                                             gint index);

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

path : A GtkTreePath.
index : The index.


gtk_tree_path_get_depth ()

gint        gtk_tree_path_get_depth         (GtkTreePath *path);

Returns the current depth of path.

path : A GtkTreePath.
Returns : The depth of path


gtk_tree_path_get_indices ()

gint*       gtk_tree_path_get_indices       (GtkTreePath *path);

Returns the current indices of path. This is an array of integers, each representing a node in a tree.

path : A GtkTreePath.
Returns : The current indices, or NULL.


gtk_tree_path_free ()

void        gtk_tree_path_free              (GtkTreePath *path);

Frees path.

path : A GtkTreePath.


gtk_tree_path_copy ()

GtkTreePath* gtk_tree_path_copy             (GtkTreePath *path);

Creates a new GtkTreePath as a copy of path.

path : A GtkTreePath.
Returns : A new GtkTreePath.


gtk_tree_path_compare ()

gint        gtk_tree_path_compare           (const GtkTreePath *a,
                                             const GtkTreePath *b);

Compares two paths. If a appears before b in a tree, then 1, is returned. If b appears before a, then -1 is returned. If the two nodes are equal, then 0 is returned.

a : A GtkTreePath.
b : A GtkTreePath to compare with.
Returns : The relative positions of a and b


gtk_tree_path_next ()

void        gtk_tree_path_next              (GtkTreePath *path);

Moves the path to point to the next node at the current depth.

path : A GtkTreePath.


gtk_tree_path_prev ()

gboolean    gtk_tree_path_prev              (GtkTreePath *path);

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

path : A GtkTreePath.
Returns : TRUE if path has a previous node, and the move was made.


gtk_tree_path_up ()

gboolean    gtk_tree_path_up                (GtkTreePath *path);

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

path : A GtkTreePath.
Returns : TRUE if path has a parent, and the move was made.


gtk_tree_path_down ()

void        gtk_tree_path_down              (GtkTreePath *path);

Moves path to point to the first child of the current path.

path : A GtkTreePath.


gtk_tree_iter_copy ()

GtkTreeIter* gtk_tree_iter_copy             (GtkTreeIter *iter);

Creates a dynamically allocated tree iterator as a copy of iter. This function is not intended for use in applications, because you can just copy the structs by value (GtkTreeIter new_iter = iter;). You must free this iter with gtk_tree_iter_free().

iter : A GtkTreeIter.
Returns : a newly allocated copy of iter.


gtk_tree_iter_free ()

void        gtk_tree_iter_free              (GtkTreeIter *iter);

Free an iterator that has been allocated on the heap. This function is mainly used for language bindings.

iter : A dynamically allocated tree iterator.


gtk_tree_model_get_flags ()

GtkTreeModelFlags gtk_tree_model_get_flags  (GtkTreeModel *tree_model);

Returns a set of flags supported by this interface. The flags are a bitwise combination of GtkTreeModelFlags. It is expected that the flags supported do not change for an interface.

tree_model : A GtkTreeModel.
Returns : The flags supported by this interface.


gtk_tree_model_get_n_columns ()

gint        gtk_tree_model_get_n_columns    (GtkTreeModel *tree_model);

Returns the number of columns supported by the tree_model

tree_model : A GtkTreeModel.
Returns : The number of columns.


gtk_tree_model_get_column_type ()

GType       gtk_tree_model_get_column_type  (GtkTreeModel *tree_model,
                                             gint index);

Returns the type of the column.

tree_model : A GtkTreeModel.
index : The column index.
Returns : The type of the column.


gtk_tree_model_get_iter ()

gboolean    gtk_tree_model_get_iter         (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             GtkTreePath *path);

Sets iter to a valid iterator pointing to path. If the model does not provide an implementation of this function, it is implemented in terms of gtk_tree_model_iter_nth_child.

tree_model : A GtkTreeModel.
iter : The uninitialized GtkTreeIter.
path : The GtkTreePath.
Returns : TRUE, if iter was set.


gtk_tree_model_get_path ()

GtkTreePath* gtk_tree_model_get_path        (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);

Returns a newly created GtkTreePath referenced by iter. This path should be freed with gtk_tree_path_free.

tree_model : A GtkTreeModel.
iter : The GtkTreeIter.
Returns : a newly created GtkTreePath.


gtk_tree_model_get_value ()

void        gtk_tree_model_get_value        (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             gint column,
                                             GValue *value);

Sets initializes and sets value to that at column. When done with value, g_value_unset needs to be called on it.

tree_model : A GtkTreeModel.
iter : The GtkTreeIter.
column : The column to lookup the value at.
value : An empty GValue to set.


gtk_tree_model_iter_next ()

gboolean    gtk_tree_model_iter_next        (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);

Sets iter to point to the node following it at the current level. If there is no next iter, FALSE is returned and iter is set to be invalid.

tree_model : A GtkTreeModel.
iter : The GtkTreeIter.
Returns : TRUE if iter has been changed to the next node.


gtk_tree_model_iter_children ()

gboolean    gtk_tree_model_iter_children    (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             GtkTreeIter *parent);

Sets iter to point to the first child of parent. If parent has no children, FALSE is returned and iter is set to be invalid. parent will remain a valid node after this function has been called.

tree_model : A GtkTreeModel.
iter : The new GtkTreeIter to be set to the child.
parent : The GtkTreeIter.
Returns : TRUE, if child has been set to the first child.


gtk_tree_model_iter_has_child ()

gboolean    gtk_tree_model_iter_has_child   (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);

Returns TRUE if iter has children, FALSE otherwise.

tree_model : A GtkTreeModel.
iter : The GtkTreeIter to test for children.
Returns : TRUE if iter has children.


gtk_tree_model_iter_n_children ()

gint        gtk_tree_model_iter_n_children  (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);

Returns the number of children that iter has. If iter is NULL, then the number of toplevel nodes is returned.

tree_model : A GtkTreeModel.
iter : The GtkTreeIter, or NULL.
Returns : The number of children of iter.


gtk_tree_model_iter_nth_child ()

gboolean    gtk_tree_model_iter_nth_child   (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             GtkTreeIter *parent,
                                             gint n);

Sets iter to be the child of parent, using the given index. The first index is 0. If the index is too big, or parent has no children, iter is set to an invalid iterator and FALSE is returned. parent will remain a valid node after this function has been called. If parent is NULL, then the root node is assumed.

tree_model : A GtkTreeModel.
iter : The GtkTreeIter to set to the nth child.
parent : The GtkTreeIter to get the child from, or NULL.
n : Then index of the desired child.
Returns : TRUE, if parent has an nth child.


gtk_tree_model_iter_parent ()

gboolean    gtk_tree_model_iter_parent      (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             GtkTreeIter *child);

Sets iter to be the parent of child. If child is at the toplevel, and doesn't have a parent, then iter is set to an invalid iterator and FALSE is returned. child will remain a valid node after this function has been called.

tree_model : A GtkTreeModel
iter : The new GtkTreeIter to set to the parent.
child : The GtkTreeIter.
Returns : TRUE, if iter is set to the parent of child.


gtk_tree_model_ref_node ()

void        gtk_tree_model_ref_node         (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);

Lets the tree ref the node. This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons.

This function is primarily meant as a way for views to let caching model know when nodes are being displayed (and hence, whether or not to cache that node.) For example, a file-system based model would not want to keep the entire file-heirarchy in memory, just the sections that are currently being displayed by every current view.

tree_model : A GtkTreeModel.
iter : The GtkTreeIter.


gtk_tree_model_unref_node ()

void        gtk_tree_model_unref_node       (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter);

Lets the tree unref the node. This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons.

For more information on what this means, please see gtk_tree_model_ref_node. Please note that nodes that are deleted are not unreffed.

tree_model : A GtkTreeModel.
iter : The GtkTreeIter.