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 gpointer GtkTreeNode;
36 typedef struct _GtkTreePath GtkTreePath;
37 typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
38 typedef struct _GtkTreeModelIface GtkTreeModelIface;
40 struct _GtkTreeModelIface
42 GTypeInterface g_iface;
45 /* Currently unimplemented as interfaces do not support signals yet, so
46 * objects implementing this interface need this. Later, it will be moved
49 void (* node_changed) (GtkTreeModel *tree_model,
52 void (* node_inserted) (GtkTreeModel *tree_model,
55 void (* node_child_toggled) (GtkTreeModel *tree_model,
58 void (* node_deleted) (GtkTreeModel *tree_model,
61 /* VTable - not signals */
62 gint (* get_n_columns) (GtkTreeModel *tree_model);
63 GtkTreeNode (* get_node) (GtkTreeModel *tree_model,
65 GtkTreePath *(* get_path) (GtkTreeModel *tree_model,
67 void (* node_get_value) (GtkTreeModel *tree_model,
71 gboolean (* node_next) (GtkTreeModel *tree_model,
73 GtkTreeNode (* node_children) (GtkTreeModel *tree_model,
75 gboolean (* node_has_child) (GtkTreeModel *tree_model,
77 gint (* node_n_children) (GtkTreeModel *tree_model,
79 GtkTreeNode (* node_nth_child) (GtkTreeModel *tree_model,
82 GtkTreeNode (* node_parent) (GtkTreeModel *tree_model,
87 /* Basic tree_model operations */
88 GtkType gtk_tree_model_get_type (void) G_GNUC_CONST;
90 /* GtkTreePath Operations */
91 GtkTreePath *gtk_tree_path_new (void);
92 GtkTreePath *gtk_tree_path_new_from_string (gchar *path);
93 gchar *gtk_tree_path_to_string (GtkTreePath *path);
94 GtkTreePath *gtk_tree_path_new_root (void);
95 void gtk_tree_path_append_index (GtkTreePath *path,
97 void gtk_tree_path_prepend_index (GtkTreePath *path,
99 gint gtk_tree_path_get_depth (GtkTreePath *path);
100 gint *gtk_tree_path_get_indices (GtkTreePath *path);
101 void gtk_tree_path_free (GtkTreePath *path);
102 GtkTreePath *gtk_tree_path_copy (GtkTreePath *path);
103 gint gtk_tree_path_compare (GtkTreePath *a,
105 void gtk_tree_path_next (GtkTreePath *path);
106 gint gtk_tree_path_prev (GtkTreePath *path);
107 gint gtk_tree_path_up (GtkTreePath *path);
108 void gtk_tree_path_down (GtkTreePath *path);
110 /* Header operations */
111 gint gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
113 /* Node operations */
114 GtkTreeNode gtk_tree_model_get_node (GtkTreeModel *tree_model,
116 GtkTreePath *gtk_tree_model_get_path (GtkTreeModel *tree_model,
118 void gtk_tree_model_node_get_value (GtkTreeModel *tree_model,
122 gboolean gtk_tree_model_node_next (GtkTreeModel *tree_model,
124 GtkTreeNode gtk_tree_model_node_children (GtkTreeModel *tree_model,
126 gboolean gtk_tree_model_node_has_child (GtkTreeModel *tree_model,
128 gint gtk_tree_model_node_n_children (GtkTreeModel *tree_model,
130 GtkTreeNode gtk_tree_model_node_nth_child (GtkTreeModel *tree_model,
133 GtkTreeNode gtk_tree_model_node_parent (GtkTreeModel *tree_model,
139 #endif /* __cplusplus */
142 #endif /* __GTK_TREE_MODEL_H__ */