1/* gtktreestore.h
2 * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <[email protected]>
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_STORE_H__
21#define __GTK_TREE_STORE_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 <gdkconfig.h>
28#include <gtk/gtktreemodel.h>
29#include <gtk/gtktreesortable.h>
30#include <stdarg.h>
31
32
33G_BEGIN_DECLS
34
35
36#define GTK_TYPE_TREE_STORE (gtk_tree_store_get_type ())
37#define GTK_TREE_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_STORE, GtkTreeStore))
38#define GTK_TREE_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_STORE, GtkTreeStoreClass))
39#define GTK_IS_TREE_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_STORE))
40#define GTK_IS_TREE_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_STORE))
41#define GTK_TREE_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_STORE, GtkTreeStoreClass))
42
43typedef struct _GtkTreeStore GtkTreeStore;
44typedef struct _GtkTreeStoreClass GtkTreeStoreClass;
45
46struct _GtkTreeStore
47{
48 GObject parent;
49
50 gint GSEAL (stamp);
51 gpointer GSEAL (root);
52 gpointer GSEAL (last);
53 gint GSEAL (n_columns);
54 gint GSEAL (sort_column_id);
55 GList *GSEAL (sort_list);
56 GtkSortType GSEAL (order);
57 GType *GSEAL (column_headers);
58 GtkTreeIterCompareFunc GSEAL (default_sort_func);
59 gpointer GSEAL (default_sort_data);
60 GDestroyNotify GSEAL (default_sort_destroy);
61 guint GSEAL (columns_dirty) : 1;
62};
63
64struct _GtkTreeStoreClass
65{
66 GObjectClass parent_class;
67
68 /* Padding for future expansion */
69 void (*_gtk_reserved1) (void);
70 void (*_gtk_reserved2) (void);
71 void (*_gtk_reserved3) (void);
72 void (*_gtk_reserved4) (void);
73};
74
75
76GType gtk_tree_store_get_type (void) G_GNUC_CONST;
77GtkTreeStore *gtk_tree_store_new (gint n_columns,
78 ...);
79GtkTreeStore *gtk_tree_store_newv (gint n_columns,
80 GType *types);
81void gtk_tree_store_set_column_types (GtkTreeStore *tree_store,
82 gint n_columns,
83 GType *types);
84
85/* NOTE: use gtk_tree_model_get to get values from a GtkTreeStore */
86
87void gtk_tree_store_set_value (GtkTreeStore *tree_store,
88 GtkTreeIter *iter,
89 gint column,
90 GValue *value);
91void gtk_tree_store_set (GtkTreeStore *tree_store,
92 GtkTreeIter *iter,
93 ...);
94void gtk_tree_store_set_valuesv (GtkTreeStore *tree_store,
95 GtkTreeIter *iter,
96 gint *columns,
97 GValue *values,
98 gint n_values);
99void gtk_tree_store_set_valist (GtkTreeStore *tree_store,
100 GtkTreeIter *iter,
101 va_list var_args);
102gboolean gtk_tree_store_remove (GtkTreeStore *tree_store,
103 GtkTreeIter *iter);
104void gtk_tree_store_insert (GtkTreeStore *tree_store,
105 GtkTreeIter *iter,
106 GtkTreeIter *parent,
107 gint position);
108void gtk_tree_store_insert_before (GtkTreeStore *tree_store,
109 GtkTreeIter *iter,
110 GtkTreeIter *parent,
111 GtkTreeIter *sibling);
112void gtk_tree_store_insert_after (GtkTreeStore *tree_store,
113 GtkTreeIter *iter,
114 GtkTreeIter *parent,
115 GtkTreeIter *sibling);
116void gtk_tree_store_insert_with_values (GtkTreeStore *tree_store,
117 GtkTreeIter *iter,
118 GtkTreeIter *parent,
119 gint position,
120 ...);
121void gtk_tree_store_insert_with_valuesv (GtkTreeStore *tree_store,
122 GtkTreeIter *iter,
123 GtkTreeIter *parent,
124 gint position,
125 gint *columns,
126 GValue *values,
127 gint n_values);
128void gtk_tree_store_prepend (GtkTreeStore *tree_store,
129 GtkTreeIter *iter,
130 GtkTreeIter *parent);
131void gtk_tree_store_append (GtkTreeStore *tree_store,
132 GtkTreeIter *iter,
133 GtkTreeIter *parent);
134gboolean gtk_tree_store_is_ancestor (GtkTreeStore *tree_store,
135 GtkTreeIter *iter,
136 GtkTreeIter *descendant);
137gint gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
138 GtkTreeIter *iter);
139void gtk_tree_store_clear (GtkTreeStore *tree_store);
140gboolean gtk_tree_store_iter_is_valid (GtkTreeStore *tree_store,
141 GtkTreeIter *iter);
142void gtk_tree_store_reorder (GtkTreeStore *tree_store,
143 GtkTreeIter *parent,
144 gint *new_order);
145void gtk_tree_store_swap (GtkTreeStore *tree_store,
146 GtkTreeIter *a,
147 GtkTreeIter *b);
148void gtk_tree_store_move_before (GtkTreeStore *tree_store,
149 GtkTreeIter *iter,
150 GtkTreeIter *position);
151void gtk_tree_store_move_after (GtkTreeStore *tree_store,
152 GtkTreeIter *iter,
153 GtkTreeIter *position);
154
155
156G_END_DECLS
157
158
159#endif /* __GTK_TREE_STORE_H__ */
160