1 | /* gtktreeselection.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, see <http://www.gnu.org/licenses/>. |
16 | */ |
17 | |
18 | #ifndef __GTK_TREE_SELECTION_H__ |
19 | #define __GTK_TREE_SELECTION_H__ |
20 | |
21 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
22 | #error "Only <gtk/gtk.h> can be included directly." |
23 | #endif |
24 | |
25 | #include <gtk/gtktreeview.h> |
26 | |
27 | G_BEGIN_DECLS |
28 | |
29 | |
30 | #define GTK_TYPE_TREE_SELECTION (gtk_tree_selection_get_type ()) |
31 | #define GTK_TREE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_SELECTION, GtkTreeSelection)) |
32 | #define GTK_IS_TREE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_SELECTION)) |
33 | |
34 | /** |
35 | * GtkTreeSelectionFunc: |
36 | * @selection: A `GtkTreeSelection` |
37 | * @model: A `GtkTreeModel` being viewed |
38 | * @path: The `GtkTreePath` of the row in question |
39 | * @path_currently_selected: %TRUE, if the path is currently selected |
40 | * @data: (closure): user data |
41 | * |
42 | * A function used by gtk_tree_selection_set_select_function() to filter |
43 | * whether or not a row may be selected. It is called whenever a row's |
44 | * state might change. |
45 | * |
46 | * A return value of %TRUE indicates to @selection that it is okay to |
47 | * change the selection. |
48 | * |
49 | * Returns: %TRUE, if the selection state of the row can be toggled |
50 | */ |
51 | typedef gboolean (* GtkTreeSelectionFunc) (GtkTreeSelection *selection, |
52 | GtkTreeModel *model, |
53 | GtkTreePath *path, |
54 | gboolean path_currently_selected, |
55 | gpointer data); |
56 | |
57 | /** |
58 | * GtkTreeSelectionForeachFunc: |
59 | * @model: The `GtkTreeModel` being viewed |
60 | * @path: The `GtkTreePath` of a selected row |
61 | * @iter: A `GtkTreeIter` pointing to a selected row |
62 | * @data: (closure): user data |
63 | * |
64 | * A function used by gtk_tree_selection_selected_foreach() to map all |
65 | * selected rows. It will be called on every selected row in the view. |
66 | */ |
67 | typedef void (* GtkTreeSelectionForeachFunc) (GtkTreeModel *model, |
68 | GtkTreePath *path, |
69 | GtkTreeIter *iter, |
70 | gpointer data); |
71 | |
72 | |
73 | GDK_AVAILABLE_IN_ALL |
74 | GType gtk_tree_selection_get_type (void) G_GNUC_CONST; |
75 | |
76 | GDK_AVAILABLE_IN_ALL |
77 | void gtk_tree_selection_set_mode (GtkTreeSelection *selection, |
78 | GtkSelectionMode type); |
79 | GDK_AVAILABLE_IN_ALL |
80 | GtkSelectionMode gtk_tree_selection_get_mode (GtkTreeSelection *selection); |
81 | GDK_AVAILABLE_IN_ALL |
82 | void gtk_tree_selection_set_select_function (GtkTreeSelection *selection, |
83 | GtkTreeSelectionFunc func, |
84 | gpointer data, |
85 | GDestroyNotify destroy); |
86 | GDK_AVAILABLE_IN_ALL |
87 | gpointer gtk_tree_selection_get_user_data (GtkTreeSelection *selection); |
88 | GDK_AVAILABLE_IN_ALL |
89 | GtkTreeView* gtk_tree_selection_get_tree_view (GtkTreeSelection *selection); |
90 | |
91 | GDK_AVAILABLE_IN_ALL |
92 | GtkTreeSelectionFunc gtk_tree_selection_get_select_function (GtkTreeSelection *selection); |
93 | |
94 | /* Only meaningful if GTK_SELECTION_SINGLE or GTK_SELECTION_BROWSE is set */ |
95 | /* Use selected_foreach or get_selected_rows for GTK_SELECTION_MULTIPLE */ |
96 | GDK_AVAILABLE_IN_ALL |
97 | gboolean gtk_tree_selection_get_selected (GtkTreeSelection *selection, |
98 | GtkTreeModel **model, |
99 | GtkTreeIter *iter); |
100 | GDK_AVAILABLE_IN_ALL |
101 | GList * gtk_tree_selection_get_selected_rows (GtkTreeSelection *selection, |
102 | GtkTreeModel **model); |
103 | GDK_AVAILABLE_IN_ALL |
104 | int gtk_tree_selection_count_selected_rows (GtkTreeSelection *selection); |
105 | GDK_AVAILABLE_IN_ALL |
106 | void gtk_tree_selection_selected_foreach (GtkTreeSelection *selection, |
107 | GtkTreeSelectionForeachFunc func, |
108 | gpointer data); |
109 | GDK_AVAILABLE_IN_ALL |
110 | void gtk_tree_selection_select_path (GtkTreeSelection *selection, |
111 | GtkTreePath *path); |
112 | GDK_AVAILABLE_IN_ALL |
113 | void gtk_tree_selection_unselect_path (GtkTreeSelection *selection, |
114 | GtkTreePath *path); |
115 | GDK_AVAILABLE_IN_ALL |
116 | void gtk_tree_selection_select_iter (GtkTreeSelection *selection, |
117 | GtkTreeIter *iter); |
118 | GDK_AVAILABLE_IN_ALL |
119 | void gtk_tree_selection_unselect_iter (GtkTreeSelection *selection, |
120 | GtkTreeIter *iter); |
121 | GDK_AVAILABLE_IN_ALL |
122 | gboolean gtk_tree_selection_path_is_selected (GtkTreeSelection *selection, |
123 | GtkTreePath *path); |
124 | GDK_AVAILABLE_IN_ALL |
125 | gboolean gtk_tree_selection_iter_is_selected (GtkTreeSelection *selection, |
126 | GtkTreeIter *iter); |
127 | GDK_AVAILABLE_IN_ALL |
128 | void gtk_tree_selection_select_all (GtkTreeSelection *selection); |
129 | GDK_AVAILABLE_IN_ALL |
130 | void gtk_tree_selection_unselect_all (GtkTreeSelection *selection); |
131 | GDK_AVAILABLE_IN_ALL |
132 | void gtk_tree_selection_select_range (GtkTreeSelection *selection, |
133 | GtkTreePath *start_path, |
134 | GtkTreePath *end_path); |
135 | GDK_AVAILABLE_IN_ALL |
136 | void gtk_tree_selection_unselect_range (GtkTreeSelection *selection, |
137 | GtkTreePath *start_path, |
138 | GtkTreePath *end_path); |
139 | |
140 | |
141 | G_END_DECLS |
142 | |
143 | #endif /* __GTK_TREE_SELECTION_H__ */ |
144 | |