]> Pileus Git - ~andy/gtk/blob - gtk/gtkiconview.h
gdk/x11: Add gdk_x11_device_manager_lookup()
[~andy/gtk] / gtk / gtkiconview.h
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
21 #error "Only <gtk/gtk.h> can be included directly."
22 #endif
23
24 #ifndef __GTK_ICON_VIEW_H__
25 #define __GTK_ICON_VIEW_H__
26
27 #include <gtk/gtkcontainer.h>
28 #include <gtk/gtktreemodel.h>
29 #include <gtk/gtkcellrenderer.h>
30 #include <gtk/gtkcellarea.h>
31 #include <gtk/gtkselection.h>
32 #include <gtk/gtktooltip.h>
33
34 G_BEGIN_DECLS
35
36 #define GTK_TYPE_ICON_VIEW            (gtk_icon_view_get_type ())
37 #define GTK_ICON_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW, GtkIconView))
38 #define GTK_ICON_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_VIEW, GtkIconViewClass))
39 #define GTK_IS_ICON_VIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW))
40 #define GTK_IS_ICON_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_VIEW))
41 #define GTK_ICON_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_VIEW, GtkIconViewClass))
42
43 typedef struct _GtkIconView           GtkIconView;
44 typedef struct _GtkIconViewClass      GtkIconViewClass;
45 typedef struct _GtkIconViewPrivate    GtkIconViewPrivate;
46
47 /**
48  * GtkIconViewForeachFunc:
49  * @icon_view: a #GtkIconView
50  * @path: The #GtkTreePath of a selected row
51  * @data: user data
52  *
53  * A function used by gtk_icon_view_selected_foreach() to map all
54  * selected rows.  It will be called on every selected row in the view.
55  */
56 typedef void (* GtkIconViewForeachFunc)     (GtkIconView      *icon_view,
57                                              GtkTreePath      *path,
58                                              gpointer          data);
59
60 /**
61  * GtkIconViewDropPosition:
62  * @GTK_ICON_VIEW_NO_DROP: no drop possible
63  * @GTK_ICON_VIEW_DROP_INTO: dropped item replaces the item
64  * @GTK_ICON_VIEW_DROP_LEFT: droppped item is inserted to the left
65  * @GTK_ICON_VIEW_DROP_RIGHT: dropped item is inserted to the right
66  * @GTK_ICON_VIEW_DROP_ABOVE: dropped item is inserted above
67  * @GTK_ICON_VIEW_DROP_BELOW: dropped item is inserted below
68  *
69  * An enum for determining where a dropped item goes.
70  */
71 typedef enum
72 {
73   GTK_ICON_VIEW_NO_DROP,
74   GTK_ICON_VIEW_DROP_INTO,
75   GTK_ICON_VIEW_DROP_LEFT,
76   GTK_ICON_VIEW_DROP_RIGHT,
77   GTK_ICON_VIEW_DROP_ABOVE,
78   GTK_ICON_VIEW_DROP_BELOW
79 } GtkIconViewDropPosition;
80
81 struct _GtkIconView
82 {
83   GtkContainer parent;
84
85   /*< private >*/
86   GtkIconViewPrivate *priv;
87 };
88
89 struct _GtkIconViewClass
90 {
91   GtkContainerClass parent_class;
92
93   void    (* item_activated)         (GtkIconView      *icon_view,
94                                       GtkTreePath      *path);
95   void    (* selection_changed)      (GtkIconView      *icon_view);
96
97   /* Key binding signals */
98   void    (* select_all)             (GtkIconView      *icon_view);
99   void    (* unselect_all)           (GtkIconView      *icon_view);
100   void    (* select_cursor_item)     (GtkIconView      *icon_view);
101   void    (* toggle_cursor_item)     (GtkIconView      *icon_view);
102   gboolean (* move_cursor)           (GtkIconView      *icon_view,
103                                       GtkMovementStep   step,
104                                       gint              count);
105   gboolean (* activate_cursor_item)  (GtkIconView      *icon_view);
106
107   /* Padding for future expansion */
108   void (*_gtk_reserved1) (void);
109   void (*_gtk_reserved2) (void);
110   void (*_gtk_reserved3) (void);
111   void (*_gtk_reserved4) (void);
112 };
113
114 GType          gtk_icon_view_get_type          (void) G_GNUC_CONST;
115 GtkWidget *    gtk_icon_view_new               (void);
116 GtkWidget *    gtk_icon_view_new_with_area     (GtkCellArea    *area);
117 GtkWidget *    gtk_icon_view_new_with_model    (GtkTreeModel   *model);
118
119 void           gtk_icon_view_set_model         (GtkIconView    *icon_view,
120                                                 GtkTreeModel   *model);
121 GtkTreeModel * gtk_icon_view_get_model         (GtkIconView    *icon_view);
122 void           gtk_icon_view_set_text_column   (GtkIconView    *icon_view,
123                                                 gint            column);
124 gint           gtk_icon_view_get_text_column   (GtkIconView    *icon_view);
125 void           gtk_icon_view_set_markup_column (GtkIconView    *icon_view,
126                                                 gint            column);
127 gint           gtk_icon_view_get_markup_column (GtkIconView    *icon_view);
128 void           gtk_icon_view_set_pixbuf_column (GtkIconView    *icon_view,
129                                                 gint            column);
130 gint           gtk_icon_view_get_pixbuf_column (GtkIconView    *icon_view);
131
132 void           gtk_icon_view_set_item_orientation (GtkIconView    *icon_view,
133                                                    GtkOrientation  orientation);
134 GtkOrientation gtk_icon_view_get_item_orientation (GtkIconView    *icon_view);
135 void           gtk_icon_view_set_columns       (GtkIconView    *icon_view,
136                                                 gint            columns);
137 gint           gtk_icon_view_get_columns       (GtkIconView    *icon_view);
138 void           gtk_icon_view_set_item_width    (GtkIconView    *icon_view,
139                                                 gint            item_width);
140 gint           gtk_icon_view_get_item_width    (GtkIconView    *icon_view);
141 void           gtk_icon_view_set_spacing       (GtkIconView    *icon_view, 
142                                                 gint            spacing);
143 gint           gtk_icon_view_get_spacing       (GtkIconView    *icon_view);
144 void           gtk_icon_view_set_row_spacing   (GtkIconView    *icon_view, 
145                                                 gint            row_spacing);
146 gint           gtk_icon_view_get_row_spacing   (GtkIconView    *icon_view);
147 void           gtk_icon_view_set_column_spacing (GtkIconView    *icon_view, 
148                                                 gint            column_spacing);
149 gint           gtk_icon_view_get_column_spacing (GtkIconView    *icon_view);
150 void           gtk_icon_view_set_margin        (GtkIconView    *icon_view, 
151                                                 gint            margin);
152 gint           gtk_icon_view_get_margin        (GtkIconView    *icon_view);
153 void           gtk_icon_view_set_item_padding  (GtkIconView    *icon_view, 
154                                                 gint            item_padding);
155 gint           gtk_icon_view_get_item_padding  (GtkIconView    *icon_view);
156
157 GtkTreePath *  gtk_icon_view_get_path_at_pos   (GtkIconView     *icon_view,
158                                                 gint             x,
159                                                 gint             y);
160 gboolean       gtk_icon_view_get_item_at_pos   (GtkIconView     *icon_view,
161                                                 gint              x,
162                                                 gint              y,
163                                                 GtkTreePath     **path,
164                                                 GtkCellRenderer **cell);
165 gboolean       gtk_icon_view_get_visible_range (GtkIconView      *icon_view,
166                                                 GtkTreePath     **start_path,
167                                                 GtkTreePath     **end_path);
168
169 void           gtk_icon_view_selected_foreach   (GtkIconView            *icon_view,
170                                                  GtkIconViewForeachFunc  func,
171                                                  gpointer                data);
172 void           gtk_icon_view_set_selection_mode (GtkIconView            *icon_view,
173                                                  GtkSelectionMode        mode);
174 GtkSelectionMode gtk_icon_view_get_selection_mode (GtkIconView            *icon_view);
175 void             gtk_icon_view_select_path        (GtkIconView            *icon_view,
176                                                    GtkTreePath            *path);
177 void             gtk_icon_view_unselect_path      (GtkIconView            *icon_view,
178                                                    GtkTreePath            *path);
179 gboolean         gtk_icon_view_path_is_selected   (GtkIconView            *icon_view,
180                                                    GtkTreePath            *path);
181 gint             gtk_icon_view_get_item_row       (GtkIconView            *icon_view,
182                                                    GtkTreePath            *path);
183 gint             gtk_icon_view_get_item_column    (GtkIconView            *icon_view,
184                                                    GtkTreePath            *path);
185 GList           *gtk_icon_view_get_selected_items (GtkIconView            *icon_view);
186 void             gtk_icon_view_select_all         (GtkIconView            *icon_view);
187 void             gtk_icon_view_unselect_all       (GtkIconView            *icon_view);
188 void             gtk_icon_view_item_activated     (GtkIconView            *icon_view,
189                                                    GtkTreePath            *path);
190 void             gtk_icon_view_set_cursor         (GtkIconView            *icon_view,
191                                                    GtkTreePath            *path,
192                                                    GtkCellRenderer        *cell,
193                                                    gboolean                start_editing);
194 gboolean         gtk_icon_view_get_cursor         (GtkIconView            *icon_view,
195                                                    GtkTreePath           **path,
196                                                    GtkCellRenderer       **cell);
197 void             gtk_icon_view_scroll_to_path     (GtkIconView            *icon_view,
198                                                    GtkTreePath            *path,
199                                                    gboolean                use_align,
200                                                    gfloat                  row_align,
201                                                    gfloat                  col_align);
202
203 /* Drag-and-Drop support */
204 void                   gtk_icon_view_enable_model_drag_source (GtkIconView              *icon_view,
205                                                                GdkModifierType           start_button_mask,
206                                                                const GtkTargetEntry     *targets,
207                                                                gint                      n_targets,
208                                                                GdkDragAction             actions);
209 void                   gtk_icon_view_enable_model_drag_dest   (GtkIconView              *icon_view,
210                                                                const GtkTargetEntry     *targets,
211                                                                gint                      n_targets,
212                                                                GdkDragAction             actions);
213 void                   gtk_icon_view_unset_model_drag_source  (GtkIconView              *icon_view);
214 void                   gtk_icon_view_unset_model_drag_dest    (GtkIconView              *icon_view);
215 void                   gtk_icon_view_set_reorderable          (GtkIconView              *icon_view,
216                                                                gboolean                  reorderable);
217 gboolean               gtk_icon_view_get_reorderable          (GtkIconView              *icon_view);
218
219
220 /* These are useful to implement your own custom stuff. */
221 void                   gtk_icon_view_set_drag_dest_item       (GtkIconView              *icon_view,
222                                                                GtkTreePath              *path,
223                                                                GtkIconViewDropPosition   pos);
224 void                   gtk_icon_view_get_drag_dest_item       (GtkIconView              *icon_view,
225                                                                GtkTreePath             **path,
226                                                                GtkIconViewDropPosition  *pos);
227 gboolean               gtk_icon_view_get_dest_item_at_pos     (GtkIconView              *icon_view,
228                                                                gint                      drag_x,
229                                                                gint                      drag_y,
230                                                                GtkTreePath             **path,
231                                                                GtkIconViewDropPosition  *pos);
232 cairo_surface_t       *gtk_icon_view_create_drag_icon         (GtkIconView              *icon_view,
233                                                                GtkTreePath              *path);
234
235 void    gtk_icon_view_convert_widget_to_bin_window_coords     (GtkIconView *icon_view,
236                                                                gint         wx,
237                                                                gint         wy,
238                                                                gint        *bx,
239                                                                gint        *by);
240
241
242 void    gtk_icon_view_set_tooltip_item                        (GtkIconView     *icon_view,
243                                                                GtkTooltip      *tooltip,
244                                                                GtkTreePath     *path);
245 void    gtk_icon_view_set_tooltip_cell                        (GtkIconView     *icon_view,
246                                                                GtkTooltip      *tooltip,
247                                                                GtkTreePath     *path,
248                                                                GtkCellRenderer *cell);
249 gboolean gtk_icon_view_get_tooltip_context                    (GtkIconView       *icon_view,
250                                                                gint              *x,
251                                                                gint              *y,
252                                                                gboolean           keyboard_tip,
253                                                                GtkTreeModel     **model,
254                                                                GtkTreePath      **path,
255                                                                GtkTreeIter       *iter);
256 void     gtk_icon_view_set_tooltip_column                     (GtkIconView       *icon_view,
257                                                                gint               column);
258 gint     gtk_icon_view_get_tooltip_column                     (GtkIconView       *icon_view);
259
260
261 G_END_DECLS
262
263 #endif /* __GTK_ICON_VIEW_H__ */