1 | /* gtkiconview.h |
2 | * Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnome.org> |
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_ICON_VIEW_H__ |
19 | #define __GTK_ICON_VIEW_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/gtkwidget.h> |
26 | #include <gtk/gtktreemodel.h> |
27 | #include <gtk/gtkcellrenderer.h> |
28 | #include <gtk/gtkcellarea.h> |
29 | #include <gtk/gtktooltip.h> |
30 | |
31 | G_BEGIN_DECLS |
32 | |
33 | #define GTK_TYPE_ICON_VIEW (gtk_icon_view_get_type ()) |
34 | #define GTK_ICON_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW, GtkIconView)) |
35 | #define GTK_IS_ICON_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW)) |
36 | |
37 | typedef struct _GtkIconView GtkIconView; |
38 | |
39 | /** |
40 | * GtkIconViewForeachFunc: |
41 | * @icon_view: a `GtkIconView` |
42 | * @path: The `GtkTreePath` of a selected row |
43 | * @data: (closure): user data |
44 | * |
45 | * A function used by gtk_icon_view_selected_foreach() to map all |
46 | * selected rows. |
47 | * |
48 | * It will be called on every selected row in the view. |
49 | */ |
50 | typedef void (* GtkIconViewForeachFunc) (GtkIconView *icon_view, |
51 | GtkTreePath *path, |
52 | gpointer data); |
53 | |
54 | /** |
55 | * GtkIconViewDropPosition: |
56 | * @GTK_ICON_VIEW_NO_DROP: no drop possible |
57 | * @GTK_ICON_VIEW_DROP_INTO: dropped item replaces the item |
58 | * @GTK_ICON_VIEW_DROP_LEFT: dropped item is inserted to the left |
59 | * @GTK_ICON_VIEW_DROP_RIGHT: dropped item is inserted to the right |
60 | * @GTK_ICON_VIEW_DROP_ABOVE: dropped item is inserted above |
61 | * @GTK_ICON_VIEW_DROP_BELOW: dropped item is inserted below |
62 | * |
63 | * An enum for determining where a dropped item goes. |
64 | */ |
65 | typedef enum |
66 | { |
67 | GTK_ICON_VIEW_NO_DROP, |
68 | GTK_ICON_VIEW_DROP_INTO, |
69 | GTK_ICON_VIEW_DROP_LEFT, |
70 | GTK_ICON_VIEW_DROP_RIGHT, |
71 | GTK_ICON_VIEW_DROP_ABOVE, |
72 | GTK_ICON_VIEW_DROP_BELOW |
73 | } GtkIconViewDropPosition; |
74 | |
75 | GDK_AVAILABLE_IN_ALL |
76 | GType gtk_icon_view_get_type (void) G_GNUC_CONST; |
77 | GDK_AVAILABLE_IN_ALL |
78 | GtkWidget * gtk_icon_view_new (void); |
79 | GDK_AVAILABLE_IN_ALL |
80 | GtkWidget * gtk_icon_view_new_with_area (GtkCellArea *area); |
81 | GDK_AVAILABLE_IN_ALL |
82 | GtkWidget * gtk_icon_view_new_with_model (GtkTreeModel *model); |
83 | |
84 | GDK_AVAILABLE_IN_ALL |
85 | void gtk_icon_view_set_model (GtkIconView *icon_view, |
86 | GtkTreeModel *model); |
87 | GDK_AVAILABLE_IN_ALL |
88 | GtkTreeModel * gtk_icon_view_get_model (GtkIconView *icon_view); |
89 | GDK_AVAILABLE_IN_ALL |
90 | void gtk_icon_view_set_text_column (GtkIconView *icon_view, |
91 | int column); |
92 | GDK_AVAILABLE_IN_ALL |
93 | int gtk_icon_view_get_text_column (GtkIconView *icon_view); |
94 | GDK_AVAILABLE_IN_ALL |
95 | void gtk_icon_view_set_markup_column (GtkIconView *icon_view, |
96 | int column); |
97 | GDK_AVAILABLE_IN_ALL |
98 | int gtk_icon_view_get_markup_column (GtkIconView *icon_view); |
99 | GDK_AVAILABLE_IN_ALL |
100 | void gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view, |
101 | int column); |
102 | GDK_AVAILABLE_IN_ALL |
103 | int gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view); |
104 | |
105 | GDK_AVAILABLE_IN_ALL |
106 | void gtk_icon_view_set_item_orientation (GtkIconView *icon_view, |
107 | GtkOrientation orientation); |
108 | GDK_AVAILABLE_IN_ALL |
109 | GtkOrientation gtk_icon_view_get_item_orientation (GtkIconView *icon_view); |
110 | GDK_AVAILABLE_IN_ALL |
111 | void gtk_icon_view_set_columns (GtkIconView *icon_view, |
112 | int columns); |
113 | GDK_AVAILABLE_IN_ALL |
114 | int gtk_icon_view_get_columns (GtkIconView *icon_view); |
115 | GDK_AVAILABLE_IN_ALL |
116 | void gtk_icon_view_set_item_width (GtkIconView *icon_view, |
117 | int item_width); |
118 | GDK_AVAILABLE_IN_ALL |
119 | int gtk_icon_view_get_item_width (GtkIconView *icon_view); |
120 | GDK_AVAILABLE_IN_ALL |
121 | void gtk_icon_view_set_spacing (GtkIconView *icon_view, |
122 | int spacing); |
123 | GDK_AVAILABLE_IN_ALL |
124 | int gtk_icon_view_get_spacing (GtkIconView *icon_view); |
125 | GDK_AVAILABLE_IN_ALL |
126 | void gtk_icon_view_set_row_spacing (GtkIconView *icon_view, |
127 | int row_spacing); |
128 | GDK_AVAILABLE_IN_ALL |
129 | int gtk_icon_view_get_row_spacing (GtkIconView *icon_view); |
130 | GDK_AVAILABLE_IN_ALL |
131 | void gtk_icon_view_set_column_spacing (GtkIconView *icon_view, |
132 | int column_spacing); |
133 | GDK_AVAILABLE_IN_ALL |
134 | int gtk_icon_view_get_column_spacing (GtkIconView *icon_view); |
135 | GDK_AVAILABLE_IN_ALL |
136 | void gtk_icon_view_set_margin (GtkIconView *icon_view, |
137 | int margin); |
138 | GDK_AVAILABLE_IN_ALL |
139 | int gtk_icon_view_get_margin (GtkIconView *icon_view); |
140 | GDK_AVAILABLE_IN_ALL |
141 | void gtk_icon_view_set_item_padding (GtkIconView *icon_view, |
142 | int item_padding); |
143 | GDK_AVAILABLE_IN_ALL |
144 | int gtk_icon_view_get_item_padding (GtkIconView *icon_view); |
145 | |
146 | GDK_AVAILABLE_IN_ALL |
147 | GtkTreePath * gtk_icon_view_get_path_at_pos (GtkIconView *icon_view, |
148 | int x, |
149 | int y); |
150 | GDK_AVAILABLE_IN_ALL |
151 | gboolean gtk_icon_view_get_item_at_pos (GtkIconView *icon_view, |
152 | int x, |
153 | int y, |
154 | GtkTreePath **path, |
155 | GtkCellRenderer **cell); |
156 | GDK_AVAILABLE_IN_ALL |
157 | gboolean gtk_icon_view_get_visible_range (GtkIconView *icon_view, |
158 | GtkTreePath **start_path, |
159 | GtkTreePath **end_path); |
160 | GDK_AVAILABLE_IN_ALL |
161 | void gtk_icon_view_set_activate_on_single_click (GtkIconView *icon_view, |
162 | gboolean single); |
163 | GDK_AVAILABLE_IN_ALL |
164 | gboolean gtk_icon_view_get_activate_on_single_click (GtkIconView *icon_view); |
165 | |
166 | GDK_AVAILABLE_IN_ALL |
167 | void gtk_icon_view_selected_foreach (GtkIconView *icon_view, |
168 | GtkIconViewForeachFunc func, |
169 | gpointer data); |
170 | GDK_AVAILABLE_IN_ALL |
171 | void gtk_icon_view_set_selection_mode (GtkIconView *icon_view, |
172 | GtkSelectionMode mode); |
173 | GDK_AVAILABLE_IN_ALL |
174 | GtkSelectionMode gtk_icon_view_get_selection_mode (GtkIconView *icon_view); |
175 | GDK_AVAILABLE_IN_ALL |
176 | void gtk_icon_view_select_path (GtkIconView *icon_view, |
177 | GtkTreePath *path); |
178 | GDK_AVAILABLE_IN_ALL |
179 | void gtk_icon_view_unselect_path (GtkIconView *icon_view, |
180 | GtkTreePath *path); |
181 | GDK_AVAILABLE_IN_ALL |
182 | gboolean gtk_icon_view_path_is_selected (GtkIconView *icon_view, |
183 | GtkTreePath *path); |
184 | GDK_AVAILABLE_IN_ALL |
185 | int gtk_icon_view_get_item_row (GtkIconView *icon_view, |
186 | GtkTreePath *path); |
187 | GDK_AVAILABLE_IN_ALL |
188 | int gtk_icon_view_get_item_column (GtkIconView *icon_view, |
189 | GtkTreePath *path); |
190 | GDK_AVAILABLE_IN_ALL |
191 | GList *gtk_icon_view_get_selected_items (GtkIconView *icon_view); |
192 | GDK_AVAILABLE_IN_ALL |
193 | void gtk_icon_view_select_all (GtkIconView *icon_view); |
194 | GDK_AVAILABLE_IN_ALL |
195 | void gtk_icon_view_unselect_all (GtkIconView *icon_view); |
196 | GDK_AVAILABLE_IN_ALL |
197 | void gtk_icon_view_item_activated (GtkIconView *icon_view, |
198 | GtkTreePath *path); |
199 | GDK_AVAILABLE_IN_ALL |
200 | void gtk_icon_view_set_cursor (GtkIconView *icon_view, |
201 | GtkTreePath *path, |
202 | GtkCellRenderer *cell, |
203 | gboolean start_editing); |
204 | GDK_AVAILABLE_IN_ALL |
205 | gboolean gtk_icon_view_get_cursor (GtkIconView *icon_view, |
206 | GtkTreePath **path, |
207 | GtkCellRenderer **cell); |
208 | GDK_AVAILABLE_IN_ALL |
209 | void gtk_icon_view_scroll_to_path (GtkIconView *icon_view, |
210 | GtkTreePath *path, |
211 | gboolean use_align, |
212 | float row_align, |
213 | float col_align); |
214 | |
215 | /* Drag-and-Drop support */ |
216 | GDK_AVAILABLE_IN_ALL |
217 | void gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view, |
218 | GdkModifierType start_button_mask, |
219 | GdkContentFormats *formats, |
220 | GdkDragAction actions); |
221 | GDK_AVAILABLE_IN_ALL |
222 | void gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view, |
223 | GdkContentFormats *formats, |
224 | GdkDragAction actions); |
225 | GDK_AVAILABLE_IN_ALL |
226 | void gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view); |
227 | GDK_AVAILABLE_IN_ALL |
228 | void gtk_icon_view_unset_model_drag_dest (GtkIconView *icon_view); |
229 | GDK_AVAILABLE_IN_ALL |
230 | void gtk_icon_view_set_reorderable (GtkIconView *icon_view, |
231 | gboolean reorderable); |
232 | GDK_AVAILABLE_IN_ALL |
233 | gboolean gtk_icon_view_get_reorderable (GtkIconView *icon_view); |
234 | |
235 | |
236 | /* These are useful to implement your own custom stuff. */ |
237 | GDK_AVAILABLE_IN_ALL |
238 | void gtk_icon_view_set_drag_dest_item (GtkIconView *icon_view, |
239 | GtkTreePath *path, |
240 | GtkIconViewDropPosition pos); |
241 | GDK_AVAILABLE_IN_ALL |
242 | void gtk_icon_view_get_drag_dest_item (GtkIconView *icon_view, |
243 | GtkTreePath **path, |
244 | GtkIconViewDropPosition *pos); |
245 | GDK_AVAILABLE_IN_ALL |
246 | gboolean gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view, |
247 | int drag_x, |
248 | int drag_y, |
249 | GtkTreePath **path, |
250 | GtkIconViewDropPosition *pos); |
251 | GDK_AVAILABLE_IN_ALL |
252 | GdkPaintable *gtk_icon_view_create_drag_icon (GtkIconView *icon_view, |
253 | GtkTreePath *path); |
254 | |
255 | GDK_AVAILABLE_IN_ALL |
256 | gboolean gtk_icon_view_get_cell_rect (GtkIconView *icon_view, |
257 | GtkTreePath *path, |
258 | GtkCellRenderer *cell, |
259 | GdkRectangle *rect); |
260 | |
261 | |
262 | GDK_AVAILABLE_IN_ALL |
263 | void gtk_icon_view_set_tooltip_item (GtkIconView *icon_view, |
264 | GtkTooltip *tooltip, |
265 | GtkTreePath *path); |
266 | GDK_AVAILABLE_IN_ALL |
267 | void gtk_icon_view_set_tooltip_cell (GtkIconView *icon_view, |
268 | GtkTooltip *tooltip, |
269 | GtkTreePath *path, |
270 | GtkCellRenderer *cell); |
271 | GDK_AVAILABLE_IN_ALL |
272 | gboolean gtk_icon_view_get_tooltip_context (GtkIconView *icon_view, |
273 | int x, |
274 | int y, |
275 | gboolean keyboard_tip, |
276 | GtkTreeModel **model, |
277 | GtkTreePath **path, |
278 | GtkTreeIter *iter); |
279 | GDK_AVAILABLE_IN_ALL |
280 | void gtk_icon_view_set_tooltip_column (GtkIconView *icon_view, |
281 | int column); |
282 | GDK_AVAILABLE_IN_ALL |
283 | int gtk_icon_view_get_tooltip_column (GtkIconView *icon_view); |
284 | |
285 | |
286 | G_END_DECLS |
287 | |
288 | #endif /* __GTK_ICON_VIEW_H__ */ |
289 | |