]> Pileus Git - ~andy/gtk/blob - gtk/gtktreemodelsort.h
added more fields to allow more interesting iterators. Also, made the
[~andy/gtk] / gtk / gtktreemodelsort.h
1 /* gtktreemodelsort.h
2  * Copyright (C) 2000  Red Hat, Inc.,  Jonathan Blandford <jrb@redhat.com>
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 #include <gtk/gtktreemodel.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 #define GTK_TYPE_TREE_MODEL_SORT                        (gtk_tree_model_sort_get_type ())
30 #define GTK_TREE_MODEL_SORT(obj)                        (GTK_CHECK_CAST ((obj), GTK_TYPE_TREE_MODEL_SORT, GtkTreeModelSort))
31 #define GTK_TREE_MODEL_SORT_CLASS(klass)                (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_MODEL_SORT, GtkTreeModelSortClass))
32 #define GTK_IS_TREE_MODEL_SORT(obj)                     (GTK_CHECK_TYPE ((obj), GTK_TYPE_TREE_MODEL_SORT))
33 #define GTK_IS_TREE_MODEL_SORT_CLASS(klass)             (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_TREE_MODEL_SORT))
34
35 typedef struct _GtkTreeModelSort       GtkTreeModelSort;
36 typedef struct _GtkTreeModelSortClass  GtkTreeModelSortClass;
37
38 typedef gint (* GValueCompareFunc) (const GValue *a,
39                                     const GValue *b);
40
41 struct _GtkTreeModelSort
42 {
43   GtkObject parent;
44
45   /* < private > */
46   gpointer root;
47   gint stamp;
48   guint flags;
49   GtkTreeModel *model;
50   gint sort_col;
51   GValueCompareFunc *func;
52 };
53
54 struct _GtkTreeModelSortClass
55 {
56   GtkObjectClass parent_class;
57
58   /* signals */
59   /* Will be moved into the GtkTreeModelIface eventually */
60   void (* changed)       (GtkTreeModel *tree_model,
61                           GtkTreePath  *path,
62                           GtkTreeIter  *iter);
63   void (* inserted)      (GtkTreeModel *tree_model,
64                           GtkTreePath  *path,
65                           GtkTreeIter  *iter);
66   void (* child_toggled) (GtkTreeModel *tree_model,
67                           GtkTreePath  *path,
68                           GtkTreeIter  *iter);
69   void (* deleted)       (GtkTreeModel *tree_model,
70                           GtkTreePath  *path);
71 };
72
73
74 GtkType       gtk_tree_model_sort_get_type       (void);
75 GtkTreeModel *gtk_tree_model_sort_new            (void);
76 GtkTreeModel *gtk_tree_model_sort_new_with_model (GtkTreeModel      *model,
77                                                   GValueCompareFunc *func,
78                                                   gint               sort_col);
79 void          gtk_tree_model_sort_set_model      (GtkTreeModelSort  *tree_model_sort,
80                                                   GtkTreeModel      *model);
81 void          gtk_tree_model_sort_set_sort_col   (GtkTreeModelSort  *tree_model_sort,
82                                                   gint               sort_col);
83 void          gtk_tree_model_sort_set_compare    (GtkTreeModelSort  *tree_model_sort,
84                                                   GValueCompareFunc *func);
85 void          gtk_tree_model_sort_resort         (GtkTreeModelSort  *tree_model_sort);
86 GtkTreePath  *gtk_tree_model_sort_convert_path   (GtkTreeModelSort  *tree_model_sort,
87                                                   GtkTreePath       *path);
88
89 #ifdef __cplusplus
90 }
91 #endif /* __cplusplus */
92
93
94 #endif /* __GTK_TREE_MODEL_SORT_H__ */