]> Pileus Git - ~andy/gtk/blob - gtk/gtkiconview.h
Test DND.
[~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 #ifndef __GTK_ICON_VIEW_H__
20 #define __GTK_ICON_VIEW_H__
21
22 #include <gtk/gtkcontainer.h>
23 #include <gtk/gtktreemodel.h>
24 #include <gtk/gtkcellrenderer.h>
25 #include <gtk/gtkselection.h>
26
27 G_BEGIN_DECLS
28
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))
35
36 typedef struct _GtkIconView           GtkIconView;
37 typedef struct _GtkIconViewClass      GtkIconViewClass;
38 typedef struct _GtkIconViewPrivate    GtkIconViewPrivate;
39
40 typedef void (* GtkIconViewForeachFunc)     (GtkIconView      *icon_view,
41                                              GtkTreePath      *path,
42                                              gpointer          data);
43
44 typedef enum
45 {
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;
53
54 struct _GtkIconView
55 {
56   GtkContainer parent;
57
58   GtkIconViewPrivate *priv;
59 };
60
61 struct _GtkIconViewClass
62 {
63   GtkContainerClass parent_class;
64
65   void    (* set_scroll_adjustments) (GtkIconView      *icon_view,
66                                       GtkAdjustment    *hadjustment,
67                                       GtkAdjustment    *vadjustment);
68   
69   void    (* item_activated)         (GtkIconView      *icon_view,
70                                       GtkTreePath      *path);
71   void    (* selection_changed)      (GtkIconView      *icon_view);
72
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,
79                                       GtkMovementStep   step,
80                                       gint              count);
81   gboolean (* activate_cursor_item)  (GtkIconView      *icon_view);
82 };
83
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);
87
88 void           gtk_icon_view_set_model         (GtkIconView    *icon_view,
89                                                 GtkTreeModel   *model);
90 GtkTreeModel * gtk_icon_view_get_model         (GtkIconView    *icon_view);
91 void           gtk_icon_view_set_text_column   (GtkIconView    *icon_view,
92                                                 gint            column);
93 gint           gtk_icon_view_get_text_column   (GtkIconView    *icon_view);
94 void           gtk_icon_view_set_markup_column (GtkIconView    *icon_view,
95                                                 gint            column);
96 gint           gtk_icon_view_get_markup_column (GtkIconView    *icon_view);
97 void           gtk_icon_view_set_pixbuf_column (GtkIconView    *icon_view,
98                                                 gint            column);
99 gint           gtk_icon_view_get_pixbuf_column (GtkIconView    *icon_view);
100
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,
105                                                 gint            columns);
106 gint           gtk_icon_view_get_columns       (GtkIconView    *icon_view);
107 void           gtk_icon_view_set_item_width    (GtkIconView    *icon_view,
108                                                 gint            item_width);
109 gint           gtk_icon_view_get_item_width    (GtkIconView    *icon_view);
110 void           gtk_icon_view_set_spacing       (GtkIconView    *icon_view, 
111                                                 gint            spacing);
112 gint           gtk_icon_view_get_spacing       (GtkIconView    *icon_view);
113 void           gtk_icon_view_set_row_spacing   (GtkIconView    *icon_view, 
114                                                 gint            row_spacing);
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, 
120                                                 gint            margin);
121 gint           gtk_icon_view_get_margin        (GtkIconView    *icon_view);
122
123
124 GtkTreePath *  gtk_icon_view_get_path_at_pos   (GtkIconView     *icon_view,
125                                                 gint             x,
126                                                 gint             y);
127 gboolean       gtk_icon_view_get_item_at_pos   (GtkIconView     *icon_view,
128                                                 gint              x,
129                                                 gint              y,
130                                                 GtkTreePath     **path,
131                                                 GtkCellRenderer **cell);
132
133 void           gtk_icon_view_selected_foreach   (GtkIconView            *icon_view,
134                                                  GtkIconViewForeachFunc  func,
135                                                  gpointer                data);
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,
140                                                    GtkTreePath            *path);
141 void             gtk_icon_view_unselect_path      (GtkIconView            *icon_view,
142                                                    GtkTreePath            *path);
143 gboolean         gtk_icon_view_path_is_selected   (GtkIconView            *icon_view,
144                                                    GtkTreePath            *path);
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,
149                                                    GtkTreePath            *path);
150 void             gtk_icon_view_set_cursor         (GtkIconView            *icon_view,
151                                                    GtkTreePath            *path,
152                                                    GtkCellRenderer        *cell,
153                                                    gboolean                start_editing);
154 gboolean         gtk_icon_view_get_cursor         (GtkIconView            *icon_view,
155                                                    GtkTreePath           **path,
156                                                    GtkCellRenderer       **cell);
157
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,
162                                                                gint                      n_targets,
163                                                                GdkDragAction             actions);
164 void                   gtk_icon_view_enable_model_drag_dest   (GtkIconView              *icon_view,
165                                                                const GtkTargetEntry     *targets,
166                                                                gint                      n_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);
173
174
175 /* These are useful to implement your own custom stuff. */
176 void                   gtk_icon_view_set_drag_dest_item       (GtkIconView              *icon_view,
177                                                                GtkTreePath              *path,
178                                                                GtkIconViewDropPosition   pos);
179 void                   gtk_icon_view_get_drag_dest_item       (GtkIconView              *icon_view,
180                                                                GtkTreePath             **path,
181                                                                GtkIconViewDropPosition  *pos);
182 gboolean               gtk_icon_view_get_dest_item_at_pos     (GtkIconView              *icon_view,
183                                                                gint                      drag_x,
184                                                                gint                      drag_y,
185                                                                GtkTreePath             **path,
186                                                                GtkIconViewDropPosition  *pos);
187 GdkPixmap             *gtk_icon_view_create_drag_icon         (GtkIconView              *icon_view,
188                                                                GtkTreePath              *path);
189
190
191 G_END_DECLS
192
193 #endif /* __GTK_ICON_VIEW_H__ */