]> Pileus Git - ~andy/gtk/blob - gtk/gtkiconview.h
Modify the gettext translation domain for the gtk3 rename
[~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/gtkselection.h>
31 #include <gtk/gtktooltip.h>
32
33 G_BEGIN_DECLS
34
35 #define GTK_TYPE_ICON_VIEW            (gtk_icon_view_get_type ())
36 #define GTK_ICON_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW, GtkIconView))
37 #define GTK_ICON_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_VIEW, GtkIconViewClass))
38 #define GTK_IS_ICON_VIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW))
39 #define GTK_IS_ICON_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_VIEW))
40 #define GTK_ICON_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_VIEW, GtkIconViewClass))
41
42 typedef struct _GtkIconView           GtkIconView;
43 typedef struct _GtkIconViewClass      GtkIconViewClass;
44 typedef struct _GtkIconViewPrivate    GtkIconViewPrivate;
45
46 typedef void (* GtkIconViewForeachFunc)     (GtkIconView      *icon_view,
47                                              GtkTreePath      *path,
48                                              gpointer          data);
49
50 typedef enum
51 {
52   GTK_ICON_VIEW_NO_DROP,
53   GTK_ICON_VIEW_DROP_INTO,
54   GTK_ICON_VIEW_DROP_LEFT,
55   GTK_ICON_VIEW_DROP_RIGHT,
56   GTK_ICON_VIEW_DROP_ABOVE,
57   GTK_ICON_VIEW_DROP_BELOW
58 } GtkIconViewDropPosition;
59
60 struct _GtkIconView
61 {
62   GtkContainer parent;
63
64   GtkIconViewPrivate *GSEAL (priv);
65 };
66
67 struct _GtkIconViewClass
68 {
69   GtkContainerClass parent_class;
70
71   void    (* set_scroll_adjustments) (GtkIconView      *icon_view,
72                                       GtkAdjustment    *hadjustment,
73                                       GtkAdjustment    *vadjustment);
74   
75   void    (* item_activated)         (GtkIconView      *icon_view,
76                                       GtkTreePath      *path);
77   void    (* selection_changed)      (GtkIconView      *icon_view);
78
79   /* Key binding signals */
80   void    (* select_all)             (GtkIconView      *icon_view);
81   void    (* unselect_all)           (GtkIconView      *icon_view);
82   void    (* select_cursor_item)     (GtkIconView      *icon_view);
83   void    (* toggle_cursor_item)     (GtkIconView      *icon_view);
84   gboolean (* move_cursor)           (GtkIconView      *icon_view,
85                                       GtkMovementStep   step,
86                                       gint              count);
87   gboolean (* activate_cursor_item)  (GtkIconView      *icon_view);
88 };
89
90 GType          gtk_icon_view_get_type          (void) G_GNUC_CONST;
91 GtkWidget *    gtk_icon_view_new               (void);
92 GtkWidget *    gtk_icon_view_new_with_model    (GtkTreeModel   *model);
93
94 void           gtk_icon_view_set_model         (GtkIconView    *icon_view,
95                                                 GtkTreeModel   *model);
96 GtkTreeModel * gtk_icon_view_get_model         (GtkIconView    *icon_view);
97 void           gtk_icon_view_set_text_column   (GtkIconView    *icon_view,
98                                                 gint            column);
99 gint           gtk_icon_view_get_text_column   (GtkIconView    *icon_view);
100 void           gtk_icon_view_set_markup_column (GtkIconView    *icon_view,
101                                                 gint            column);
102 gint           gtk_icon_view_get_markup_column (GtkIconView    *icon_view);
103 void           gtk_icon_view_set_pixbuf_column (GtkIconView    *icon_view,
104                                                 gint            column);
105 gint           gtk_icon_view_get_pixbuf_column (GtkIconView    *icon_view);
106
107 void           gtk_icon_view_set_orientation   (GtkIconView    *icon_view,
108                                                 GtkOrientation  orientation);
109 GtkOrientation gtk_icon_view_get_orientation   (GtkIconView    *icon_view);
110 void           gtk_icon_view_set_columns       (GtkIconView    *icon_view,
111                                                 gint            columns);
112 gint           gtk_icon_view_get_columns       (GtkIconView    *icon_view);
113 void           gtk_icon_view_set_item_width    (GtkIconView    *icon_view,
114                                                 gint            item_width);
115 gint           gtk_icon_view_get_item_width    (GtkIconView    *icon_view);
116 void           gtk_icon_view_set_spacing       (GtkIconView    *icon_view, 
117                                                 gint            spacing);
118 gint           gtk_icon_view_get_spacing       (GtkIconView    *icon_view);
119 void           gtk_icon_view_set_row_spacing   (GtkIconView    *icon_view, 
120                                                 gint            row_spacing);
121 gint           gtk_icon_view_get_row_spacing   (GtkIconView    *icon_view);
122 void           gtk_icon_view_set_column_spacing (GtkIconView    *icon_view, 
123                                                 gint            column_spacing);
124 gint           gtk_icon_view_get_column_spacing (GtkIconView    *icon_view);
125 void           gtk_icon_view_set_margin        (GtkIconView    *icon_view, 
126                                                 gint            margin);
127 gint           gtk_icon_view_get_margin        (GtkIconView    *icon_view);
128 void           gtk_icon_view_set_item_padding  (GtkIconView    *icon_view, 
129                                                 gint            item_padding);
130 gint           gtk_icon_view_get_item_padding  (GtkIconView    *icon_view);
131
132
133 GtkTreePath *  gtk_icon_view_get_path_at_pos   (GtkIconView     *icon_view,
134                                                 gint             x,
135                                                 gint             y);
136 gboolean       gtk_icon_view_get_item_at_pos   (GtkIconView     *icon_view,
137                                                 gint              x,
138                                                 gint              y,
139                                                 GtkTreePath     **path,
140                                                 GtkCellRenderer **cell);
141 gboolean       gtk_icon_view_get_visible_range (GtkIconView      *icon_view,
142                                                 GtkTreePath     **start_path,
143                                                 GtkTreePath     **end_path);
144
145 void           gtk_icon_view_selected_foreach   (GtkIconView            *icon_view,
146                                                  GtkIconViewForeachFunc  func,
147                                                  gpointer                data);
148 void           gtk_icon_view_set_selection_mode (GtkIconView            *icon_view,
149                                                  GtkSelectionMode        mode);
150 GtkSelectionMode gtk_icon_view_get_selection_mode (GtkIconView            *icon_view);
151 void             gtk_icon_view_select_path        (GtkIconView            *icon_view,
152                                                    GtkTreePath            *path);
153 void             gtk_icon_view_unselect_path      (GtkIconView            *icon_view,
154                                                    GtkTreePath            *path);
155 gboolean         gtk_icon_view_path_is_selected   (GtkIconView            *icon_view,
156                                                    GtkTreePath            *path);
157 GList           *gtk_icon_view_get_selected_items (GtkIconView            *icon_view);
158 void             gtk_icon_view_select_all         (GtkIconView            *icon_view);
159 void             gtk_icon_view_unselect_all       (GtkIconView            *icon_view);
160 void             gtk_icon_view_item_activated     (GtkIconView            *icon_view,
161                                                    GtkTreePath            *path);
162 void             gtk_icon_view_set_cursor         (GtkIconView            *icon_view,
163                                                    GtkTreePath            *path,
164                                                    GtkCellRenderer        *cell,
165                                                    gboolean                start_editing);
166 gboolean         gtk_icon_view_get_cursor         (GtkIconView            *icon_view,
167                                                    GtkTreePath           **path,
168                                                    GtkCellRenderer       **cell);
169 void             gtk_icon_view_scroll_to_path     (GtkIconView            *icon_view,
170                                                    GtkTreePath            *path,
171                                                    gboolean                use_align,
172                                                    gfloat                  row_align,
173                                                    gfloat                  col_align);
174
175 /* Drag-and-Drop support */
176 void                   gtk_icon_view_enable_model_drag_source (GtkIconView              *icon_view,
177                                                                GdkModifierType           start_button_mask,
178                                                                const GtkTargetEntry     *targets,
179                                                                gint                      n_targets,
180                                                                GdkDragAction             actions);
181 void                   gtk_icon_view_enable_model_drag_dest   (GtkIconView              *icon_view,
182                                                                const GtkTargetEntry     *targets,
183                                                                gint                      n_targets,
184                                                                GdkDragAction             actions);
185 void                   gtk_icon_view_unset_model_drag_source  (GtkIconView              *icon_view);
186 void                   gtk_icon_view_unset_model_drag_dest    (GtkIconView              *icon_view);
187 void                   gtk_icon_view_set_reorderable          (GtkIconView              *icon_view,
188                                                                gboolean                  reorderable);
189 gboolean               gtk_icon_view_get_reorderable          (GtkIconView              *icon_view);
190
191
192 /* These are useful to implement your own custom stuff. */
193 void                   gtk_icon_view_set_drag_dest_item       (GtkIconView              *icon_view,
194                                                                GtkTreePath              *path,
195                                                                GtkIconViewDropPosition   pos);
196 void                   gtk_icon_view_get_drag_dest_item       (GtkIconView              *icon_view,
197                                                                GtkTreePath             **path,
198                                                                GtkIconViewDropPosition  *pos);
199 gboolean               gtk_icon_view_get_dest_item_at_pos     (GtkIconView              *icon_view,
200                                                                gint                      drag_x,
201                                                                gint                      drag_y,
202                                                                GtkTreePath             **path,
203                                                                GtkIconViewDropPosition  *pos);
204 GdkPixmap             *gtk_icon_view_create_drag_icon         (GtkIconView              *icon_view,
205                                                                GtkTreePath              *path);
206
207 void    gtk_icon_view_convert_widget_to_bin_window_coords     (GtkIconView *icon_view,
208                                                                gint         wx,
209                                                                gint         wy,
210                                                                gint        *bx,
211                                                                gint        *by);
212
213
214 void    gtk_icon_view_set_tooltip_item                        (GtkIconView     *icon_view,
215                                                                GtkTooltip      *tooltip,
216                                                                GtkTreePath     *path);
217 void    gtk_icon_view_set_tooltip_cell                        (GtkIconView     *icon_view,
218                                                                GtkTooltip      *tooltip,
219                                                                GtkTreePath     *path,
220                                                                GtkCellRenderer *cell);
221 gboolean gtk_icon_view_get_tooltip_context                    (GtkIconView       *icon_view,
222                                                                gint              *x,
223                                                                gint              *y,
224                                                                gboolean           keyboard_tip,
225                                                                GtkTreeModel     **model,
226                                                                GtkTreePath      **path,
227                                                                GtkTreeIter       *iter);
228 void     gtk_icon_view_set_tooltip_column                     (GtkIconView       *icon_view,
229                                                                gint               column);
230 gint     gtk_icon_view_get_tooltip_column                     (GtkIconView       *icon_view);
231
232
233 G_END_DECLS
234
235 #endif /* __GTK_ICON_VIEW_H__ */