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>
29 #define GTK_TYPE_ICON_VIEW (gtk_icon_view_get_type ())
30 #define GTK_ICON_VIEW(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ICON_VIEW, GtkIconView))
31 #define GTK_ICON_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_VIEW, GtkIconViewClass))
32 #define GTK_IS_ICON_VIEW(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ICON_VIEW))
33 #define GTK_IS_ICON_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_VIEW))
34 #define GTK_ICON_VIEW_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ICON_VIEW, GtkIconViewClass))
36 typedef struct _GtkIconView GtkIconView;
37 typedef struct _GtkIconViewClass GtkIconViewClass;
38 typedef struct _GtkIconViewPrivate GtkIconViewPrivate;
40 typedef void (* GtkIconViewForeachFunc) (GtkIconView *icon_view,
46 GTK_ICON_VIEW_NO_DROP,
47 GTK_ICON_VIEW_DROP_INTO,
48 GTK_ICON_VIEW_DROP_LEFT,
49 GTK_ICON_VIEW_DROP_RIGHT,
50 GTK_ICON_VIEW_DROP_ABOVE,
51 GTK_ICON_VIEW_DROP_BELOW
52 } GtkIconViewDropPosition;
58 GtkIconViewPrivate *priv;
61 struct _GtkIconViewClass
63 GtkContainerClass parent_class;
65 void (* set_scroll_adjustments) (GtkIconView *icon_view,
66 GtkAdjustment *hadjustment,
67 GtkAdjustment *vadjustment);
69 void (* item_activated) (GtkIconView *icon_view,
71 void (* selection_changed) (GtkIconView *icon_view);
73 /* Key binding signals */
74 void (* select_all) (GtkIconView *icon_view);
75 void (* unselect_all) (GtkIconView *icon_view);
76 void (* select_cursor_item) (GtkIconView *icon_view);
77 void (* toggle_cursor_item) (GtkIconView *icon_view);
78 gboolean (* move_cursor) (GtkIconView *icon_view,
81 gboolean (* activate_cursor_item) (GtkIconView *icon_view);
84 GType gtk_icon_view_get_type (void) G_GNUC_CONST;
85 GtkWidget * gtk_icon_view_new (void);
86 GtkWidget * gtk_icon_view_new_with_model (GtkTreeModel *model);
88 void gtk_icon_view_set_model (GtkIconView *icon_view,
90 GtkTreeModel * gtk_icon_view_get_model (GtkIconView *icon_view);
91 void gtk_icon_view_set_text_column (GtkIconView *icon_view,
93 gint gtk_icon_view_get_text_column (GtkIconView *icon_view);
94 void gtk_icon_view_set_markup_column (GtkIconView *icon_view,
96 gint gtk_icon_view_get_markup_column (GtkIconView *icon_view);
97 void gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
99 gint gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view);
101 void gtk_icon_view_set_orientation (GtkIconView *icon_view,
102 GtkOrientation orientation);
103 GtkOrientation gtk_icon_view_get_orientation (GtkIconView *icon_view);
104 void gtk_icon_view_set_columns (GtkIconView *icon_view,
106 gint gtk_icon_view_get_columns (GtkIconView *icon_view);
107 void gtk_icon_view_set_item_width (GtkIconView *icon_view,
109 gint gtk_icon_view_get_item_width (GtkIconView *icon_view);
110 void gtk_icon_view_set_spacing (GtkIconView *icon_view,
112 gint gtk_icon_view_get_spacing (GtkIconView *icon_view);
113 void gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
115 gint gtk_icon_view_get_row_spacing (GtkIconView *icon_view);
116 void gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
117 gint column_spacing);
118 gint gtk_icon_view_get_column_spacing (GtkIconView *icon_view);
119 void gtk_icon_view_set_margin (GtkIconView *icon_view,
121 gint gtk_icon_view_get_margin (GtkIconView *icon_view);
124 GtkTreePath * gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
127 gboolean gtk_icon_view_get_item_at_pos (GtkIconView *icon_view,
131 GtkCellRenderer **cell);
133 void gtk_icon_view_selected_foreach (GtkIconView *icon_view,
134 GtkIconViewForeachFunc func,
136 void gtk_icon_view_set_selection_mode (GtkIconView *icon_view,
137 GtkSelectionMode mode);
138 GtkSelectionMode gtk_icon_view_get_selection_mode (GtkIconView *icon_view);
139 void gtk_icon_view_select_path (GtkIconView *icon_view,
141 void gtk_icon_view_unselect_path (GtkIconView *icon_view,
143 gboolean gtk_icon_view_path_is_selected (GtkIconView *icon_view,
145 GList *gtk_icon_view_get_selected_items (GtkIconView *icon_view);
146 void gtk_icon_view_select_all (GtkIconView *icon_view);
147 void gtk_icon_view_unselect_all (GtkIconView *icon_view);
148 void gtk_icon_view_item_activated (GtkIconView *icon_view,
150 void gtk_icon_view_set_cursor (GtkIconView *icon_view,
152 GtkCellRenderer *cell,
153 gboolean start_editing);
154 gboolean gtk_icon_view_get_cursor (GtkIconView *icon_view,
156 GtkCellRenderer **cell);
158 /* Drag-and-Drop support */
159 void gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view,
160 GdkModifierType start_button_mask,
161 const GtkTargetEntry *targets,
163 GdkDragAction actions);
164 void gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view,
165 const GtkTargetEntry *targets,
167 GdkDragAction actions);
168 void gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view);
169 void gtk_icon_view_unset_model_drag_dest (GtkIconView *icon_view);
170 void gtk_icon_view_set_reorderable (GtkIconView *icon_view,
171 gboolean reorderable);
172 gboolean gtk_icon_view_get_reorderable (GtkIconView *icon_view);
175 /* These are useful to implement your own custom stuff. */
176 void gtk_icon_view_set_drag_dest_item (GtkIconView *icon_view,
178 GtkIconViewDropPosition pos);
179 void gtk_icon_view_get_drag_dest_item (GtkIconView *icon_view,
181 GtkIconViewDropPosition *pos);
182 gboolean gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view,
186 GtkIconViewDropPosition *pos);
187 GdkPixmap *gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
193 #endif /* __GTK_ICON_VIEW_H__ */