1 | /* gtktreeview.h |
2 | * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <[email protected]> |
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, write to the |
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | * Boston, MA 02111-1307, USA. |
18 | */ |
19 | |
20 | #ifndef __GTK_TREE_VIEW_H__ |
21 | #define __GTK_TREE_VIEW_H__ |
22 | |
23 | #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
24 | #error "Only <gtk/gtk.h> can be included directly." |
25 | #endif |
26 | |
27 | #include <gtk/gtkcontainer.h> |
28 | #include <gtk/gtktreemodel.h> |
29 | #include <gtk/gtktreeviewcolumn.h> |
30 | #include <gtk/gtkdnd.h> |
31 | #include <gtk/gtkentry.h> |
32 | |
33 | G_BEGIN_DECLS |
34 | |
35 | |
36 | typedef enum |
37 | { |
38 | /* drop before/after this row */ |
39 | GTK_TREE_VIEW_DROP_BEFORE, |
40 | GTK_TREE_VIEW_DROP_AFTER, |
41 | /* drop as a child of this row (with fallback to before or after |
42 | * if into is not possible) |
43 | */ |
44 | GTK_TREE_VIEW_DROP_INTO_OR_BEFORE, |
45 | GTK_TREE_VIEW_DROP_INTO_OR_AFTER |
46 | } GtkTreeViewDropPosition; |
47 | |
48 | #define GTK_TYPE_TREE_VIEW (gtk_tree_view_get_type ()) |
49 | #define GTK_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_VIEW, GtkTreeView)) |
50 | #define GTK_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_VIEW, GtkTreeViewClass)) |
51 | #define GTK_IS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_VIEW)) |
52 | #define GTK_IS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_VIEW)) |
53 | #define GTK_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_VIEW, GtkTreeViewClass)) |
54 | |
55 | typedef struct _GtkTreeView GtkTreeView; |
56 | typedef struct _GtkTreeViewClass GtkTreeViewClass; |
57 | typedef struct _GtkTreeViewPrivate GtkTreeViewPrivate; |
58 | typedef struct _GtkTreeSelection GtkTreeSelection; |
59 | typedef struct _GtkTreeSelectionClass GtkTreeSelectionClass; |
60 | |
61 | struct _GtkTreeView |
62 | { |
63 | GtkContainer parent; |
64 | |
65 | GtkTreeViewPrivate *GSEAL (priv); |
66 | }; |
67 | |
68 | struct _GtkTreeViewClass |
69 | { |
70 | GtkContainerClass parent_class; |
71 | |
72 | void (* set_scroll_adjustments) (GtkTreeView *tree_view, |
73 | GtkAdjustment *hadjustment, |
74 | GtkAdjustment *vadjustment); |
75 | void (* row_activated) (GtkTreeView *tree_view, |
76 | GtkTreePath *path, |
77 | GtkTreeViewColumn *column); |
78 | gboolean (* test_expand_row) (GtkTreeView *tree_view, |
79 | GtkTreeIter *iter, |
80 | GtkTreePath *path); |
81 | gboolean (* test_collapse_row) (GtkTreeView *tree_view, |
82 | GtkTreeIter *iter, |
83 | GtkTreePath *path); |
84 | void (* row_expanded) (GtkTreeView *tree_view, |
85 | GtkTreeIter *iter, |
86 | GtkTreePath *path); |
87 | void (* row_collapsed) (GtkTreeView *tree_view, |
88 | GtkTreeIter *iter, |
89 | GtkTreePath *path); |
90 | void (* columns_changed) (GtkTreeView *tree_view); |
91 | void (* cursor_changed) (GtkTreeView *tree_view); |
92 | |
93 | /* Key Binding signals */ |
94 | gboolean (* move_cursor) (GtkTreeView *tree_view, |
95 | GtkMovementStep step, |
96 | gint count); |
97 | gboolean (* select_all) (GtkTreeView *tree_view); |
98 | gboolean (* unselect_all) (GtkTreeView *tree_view); |
99 | gboolean (* select_cursor_row) (GtkTreeView *tree_view, |
100 | gboolean start_editing); |
101 | gboolean (* toggle_cursor_row) (GtkTreeView *tree_view); |
102 | gboolean (* expand_collapse_cursor_row) (GtkTreeView *tree_view, |
103 | gboolean logical, |
104 | gboolean expand, |
105 | gboolean open_all); |
106 | gboolean (* select_cursor_parent) (GtkTreeView *tree_view); |
107 | gboolean (* start_interactive_search) (GtkTreeView *tree_view); |
108 | |
109 | /* Padding for future expansion */ |
110 | void (*_gtk_reserved0) (void); |
111 | void (*_gtk_reserved1) (void); |
112 | void (*_gtk_reserved2) (void); |
113 | void (*_gtk_reserved3) (void); |
114 | void (*_gtk_reserved4) (void); |
115 | }; |
116 | |
117 | |
118 | typedef gboolean (* GtkTreeViewColumnDropFunc) (GtkTreeView *tree_view, |
119 | GtkTreeViewColumn *column, |
120 | GtkTreeViewColumn *prev_column, |
121 | GtkTreeViewColumn *next_column, |
122 | gpointer data); |
123 | typedef void (* GtkTreeViewMappingFunc) (GtkTreeView *tree_view, |
124 | GtkTreePath *path, |
125 | gpointer user_data); |
126 | typedef gboolean (*GtkTreeViewSearchEqualFunc) (GtkTreeModel *model, |
127 | gint column, |
128 | const gchar *key, |
129 | GtkTreeIter *iter, |
130 | gpointer search_data); |
131 | typedef gboolean (*GtkTreeViewRowSeparatorFunc) (GtkTreeModel *model, |
132 | GtkTreeIter *iter, |
133 | gpointer data); |
134 | typedef void (*GtkTreeViewSearchPositionFunc) (GtkTreeView *tree_view, |
135 | GtkWidget *search_dialog, |
136 | gpointer user_data); |
137 | |
138 | |
139 | /* Creators */ |
140 | GType gtk_tree_view_get_type (void) G_GNUC_CONST; |
141 | GtkWidget *gtk_tree_view_new (void); |
142 | GtkWidget *gtk_tree_view_new_with_model (GtkTreeModel *model); |
143 | |
144 | /* Accessors */ |
145 | GtkTreeModel *gtk_tree_view_get_model (GtkTreeView *tree_view); |
146 | void gtk_tree_view_set_model (GtkTreeView *tree_view, |
147 | GtkTreeModel *model); |
148 | GtkTreeSelection *gtk_tree_view_get_selection (GtkTreeView *tree_view); |
149 | GtkAdjustment *gtk_tree_view_get_hadjustment (GtkTreeView *tree_view); |
150 | void gtk_tree_view_set_hadjustment (GtkTreeView *tree_view, |
151 | GtkAdjustment *adjustment); |
152 | GtkAdjustment *gtk_tree_view_get_vadjustment (GtkTreeView *tree_view); |
153 | void gtk_tree_view_set_vadjustment (GtkTreeView *tree_view, |
154 | GtkAdjustment *adjustment); |
155 | gboolean (GtkTreeView *tree_view); |
156 | void (GtkTreeView *tree_view, |
157 | gboolean ); |
158 | void gtk_tree_view_columns_autosize (GtkTreeView *tree_view); |
159 | gboolean (GtkTreeView *tree_view); |
160 | void (GtkTreeView *tree_view, |
161 | gboolean setting); |
162 | void gtk_tree_view_set_rules_hint (GtkTreeView *tree_view, |
163 | gboolean setting); |
164 | gboolean gtk_tree_view_get_rules_hint (GtkTreeView *tree_view); |
165 | |
166 | /* Column funtions */ |
167 | gint gtk_tree_view_append_column (GtkTreeView *tree_view, |
168 | GtkTreeViewColumn *column); |
169 | gint gtk_tree_view_remove_column (GtkTreeView *tree_view, |
170 | GtkTreeViewColumn *column); |
171 | gint gtk_tree_view_insert_column (GtkTreeView *tree_view, |
172 | GtkTreeViewColumn *column, |
173 | gint position); |
174 | gint gtk_tree_view_insert_column_with_attributes (GtkTreeView *tree_view, |
175 | gint position, |
176 | const gchar *title, |
177 | GtkCellRenderer *cell, |
178 | ...) G_GNUC_NULL_TERMINATED; |
179 | gint gtk_tree_view_insert_column_with_data_func (GtkTreeView *tree_view, |
180 | gint position, |
181 | const gchar *title, |
182 | GtkCellRenderer *cell, |
183 | GtkTreeCellDataFunc func, |
184 | gpointer data, |
185 | GDestroyNotify dnotify); |
186 | GtkTreeViewColumn *gtk_tree_view_get_column (GtkTreeView *tree_view, |
187 | gint n); |
188 | GList *gtk_tree_view_get_columns (GtkTreeView *tree_view); |
189 | void gtk_tree_view_move_column_after (GtkTreeView *tree_view, |
190 | GtkTreeViewColumn *column, |
191 | GtkTreeViewColumn *base_column); |
192 | void gtk_tree_view_set_expander_column (GtkTreeView *tree_view, |
193 | GtkTreeViewColumn *column); |
194 | GtkTreeViewColumn *gtk_tree_view_get_expander_column (GtkTreeView *tree_view); |
195 | void gtk_tree_view_set_column_drag_function (GtkTreeView *tree_view, |
196 | GtkTreeViewColumnDropFunc func, |
197 | gpointer user_data, |
198 | GDestroyNotify destroy); |
199 | |
200 | /* Actions */ |
201 | void gtk_tree_view_scroll_to_point (GtkTreeView *tree_view, |
202 | gint tree_x, |
203 | gint tree_y); |
204 | void gtk_tree_view_scroll_to_cell (GtkTreeView *tree_view, |
205 | GtkTreePath *path, |
206 | GtkTreeViewColumn *column, |
207 | gboolean use_align, |
208 | gfloat row_align, |
209 | gfloat col_align); |
210 | void gtk_tree_view_row_activated (GtkTreeView *tree_view, |
211 | GtkTreePath *path, |
212 | GtkTreeViewColumn *column); |
213 | void gtk_tree_view_expand_all (GtkTreeView *tree_view); |
214 | void gtk_tree_view_collapse_all (GtkTreeView *tree_view); |
215 | void gtk_tree_view_expand_to_path (GtkTreeView *tree_view, |
216 | GtkTreePath *path); |
217 | gboolean gtk_tree_view_expand_row (GtkTreeView *tree_view, |
218 | GtkTreePath *path, |
219 | gboolean open_all); |
220 | gboolean gtk_tree_view_collapse_row (GtkTreeView *tree_view, |
221 | GtkTreePath *path); |
222 | void gtk_tree_view_map_expanded_rows (GtkTreeView *tree_view, |
223 | GtkTreeViewMappingFunc func, |
224 | gpointer data); |
225 | gboolean gtk_tree_view_row_expanded (GtkTreeView *tree_view, |
226 | GtkTreePath *path); |
227 | void gtk_tree_view_set_reorderable (GtkTreeView *tree_view, |
228 | gboolean reorderable); |
229 | gboolean gtk_tree_view_get_reorderable (GtkTreeView *tree_view); |
230 | void gtk_tree_view_set_cursor (GtkTreeView *tree_view, |
231 | GtkTreePath *path, |
232 | GtkTreeViewColumn *focus_column, |
233 | gboolean start_editing); |
234 | void gtk_tree_view_set_cursor_on_cell (GtkTreeView *tree_view, |
235 | GtkTreePath *path, |
236 | GtkTreeViewColumn *focus_column, |
237 | GtkCellRenderer *focus_cell, |
238 | gboolean start_editing); |
239 | void gtk_tree_view_get_cursor (GtkTreeView *tree_view, |
240 | GtkTreePath **path, |
241 | GtkTreeViewColumn **focus_column); |
242 | |
243 | |
244 | /* Layout information */ |
245 | GdkWindow *gtk_tree_view_get_bin_window (GtkTreeView *tree_view); |
246 | gboolean gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view, |
247 | gint x, |
248 | gint y, |
249 | GtkTreePath **path, |
250 | GtkTreeViewColumn **column, |
251 | gint *cell_x, |
252 | gint *cell_y); |
253 | void gtk_tree_view_get_cell_area (GtkTreeView *tree_view, |
254 | GtkTreePath *path, |
255 | GtkTreeViewColumn *column, |
256 | GdkRectangle *rect); |
257 | void gtk_tree_view_get_background_area (GtkTreeView *tree_view, |
258 | GtkTreePath *path, |
259 | GtkTreeViewColumn *column, |
260 | GdkRectangle *rect); |
261 | void gtk_tree_view_get_visible_rect (GtkTreeView *tree_view, |
262 | GdkRectangle *visible_rect); |
263 | |
264 | #ifndef GTK_DISABLE_DEPRECATED |
265 | void gtk_tree_view_widget_to_tree_coords (GtkTreeView *tree_view, |
266 | gint wx, |
267 | gint wy, |
268 | gint *tx, |
269 | gint *ty); |
270 | void gtk_tree_view_tree_to_widget_coords (GtkTreeView *tree_view, |
271 | gint tx, |
272 | gint ty, |
273 | gint *wx, |
274 | gint *wy); |
275 | #endif /* !GTK_DISABLE_DEPRECATED */ |
276 | gboolean gtk_tree_view_get_visible_range (GtkTreeView *tree_view, |
277 | GtkTreePath **start_path, |
278 | GtkTreePath **end_path); |
279 | |
280 | /* Drag-and-Drop support */ |
281 | void gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view, |
282 | GdkModifierType start_button_mask, |
283 | const GtkTargetEntry *targets, |
284 | gint n_targets, |
285 | GdkDragAction actions); |
286 | void gtk_tree_view_enable_model_drag_dest (GtkTreeView *tree_view, |
287 | const GtkTargetEntry *targets, |
288 | gint n_targets, |
289 | GdkDragAction actions); |
290 | void gtk_tree_view_unset_rows_drag_source (GtkTreeView *tree_view); |
291 | void gtk_tree_view_unset_rows_drag_dest (GtkTreeView *tree_view); |
292 | |
293 | |
294 | /* These are useful to implement your own custom stuff. */ |
295 | void gtk_tree_view_set_drag_dest_row (GtkTreeView *tree_view, |
296 | GtkTreePath *path, |
297 | GtkTreeViewDropPosition pos); |
298 | void gtk_tree_view_get_drag_dest_row (GtkTreeView *tree_view, |
299 | GtkTreePath **path, |
300 | GtkTreeViewDropPosition *pos); |
301 | gboolean gtk_tree_view_get_dest_row_at_pos (GtkTreeView *tree_view, |
302 | gint drag_x, |
303 | gint drag_y, |
304 | GtkTreePath **path, |
305 | GtkTreeViewDropPosition *pos); |
306 | GdkPixmap *gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view, |
307 | GtkTreePath *path); |
308 | |
309 | /* Interactive search */ |
310 | void gtk_tree_view_set_enable_search (GtkTreeView *tree_view, |
311 | gboolean enable_search); |
312 | gboolean gtk_tree_view_get_enable_search (GtkTreeView *tree_view); |
313 | gint gtk_tree_view_get_search_column (GtkTreeView *tree_view); |
314 | void gtk_tree_view_set_search_column (GtkTreeView *tree_view, |
315 | gint column); |
316 | GtkTreeViewSearchEqualFunc gtk_tree_view_get_search_equal_func (GtkTreeView *tree_view); |
317 | void gtk_tree_view_set_search_equal_func (GtkTreeView *tree_view, |
318 | GtkTreeViewSearchEqualFunc search_equal_func, |
319 | gpointer search_user_data, |
320 | GDestroyNotify search_destroy); |
321 | |
322 | GtkEntry *gtk_tree_view_get_search_entry (GtkTreeView *tree_view); |
323 | void gtk_tree_view_set_search_entry (GtkTreeView *tree_view, |
324 | GtkEntry *entry); |
325 | GtkTreeViewSearchPositionFunc gtk_tree_view_get_search_position_func (GtkTreeView *tree_view); |
326 | void gtk_tree_view_set_search_position_func (GtkTreeView *tree_view, |
327 | GtkTreeViewSearchPositionFunc func, |
328 | gpointer data, |
329 | GDestroyNotify destroy); |
330 | |
331 | /* Convert between the different coordinate systems */ |
332 | void gtk_tree_view_convert_widget_to_tree_coords (GtkTreeView *tree_view, |
333 | gint wx, |
334 | gint wy, |
335 | gint *tx, |
336 | gint *ty); |
337 | void gtk_tree_view_convert_tree_to_widget_coords (GtkTreeView *tree_view, |
338 | gint tx, |
339 | gint ty, |
340 | gint *wx, |
341 | gint *wy); |
342 | void gtk_tree_view_convert_widget_to_bin_window_coords (GtkTreeView *tree_view, |
343 | gint wx, |
344 | gint wy, |
345 | gint *bx, |
346 | gint *by); |
347 | void gtk_tree_view_convert_bin_window_to_widget_coords (GtkTreeView *tree_view, |
348 | gint bx, |
349 | gint by, |
350 | gint *wx, |
351 | gint *wy); |
352 | void gtk_tree_view_convert_tree_to_bin_window_coords (GtkTreeView *tree_view, |
353 | gint tx, |
354 | gint ty, |
355 | gint *bx, |
356 | gint *by); |
357 | void gtk_tree_view_convert_bin_window_to_tree_coords (GtkTreeView *tree_view, |
358 | gint bx, |
359 | gint by, |
360 | gint *tx, |
361 | gint *ty); |
362 | |
363 | /* This function should really never be used. It is just for use by ATK. |
364 | */ |
365 | typedef void (* GtkTreeDestroyCountFunc) (GtkTreeView *tree_view, |
366 | GtkTreePath *path, |
367 | gint children, |
368 | gpointer user_data); |
369 | void gtk_tree_view_set_destroy_count_func (GtkTreeView *tree_view, |
370 | GtkTreeDestroyCountFunc func, |
371 | gpointer data, |
372 | GDestroyNotify destroy); |
373 | |
374 | void gtk_tree_view_set_fixed_height_mode (GtkTreeView *tree_view, |
375 | gboolean enable); |
376 | gboolean gtk_tree_view_get_fixed_height_mode (GtkTreeView *tree_view); |
377 | void gtk_tree_view_set_hover_selection (GtkTreeView *tree_view, |
378 | gboolean hover); |
379 | gboolean gtk_tree_view_get_hover_selection (GtkTreeView *tree_view); |
380 | void gtk_tree_view_set_hover_expand (GtkTreeView *tree_view, |
381 | gboolean expand); |
382 | gboolean gtk_tree_view_get_hover_expand (GtkTreeView *tree_view); |
383 | void gtk_tree_view_set_rubber_banding (GtkTreeView *tree_view, |
384 | gboolean enable); |
385 | gboolean gtk_tree_view_get_rubber_banding (GtkTreeView *tree_view); |
386 | |
387 | gboolean gtk_tree_view_is_rubber_banding_active (GtkTreeView *tree_view); |
388 | |
389 | GtkTreeViewRowSeparatorFunc gtk_tree_view_get_row_separator_func (GtkTreeView *tree_view); |
390 | void gtk_tree_view_set_row_separator_func (GtkTreeView *tree_view, |
391 | GtkTreeViewRowSeparatorFunc func, |
392 | gpointer data, |
393 | GDestroyNotify destroy); |
394 | |
395 | GtkTreeViewGridLines gtk_tree_view_get_grid_lines (GtkTreeView *tree_view); |
396 | void gtk_tree_view_set_grid_lines (GtkTreeView *tree_view, |
397 | GtkTreeViewGridLines grid_lines); |
398 | gboolean gtk_tree_view_get_enable_tree_lines (GtkTreeView *tree_view); |
399 | void gtk_tree_view_set_enable_tree_lines (GtkTreeView *tree_view, |
400 | gboolean enabled); |
401 | void gtk_tree_view_set_show_expanders (GtkTreeView *tree_view, |
402 | gboolean enabled); |
403 | gboolean gtk_tree_view_get_show_expanders (GtkTreeView *tree_view); |
404 | void gtk_tree_view_set_level_indentation (GtkTreeView *tree_view, |
405 | gint indentation); |
406 | gint gtk_tree_view_get_level_indentation (GtkTreeView *tree_view); |
407 | |
408 | /* Convenience functions for setting tooltips */ |
409 | void gtk_tree_view_set_tooltip_row (GtkTreeView *tree_view, |
410 | GtkTooltip *tooltip, |
411 | GtkTreePath *path); |
412 | void gtk_tree_view_set_tooltip_cell (GtkTreeView *tree_view, |
413 | GtkTooltip *tooltip, |
414 | GtkTreePath *path, |
415 | GtkTreeViewColumn *column, |
416 | GtkCellRenderer *cell); |
417 | gboolean gtk_tree_view_get_tooltip_context(GtkTreeView *tree_view, |
418 | gint *x, |
419 | gint *y, |
420 | gboolean keyboard_tip, |
421 | GtkTreeModel **model, |
422 | GtkTreePath **path, |
423 | GtkTreeIter *iter); |
424 | void gtk_tree_view_set_tooltip_column (GtkTreeView *tree_view, |
425 | gint column); |
426 | gint gtk_tree_view_get_tooltip_column (GtkTreeView *tree_view); |
427 | |
428 | G_END_DECLS |
429 | |
430 | |
431 | #endif /* __GTK_TREE_VIEW_H__ */ |
432 | |