2 * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
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.
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.
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.
20 #ifndef __GTK_TREE_MODEL_H__
21 #define __GTK_TREE_MODEL_H__
23 #include <gtk/gtkobject.h>
27 #endif /* __cplusplus */
29 #define GTK_TYPE_TREE_MODEL (gtk_tree_model_get_type ())
30 #define GTK_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModel))
31 #define GTK_IS_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL))
32 #define GTK_TREE_MODEL_GET_IFACE(obj) ((GtkTreeModelIface *)g_type_interface_peek (((GTypeInstance *)GTK_TREE_MODEL (obj))->g_class, GTK_TYPE_TREE_MODEL))
35 typedef struct _GtkTreeIter GtkTreeIter;
36 typedef struct _GtkTreePath GtkTreePath;
37 typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
38 typedef struct _GtkTreeModelIface GtkTreeModelIface;
43 GTK_TREE_MODEL_ITERS_PERSIST = 1 << 0
54 struct _GtkTreeModelIface
56 GTypeInterface g_iface;
59 /* Currently unimplemented as interfaces do not support signals yet, so
60 * objects implementing this interface need this. Later, it will be moved
63 void (* changed) (GtkTreeModel *tree_model,
66 void (* inserted) (GtkTreeModel *tree_model,
69 void (* child_toggled) (GtkTreeModel *tree_model,
72 void (* deleted) (GtkTreeModel *tree_model,
74 void (* reordered) (GtkTreeModel *tree_model,
78 /* VTable - not signals */
79 guint (* get_flags) (GtkTreeModel *tree_model);
80 gint (* get_n_columns) (GtkTreeModel *tree_model);
81 GType (* get_column_type) (GtkTreeModel *tree_model,
83 gboolean (* get_iter) (GtkTreeModel *tree_model,
86 GtkTreePath *(* get_path) (GtkTreeModel *tree_model,
88 void (* get_value) (GtkTreeModel *tree_model,
92 gboolean (* iter_next) (GtkTreeModel *tree_model,
94 gboolean (* iter_children) (GtkTreeModel *tree_model,
97 gboolean (* iter_has_child) (GtkTreeModel *tree_model,
99 gint (* iter_n_children) (GtkTreeModel *tree_model,
101 gboolean (* iter_nth_child) (GtkTreeModel *tree_model,
105 gboolean (* iter_parent) (GtkTreeModel *tree_model,
108 void (* ref_iter) (GtkTreeModel *tree_model,
110 void (* unref_iter) (GtkTreeModel *tree_model,
115 /* GtkTreePath operations */
116 GtkTreePath *gtk_tree_path_new (void);
117 GtkTreePath *gtk_tree_path_new_from_string (gchar *path);
118 gchar *gtk_tree_path_to_string (GtkTreePath *path);
119 GtkTreePath *gtk_tree_path_new_root (void);
120 void gtk_tree_path_append_index (GtkTreePath *path,
122 void gtk_tree_path_prepend_index (GtkTreePath *path,
124 gint gtk_tree_path_get_depth (GtkTreePath *path);
125 gint *gtk_tree_path_get_indices (GtkTreePath *path);
126 void gtk_tree_path_free (GtkTreePath *path);
127 GtkTreePath *gtk_tree_path_copy (GtkTreePath *path);
128 gint gtk_tree_path_compare (const GtkTreePath *a,
129 const GtkTreePath *b);
130 void gtk_tree_path_next (GtkTreePath *path);
131 gint gtk_tree_path_prev (GtkTreePath *path);
132 gint gtk_tree_path_up (GtkTreePath *path);
133 void gtk_tree_path_down (GtkTreePath *path);
136 /* GtkTreeIter operations */
137 GtkTreeIter *gtk_tree_iter_copy (GtkTreeIter *iter);
138 void gtk_tree_iter_free (GtkTreeIter *iter);
140 /* GtkTreeModel stuff */
141 GtkType gtk_tree_model_get_type (void) G_GNUC_CONST;
142 guint gtk_tree_model_get_flags (GtkTreeModel *tree_model);
144 /* Column information */
145 gint gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
146 GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
150 /* Iterator movement */
151 gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
154 GtkTreePath *gtk_tree_model_get_path (GtkTreeModel *tree_model,
156 void gtk_tree_model_get_value (GtkTreeModel *tree_model,
160 gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,
162 gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,
164 GtkTreeIter *parent);
165 gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
167 gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
169 gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
173 gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
176 void gtk_tree_model_ref_iter (GtkTreeModel *tree_model,
178 void gtk_tree_model_unref_iter (GtkTreeModel *tree_model,
183 #endif /* __cplusplus */
186 #endif /* __GTK_TREE_MODEL_H__ */