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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22 #error "Only <gtk/gtk.h> can be included directly."
25 #ifndef __GTK_TREE_MODEL_FILTER_H__
26 #define __GTK_TREE_MODEL_FILTER_H__
28 #include <gdkconfig.h>
29 #include <gtk/gtktreemodel.h>
33 #define GTK_TYPE_TREE_MODEL_FILTER (gtk_tree_model_filter_get_type ())
34 #define GTK_TREE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilter))
35 #define GTK_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilterClass))
36 #define GTK_IS_TREE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL_FILTER))
37 #define GTK_IS_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_TREE_MODEL_FILTER))
38 #define GTK_TREE_MODEL_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilterClass))
41 * GtkTreeModelFilterVisibleFunc:
42 * @model: the child model of the #GtkTreeModelFilter
43 * @iter: a #GtkTreeIter pointing to the row in @model whose visibility
45 * @data: user data given to gtk_tree_model_filter_set_visible_func()
47 * A function which decides whether the row indicated by @iter is visible.
49 * Returns: Whether the row indicated by @iter is visible.
51 typedef gboolean (* GtkTreeModelFilterVisibleFunc) (GtkTreeModel *model,
56 * GtkTreeModelFilterModifyFunc:
57 * @model: the #GtkTreeModelFilter
58 * @iter: a #GtkTreeIter pointing to the row whose display values are determined
59 * @value: A #GValue which is already initialized for with the correct type for
61 * @column: the column whose display value is determined
62 * @data: user data given to gtk_tree_model_filter_set_modify_func()
64 * A function which calculates display values from raw values in the model.
65 * It must fill @value with the display value for the column @column in the
66 * row indicated by @iter.
68 * Since this function is called for each data access, it's not a
69 * particularly efficient operation.
72 typedef void (* GtkTreeModelFilterModifyFunc) (GtkTreeModel *model,
78 typedef struct _GtkTreeModelFilter GtkTreeModelFilter;
79 typedef struct _GtkTreeModelFilterClass GtkTreeModelFilterClass;
80 typedef struct _GtkTreeModelFilterPrivate GtkTreeModelFilterPrivate;
82 struct _GtkTreeModelFilter
87 GtkTreeModelFilterPrivate *priv;
90 struct _GtkTreeModelFilterClass
92 GObjectClass parent_class;
94 gboolean (* visible) (GtkTreeModelFilter *self,
95 GtkTreeModel *child_model,
97 void (* modify) (GtkTreeModelFilter *self,
98 GtkTreeModel *child_model,
103 /* Padding for future expansion */
104 void (*_gtk_reserved1) (void);
105 void (*_gtk_reserved2) (void);
106 void (*_gtk_reserved3) (void);
107 void (*_gtk_reserved4) (void);
111 GType gtk_tree_model_filter_get_type (void) G_GNUC_CONST;
112 GtkTreeModel *gtk_tree_model_filter_new (GtkTreeModel *child_model,
114 void gtk_tree_model_filter_set_visible_func (GtkTreeModelFilter *filter,
115 GtkTreeModelFilterVisibleFunc func,
117 GDestroyNotify destroy);
118 void gtk_tree_model_filter_set_modify_func (GtkTreeModelFilter *filter,
121 GtkTreeModelFilterModifyFunc func,
123 GDestroyNotify destroy);
124 void gtk_tree_model_filter_set_visible_column (GtkTreeModelFilter *filter,
127 GtkTreeModel *gtk_tree_model_filter_get_model (GtkTreeModelFilter *filter);
130 gboolean gtk_tree_model_filter_convert_child_iter_to_iter (GtkTreeModelFilter *filter,
131 GtkTreeIter *filter_iter,
132 GtkTreeIter *child_iter);
133 void gtk_tree_model_filter_convert_iter_to_child_iter (GtkTreeModelFilter *filter,
134 GtkTreeIter *child_iter,
135 GtkTreeIter *filter_iter);
136 GtkTreePath *gtk_tree_model_filter_convert_child_path_to_path (GtkTreeModelFilter *filter,
137 GtkTreePath *child_path);
138 GtkTreePath *gtk_tree_model_filter_convert_path_to_child_path (GtkTreeModelFilter *filter,
139 GtkTreePath *filter_path);
142 void gtk_tree_model_filter_refilter (GtkTreeModelFilter *filter);
143 void gtk_tree_model_filter_clear_cache (GtkTreeModelFilter *filter);
147 #endif /* __GTK_TREE_MODEL_FILTER_H__ */