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;
46 struct _GtkTreeModelIface
48 GTypeInterface g_iface;
51 /* Currently unimplemented as interfaces do not support signals yet, so
52 * objects implementing this interface need this. Later, it will be moved
55 void (* changed) (GtkTreeModel *tree_model,
58 void (* inserted) (GtkTreeModel *tree_model,
61 void (* child_toggled) (GtkTreeModel *tree_model,
64 void (* deleted) (GtkTreeModel *tree_model,
67 /* VTable - not signals */
68 gint (* get_n_columns) (GtkTreeModel *tree_model);
69 GType (* get_column_type) (GtkTreeModel *tree_model,
71 gboolean (* get_iter) (GtkTreeModel *tree_model,
74 GtkTreePath *(* get_path) (GtkTreeModel *tree_model,
76 void (* get_value) (GtkTreeModel *tree_model,
80 gboolean (* iter_next) (GtkTreeModel *tree_model,
82 gboolean (* iter_children) (GtkTreeModel *tree_model,
85 gboolean (* iter_has_child) (GtkTreeModel *tree_model,
87 gint (* iter_n_children) (GtkTreeModel *tree_model,
89 gboolean (* iter_nth_child) (GtkTreeModel *tree_model,
93 gboolean (* iter_parent) (GtkTreeModel *tree_model,
100 GtkTreePath *gtk_tree_path_new (void);
101 GtkTreePath *gtk_tree_path_new_from_string (gchar *path);
102 gchar *gtk_tree_path_to_string (GtkTreePath *path);
103 GtkTreePath *gtk_tree_path_new_root (void);
104 void gtk_tree_path_append_index (GtkTreePath *path,
106 void gtk_tree_path_prepend_index (GtkTreePath *path,
108 gint gtk_tree_path_get_depth (GtkTreePath *path);
109 gint *gtk_tree_path_get_indices (GtkTreePath *path);
110 void gtk_tree_path_free (GtkTreePath *path);
111 GtkTreePath *gtk_tree_path_copy (GtkTreePath *path);
112 gint gtk_tree_path_compare (const GtkTreePath *a,
113 const GtkTreePath *b);
114 void gtk_tree_path_next (GtkTreePath *path);
115 gint gtk_tree_path_prev (GtkTreePath *path);
116 gint gtk_tree_path_up (GtkTreePath *path);
117 void gtk_tree_path_down (GtkTreePath *path);
120 /* GtkTreeModel stuff */
121 GtkType gtk_tree_model_get_type (void) G_GNUC_CONST;
124 /* Column information */
125 gint gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
126 GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
130 /* Iterator movement */
131 gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
134 GtkTreePath *gtk_tree_model_get_path (GtkTreeModel *tree_model,
136 void gtk_tree_model_get_value (GtkTreeModel *tree_model,
140 gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,
142 gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,
144 GtkTreeIter *parent);
145 gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
147 gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
149 gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
153 gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
160 #endif /* __cplusplus */
163 #endif /* __GTK_TREE_MODEL_H__ */