2 * Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnome.org>
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.
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.
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.
19 #ifndef __GTK_ICON_VIEW_H__
20 #define __GTK_ICON_VIEW_H__
22 #include <gtk/gtkcontainer.h>
23 #include <gtk/gtktreemodel.h>
24 #include <gtk/gtkcellrenderer.h>
25 #include <gtk/gtkselection.h>
26 #include <gtk/gtktooltip.h>
30 #define GTK_TYPE_ICON_VIEW (gtk_icon_view_get_type ())
31 #define GTK_ICON_VIEW(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ICON_VIEW, GtkIconView))
32 #define GTK_ICON_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_VIEW, GtkIconViewClass))
33 #define GTK_IS_ICON_VIEW(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ICON_VIEW))
34 #define GTK_IS_ICON_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_VIEW))
35 #define GTK_ICON_VIEW_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ICON_VIEW, GtkIconViewClass))
37 typedef struct _GtkIconView GtkIconView;
38 typedef struct _GtkIconViewClass GtkIconViewClass;
39 typedef struct _GtkIconViewPrivate GtkIconViewPrivate;
41 typedef void (* GtkIconViewForeachFunc) (GtkIconView *icon_view,
47 GTK_ICON_VIEW_NO_DROP,
48 GTK_ICON_VIEW_DROP_INTO,
49 GTK_ICON_VIEW_DROP_LEFT,
50 GTK_ICON_VIEW_DROP_RIGHT,
51 GTK_ICON_VIEW_DROP_ABOVE,
52 GTK_ICON_VIEW_DROP_BELOW
53 } GtkIconViewDropPosition;
59 GtkIconViewPrivate *priv;
62 struct _GtkIconViewClass
64 GtkContainerClass parent_class;
66 void (* set_scroll_adjustments) (GtkIconView *icon_view,
67 GtkAdjustment *hadjustment,
68 GtkAdjustment *vadjustment);
70 void (* item_activated) (GtkIconView *icon_view,
72 void (* selection_changed) (GtkIconView *icon_view);
74 /* Key binding signals */
75 void (* select_all) (GtkIconView *icon_view);
76 void (* unselect_all) (GtkIconView *icon_view);
77 void (* select_cursor_item) (GtkIconView *icon_view);
78 void (* toggle_cursor_item) (GtkIconView *icon_view);
79 gboolean (* move_cursor) (GtkIconView *icon_view,
82 gboolean (* activate_cursor_item) (GtkIconView *icon_view);
85 GType gtk_icon_view_get_type (void) G_GNUC_CONST;
86 GtkWidget * gtk_icon_view_new (void);
87 GtkWidget * gtk_icon_view_new_with_model (GtkTreeModel *model);
89 void gtk_icon_view_set_model (GtkIconView *icon_view,
91 GtkTreeModel * gtk_icon_view_get_model (GtkIconView *icon_view);
92 void gtk_icon_view_set_text_column (GtkIconView *icon_view,
94 gint gtk_icon_view_get_text_column (GtkIconView *icon_view);
95 void gtk_icon_view_set_markup_column (GtkIconView *icon_view,
97 gint gtk_icon_view_get_markup_column (GtkIconView *icon_view);
98 void gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
100 gint gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view);
102 void gtk_icon_view_set_orientation (GtkIconView *icon_view,
103 GtkOrientation orientation);
104 GtkOrientation gtk_icon_view_get_orientation (GtkIconView *icon_view);
105 void gtk_icon_view_set_columns (GtkIconView *icon_view,
107 gint gtk_icon_view_get_columns (GtkIconView *icon_view);
108 void gtk_icon_view_set_item_width (GtkIconView *icon_view,
110 gint gtk_icon_view_get_item_width (GtkIconView *icon_view);
111 void gtk_icon_view_set_spacing (GtkIconView *icon_view,
113 gint gtk_icon_view_get_spacing (GtkIconView *icon_view);
114 void gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
116 gint gtk_icon_view_get_row_spacing (GtkIconView *icon_view);
117 void gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
118 gint column_spacing);
119 gint gtk_icon_view_get_column_spacing (GtkIconView *icon_view);
120 void gtk_icon_view_set_margin (GtkIconView *icon_view,
122 gint gtk_icon_view_get_margin (GtkIconView *icon_view);
125 GtkTreePath * gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
128 gboolean gtk_icon_view_get_item_at_pos (GtkIconView *icon_view,
132 GtkCellRenderer **cell);
133 gboolean gtk_icon_view_get_visible_range (GtkIconView *icon_view,
134 GtkTreePath **start_path,
135 GtkTreePath **end_path);
137 void gtk_icon_view_selected_foreach (GtkIconView *icon_view,
138 GtkIconViewForeachFunc func,
140 void gtk_icon_view_set_selection_mode (GtkIconView *icon_view,
141 GtkSelectionMode mode);
142 GtkSelectionMode gtk_icon_view_get_selection_mode (GtkIconView *icon_view);
143 void gtk_icon_view_select_path (GtkIconView *icon_view,
145 void gtk_icon_view_unselect_path (GtkIconView *icon_view,
147 gboolean gtk_icon_view_path_is_selected (GtkIconView *icon_view,
149 GList *gtk_icon_view_get_selected_items (GtkIconView *icon_view);
150 void gtk_icon_view_select_all (GtkIconView *icon_view);
151 void gtk_icon_view_unselect_all (GtkIconView *icon_view);
152 void gtk_icon_view_item_activated (GtkIconView *icon_view,
154 void gtk_icon_view_set_cursor (GtkIconView *icon_view,
156 GtkCellRenderer *cell,
157 gboolean start_editing);
158 gboolean gtk_icon_view_get_cursor (GtkIconView *icon_view,
160 GtkCellRenderer **cell);
161 void gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
167 /* Drag-and-Drop support */
168 void gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view,
169 GdkModifierType start_button_mask,
170 const GtkTargetEntry *targets,
172 GdkDragAction actions);
173 void gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view,
174 const GtkTargetEntry *targets,
176 GdkDragAction actions);
177 void gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view);
178 void gtk_icon_view_unset_model_drag_dest (GtkIconView *icon_view);
179 void gtk_icon_view_set_reorderable (GtkIconView *icon_view,
180 gboolean reorderable);
181 gboolean gtk_icon_view_get_reorderable (GtkIconView *icon_view);
184 /* These are useful to implement your own custom stuff. */
185 void gtk_icon_view_set_drag_dest_item (GtkIconView *icon_view,
187 GtkIconViewDropPosition pos);
188 void gtk_icon_view_get_drag_dest_item (GtkIconView *icon_view,
190 GtkIconViewDropPosition *pos);
191 gboolean gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view,
195 GtkIconViewDropPosition *pos);
196 GdkPixmap *gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
199 void gtk_icon_view_convert_widget_to_bin_window_coords (GtkIconView *icon_view,
206 void gtk_icon_view_set_tooltip_item (GtkIconView *icon_view,
209 void gtk_icon_view_set_tooltip_cell (GtkIconView *icon_view,
212 GtkCellRenderer *cell);
213 gboolean gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
216 gboolean keyboard_tip,
217 GtkTreeModel **model,
220 void gtk_icon_view_set_tooltip_column (GtkIconView *icon_view,
222 gint gtk_icon_view_get_tooltip_column (GtkIconView *icon_view);
227 #endif /* __GTK_ICON_VIEW_H__ */