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, see <http://www.gnu.org/licenses/>. |
16 | */ |
17 | |
18 | #include "gtk/gtkiconview.h" |
19 | #include "gtk/gtkcssnodeprivate.h" |
20 | #include "gtk/gtkeventcontrollermotion.h" |
21 | #include "gtk/gtkdragsource.h" |
22 | #include "gtk/gtkdroptargetasync.h" |
23 | #include "gtk/gtkgestureclick.h" |
24 | |
25 | #ifndef __GTK_ICON_VIEW_PRIVATE_H__ |
26 | #define __GTK_ICON_VIEW_PRIVATE_H__ |
27 | |
28 | typedef struct _GtkIconViewItem GtkIconViewItem; |
29 | struct _GtkIconViewItem |
30 | { |
31 | GdkRectangle cell_area; |
32 | |
33 | int index; |
34 | |
35 | int row, col; |
36 | |
37 | guint selected : 1; |
38 | guint selected_before_rubberbanding : 1; |
39 | |
40 | }; |
41 | |
42 | typedef struct _GtkIconViewClass GtkIconViewClass; |
43 | typedef struct _GtkIconViewPrivate GtkIconViewPrivate; |
44 | |
45 | struct _GtkIconView |
46 | { |
47 | GtkWidget parent; |
48 | |
49 | GtkIconViewPrivate *priv; |
50 | }; |
51 | |
52 | struct _GtkIconViewClass |
53 | { |
54 | GtkWidgetClass parent_class; |
55 | |
56 | void (* item_activated) (GtkIconView *icon_view, |
57 | GtkTreePath *path); |
58 | void (* selection_changed) (GtkIconView *icon_view); |
59 | |
60 | void (* select_all) (GtkIconView *icon_view); |
61 | void (* unselect_all) (GtkIconView *icon_view); |
62 | void (* select_cursor_item) (GtkIconView *icon_view); |
63 | void (* toggle_cursor_item) (GtkIconView *icon_view); |
64 | gboolean (* move_cursor) (GtkIconView *icon_view, |
65 | GtkMovementStep step, |
66 | int count, |
67 | gboolean extend, |
68 | gboolean modify); |
69 | gboolean (* activate_cursor_item) (GtkIconView *icon_view); |
70 | }; |
71 | |
72 | struct _GtkIconViewPrivate |
73 | { |
74 | GtkCellArea *cell_area; |
75 | GtkCellAreaContext *cell_area_context; |
76 | |
77 | gulong add_editable_id; |
78 | gulong remove_editable_id; |
79 | gulong context_changed_id; |
80 | |
81 | GPtrArray *row_contexts; |
82 | |
83 | int width, height; |
84 | double mouse_x; |
85 | double mouse_y; |
86 | |
87 | GtkSelectionMode selection_mode; |
88 | |
89 | GList *children; |
90 | |
91 | GtkTreeModel *model; |
92 | |
93 | GList *items; |
94 | |
95 | GtkEventController *key_controller; |
96 | |
97 | GtkAdjustment *hadjustment; |
98 | GtkAdjustment *vadjustment; |
99 | |
100 | int rubberband_x1, rubberband_y1; |
101 | int rubberband_x2, rubberband_y2; |
102 | GdkDevice *rubberband_device; |
103 | GtkCssNode *rubberband_node; |
104 | |
105 | guint scroll_timeout_id; |
106 | int scroll_value_diff; |
107 | int event_last_x, event_last_y; |
108 | |
109 | GtkIconViewItem *anchor_item; |
110 | GtkIconViewItem *cursor_item; |
111 | |
112 | GtkIconViewItem *last_single_clicked; |
113 | GtkIconViewItem *last_prelight; |
114 | |
115 | GtkOrientation item_orientation; |
116 | |
117 | int columns; |
118 | int item_width; |
119 | int spacing; |
120 | int row_spacing; |
121 | int column_spacing; |
122 | int margin; |
123 | int item_padding; |
124 | |
125 | int text_column; |
126 | int markup_column; |
127 | int pixbuf_column; |
128 | int tooltip_column; |
129 | |
130 | GtkCellRenderer *pixbuf_cell; |
131 | GtkCellRenderer *text_cell; |
132 | |
133 | /* Drag-and-drop. */ |
134 | GdkModifierType start_button_mask; |
135 | int pressed_button; |
136 | double press_start_x; |
137 | double press_start_y; |
138 | |
139 | GdkContentFormats *source_formats; |
140 | GtkDropTargetAsync *dest; |
141 | GtkCssNode *dndnode; |
142 | |
143 | GdkDrag *drag; |
144 | |
145 | GdkDragAction source_actions; |
146 | GdkDragAction dest_actions; |
147 | |
148 | GtkTreeRowReference *source_item; |
149 | GtkTreeRowReference *dest_item; |
150 | GtkIconViewDropPosition dest_pos; |
151 | |
152 | /* scroll to */ |
153 | GtkTreeRowReference *scroll_to_path; |
154 | float scroll_to_row_align; |
155 | float scroll_to_col_align; |
156 | guint scroll_to_use_align : 1; |
157 | |
158 | guint source_set : 1; |
159 | guint dest_set : 1; |
160 | guint reorderable : 1; |
161 | guint empty_view_drop :1; |
162 | guint activate_on_single_click : 1; |
163 | |
164 | guint modify_selection_pressed : 1; |
165 | guint extend_selection_pressed : 1; |
166 | |
167 | guint draw_focus : 1; |
168 | |
169 | /* GtkScrollablePolicy needs to be checked when |
170 | * driving the scrollable adjustment values */ |
171 | guint hscroll_policy : 1; |
172 | guint vscroll_policy : 1; |
173 | |
174 | guint doing_rubberband : 1; |
175 | |
176 | }; |
177 | |
178 | void _gtk_icon_view_set_cell_data (GtkIconView *icon_view, |
179 | GtkIconViewItem *item); |
180 | void _gtk_icon_view_set_cursor_item (GtkIconView *icon_view, |
181 | GtkIconViewItem *item, |
182 | GtkCellRenderer *cursor_cell); |
183 | GtkIconViewItem * _gtk_icon_view_get_item_at_coords (GtkIconView *icon_view, |
184 | int x, |
185 | int y, |
186 | gboolean only_in_cell, |
187 | GtkCellRenderer **cell_at_pos); |
188 | void _gtk_icon_view_select_item (GtkIconView *icon_view, |
189 | GtkIconViewItem *item); |
190 | void _gtk_icon_view_unselect_item (GtkIconView *icon_view, |
191 | GtkIconViewItem *item); |
192 | |
193 | G_END_DECLS |
194 | |
195 | #endif /* __GTK_ICON_VIEW_PRIVATE_H__ */ |
196 | |