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 <gtk/gtktreemodel.h>
32 #define GTK_TYPE_TREE_MODEL_FILTER (gtk_tree_model_filter_get_type ())
33 #define GTK_TREE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilter))
34 #define GTK_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilterClass))
35 #define GTK_IS_TREE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL_FILTER))
36 #define GTK_IS_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_TREE_MODEL_FILTER))
37 #define GTK_TREE_MODEL_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilterClass))
40 * GtkTreeModelFilterVisibleFunc:
41 * @model: the child model of the #GtkTreeModelFilter
42 * @iter: a #GtkTreeIter pointing to the row in @model whose visibility
44 * @data: user data given to gtk_tree_model_filter_set_visible_func()
46 * A function which decides whether the row indicated by @iter is visible.
48 * Returns: Whether the row indicated by @iter is visible.
50 typedef gboolean (* GtkTreeModelFilterVisibleFunc) (GtkTreeModel *model,
55 * GtkTreeModelFilterModifyFunc:
56 * @model: the #GtkTreeModelFilter
57 * @iter: a #GtkTreeIter pointing to the row whose display values are determined
58 * @value: A #GValue which is already initialized for with the correct type for
60 * @column: the column whose display value is determined
61 * @data: user data given to gtk_tree_model_filter_set_modify_func()
63 * A function which calculates display values from raw values in the model.
64 * It must fill @value with the display value for the column @column in the
65 * row indicated by @iter.
67 * Since this function is called for each data access, it's not a
68 * particularly efficient operation.
71 typedef void (* GtkTreeModelFilterModifyFunc) (GtkTreeModel *model,
77 typedef struct _GtkTreeModelFilter GtkTreeModelFilter;
78 typedef struct _GtkTreeModelFilterClass GtkTreeModelFilterClass;
79 typedef struct _GtkTreeModelFilterPrivate GtkTreeModelFilterPrivate;
81 struct _GtkTreeModelFilter
86 GtkTreeModelFilterPrivate *priv;
89 struct _GtkTreeModelFilterClass
91 GObjectClass parent_class;
93 gboolean (* visible) (GtkTreeModelFilter *self,
94 GtkTreeModel *child_model,
96 void (* modify) (GtkTreeModelFilter *self,
97 GtkTreeModel *child_model,
102 /* Padding for future expansion */
103 void (*_gtk_reserved1) (void);
104 void (*_gtk_reserved2) (void);
105 void (*_gtk_reserved3) (void);
106 void (*_gtk_reserved4) (void);
110 GType gtk_tree_model_filter_get_type (void) G_GNUC_CONST;
111 GtkTreeModel *gtk_tree_model_filter_new (GtkTreeModel *child_model,
113 void gtk_tree_model_filter_set_visible_func (GtkTreeModelFilter *filter,
114 GtkTreeModelFilterVisibleFunc func,
116 GDestroyNotify destroy);
117 void gtk_tree_model_filter_set_modify_func (GtkTreeModelFilter *filter,
120 GtkTreeModelFilterModifyFunc func,
122 GDestroyNotify destroy);
123 void gtk_tree_model_filter_set_visible_column (GtkTreeModelFilter *filter,
126 GtkTreeModel *gtk_tree_model_filter_get_model (GtkTreeModelFilter *filter);
129 gboolean gtk_tree_model_filter_convert_child_iter_to_iter (GtkTreeModelFilter *filter,
130 GtkTreeIter *filter_iter,
131 GtkTreeIter *child_iter);
132 void gtk_tree_model_filter_convert_iter_to_child_iter (GtkTreeModelFilter *filter,
133 GtkTreeIter *child_iter,
134 GtkTreeIter *filter_iter);
135 GtkTreePath *gtk_tree_model_filter_convert_child_path_to_path (GtkTreeModelFilter *filter,
136 GtkTreePath *child_path);
137 GtkTreePath *gtk_tree_model_filter_convert_path_to_child_path (GtkTreeModelFilter *filter,
138 GtkTreePath *filter_path);
141 void gtk_tree_model_filter_refilter (GtkTreeModelFilter *filter);
142 void gtk_tree_model_filter_clear_cache (GtkTreeModelFilter *filter);
146 #endif /* __GTK_TREE_MODEL_FILTER_H__ */