1/* gtktreemodelsort.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_MODEL_SORT_H__
21#define __GTK_TREE_MODEL_SORT_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
31G_BEGIN_DECLS
32
33#define GTK_TYPE_TREE_MODEL_SORT (gtk_tree_model_sort_get_type ())
34#define GTK_TREE_MODEL_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL_SORT, GtkTreeModelSort))
35#define GTK_TREE_MODEL_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_MODEL_SORT, GtkTreeModelSortClass))
36#define GTK_IS_TREE_MODEL_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL_SORT))
37#define GTK_IS_TREE_MODEL_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_MODEL_SORT))
38#define GTK_TREE_MODEL_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_MODEL_SORT, GtkTreeModelSortClass))
39
40typedef struct _GtkTreeModelSort GtkTreeModelSort;
41typedef struct _GtkTreeModelSortClass GtkTreeModelSortClass;
42
43struct _GtkTreeModelSort
44{
45 GObject parent;
46
47 /* < private > */
48 gpointer GSEAL (root);
49 gint GSEAL (stamp);
50 guint GSEAL (child_flags);
51 GtkTreeModel *GSEAL (child_model);
52 gint GSEAL (zero_ref_count);
53
54 /* sort information */
55 GList *GSEAL (sort_list);
56 gint GSEAL (sort_column_id);
57 GtkSortType GSEAL (order);
58
59 /* default sort */
60 GtkTreeIterCompareFunc GSEAL (default_sort_func);
61 gpointer GSEAL (default_sort_data);
62 GDestroyNotify GSEAL (default_sort_destroy);
63
64 /* signal ids */
65 guint GSEAL (changed_id);
66 guint GSEAL (inserted_id);
67 guint GSEAL (has_child_toggled_id);
68 guint GSEAL (deleted_id);
69 guint GSEAL (reordered_id);
70};
71
72struct _GtkTreeModelSortClass
73{
74 GObjectClass parent_class;
75
76 /* Padding for future expansion */
77 void (*_gtk_reserved1) (void);
78 void (*_gtk_reserved2) (void);
79 void (*_gtk_reserved3) (void);
80 void (*_gtk_reserved4) (void);
81};
82
83
84GType gtk_tree_model_sort_get_type (void) G_GNUC_CONST;
85GtkTreeModel *gtk_tree_model_sort_new_with_model (GtkTreeModel *child_model);
86
87GtkTreeModel *gtk_tree_model_sort_get_model (GtkTreeModelSort *tree_model);
88GtkTreePath *gtk_tree_model_sort_convert_child_path_to_path (GtkTreeModelSort *tree_model_sort,
89 GtkTreePath *child_path);
90gboolean gtk_tree_model_sort_convert_child_iter_to_iter (GtkTreeModelSort *tree_model_sort,
91 GtkTreeIter *sort_iter,
92 GtkTreeIter *child_iter);
93GtkTreePath *gtk_tree_model_sort_convert_path_to_child_path (GtkTreeModelSort *tree_model_sort,
94 GtkTreePath *sorted_path);
95void gtk_tree_model_sort_convert_iter_to_child_iter (GtkTreeModelSort *tree_model_sort,
96 GtkTreeIter *child_iter,
97 GtkTreeIter *sorted_iter);
98void gtk_tree_model_sort_reset_default_sort_func (GtkTreeModelSort *tree_model_sort);
99void gtk_tree_model_sort_clear_cache (GtkTreeModelSort *tree_model_sort);
100gboolean gtk_tree_model_sort_iter_is_valid (GtkTreeModelSort *tree_model_sort,
101 GtkTreeIter *iter);
102
103
104G_END_DECLS
105
106#endif /* __GTK_TREE_MODEL_SORT_H__ */
107