CoreGTK  3.22.0
CoreGTK is an Objective-C language binding for the GTK+ widget toolkit
CGTKIconView.m
1 /*
2  * CGTKIconView.m
3  * This file is part of CoreGTK
4  *
5  * Copyright (C) 2017 - Tyler Burton
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /*
23  * Modified by the CoreGTK Team, 2017. See the AUTHORS file for a
24  * list of people on the CoreGTK Team.
25  * See the ChangeLog files for a list of changes.
26  *
27  */
28 
29 /*
30  * Objective-C imports
31  */
32 #import "CoreGTK/CGTKIconView.h"
33 
34 @implementation CGTKIconView
35 
36 -(id)init
37 {
38  self = [super initWithGObject:(GObject *)gtk_icon_view_new()];
39 
40  if(self)
41  {
42  //Do nothing
43  }
44 
45  return self;
46 }
47 
48 -(id)initWithArea:(GtkCellArea*) area
49 {
50  self = [super initWithGObject:(GObject *)gtk_icon_view_new_with_area(area)];
51 
52  if(self)
53  {
54  //Do nothing
55  }
56 
57  return self;
58 }
59 
60 -(id)initWithModel:(GtkTreeModel*) model
61 {
62  self = [super initWithGObject:(GObject *)gtk_icon_view_new_with_model(model)];
63 
64  if(self)
65  {
66  //Do nothing
67  }
68 
69  return self;
70 }
71 
72 -(GtkIconView*)ICONVIEW
73 {
74  return GTK_ICON_VIEW([self GOBJECT]);
75 }
76 
77 -(void)convertWidgetToBinWindowCoordsWithWx:(gint) wx andWy:(gint) wy andBx:(gint*) bx andBy:(gint*) by
78 {
79  gtk_icon_view_convert_widget_to_bin_window_coords(GTK_ICON_VIEW([self GOBJECT]), wx, wy, bx, by);
80 }
81 
82 -(cairo_surface_t*)createDragIcon:(GtkTreePath*) path
83 {
84  return gtk_icon_view_create_drag_icon(GTK_ICON_VIEW([self GOBJECT]), path);
85 }
86 
87 -(void)enableModelDragDestWithTargets:(GtkTargetEntry*) targets andNtargets:(gint) ntargets andActions:(GdkDragAction) actions
88 {
89  gtk_icon_view_enable_model_drag_dest(GTK_ICON_VIEW([self GOBJECT]), targets, ntargets, actions);
90 }
91 
92 -(void)enableModelDragSourceWithStartButtonMask:(GdkModifierType) startButtonMask andTargets:(GtkTargetEntry*) targets andNtargets:(gint) ntargets andActions:(GdkDragAction) actions
93 {
94  gtk_icon_view_enable_model_drag_source(GTK_ICON_VIEW([self GOBJECT]), startButtonMask, targets, ntargets, actions);
95 }
96 
98 {
99  return (gtk_icon_view_get_activate_on_single_click(GTK_ICON_VIEW([self GOBJECT])) ? YES : NO);
100 }
101 
102 -(BOOL)getCellRectWithPath:(GtkTreePath*) path andCell:(GtkCellRenderer*) cell andRect:(GdkRectangle*) rect
103 {
104  return (gtk_icon_view_get_cell_rect(GTK_ICON_VIEW([self GOBJECT]), path, cell, rect) ? YES : NO);
105 }
106 
108 {
109  return gtk_icon_view_get_column_spacing(GTK_ICON_VIEW([self GOBJECT]));
110 }
111 
113 {
114  return gtk_icon_view_get_columns(GTK_ICON_VIEW([self GOBJECT]));
115 }
116 
117 -(BOOL)getCursorWithPath:(GtkTreePath**) path andCell:(GtkCellRenderer**) cell
118 {
119  return (gtk_icon_view_get_cursor(GTK_ICON_VIEW([self GOBJECT]), path, cell) ? YES : NO);
120 }
121 
122 -(BOOL)getDestItemAtPosWithDragX:(gint) dragX andDragY:(gint) dragY andPath:(GtkTreePath**) path andPos:(GtkIconViewDropPosition*) pos
123 {
124  return (gtk_icon_view_get_dest_item_at_pos(GTK_ICON_VIEW([self GOBJECT]), dragX, dragY, path, pos) ? YES : NO);
125 }
126 
127 -(void)getDragDestItemWithPath:(GtkTreePath**) path andPos:(GtkIconViewDropPosition*) pos
128 {
129  gtk_icon_view_get_drag_dest_item(GTK_ICON_VIEW([self GOBJECT]), path, pos);
130 }
131 
132 -(BOOL)getItemAtPosWithX:(gint) x andY:(gint) y andPath:(GtkTreePath**) path andCell:(GtkCellRenderer**) cell
133 {
134  return (gtk_icon_view_get_item_at_pos(GTK_ICON_VIEW([self GOBJECT]), x, y, path, cell) ? YES : NO);
135 }
136 
137 -(gint)getItemColumn:(GtkTreePath*) path
138 {
139  return gtk_icon_view_get_item_column(GTK_ICON_VIEW([self GOBJECT]), path);
140 }
141 
142 -(GtkOrientation)getItemOrientation
143 {
144  return gtk_icon_view_get_item_orientation(GTK_ICON_VIEW([self GOBJECT]));
145 }
146 
148 {
149  return gtk_icon_view_get_item_padding(GTK_ICON_VIEW([self GOBJECT]));
150 }
151 
152 -(gint)getItemRow:(GtkTreePath*) path
153 {
154  return gtk_icon_view_get_item_row(GTK_ICON_VIEW([self GOBJECT]), path);
155 }
156 
158 {
159  return gtk_icon_view_get_item_width(GTK_ICON_VIEW([self GOBJECT]));
160 }
161 
162 -(gint)getMargin
163 {
164  return gtk_icon_view_get_margin(GTK_ICON_VIEW([self GOBJECT]));
165 }
166 
168 {
169  return gtk_icon_view_get_markup_column(GTK_ICON_VIEW([self GOBJECT]));
170 }
171 
172 -(GtkTreeModel*)getModel
173 {
174  return gtk_icon_view_get_model(GTK_ICON_VIEW([self GOBJECT]));
175 }
176 
177 -(GtkTreePath*)getPathAtPosWithX:(gint) x andY:(gint) y
178 {
179  return gtk_icon_view_get_path_at_pos(GTK_ICON_VIEW([self GOBJECT]), x, y);
180 }
181 
183 {
184  return gtk_icon_view_get_pixbuf_column(GTK_ICON_VIEW([self GOBJECT]));
185 }
186 
188 {
189  return (gtk_icon_view_get_reorderable(GTK_ICON_VIEW([self GOBJECT])) ? YES : NO);
190 }
191 
193 {
194  return gtk_icon_view_get_row_spacing(GTK_ICON_VIEW([self GOBJECT]));
195 }
196 
198 {
199  return gtk_icon_view_get_selected_items(GTK_ICON_VIEW([self GOBJECT]));
200 }
201 
202 -(GtkSelectionMode)getSelectionMode
203 {
204  return gtk_icon_view_get_selection_mode(GTK_ICON_VIEW([self GOBJECT]));
205 }
206 
208 {
209  return gtk_icon_view_get_spacing(GTK_ICON_VIEW([self GOBJECT]));
210 }
211 
213 {
214  return gtk_icon_view_get_text_column(GTK_ICON_VIEW([self GOBJECT]));
215 }
216 
218 {
219  return gtk_icon_view_get_tooltip_column(GTK_ICON_VIEW([self GOBJECT]));
220 }
221 
222 -(BOOL)getTooltipContextWithX:(gint*) x andY:(gint*) y andKeyboardTip:(BOOL) keyboardTip andModel:(GtkTreeModel**) model andPath:(GtkTreePath**) path andIter:(GtkTreeIter*) iter
223 {
224  return (gtk_icon_view_get_tooltip_context(GTK_ICON_VIEW([self GOBJECT]), x, y, (keyboardTip ? TRUE : FALSE), model, path, iter) ? YES : NO);
225 }
226 
227 -(BOOL)getVisibleRangeWithStartPath:(GtkTreePath**) startPath andEndPath:(GtkTreePath**) endPath
228 {
229  return (gtk_icon_view_get_visible_range(GTK_ICON_VIEW([self GOBJECT]), startPath, endPath) ? YES : NO);
230 }
231 
232 -(void)itemActivated:(GtkTreePath*) path
233 {
234  gtk_icon_view_item_activated(GTK_ICON_VIEW([self GOBJECT]), path);
235 }
236 
237 -(BOOL)pathIsSelected:(GtkTreePath*) path
238 {
239  return (gtk_icon_view_path_is_selected(GTK_ICON_VIEW([self GOBJECT]), path) ? YES : NO);
240 }
241 
242 -(void)scrollToPathWithPath:(GtkTreePath*) path andUseAlign:(BOOL) useAlign andRowAlign:(gfloat) rowAlign andColAlign:(gfloat) colAlign
243 {
244  gtk_icon_view_scroll_to_path(GTK_ICON_VIEW([self GOBJECT]), path, (useAlign ? TRUE : FALSE), rowAlign, colAlign);
245 }
246 
247 -(void)selectAll
248 {
249  gtk_icon_view_select_all(GTK_ICON_VIEW([self GOBJECT]));
250 }
251 
252 -(void)selectPath:(GtkTreePath*) path
253 {
254  gtk_icon_view_select_path(GTK_ICON_VIEW([self GOBJECT]), path);
255 }
256 
257 -(void)selectedForeachWithFunc:(GtkIconViewForeachFunc) func andData:(gpointer) data
258 {
259  gtk_icon_view_selected_foreach(GTK_ICON_VIEW([self GOBJECT]), func, data);
260 }
261 
262 -(void)setActivateOnSingleClick:(BOOL) single
263 {
264  gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW([self GOBJECT]), (single ? TRUE : FALSE));
265 }
266 
267 -(void)setColumnSpacing:(gint) columnSpacing
268 {
269  gtk_icon_view_set_column_spacing(GTK_ICON_VIEW([self GOBJECT]), columnSpacing);
270 }
271 
272 -(void)setColumns:(gint) columns
273 {
274  gtk_icon_view_set_columns(GTK_ICON_VIEW([self GOBJECT]), columns);
275 }
276 
277 -(void)setCursorWithPath:(GtkTreePath*) path andCell:(GtkCellRenderer*) cell andStartEditing:(BOOL) startEditing
278 {
279  gtk_icon_view_set_cursor(GTK_ICON_VIEW([self GOBJECT]), path, cell, (startEditing ? TRUE : FALSE));
280 }
281 
282 -(void)setDragDestItemWithPath:(GtkTreePath*) path andPos:(GtkIconViewDropPosition) pos
283 {
284  gtk_icon_view_set_drag_dest_item(GTK_ICON_VIEW([self GOBJECT]), path, pos);
285 }
286 
287 -(void)setItemOrientation:(GtkOrientation) orientation
288 {
289  gtk_icon_view_set_item_orientation(GTK_ICON_VIEW([self GOBJECT]), orientation);
290 }
291 
292 -(void)setItemPadding:(gint) itemPadding
293 {
294  gtk_icon_view_set_item_padding(GTK_ICON_VIEW([self GOBJECT]), itemPadding);
295 }
296 
297 -(void)setItemWidth:(gint) itemWidth
298 {
299  gtk_icon_view_set_item_width(GTK_ICON_VIEW([self GOBJECT]), itemWidth);
300 }
301 
302 -(void)setMargin:(gint) margin
303 {
304  gtk_icon_view_set_margin(GTK_ICON_VIEW([self GOBJECT]), margin);
305 }
306 
307 -(void)setMarkupColumn:(gint) column
308 {
309  gtk_icon_view_set_markup_column(GTK_ICON_VIEW([self GOBJECT]), column);
310 }
311 
312 -(void)setModel:(GtkTreeModel*) model
313 {
314  gtk_icon_view_set_model(GTK_ICON_VIEW([self GOBJECT]), model);
315 }
316 
317 -(void)setPixbufColumn:(gint) column
318 {
319  gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW([self GOBJECT]), column);
320 }
321 
322 -(void)setReorderable:(BOOL) reorderable
323 {
324  gtk_icon_view_set_reorderable(GTK_ICON_VIEW([self GOBJECT]), (reorderable ? TRUE : FALSE));
325 }
326 
327 -(void)setRowSpacing:(gint) rowSpacing
328 {
329  gtk_icon_view_set_row_spacing(GTK_ICON_VIEW([self GOBJECT]), rowSpacing);
330 }
331 
332 -(void)setSelectionMode:(GtkSelectionMode) mode
333 {
334  gtk_icon_view_set_selection_mode(GTK_ICON_VIEW([self GOBJECT]), mode);
335 }
336 
337 -(void)setSpacing:(gint) spacing
338 {
339  gtk_icon_view_set_spacing(GTK_ICON_VIEW([self GOBJECT]), spacing);
340 }
341 
342 -(void)setTextColumn:(gint) column
343 {
344  gtk_icon_view_set_text_column(GTK_ICON_VIEW([self GOBJECT]), column);
345 }
346 
347 -(void)setTooltipCellWithTooltip:(GtkTooltip*) tooltip andPath:(GtkTreePath*) path andCell:(GtkCellRenderer*) cell
348 {
349  gtk_icon_view_set_tooltip_cell(GTK_ICON_VIEW([self GOBJECT]), tooltip, path, cell);
350 }
351 
352 -(void)setTooltipColumn:(gint) column
353 {
354  gtk_icon_view_set_tooltip_column(GTK_ICON_VIEW([self GOBJECT]), column);
355 }
356 
357 -(void)setTooltipItemWithTooltip:(GtkTooltip*) tooltip andPath:(GtkTreePath*) path
358 {
359  gtk_icon_view_set_tooltip_item(GTK_ICON_VIEW([self GOBJECT]), tooltip, path);
360 }
361 
363 {
364  gtk_icon_view_unselect_all(GTK_ICON_VIEW([self GOBJECT]));
365 }
366 
367 -(void)unselectPath:(GtkTreePath*) path
368 {
369  gtk_icon_view_unselect_path(GTK_ICON_VIEW([self GOBJECT]), path);
370 }
371 
373 {
374  gtk_icon_view_unset_model_drag_dest(GTK_ICON_VIEW([self GOBJECT]));
375 }
376 
378 {
379  gtk_icon_view_unset_model_drag_source(GTK_ICON_VIEW([self GOBJECT]));
380 }
381 
382 
383 @end
GtkTreeModel * getModel()
Definition: CGTKIconView.m:172
GObject * GOBJECT()
Definition: CGTKBase.m:82
gint getItemPadding()
Definition: CGTKIconView.m:147
id initWithGObject:(GObject *obj)
Definition: CGTKBase.m:48
GtkSelectionMode getSelectionMode()
Definition: CGTKIconView.m:202
BOOL getActivateOnSingleClick()
Definition: CGTKIconView.m:97
gint getPixbufColumn()
Definition: CGTKIconView.m:182
gint getRowSpacing()
Definition: CGTKIconView.m:192
gint getMarkupColumn()
Definition: CGTKIconView.m:167
gint getColumnSpacing()
Definition: CGTKIconView.m:107
void unsetModelDragSource()
Definition: CGTKIconView.m:377
gint getTooltipColumn()
Definition: CGTKIconView.m:217
gint getItemWidth()
Definition: CGTKIconView.m:157
void unsetModelDragDest()
Definition: CGTKIconView.m:372
gint getTextColumn()
Definition: CGTKIconView.m:212
BOOL getReorderable()
Definition: CGTKIconView.m:187
GtkIconView * ICONVIEW()
Definition: CGTKIconView.m:72
GList * getSelectedItems()
Definition: CGTKIconView.m:197
GtkOrientation getItemOrientation()
Definition: CGTKIconView.m:142
void unselectAll()
Definition: CGTKIconView.m:362