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 GtkTreeModelFlags (* get_flags) (GtkTreeModel *tree_model);
81 gint (* get_n_columns) (GtkTreeModel *tree_model);
82 GType (* get_column_type) (GtkTreeModel *tree_model,
84 gboolean (* get_iter) (GtkTreeModel *tree_model,
87 GtkTreePath *(* get_path) (GtkTreeModel *tree_model,
89 void (* get_value) (GtkTreeModel *tree_model,
93 gboolean (* iter_next) (GtkTreeModel *tree_model,
95 gboolean (* iter_children) (GtkTreeModel *tree_model,
98 gboolean (* iter_has_child) (GtkTreeModel *tree_model,
100 gint (* iter_n_children) (GtkTreeModel *tree_model,
102 gboolean (* iter_nth_child) (GtkTreeModel *tree_model,
106 gboolean (* iter_parent) (GtkTreeModel *tree_model,
109 void (* ref_iter) (GtkTreeModel *tree_model,
111 void (* unref_iter) (GtkTreeModel *tree_model,
116 /* GtkTreePath operations */
117 GtkTreePath *gtk_tree_path_new (void);
118 GtkTreePath *gtk_tree_path_new_from_string (gchar *path);
119 gchar *gtk_tree_path_to_string (GtkTreePath *path);
120 GtkTreePath *gtk_tree_path_new_root (void);
121 void gtk_tree_path_append_index (GtkTreePath *path,
123 void gtk_tree_path_prepend_index (GtkTreePath *path,
125 gint gtk_tree_path_get_depth (GtkTreePath *path);
126 gint *gtk_tree_path_get_indices (GtkTreePath *path);
127 void gtk_tree_path_free (GtkTreePath *path);
128 GtkTreePath *gtk_tree_path_copy (GtkTreePath *path);
129 gint gtk_tree_path_compare (const GtkTreePath *a,
130 const GtkTreePath *b);
131 void gtk_tree_path_next (GtkTreePath *path);
132 gboolean gtk_tree_path_prev (GtkTreePath *path);
133 gboolean gtk_tree_path_up (GtkTreePath *path);
134 void gtk_tree_path_down (GtkTreePath *path);
137 /* GtkTreeIter operations */
138 GtkTreeIter *gtk_tree_iter_copy (GtkTreeIter *iter);
139 void gtk_tree_iter_free (GtkTreeIter *iter);
141 /* GtkTreeModel stuff */
142 GtkType gtk_tree_model_get_type (void) G_GNUC_CONST;
143 GtkTreeModelFlags gtk_tree_model_get_flags (GtkTreeModel *tree_model);
145 /* Column information */
146 gint gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
147 GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
151 /* Iterator movement */
152 gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
155 gboolean gtk_tree_model_get_first (GtkTreeModel *tree_model,
157 GtkTreePath *gtk_tree_model_get_path (GtkTreeModel *tree_model,
159 void gtk_tree_model_get_value (GtkTreeModel *tree_model,
163 gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,
165 gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,
167 GtkTreeIter *parent);
168 gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
170 gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
172 gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
176 gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
179 void gtk_tree_model_ref_iter (GtkTreeModel *tree_model,
181 void gtk_tree_model_unref_iter (GtkTreeModel *tree_model,
186 #endif /* __cplusplus */
189 #endif /* __GTK_TREE_MODEL_H__ */