1 /* gtktreemodelfilter.h
2 * Copyright (C) 2000,2001 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
3 * Copyright (C) 2001-2003 Kristian Rietveld <kris@gtk.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef __GTK_TREE_MODEL_FILTER_H__
20 #define __GTK_TREE_MODEL_FILTER_H__
22 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23 #error "Only <gtk/gtk.h> can be included directly."
26 #include <gtk/gtktreemodel.h>
30 #define GTK_TYPE_TREE_MODEL_FILTER (gtk_tree_model_filter_get_type ())
31 #define GTK_TREE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilter))
32 #define GTK_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilterClass))
33 #define GTK_IS_TREE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL_FILTER))
34 #define GTK_IS_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_TREE_MODEL_FILTER))
35 #define GTK_TREE_MODEL_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilterClass))
38 * GtkTreeModelFilterVisibleFunc:
39 * @model: the child model of the #GtkTreeModelFilter
40 * @iter: a #GtkTreeIter pointing to the row in @model whose visibility
42 * @data: (closure): user data given to gtk_tree_model_filter_set_visible_func()
44 * A function which decides whether the row indicated by @iter is visible.
46 * Returns: Whether the row indicated by @iter is visible.
48 typedef gboolean (* GtkTreeModelFilterVisibleFunc) (GtkTreeModel *model,
53 * GtkTreeModelFilterModifyFunc:
54 * @model: the #GtkTreeModelFilter
55 * @iter: a #GtkTreeIter pointing to the row whose display values are determined
56 * @value: A #GValue which is already initialized for with the correct type for
58 * @column: the column whose display value is determined
59 * @data: (closure): user data given to gtk_tree_model_filter_set_modify_func()
61 * A function which calculates display values from raw values in the model.
62 * It must fill @value with the display value for the column @column in the
63 * row indicated by @iter.
65 * Since this function is called for each data access, it's not a
66 * particularly efficient operation.
69 typedef void (* GtkTreeModelFilterModifyFunc) (GtkTreeModel *model,
75 typedef struct _GtkTreeModelFilter GtkTreeModelFilter;
76 typedef struct _GtkTreeModelFilterClass GtkTreeModelFilterClass;
77 typedef struct _GtkTreeModelFilterPrivate GtkTreeModelFilterPrivate;
79 struct _GtkTreeModelFilter
84 GtkTreeModelFilterPrivate *priv;
87 struct _GtkTreeModelFilterClass
89 GObjectClass parent_class;
91 gboolean (* visible) (GtkTreeModelFilter *self,
92 GtkTreeModel *child_model,
94 void (* modify) (GtkTreeModelFilter *self,
95 GtkTreeModel *child_model,
100 /* Padding for future expansion */
101 void (*_gtk_reserved1) (void);
102 void (*_gtk_reserved2) (void);
103 void (*_gtk_reserved3) (void);
104 void (*_gtk_reserved4) (void);
108 GType gtk_tree_model_filter_get_type (void) G_GNUC_CONST;
109 GtkTreeModel *gtk_tree_model_filter_new (GtkTreeModel *child_model,
111 void gtk_tree_model_filter_set_visible_func (GtkTreeModelFilter *filter,
112 GtkTreeModelFilterVisibleFunc func,
114 GDestroyNotify destroy);
115 void gtk_tree_model_filter_set_modify_func (GtkTreeModelFilter *filter,
118 GtkTreeModelFilterModifyFunc func,
120 GDestroyNotify destroy);
121 void gtk_tree_model_filter_set_visible_column (GtkTreeModelFilter *filter,
124 GtkTreeModel *gtk_tree_model_filter_get_model (GtkTreeModelFilter *filter);
127 gboolean gtk_tree_model_filter_convert_child_iter_to_iter (GtkTreeModelFilter *filter,
128 GtkTreeIter *filter_iter,
129 GtkTreeIter *child_iter);
130 void gtk_tree_model_filter_convert_iter_to_child_iter (GtkTreeModelFilter *filter,
131 GtkTreeIter *child_iter,
132 GtkTreeIter *filter_iter);
133 GtkTreePath *gtk_tree_model_filter_convert_child_path_to_path (GtkTreeModelFilter *filter,
134 GtkTreePath *child_path);
135 GtkTreePath *gtk_tree_model_filter_convert_path_to_child_path (GtkTreeModelFilter *filter,
136 GtkTreePath *filter_path);
139 void gtk_tree_model_filter_refilter (GtkTreeModelFilter *filter);
140 void gtk_tree_model_filter_clear_cache (GtkTreeModelFilter *filter);
144 #endif /* __GTK_TREE_MODEL_FILTER_H__ */