Ardour  9.0-pre0-582-g084a23a80d
gtktreemodel.h
Go to the documentation of this file.
1 /* gtktreemodel.h
2  * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef __GTK_TREE_MODEL_H__
21 #define __GTK_TREE_MODEL_H__
22 
23 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
24 #error "Only <gtk/gtk.h> can be included directly."
25 #endif
26 
27 #include <glib-object.h>
28 
29 /* Not needed, retained for compatibility -Yosh */
30 #include <gtk/gtkobject.h>
31 
32 G_BEGIN_DECLS
33 
34 #define GTK_TYPE_TREE_MODEL (gtk_tree_model_get_type ())
35 #define GTK_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModel))
36 #define GTK_IS_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL))
37 #define GTK_TREE_MODEL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModelIface))
38 
39 #define GTK_TYPE_TREE_ITER (gtk_tree_iter_get_type ())
40 #define GTK_TYPE_TREE_PATH (gtk_tree_path_get_type ())
41 #define GTK_TYPE_TREE_ROW_REFERENCE (gtk_tree_row_reference_get_type ())
42 
43 typedef struct _GtkTreeIter GtkTreeIter;
44 typedef struct _GtkTreePath GtkTreePath;
45 typedef struct _GtkTreeRowReference GtkTreeRowReference;
46 typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
48 typedef gboolean (* GtkTreeModelForeachFunc) (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
49 
50 
51 typedef enum
52 {
56 
58 {
59  gint stamp;
60  gpointer user_data;
61  gpointer user_data2;
62  gpointer user_data3;
63 };
64 
66 {
67  GTypeInterface g_iface;
68 
69  /* Signals */
70  void (* row_changed) (GtkTreeModel *tree_model,
71  GtkTreePath *path,
72  GtkTreeIter *iter);
73  void (* row_inserted) (GtkTreeModel *tree_model,
74  GtkTreePath *path,
75  GtkTreeIter *iter);
76  void (* row_has_child_toggled) (GtkTreeModel *tree_model,
77  GtkTreePath *path,
78  GtkTreeIter *iter);
79  void (* row_deleted) (GtkTreeModel *tree_model,
80  GtkTreePath *path);
81  void (* rows_reordered) (GtkTreeModel *tree_model,
82  GtkTreePath *path,
83  GtkTreeIter *iter,
84  gint *new_order);
85 
86  /* Virtual Table */
88 
89  gint (* get_n_columns) (GtkTreeModel *tree_model);
90  GType (* get_column_type) (GtkTreeModel *tree_model,
91  gint index_);
92  gboolean (* get_iter) (GtkTreeModel *tree_model,
93  GtkTreeIter *iter,
94  GtkTreePath *path);
95  GtkTreePath *(* get_path) (GtkTreeModel *tree_model,
96  GtkTreeIter *iter);
97  void (* get_value) (GtkTreeModel *tree_model,
98  GtkTreeIter *iter,
99  gint column,
100  GValue *value);
101  gboolean (* iter_next) (GtkTreeModel *tree_model,
102  GtkTreeIter *iter);
103  gboolean (* iter_children) (GtkTreeModel *tree_model,
104  GtkTreeIter *iter,
105  GtkTreeIter *parent);
106  gboolean (* iter_has_child) (GtkTreeModel *tree_model,
107  GtkTreeIter *iter);
108  gint (* iter_n_children) (GtkTreeModel *tree_model,
109  GtkTreeIter *iter);
110  gboolean (* iter_nth_child) (GtkTreeModel *tree_model,
111  GtkTreeIter *iter,
112  GtkTreeIter *parent,
113  gint n);
114  gboolean (* iter_parent) (GtkTreeModel *tree_model,
115  GtkTreeIter *iter,
116  GtkTreeIter *child);
117  void (* ref_node) (GtkTreeModel *tree_model,
118  GtkTreeIter *iter);
119  void (* unref_node) (GtkTreeModel *tree_model,
120  GtkTreeIter *iter);
121 };
122 
123 
124 /* GtkTreePath operations */
128  ...);
132  gint index_);
134  gint index_);
138  gint *depth);
141 GType gtk_tree_path_get_type (void) G_GNUC_CONST;
143  const GtkTreePath *b);
146 gboolean gtk_tree_path_up (GtkTreePath *path);
148 
150  GtkTreePath *descendant);
152  GtkTreePath *ancestor);
153 
154 #ifndef GTK_DISABLE_DEPRECATED
155 #define gtk_tree_path_new_root() gtk_tree_path_new_first()
156 #endif /* !GTK_DISABLE_DEPRECATED */
157 
158 /* Row reference (an object that tracks model changes so it refers to the same
159  * row always; a path refers to a position, not a fixed row). You almost always
160  * want to call gtk_tree_row_reference_new.
161  */
162 
163 GType gtk_tree_row_reference_get_type (void) G_GNUC_CONST;
165  GtkTreePath *path);
167  GtkTreeModel *model,
168  GtkTreePath *path);
174 /* These two functions are only needed if you created the row reference with a
175  * proxy object */
176 void gtk_tree_row_reference_inserted (GObject *proxy,
177  GtkTreePath *path);
178 void gtk_tree_row_reference_deleted (GObject *proxy,
179  GtkTreePath *path);
180 void gtk_tree_row_reference_reordered (GObject *proxy,
181  GtkTreePath *path,
182  GtkTreeIter *iter,
183  gint *new_order);
184 
185 /* GtkTreeIter operations */
188 GType gtk_tree_iter_get_type (void) G_GNUC_CONST;
189 
190 GType gtk_tree_model_get_type (void) G_GNUC_CONST;
194  gint index_);
195 
196 
197 /* Iterator movement */
198 gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
199  GtkTreeIter *iter,
200  GtkTreePath *path);
202  GtkTreeIter *iter,
203  const gchar *path_string);
205  GtkTreeIter *iter);
207  GtkTreeIter *iter);
209  GtkTreeIter *iter);
211  GtkTreeIter *iter,
212  gint column,
213  GValue *value);
215  GtkTreeIter *iter);
217  GtkTreeIter *iter,
218  GtkTreeIter *parent);
220  GtkTreeIter *iter);
222  GtkTreeIter *iter);
224  GtkTreeIter *iter,
225  GtkTreeIter *parent,
226  gint n);
228  GtkTreeIter *iter,
229  GtkTreeIter *child);
231  GtkTreeIter *iter);
233  GtkTreeIter *iter);
235  GtkTreeIter *iter,
236  ...);
238  GtkTreeIter *iter,
239  va_list var_args);
240 
241 
244  gpointer user_data);
245 
246 
247 #ifndef GTK_DISABLE_DEPRECATED
248 #define gtk_tree_model_get_iter_root(tree_model, iter) gtk_tree_model_get_iter_first(tree_model, iter)
249 #endif /* !GTK_DISABLE_DEPRECATED */
250 
251 /* Signals */
253  GtkTreePath *path,
254  GtkTreeIter *iter);
256  GtkTreePath *path,
257  GtkTreeIter *iter);
259  GtkTreePath *path,
260  GtkTreeIter *iter);
262  GtkTreePath *path);
264  GtkTreePath *path,
265  GtkTreeIter *iter,
266  gint *new_order);
267 
268 G_END_DECLS
269 
270 #endif /* __GTK_TREE_MODEL_H__ */
gboolean gtk_tree_model_get_iter(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath *path)
gchar * gtk_tree_path_to_string(GtkTreePath *path)
gboolean gtk_tree_model_iter_has_child(GtkTreeModel *tree_model, GtkTreeIter *iter)
void gtk_tree_path_prepend_index(GtkTreePath *path, gint index_)
GtkTreePath * gtk_tree_path_new_from_indices(gint first_index,...)
struct _GtkTreePath GtkTreePath
Definition: gtktreemodel.h:44
gboolean gtk_tree_model_iter_parent(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child)
void gtk_tree_path_next(GtkTreePath *path)
void gtk_tree_model_rows_reordered(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter, gint *new_order)
gint * gtk_tree_path_get_indices_with_depth(GtkTreePath *path, gint *depth)
gint gtk_tree_path_compare(const GtkTreePath *a, const GtkTreePath *b)
GtkTreePath * gtk_tree_row_reference_get_path(GtkTreeRowReference *reference)
GType gtk_tree_iter_get_type(void) G_GNUC_CONST
GtkTreeIter * gtk_tree_iter_copy(GtkTreeIter *iter)
gint gtk_tree_model_iter_n_children(GtkTreeModel *tree_model, GtkTreeIter *iter)
void gtk_tree_path_append_index(GtkTreePath *path, gint index_)
void gtk_tree_model_ref_node(GtkTreeModel *tree_model, GtkTreeIter *iter)
void gtk_tree_model_unref_node(GtkTreeModel *tree_model, GtkTreeIter *iter)
GType gtk_tree_row_reference_get_type(void) G_GNUC_CONST
GtkTreePath * gtk_tree_path_new_first(void)
void gtk_tree_model_foreach(GtkTreeModel *model, GtkTreeModelForeachFunc func, gpointer user_data)
GtkTreePath * gtk_tree_path_new_from_string(const gchar *path)
void gtk_tree_model_get_valist(GtkTreeModel *tree_model, GtkTreeIter *iter, va_list var_args)
GType gtk_tree_path_get_type(void) G_GNUC_CONST
gboolean gtk_tree_model_iter_nth_child(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n)
gint gtk_tree_path_get_depth(GtkTreePath *path)
GtkTreeModel * gtk_tree_row_reference_get_model(GtkTreeRowReference *reference)
void gtk_tree_row_reference_free(GtkTreeRowReference *reference)
GtkTreeModelFlags gtk_tree_model_get_flags(GtkTreeModel *tree_model)
gint gtk_tree_model_get_n_columns(GtkTreeModel *tree_model)
void gtk_tree_row_reference_deleted(GObject *proxy, GtkTreePath *path)
GtkTreePath * gtk_tree_model_get_path(GtkTreeModel *tree_model, GtkTreeIter *iter)
GtkTreePath * gtk_tree_path_copy(const GtkTreePath *path)
void gtk_tree_model_get(GtkTreeModel *tree_model, GtkTreeIter *iter,...)
gboolean gtk_tree_model_iter_children(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent)
gboolean gtk_tree_path_up(GtkTreePath *path)
gboolean gtk_tree_path_prev(GtkTreePath *path)
void gtk_tree_model_row_inserted(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter)
void gtk_tree_path_free(GtkTreePath *path)
struct _GtkTreeRowReference GtkTreeRowReference
Definition: gtktreemodel.h:45
void gtk_tree_row_reference_reordered(GObject *proxy, GtkTreePath *path, GtkTreeIter *iter, gint *new_order)
gboolean gtk_tree_path_is_ancestor(GtkTreePath *path, GtkTreePath *descendant)
GType gtk_tree_model_get_type(void) G_GNUC_CONST
gchar * gtk_tree_model_get_string_from_iter(GtkTreeModel *tree_model, GtkTreeIter *iter)
gboolean(* GtkTreeModelForeachFunc)(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition: gtktreemodel.h:48
void gtk_tree_row_reference_inserted(GObject *proxy, GtkTreePath *path)
GtkTreePath * gtk_tree_path_new(void)
gboolean gtk_tree_model_get_iter_first(GtkTreeModel *tree_model, GtkTreeIter *iter)
GtkTreeRowReference * gtk_tree_row_reference_copy(GtkTreeRowReference *reference)
GtkTreeRowReference * gtk_tree_row_reference_new(GtkTreeModel *model, GtkTreePath *path)
void gtk_tree_model_row_deleted(GtkTreeModel *tree_model, GtkTreePath *path)
GtkTreeRowReference * gtk_tree_row_reference_new_proxy(GObject *proxy, GtkTreeModel *model, GtkTreePath *path)
gboolean gtk_tree_model_get_iter_from_string(GtkTreeModel *tree_model, GtkTreeIter *iter, const gchar *path_string)
void gtk_tree_iter_free(GtkTreeIter *iter)
gint * gtk_tree_path_get_indices(GtkTreePath *path)
void gtk_tree_model_row_changed(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter)
void gtk_tree_model_row_has_child_toggled(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter)
GType gtk_tree_model_get_column_type(GtkTreeModel *tree_model, gint index_)
gboolean gtk_tree_path_is_descendant(GtkTreePath *path, GtkTreePath *ancestor)
void gtk_tree_path_down(GtkTreePath *path)
GtkTreeModelFlags
Definition: gtktreemodel.h:52
@ GTK_TREE_MODEL_LIST_ONLY
Definition: gtktreemodel.h:54
@ GTK_TREE_MODEL_ITERS_PERSIST
Definition: gtktreemodel.h:53
gboolean gtk_tree_model_iter_next(GtkTreeModel *tree_model, GtkTreeIter *iter)
gboolean gtk_tree_row_reference_valid(GtkTreeRowReference *reference)
void gtk_tree_model_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value)
struct _GtkTreeModel GtkTreeModel
Definition: gtktreemodel.h:46
gpointer user_data
Definition: gtktreemodel.h:60
gpointer user_data2
Definition: gtktreemodel.h:61
gpointer user_data3
Definition: gtktreemodel.h:62
gboolean(* iter_children)(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent)
Definition: gtktreemodel.h:103
gboolean(* iter_parent)(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child)
Definition: gtktreemodel.h:114
gint(* get_n_columns)(GtkTreeModel *tree_model)
Definition: gtktreemodel.h:89
gboolean(* iter_nth_child)(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n)
Definition: gtktreemodel.h:110
gint(* iter_n_children)(GtkTreeModel *tree_model, GtkTreeIter *iter)
Definition: gtktreemodel.h:108
void(* row_inserted)(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter)
Definition: gtktreemodel.h:73
void(* unref_node)(GtkTreeModel *tree_model, GtkTreeIter *iter)
Definition: gtktreemodel.h:119
GtkTreeModelFlags(* get_flags)(GtkTreeModel *tree_model)
Definition: gtktreemodel.h:87
void(* ref_node)(GtkTreeModel *tree_model, GtkTreeIter *iter)
Definition: gtktreemodel.h:117
gboolean(* get_iter)(GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath *path)
Definition: gtktreemodel.h:92
void(* get_value)(GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value)
Definition: gtktreemodel.h:97
void(* row_changed)(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter)
Definition: gtktreemodel.h:70
GType(* get_column_type)(GtkTreeModel *tree_model, gint index_)
Definition: gtktreemodel.h:90
gboolean(* iter_has_child)(GtkTreeModel *tree_model, GtkTreeIter *iter)
Definition: gtktreemodel.h:106
void(* row_has_child_toggled)(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter)
Definition: gtktreemodel.h:76
GTypeInterface g_iface
Definition: gtktreemodel.h:67
gboolean(* iter_next)(GtkTreeModel *tree_model, GtkTreeIter *iter)
Definition: gtktreemodel.h:101
void(* row_deleted)(GtkTreeModel *tree_model, GtkTreePath *path)
Definition: gtktreemodel.h:79
void(* rows_reordered)(GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter, gint *new_order)
Definition: gtktreemodel.h:81