1#![allow(deprecated)]
5
6use crate::{
7 ffi, Accessible, AccessibleRole, Adjustment, Align, Buildable, CellArea, CellLayout,
8 CellRenderer, ConstraintTarget, IconViewDropPosition, LayoutManager, MovementStep, Orientation,
9 Overflow, Scrollable, ScrollablePolicy, SelectionMode, Tooltip, TreeIter, TreeModel, TreePath,
10 Widget,
11};
12use glib::{
13 object::ObjectType as _,
14 prelude::*,
15 signal::{connect_raw, SignalHandlerId},
16 translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21 #[doc(alias = "GtkIconView")]
22 pub struct IconView(Object<ffi::GtkIconView>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, CellLayout, Scrollable;
23
24 match fn {
25 type_ => || ffi::gtk_icon_view_get_type(),
26 }
27}
28
29impl IconView {
30 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
31 #[allow(deprecated)]
32 #[doc(alias = "gtk_icon_view_new")]
33 pub fn new() -> IconView {
34 assert_initialized_main_thread!();
35 unsafe { Widget::from_glib_none(ffi::gtk_icon_view_new()).unsafe_cast() }
36 }
37
38 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
39 #[allow(deprecated)]
40 #[doc(alias = "gtk_icon_view_new_with_area")]
41 #[doc(alias = "new_with_area")]
42 pub fn with_area(area: &impl IsA<CellArea>) -> IconView {
43 skip_assert_initialized!();
44 unsafe {
45 Widget::from_glib_none(ffi::gtk_icon_view_new_with_area(
46 area.as_ref().to_glib_none().0,
47 ))
48 .unsafe_cast()
49 }
50 }
51
52 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
53 #[allow(deprecated)]
54 #[doc(alias = "gtk_icon_view_new_with_model")]
55 #[doc(alias = "new_with_model")]
56 pub fn with_model(model: &impl IsA<TreeModel>) -> IconView {
57 skip_assert_initialized!();
58 unsafe {
59 Widget::from_glib_none(ffi::gtk_icon_view_new_with_model(
60 model.as_ref().to_glib_none().0,
61 ))
62 .unsafe_cast()
63 }
64 }
65
66 pub fn builder() -> IconViewBuilder {
71 IconViewBuilder::new()
72 }
73
74 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
75 #[allow(deprecated)]
76 #[doc(alias = "gtk_icon_view_create_drag_icon")]
77 pub fn create_drag_icon(&self, path: &TreePath) -> Option<gdk::Paintable> {
78 unsafe {
79 from_glib_full(ffi::gtk_icon_view_create_drag_icon(
80 self.to_glib_none().0,
81 mut_override(path.to_glib_none().0),
82 ))
83 }
84 }
85
86 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
87 #[allow(deprecated)]
88 #[doc(alias = "gtk_icon_view_enable_model_drag_dest")]
89 pub fn enable_model_drag_dest(&self, formats: &gdk::ContentFormats, actions: gdk::DragAction) {
90 unsafe {
91 ffi::gtk_icon_view_enable_model_drag_dest(
92 self.to_glib_none().0,
93 formats.to_glib_none().0,
94 actions.into_glib(),
95 );
96 }
97 }
98
99 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
100 #[allow(deprecated)]
101 #[doc(alias = "gtk_icon_view_enable_model_drag_source")]
102 pub fn enable_model_drag_source(
103 &self,
104 start_button_mask: gdk::ModifierType,
105 formats: &gdk::ContentFormats,
106 actions: gdk::DragAction,
107 ) {
108 unsafe {
109 ffi::gtk_icon_view_enable_model_drag_source(
110 self.to_glib_none().0,
111 start_button_mask.into_glib(),
112 formats.to_glib_none().0,
113 actions.into_glib(),
114 );
115 }
116 }
117
118 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
119 #[allow(deprecated)]
120 #[doc(alias = "gtk_icon_view_get_activate_on_single_click")]
121 #[doc(alias = "get_activate_on_single_click")]
122 #[doc(alias = "activate-on-single-click")]
123 pub fn activates_on_single_click(&self) -> bool {
124 unsafe {
125 from_glib(ffi::gtk_icon_view_get_activate_on_single_click(
126 self.to_glib_none().0,
127 ))
128 }
129 }
130
131 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
132 #[allow(deprecated)]
133 #[doc(alias = "gtk_icon_view_get_cell_rect")]
134 #[doc(alias = "get_cell_rect")]
135 pub fn cell_rect(
136 &self,
137 path: &TreePath,
138 cell: Option<&impl IsA<CellRenderer>>,
139 ) -> Option<gdk::Rectangle> {
140 unsafe {
141 let mut rect = gdk::Rectangle::uninitialized();
142 let ret = from_glib(ffi::gtk_icon_view_get_cell_rect(
143 self.to_glib_none().0,
144 mut_override(path.to_glib_none().0),
145 cell.map(|p| p.as_ref()).to_glib_none().0,
146 rect.to_glib_none_mut().0,
147 ));
148 if ret {
149 Some(rect)
150 } else {
151 None
152 }
153 }
154 }
155
156 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
157 #[allow(deprecated)]
158 #[doc(alias = "gtk_icon_view_get_column_spacing")]
159 #[doc(alias = "get_column_spacing")]
160 #[doc(alias = "column-spacing")]
161 pub fn column_spacing(&self) -> i32 {
162 unsafe { ffi::gtk_icon_view_get_column_spacing(self.to_glib_none().0) }
163 }
164
165 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
166 #[allow(deprecated)]
167 #[doc(alias = "gtk_icon_view_get_columns")]
168 #[doc(alias = "get_columns")]
169 pub fn columns(&self) -> i32 {
170 unsafe { ffi::gtk_icon_view_get_columns(self.to_glib_none().0) }
171 }
172
173 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
174 #[allow(deprecated)]
175 #[doc(alias = "gtk_icon_view_get_cursor")]
176 #[doc(alias = "get_cursor")]
177 pub fn cursor(&self) -> Option<(TreePath, CellRenderer)> {
178 unsafe {
179 let mut path = std::ptr::null_mut();
180 let mut cell = std::ptr::null_mut();
181 let ret = from_glib(ffi::gtk_icon_view_get_cursor(
182 self.to_glib_none().0,
183 &mut path,
184 &mut cell,
185 ));
186 if ret {
187 Some((from_glib_full(path), from_glib_none(cell)))
188 } else {
189 None
190 }
191 }
192 }
193
194 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
195 #[allow(deprecated)]
196 #[doc(alias = "gtk_icon_view_get_dest_item_at_pos")]
197 #[doc(alias = "get_dest_item_at_pos")]
198 pub fn dest_item_at_pos(
199 &self,
200 drag_x: i32,
201 drag_y: i32,
202 ) -> Option<(TreePath, IconViewDropPosition)> {
203 unsafe {
204 let mut path = std::ptr::null_mut();
205 let mut pos = std::mem::MaybeUninit::uninit();
206 let ret = from_glib(ffi::gtk_icon_view_get_dest_item_at_pos(
207 self.to_glib_none().0,
208 drag_x,
209 drag_y,
210 &mut path,
211 pos.as_mut_ptr(),
212 ));
213 if ret {
214 Some((from_glib_full(path), from_glib(pos.assume_init())))
215 } else {
216 None
217 }
218 }
219 }
220
221 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
222 #[allow(deprecated)]
223 #[doc(alias = "gtk_icon_view_get_drag_dest_item")]
224 #[doc(alias = "get_drag_dest_item")]
225 pub fn drag_dest_item(&self) -> (Option<TreePath>, IconViewDropPosition) {
226 unsafe {
227 let mut path = std::ptr::null_mut();
228 let mut pos = std::mem::MaybeUninit::uninit();
229 ffi::gtk_icon_view_get_drag_dest_item(
230 self.to_glib_none().0,
231 &mut path,
232 pos.as_mut_ptr(),
233 );
234 (from_glib_full(path), from_glib(pos.assume_init()))
235 }
236 }
237
238 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
239 #[allow(deprecated)]
240 #[doc(alias = "gtk_icon_view_get_item_at_pos")]
241 #[doc(alias = "get_item_at_pos")]
242 pub fn item_at_pos(&self, x: i32, y: i32) -> Option<(TreePath, CellRenderer)> {
243 unsafe {
244 let mut path = std::ptr::null_mut();
245 let mut cell = std::ptr::null_mut();
246 let ret = from_glib(ffi::gtk_icon_view_get_item_at_pos(
247 self.to_glib_none().0,
248 x,
249 y,
250 &mut path,
251 &mut cell,
252 ));
253 if ret {
254 Some((from_glib_full(path), from_glib_none(cell)))
255 } else {
256 None
257 }
258 }
259 }
260
261 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
262 #[allow(deprecated)]
263 #[doc(alias = "gtk_icon_view_get_item_column")]
264 #[doc(alias = "get_item_column")]
265 pub fn item_column(&self, path: &TreePath) -> i32 {
266 unsafe {
267 ffi::gtk_icon_view_get_item_column(
268 self.to_glib_none().0,
269 mut_override(path.to_glib_none().0),
270 )
271 }
272 }
273
274 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
275 #[allow(deprecated)]
276 #[doc(alias = "gtk_icon_view_get_item_orientation")]
277 #[doc(alias = "get_item_orientation")]
278 #[doc(alias = "item-orientation")]
279 pub fn item_orientation(&self) -> Orientation {
280 unsafe {
281 from_glib(ffi::gtk_icon_view_get_item_orientation(
282 self.to_glib_none().0,
283 ))
284 }
285 }
286
287 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
288 #[allow(deprecated)]
289 #[doc(alias = "gtk_icon_view_get_item_padding")]
290 #[doc(alias = "get_item_padding")]
291 #[doc(alias = "item-padding")]
292 pub fn item_padding(&self) -> i32 {
293 unsafe { ffi::gtk_icon_view_get_item_padding(self.to_glib_none().0) }
294 }
295
296 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
297 #[allow(deprecated)]
298 #[doc(alias = "gtk_icon_view_get_item_row")]
299 #[doc(alias = "get_item_row")]
300 pub fn item_row(&self, path: &TreePath) -> i32 {
301 unsafe {
302 ffi::gtk_icon_view_get_item_row(
303 self.to_glib_none().0,
304 mut_override(path.to_glib_none().0),
305 )
306 }
307 }
308
309 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
310 #[allow(deprecated)]
311 #[doc(alias = "gtk_icon_view_get_item_width")]
312 #[doc(alias = "get_item_width")]
313 #[doc(alias = "item-width")]
314 pub fn item_width(&self) -> i32 {
315 unsafe { ffi::gtk_icon_view_get_item_width(self.to_glib_none().0) }
316 }
317
318 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
319 #[allow(deprecated)]
320 #[doc(alias = "gtk_icon_view_get_margin")]
321 #[doc(alias = "get_margin")]
322 pub fn margin(&self) -> i32 {
323 unsafe { ffi::gtk_icon_view_get_margin(self.to_glib_none().0) }
324 }
325
326 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
327 #[allow(deprecated)]
328 #[doc(alias = "gtk_icon_view_get_markup_column")]
329 #[doc(alias = "get_markup_column")]
330 #[doc(alias = "markup-column")]
331 pub fn markup_column(&self) -> i32 {
332 unsafe { ffi::gtk_icon_view_get_markup_column(self.to_glib_none().0) }
333 }
334
335 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
336 #[allow(deprecated)]
337 #[doc(alias = "gtk_icon_view_get_model")]
338 #[doc(alias = "get_model")]
339 pub fn model(&self) -> Option<TreeModel> {
340 unsafe { from_glib_none(ffi::gtk_icon_view_get_model(self.to_glib_none().0)) }
341 }
342
343 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
344 #[allow(deprecated)]
345 #[doc(alias = "gtk_icon_view_get_path_at_pos")]
346 #[doc(alias = "get_path_at_pos")]
347 pub fn path_at_pos(&self, x: i32, y: i32) -> Option<TreePath> {
348 unsafe {
349 from_glib_full(ffi::gtk_icon_view_get_path_at_pos(
350 self.to_glib_none().0,
351 x,
352 y,
353 ))
354 }
355 }
356
357 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
358 #[allow(deprecated)]
359 #[doc(alias = "gtk_icon_view_get_pixbuf_column")]
360 #[doc(alias = "get_pixbuf_column")]
361 #[doc(alias = "pixbuf-column")]
362 pub fn pixbuf_column(&self) -> i32 {
363 unsafe { ffi::gtk_icon_view_get_pixbuf_column(self.to_glib_none().0) }
364 }
365
366 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
367 #[allow(deprecated)]
368 #[doc(alias = "gtk_icon_view_get_reorderable")]
369 #[doc(alias = "get_reorderable")]
370 #[doc(alias = "reorderable")]
371 pub fn is_reorderable(&self) -> bool {
372 unsafe { from_glib(ffi::gtk_icon_view_get_reorderable(self.to_glib_none().0)) }
373 }
374
375 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
376 #[allow(deprecated)]
377 #[doc(alias = "gtk_icon_view_get_row_spacing")]
378 #[doc(alias = "get_row_spacing")]
379 #[doc(alias = "row-spacing")]
380 pub fn row_spacing(&self) -> i32 {
381 unsafe { ffi::gtk_icon_view_get_row_spacing(self.to_glib_none().0) }
382 }
383
384 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
385 #[allow(deprecated)]
386 #[doc(alias = "gtk_icon_view_get_selected_items")]
387 #[doc(alias = "get_selected_items")]
388 pub fn selected_items(&self) -> Vec<TreePath> {
389 unsafe {
390 FromGlibPtrContainer::from_glib_full(ffi::gtk_icon_view_get_selected_items(
391 self.to_glib_none().0,
392 ))
393 }
394 }
395
396 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
397 #[allow(deprecated)]
398 #[doc(alias = "gtk_icon_view_get_selection_mode")]
399 #[doc(alias = "get_selection_mode")]
400 #[doc(alias = "selection-mode")]
401 pub fn selection_mode(&self) -> SelectionMode {
402 unsafe { from_glib(ffi::gtk_icon_view_get_selection_mode(self.to_glib_none().0)) }
403 }
404
405 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
406 #[allow(deprecated)]
407 #[doc(alias = "gtk_icon_view_get_spacing")]
408 #[doc(alias = "get_spacing")]
409 pub fn spacing(&self) -> i32 {
410 unsafe { ffi::gtk_icon_view_get_spacing(self.to_glib_none().0) }
411 }
412
413 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
414 #[allow(deprecated)]
415 #[doc(alias = "gtk_icon_view_get_text_column")]
416 #[doc(alias = "get_text_column")]
417 #[doc(alias = "text-column")]
418 pub fn text_column(&self) -> i32 {
419 unsafe { ffi::gtk_icon_view_get_text_column(self.to_glib_none().0) }
420 }
421
422 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
423 #[allow(deprecated)]
424 #[doc(alias = "gtk_icon_view_get_tooltip_column")]
425 #[doc(alias = "get_tooltip_column")]
426 #[doc(alias = "tooltip-column")]
427 pub fn tooltip_column(&self) -> i32 {
428 unsafe { ffi::gtk_icon_view_get_tooltip_column(self.to_glib_none().0) }
429 }
430
431 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
432 #[allow(deprecated)]
433 #[doc(alias = "gtk_icon_view_get_tooltip_context")]
434 #[doc(alias = "get_tooltip_context")]
435 pub fn tooltip_context(
436 &self,
437 x: i32,
438 y: i32,
439 keyboard_tip: bool,
440 ) -> Option<(TreeModel, TreePath, TreeIter)> {
441 unsafe {
442 let mut model = std::ptr::null_mut();
443 let mut path = std::ptr::null_mut();
444 let mut iter = TreeIter::uninitialized();
445 let ret = from_glib(ffi::gtk_icon_view_get_tooltip_context(
446 self.to_glib_none().0,
447 x,
448 y,
449 keyboard_tip.into_glib(),
450 &mut model,
451 &mut path,
452 iter.to_glib_none_mut().0,
453 ));
454 if ret {
455 Some((from_glib_none(model), from_glib_full(path), iter))
456 } else {
457 None
458 }
459 }
460 }
461
462 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
463 #[allow(deprecated)]
464 #[doc(alias = "gtk_icon_view_get_visible_range")]
465 #[doc(alias = "get_visible_range")]
466 pub fn visible_range(&self) -> Option<(TreePath, TreePath)> {
467 unsafe {
468 let mut start_path = std::ptr::null_mut();
469 let mut end_path = std::ptr::null_mut();
470 let ret = from_glib(ffi::gtk_icon_view_get_visible_range(
471 self.to_glib_none().0,
472 &mut start_path,
473 &mut end_path,
474 ));
475 if ret {
476 Some((from_glib_full(start_path), from_glib_full(end_path)))
477 } else {
478 None
479 }
480 }
481 }
482
483 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
484 #[allow(deprecated)]
485 #[doc(alias = "gtk_icon_view_item_activated")]
486 pub fn item_activated(&self, path: &TreePath) {
487 unsafe {
488 ffi::gtk_icon_view_item_activated(
489 self.to_glib_none().0,
490 mut_override(path.to_glib_none().0),
491 );
492 }
493 }
494
495 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
496 #[allow(deprecated)]
497 #[doc(alias = "gtk_icon_view_path_is_selected")]
498 pub fn path_is_selected(&self, path: &TreePath) -> bool {
499 unsafe {
500 from_glib(ffi::gtk_icon_view_path_is_selected(
501 self.to_glib_none().0,
502 mut_override(path.to_glib_none().0),
503 ))
504 }
505 }
506
507 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
508 #[allow(deprecated)]
509 #[doc(alias = "gtk_icon_view_scroll_to_path")]
510 pub fn scroll_to_path(&self, path: &TreePath, use_align: bool, row_align: f32, col_align: f32) {
511 unsafe {
512 ffi::gtk_icon_view_scroll_to_path(
513 self.to_glib_none().0,
514 mut_override(path.to_glib_none().0),
515 use_align.into_glib(),
516 row_align,
517 col_align,
518 );
519 }
520 }
521
522 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
523 #[allow(deprecated)]
524 #[doc(alias = "gtk_icon_view_select_all")]
525 pub fn select_all(&self) {
526 unsafe {
527 ffi::gtk_icon_view_select_all(self.to_glib_none().0);
528 }
529 }
530
531 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
532 #[allow(deprecated)]
533 #[doc(alias = "gtk_icon_view_select_path")]
534 pub fn select_path(&self, path: &TreePath) {
535 unsafe {
536 ffi::gtk_icon_view_select_path(
537 self.to_glib_none().0,
538 mut_override(path.to_glib_none().0),
539 );
540 }
541 }
542
543 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
544 #[allow(deprecated)]
545 #[doc(alias = "gtk_icon_view_selected_foreach")]
546 pub fn selected_foreach<P: FnMut(&IconView, &TreePath)>(&self, func: P) {
547 let mut func_data: P = func;
548 unsafe extern "C" fn func_func<P: FnMut(&IconView, &TreePath)>(
549 icon_view: *mut ffi::GtkIconView,
550 path: *mut ffi::GtkTreePath,
551 data: glib::ffi::gpointer,
552 ) {
553 let icon_view = from_glib_borrow(icon_view);
554 let path = from_glib_borrow(path);
555 let callback = data as *mut P;
556 (*callback)(&icon_view, &path)
557 }
558 let func = Some(func_func::<P> as _);
559 let super_callback0: &mut P = &mut func_data;
560 unsafe {
561 ffi::gtk_icon_view_selected_foreach(
562 self.to_glib_none().0,
563 func,
564 super_callback0 as *mut _ as *mut _,
565 );
566 }
567 }
568
569 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
570 #[allow(deprecated)]
571 #[doc(alias = "gtk_icon_view_set_activate_on_single_click")]
572 #[doc(alias = "activate-on-single-click")]
573 pub fn set_activate_on_single_click(&self, single: bool) {
574 unsafe {
575 ffi::gtk_icon_view_set_activate_on_single_click(
576 self.to_glib_none().0,
577 single.into_glib(),
578 );
579 }
580 }
581
582 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
583 #[allow(deprecated)]
584 #[doc(alias = "gtk_icon_view_set_column_spacing")]
585 #[doc(alias = "column-spacing")]
586 pub fn set_column_spacing(&self, column_spacing: i32) {
587 unsafe {
588 ffi::gtk_icon_view_set_column_spacing(self.to_glib_none().0, column_spacing);
589 }
590 }
591
592 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
593 #[allow(deprecated)]
594 #[doc(alias = "gtk_icon_view_set_columns")]
595 #[doc(alias = "columns")]
596 pub fn set_columns(&self, columns: i32) {
597 unsafe {
598 ffi::gtk_icon_view_set_columns(self.to_glib_none().0, columns);
599 }
600 }
601
602 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
603 #[allow(deprecated)]
604 #[doc(alias = "gtk_icon_view_set_cursor")]
605 pub fn set_cursor(
606 &self,
607 path: &TreePath,
608 cell: Option<&impl IsA<CellRenderer>>,
609 start_editing: bool,
610 ) {
611 unsafe {
612 ffi::gtk_icon_view_set_cursor(
613 self.to_glib_none().0,
614 mut_override(path.to_glib_none().0),
615 cell.map(|p| p.as_ref()).to_glib_none().0,
616 start_editing.into_glib(),
617 );
618 }
619 }
620
621 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
622 #[allow(deprecated)]
623 #[doc(alias = "gtk_icon_view_set_drag_dest_item")]
624 pub fn set_drag_dest_item(&self, path: Option<&TreePath>, pos: IconViewDropPosition) {
625 unsafe {
626 ffi::gtk_icon_view_set_drag_dest_item(
627 self.to_glib_none().0,
628 mut_override(path.to_glib_none().0),
629 pos.into_glib(),
630 );
631 }
632 }
633
634 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
635 #[allow(deprecated)]
636 #[doc(alias = "gtk_icon_view_set_item_orientation")]
637 #[doc(alias = "item-orientation")]
638 pub fn set_item_orientation(&self, orientation: Orientation) {
639 unsafe {
640 ffi::gtk_icon_view_set_item_orientation(self.to_glib_none().0, orientation.into_glib());
641 }
642 }
643
644 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
645 #[allow(deprecated)]
646 #[doc(alias = "gtk_icon_view_set_item_padding")]
647 #[doc(alias = "item-padding")]
648 pub fn set_item_padding(&self, item_padding: i32) {
649 unsafe {
650 ffi::gtk_icon_view_set_item_padding(self.to_glib_none().0, item_padding);
651 }
652 }
653
654 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
655 #[allow(deprecated)]
656 #[doc(alias = "gtk_icon_view_set_item_width")]
657 #[doc(alias = "item-width")]
658 pub fn set_item_width(&self, item_width: i32) {
659 unsafe {
660 ffi::gtk_icon_view_set_item_width(self.to_glib_none().0, item_width);
661 }
662 }
663
664 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
665 #[allow(deprecated)]
666 #[doc(alias = "gtk_icon_view_set_margin")]
667 #[doc(alias = "margin")]
668 pub fn set_margin(&self, margin: i32) {
669 unsafe {
670 ffi::gtk_icon_view_set_margin(self.to_glib_none().0, margin);
671 }
672 }
673
674 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
675 #[allow(deprecated)]
676 #[doc(alias = "gtk_icon_view_set_markup_column")]
677 #[doc(alias = "markup-column")]
678 pub fn set_markup_column(&self, column: i32) {
679 unsafe {
680 ffi::gtk_icon_view_set_markup_column(self.to_glib_none().0, column);
681 }
682 }
683
684 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
685 #[allow(deprecated)]
686 #[doc(alias = "gtk_icon_view_set_model")]
687 #[doc(alias = "model")]
688 pub fn set_model(&self, model: Option<&impl IsA<TreeModel>>) {
689 unsafe {
690 ffi::gtk_icon_view_set_model(
691 self.to_glib_none().0,
692 model.map(|p| p.as_ref()).to_glib_none().0,
693 );
694 }
695 }
696
697 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
698 #[allow(deprecated)]
699 #[doc(alias = "gtk_icon_view_set_pixbuf_column")]
700 #[doc(alias = "pixbuf-column")]
701 pub fn set_pixbuf_column(&self, column: i32) {
702 unsafe {
703 ffi::gtk_icon_view_set_pixbuf_column(self.to_glib_none().0, column);
704 }
705 }
706
707 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
708 #[allow(deprecated)]
709 #[doc(alias = "gtk_icon_view_set_reorderable")]
710 #[doc(alias = "reorderable")]
711 pub fn set_reorderable(&self, reorderable: bool) {
712 unsafe {
713 ffi::gtk_icon_view_set_reorderable(self.to_glib_none().0, reorderable.into_glib());
714 }
715 }
716
717 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
718 #[allow(deprecated)]
719 #[doc(alias = "gtk_icon_view_set_row_spacing")]
720 #[doc(alias = "row-spacing")]
721 pub fn set_row_spacing(&self, row_spacing: i32) {
722 unsafe {
723 ffi::gtk_icon_view_set_row_spacing(self.to_glib_none().0, row_spacing);
724 }
725 }
726
727 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
728 #[allow(deprecated)]
729 #[doc(alias = "gtk_icon_view_set_selection_mode")]
730 #[doc(alias = "selection-mode")]
731 pub fn set_selection_mode(&self, mode: SelectionMode) {
732 unsafe {
733 ffi::gtk_icon_view_set_selection_mode(self.to_glib_none().0, mode.into_glib());
734 }
735 }
736
737 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
738 #[allow(deprecated)]
739 #[doc(alias = "gtk_icon_view_set_spacing")]
740 #[doc(alias = "spacing")]
741 pub fn set_spacing(&self, spacing: i32) {
742 unsafe {
743 ffi::gtk_icon_view_set_spacing(self.to_glib_none().0, spacing);
744 }
745 }
746
747 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
748 #[allow(deprecated)]
749 #[doc(alias = "gtk_icon_view_set_text_column")]
750 #[doc(alias = "text-column")]
751 pub fn set_text_column(&self, column: i32) {
752 unsafe {
753 ffi::gtk_icon_view_set_text_column(self.to_glib_none().0, column);
754 }
755 }
756
757 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
758 #[allow(deprecated)]
759 #[doc(alias = "gtk_icon_view_set_tooltip_cell")]
760 pub fn set_tooltip_cell(
761 &self,
762 tooltip: &Tooltip,
763 path: &TreePath,
764 cell: Option<&impl IsA<CellRenderer>>,
765 ) {
766 unsafe {
767 ffi::gtk_icon_view_set_tooltip_cell(
768 self.to_glib_none().0,
769 tooltip.to_glib_none().0,
770 mut_override(path.to_glib_none().0),
771 cell.map(|p| p.as_ref()).to_glib_none().0,
772 );
773 }
774 }
775
776 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
777 #[allow(deprecated)]
778 #[doc(alias = "gtk_icon_view_set_tooltip_column")]
779 #[doc(alias = "tooltip-column")]
780 pub fn set_tooltip_column(&self, column: i32) {
781 unsafe {
782 ffi::gtk_icon_view_set_tooltip_column(self.to_glib_none().0, column);
783 }
784 }
785
786 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
787 #[allow(deprecated)]
788 #[doc(alias = "gtk_icon_view_set_tooltip_item")]
789 pub fn set_tooltip_item(&self, tooltip: &Tooltip, path: &TreePath) {
790 unsafe {
791 ffi::gtk_icon_view_set_tooltip_item(
792 self.to_glib_none().0,
793 tooltip.to_glib_none().0,
794 mut_override(path.to_glib_none().0),
795 );
796 }
797 }
798
799 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
800 #[allow(deprecated)]
801 #[doc(alias = "gtk_icon_view_unselect_all")]
802 pub fn unselect_all(&self) {
803 unsafe {
804 ffi::gtk_icon_view_unselect_all(self.to_glib_none().0);
805 }
806 }
807
808 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
809 #[allow(deprecated)]
810 #[doc(alias = "gtk_icon_view_unselect_path")]
811 pub fn unselect_path(&self, path: &TreePath) {
812 unsafe {
813 ffi::gtk_icon_view_unselect_path(
814 self.to_glib_none().0,
815 mut_override(path.to_glib_none().0),
816 );
817 }
818 }
819
820 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
821 #[allow(deprecated)]
822 #[doc(alias = "gtk_icon_view_unset_model_drag_dest")]
823 pub fn unset_model_drag_dest(&self) {
824 unsafe {
825 ffi::gtk_icon_view_unset_model_drag_dest(self.to_glib_none().0);
826 }
827 }
828
829 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
830 #[allow(deprecated)]
831 #[doc(alias = "gtk_icon_view_unset_model_drag_source")]
832 pub fn unset_model_drag_source(&self) {
833 unsafe {
834 ffi::gtk_icon_view_unset_model_drag_source(self.to_glib_none().0);
835 }
836 }
837
838 #[doc(alias = "cell-area")]
839 pub fn cell_area(&self) -> Option<CellArea> {
840 ObjectExt::property(self, "cell-area")
841 }
842
843 #[doc(alias = "activate-cursor-item")]
844 pub fn connect_activate_cursor_item<F: Fn(&Self) -> bool + 'static>(
845 &self,
846 f: F,
847 ) -> SignalHandlerId {
848 unsafe extern "C" fn activate_cursor_item_trampoline<F: Fn(&IconView) -> bool + 'static>(
849 this: *mut ffi::GtkIconView,
850 f: glib::ffi::gpointer,
851 ) -> glib::ffi::gboolean {
852 let f: &F = &*(f as *const F);
853 f(&from_glib_borrow(this)).into_glib()
854 }
855 unsafe {
856 let f: Box_<F> = Box_::new(f);
857 connect_raw(
858 self.as_ptr() as *mut _,
859 c"activate-cursor-item".as_ptr() as *const _,
860 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
861 activate_cursor_item_trampoline::<F> as *const (),
862 )),
863 Box_::into_raw(f),
864 )
865 }
866 }
867
868 pub fn emit_activate_cursor_item(&self) -> bool {
869 self.emit_by_name("activate-cursor-item", &[])
870 }
871
872 #[doc(alias = "item-activated")]
873 pub fn connect_item_activated<F: Fn(&Self, &TreePath) + 'static>(
874 &self,
875 f: F,
876 ) -> SignalHandlerId {
877 unsafe extern "C" fn item_activated_trampoline<F: Fn(&IconView, &TreePath) + 'static>(
878 this: *mut ffi::GtkIconView,
879 path: *mut ffi::GtkTreePath,
880 f: glib::ffi::gpointer,
881 ) {
882 let f: &F = &*(f as *const F);
883 f(&from_glib_borrow(this), &from_glib_borrow(path))
884 }
885 unsafe {
886 let f: Box_<F> = Box_::new(f);
887 connect_raw(
888 self.as_ptr() as *mut _,
889 c"item-activated".as_ptr() as *const _,
890 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
891 item_activated_trampoline::<F> as *const (),
892 )),
893 Box_::into_raw(f),
894 )
895 }
896 }
897
898 #[doc(alias = "move-cursor")]
899 pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool, bool) -> bool + 'static>(
900 &self,
901 f: F,
902 ) -> SignalHandlerId {
903 unsafe extern "C" fn move_cursor_trampoline<
904 F: Fn(&IconView, MovementStep, i32, bool, bool) -> bool + 'static,
905 >(
906 this: *mut ffi::GtkIconView,
907 step: ffi::GtkMovementStep,
908 count: std::ffi::c_int,
909 extend: glib::ffi::gboolean,
910 modify: glib::ffi::gboolean,
911 f: glib::ffi::gpointer,
912 ) -> glib::ffi::gboolean {
913 let f: &F = &*(f as *const F);
914 f(
915 &from_glib_borrow(this),
916 from_glib(step),
917 count,
918 from_glib(extend),
919 from_glib(modify),
920 )
921 .into_glib()
922 }
923 unsafe {
924 let f: Box_<F> = Box_::new(f);
925 connect_raw(
926 self.as_ptr() as *mut _,
927 c"move-cursor".as_ptr() as *const _,
928 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
929 move_cursor_trampoline::<F> as *const (),
930 )),
931 Box_::into_raw(f),
932 )
933 }
934 }
935
936 pub fn emit_move_cursor(
937 &self,
938 step: MovementStep,
939 count: i32,
940 extend: bool,
941 modify: bool,
942 ) -> bool {
943 self.emit_by_name("move-cursor", &[&step, &count, &extend, &modify])
944 }
945
946 #[doc(alias = "select-all")]
947 pub fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
948 unsafe extern "C" fn select_all_trampoline<F: Fn(&IconView) + 'static>(
949 this: *mut ffi::GtkIconView,
950 f: glib::ffi::gpointer,
951 ) {
952 let f: &F = &*(f as *const F);
953 f(&from_glib_borrow(this))
954 }
955 unsafe {
956 let f: Box_<F> = Box_::new(f);
957 connect_raw(
958 self.as_ptr() as *mut _,
959 c"select-all".as_ptr() as *const _,
960 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
961 select_all_trampoline::<F> as *const (),
962 )),
963 Box_::into_raw(f),
964 )
965 }
966 }
967
968 pub fn emit_select_all(&self) {
969 self.emit_by_name::<()>("select-all", &[]);
970 }
971
972 #[doc(alias = "select-cursor-item")]
973 pub fn connect_select_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
974 unsafe extern "C" fn select_cursor_item_trampoline<F: Fn(&IconView) + 'static>(
975 this: *mut ffi::GtkIconView,
976 f: glib::ffi::gpointer,
977 ) {
978 let f: &F = &*(f as *const F);
979 f(&from_glib_borrow(this))
980 }
981 unsafe {
982 let f: Box_<F> = Box_::new(f);
983 connect_raw(
984 self.as_ptr() as *mut _,
985 c"select-cursor-item".as_ptr() as *const _,
986 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
987 select_cursor_item_trampoline::<F> as *const (),
988 )),
989 Box_::into_raw(f),
990 )
991 }
992 }
993
994 pub fn emit_select_cursor_item(&self) {
995 self.emit_by_name::<()>("select-cursor-item", &[]);
996 }
997
998 #[doc(alias = "selection-changed")]
999 pub fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1000 unsafe extern "C" fn selection_changed_trampoline<F: Fn(&IconView) + 'static>(
1001 this: *mut ffi::GtkIconView,
1002 f: glib::ffi::gpointer,
1003 ) {
1004 let f: &F = &*(f as *const F);
1005 f(&from_glib_borrow(this))
1006 }
1007 unsafe {
1008 let f: Box_<F> = Box_::new(f);
1009 connect_raw(
1010 self.as_ptr() as *mut _,
1011 c"selection-changed".as_ptr() as *const _,
1012 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1013 selection_changed_trampoline::<F> as *const (),
1014 )),
1015 Box_::into_raw(f),
1016 )
1017 }
1018 }
1019
1020 #[doc(alias = "toggle-cursor-item")]
1021 pub fn connect_toggle_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1022 unsafe extern "C" fn toggle_cursor_item_trampoline<F: Fn(&IconView) + 'static>(
1023 this: *mut ffi::GtkIconView,
1024 f: glib::ffi::gpointer,
1025 ) {
1026 let f: &F = &*(f as *const F);
1027 f(&from_glib_borrow(this))
1028 }
1029 unsafe {
1030 let f: Box_<F> = Box_::new(f);
1031 connect_raw(
1032 self.as_ptr() as *mut _,
1033 c"toggle-cursor-item".as_ptr() as *const _,
1034 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1035 toggle_cursor_item_trampoline::<F> as *const (),
1036 )),
1037 Box_::into_raw(f),
1038 )
1039 }
1040 }
1041
1042 pub fn emit_toggle_cursor_item(&self) {
1043 self.emit_by_name::<()>("toggle-cursor-item", &[]);
1044 }
1045
1046 #[doc(alias = "unselect-all")]
1047 pub fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1048 unsafe extern "C" fn unselect_all_trampoline<F: Fn(&IconView) + 'static>(
1049 this: *mut ffi::GtkIconView,
1050 f: glib::ffi::gpointer,
1051 ) {
1052 let f: &F = &*(f as *const F);
1053 f(&from_glib_borrow(this))
1054 }
1055 unsafe {
1056 let f: Box_<F> = Box_::new(f);
1057 connect_raw(
1058 self.as_ptr() as *mut _,
1059 c"unselect-all".as_ptr() as *const _,
1060 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1061 unselect_all_trampoline::<F> as *const (),
1062 )),
1063 Box_::into_raw(f),
1064 )
1065 }
1066 }
1067
1068 pub fn emit_unselect_all(&self) {
1069 self.emit_by_name::<()>("unselect-all", &[]);
1070 }
1071
1072 #[doc(alias = "activate-on-single-click")]
1073 pub fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
1074 &self,
1075 f: F,
1076 ) -> SignalHandlerId {
1077 unsafe extern "C" fn notify_activate_on_single_click_trampoline<
1078 F: Fn(&IconView) + 'static,
1079 >(
1080 this: *mut ffi::GtkIconView,
1081 _param_spec: glib::ffi::gpointer,
1082 f: glib::ffi::gpointer,
1083 ) {
1084 let f: &F = &*(f as *const F);
1085 f(&from_glib_borrow(this))
1086 }
1087 unsafe {
1088 let f: Box_<F> = Box_::new(f);
1089 connect_raw(
1090 self.as_ptr() as *mut _,
1091 c"notify::activate-on-single-click".as_ptr() as *const _,
1092 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1093 notify_activate_on_single_click_trampoline::<F> as *const (),
1094 )),
1095 Box_::into_raw(f),
1096 )
1097 }
1098 }
1099
1100 #[doc(alias = "column-spacing")]
1101 pub fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1102 unsafe extern "C" fn notify_column_spacing_trampoline<F: Fn(&IconView) + 'static>(
1103 this: *mut ffi::GtkIconView,
1104 _param_spec: glib::ffi::gpointer,
1105 f: glib::ffi::gpointer,
1106 ) {
1107 let f: &F = &*(f as *const F);
1108 f(&from_glib_borrow(this))
1109 }
1110 unsafe {
1111 let f: Box_<F> = Box_::new(f);
1112 connect_raw(
1113 self.as_ptr() as *mut _,
1114 c"notify::column-spacing".as_ptr() as *const _,
1115 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1116 notify_column_spacing_trampoline::<F> as *const (),
1117 )),
1118 Box_::into_raw(f),
1119 )
1120 }
1121 }
1122
1123 #[doc(alias = "columns")]
1124 pub fn connect_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1125 unsafe extern "C" fn notify_columns_trampoline<F: Fn(&IconView) + 'static>(
1126 this: *mut ffi::GtkIconView,
1127 _param_spec: glib::ffi::gpointer,
1128 f: glib::ffi::gpointer,
1129 ) {
1130 let f: &F = &*(f as *const F);
1131 f(&from_glib_borrow(this))
1132 }
1133 unsafe {
1134 let f: Box_<F> = Box_::new(f);
1135 connect_raw(
1136 self.as_ptr() as *mut _,
1137 c"notify::columns".as_ptr() as *const _,
1138 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1139 notify_columns_trampoline::<F> as *const (),
1140 )),
1141 Box_::into_raw(f),
1142 )
1143 }
1144 }
1145
1146 #[doc(alias = "item-orientation")]
1147 pub fn connect_item_orientation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1148 unsafe extern "C" fn notify_item_orientation_trampoline<F: Fn(&IconView) + 'static>(
1149 this: *mut ffi::GtkIconView,
1150 _param_spec: glib::ffi::gpointer,
1151 f: glib::ffi::gpointer,
1152 ) {
1153 let f: &F = &*(f as *const F);
1154 f(&from_glib_borrow(this))
1155 }
1156 unsafe {
1157 let f: Box_<F> = Box_::new(f);
1158 connect_raw(
1159 self.as_ptr() as *mut _,
1160 c"notify::item-orientation".as_ptr() as *const _,
1161 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1162 notify_item_orientation_trampoline::<F> as *const (),
1163 )),
1164 Box_::into_raw(f),
1165 )
1166 }
1167 }
1168
1169 #[doc(alias = "item-padding")]
1170 pub fn connect_item_padding_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1171 unsafe extern "C" fn notify_item_padding_trampoline<F: Fn(&IconView) + 'static>(
1172 this: *mut ffi::GtkIconView,
1173 _param_spec: glib::ffi::gpointer,
1174 f: glib::ffi::gpointer,
1175 ) {
1176 let f: &F = &*(f as *const F);
1177 f(&from_glib_borrow(this))
1178 }
1179 unsafe {
1180 let f: Box_<F> = Box_::new(f);
1181 connect_raw(
1182 self.as_ptr() as *mut _,
1183 c"notify::item-padding".as_ptr() as *const _,
1184 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1185 notify_item_padding_trampoline::<F> as *const (),
1186 )),
1187 Box_::into_raw(f),
1188 )
1189 }
1190 }
1191
1192 #[doc(alias = "item-width")]
1193 pub fn connect_item_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1194 unsafe extern "C" fn notify_item_width_trampoline<F: Fn(&IconView) + 'static>(
1195 this: *mut ffi::GtkIconView,
1196 _param_spec: glib::ffi::gpointer,
1197 f: glib::ffi::gpointer,
1198 ) {
1199 let f: &F = &*(f as *const F);
1200 f(&from_glib_borrow(this))
1201 }
1202 unsafe {
1203 let f: Box_<F> = Box_::new(f);
1204 connect_raw(
1205 self.as_ptr() as *mut _,
1206 c"notify::item-width".as_ptr() as *const _,
1207 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1208 notify_item_width_trampoline::<F> as *const (),
1209 )),
1210 Box_::into_raw(f),
1211 )
1212 }
1213 }
1214
1215 #[doc(alias = "margin")]
1216 pub fn connect_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1217 unsafe extern "C" fn notify_margin_trampoline<F: Fn(&IconView) + 'static>(
1218 this: *mut ffi::GtkIconView,
1219 _param_spec: glib::ffi::gpointer,
1220 f: glib::ffi::gpointer,
1221 ) {
1222 let f: &F = &*(f as *const F);
1223 f(&from_glib_borrow(this))
1224 }
1225 unsafe {
1226 let f: Box_<F> = Box_::new(f);
1227 connect_raw(
1228 self.as_ptr() as *mut _,
1229 c"notify::margin".as_ptr() as *const _,
1230 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1231 notify_margin_trampoline::<F> as *const (),
1232 )),
1233 Box_::into_raw(f),
1234 )
1235 }
1236 }
1237
1238 #[doc(alias = "markup-column")]
1239 pub fn connect_markup_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1240 unsafe extern "C" fn notify_markup_column_trampoline<F: Fn(&IconView) + 'static>(
1241 this: *mut ffi::GtkIconView,
1242 _param_spec: glib::ffi::gpointer,
1243 f: glib::ffi::gpointer,
1244 ) {
1245 let f: &F = &*(f as *const F);
1246 f(&from_glib_borrow(this))
1247 }
1248 unsafe {
1249 let f: Box_<F> = Box_::new(f);
1250 connect_raw(
1251 self.as_ptr() as *mut _,
1252 c"notify::markup-column".as_ptr() as *const _,
1253 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1254 notify_markup_column_trampoline::<F> as *const (),
1255 )),
1256 Box_::into_raw(f),
1257 )
1258 }
1259 }
1260
1261 #[doc(alias = "model")]
1262 pub fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1263 unsafe extern "C" fn notify_model_trampoline<F: Fn(&IconView) + 'static>(
1264 this: *mut ffi::GtkIconView,
1265 _param_spec: glib::ffi::gpointer,
1266 f: glib::ffi::gpointer,
1267 ) {
1268 let f: &F = &*(f as *const F);
1269 f(&from_glib_borrow(this))
1270 }
1271 unsafe {
1272 let f: Box_<F> = Box_::new(f);
1273 connect_raw(
1274 self.as_ptr() as *mut _,
1275 c"notify::model".as_ptr() as *const _,
1276 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1277 notify_model_trampoline::<F> as *const (),
1278 )),
1279 Box_::into_raw(f),
1280 )
1281 }
1282 }
1283
1284 #[doc(alias = "pixbuf-column")]
1285 pub fn connect_pixbuf_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1286 unsafe extern "C" fn notify_pixbuf_column_trampoline<F: Fn(&IconView) + 'static>(
1287 this: *mut ffi::GtkIconView,
1288 _param_spec: glib::ffi::gpointer,
1289 f: glib::ffi::gpointer,
1290 ) {
1291 let f: &F = &*(f as *const F);
1292 f(&from_glib_borrow(this))
1293 }
1294 unsafe {
1295 let f: Box_<F> = Box_::new(f);
1296 connect_raw(
1297 self.as_ptr() as *mut _,
1298 c"notify::pixbuf-column".as_ptr() as *const _,
1299 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1300 notify_pixbuf_column_trampoline::<F> as *const (),
1301 )),
1302 Box_::into_raw(f),
1303 )
1304 }
1305 }
1306
1307 #[doc(alias = "reorderable")]
1308 pub fn connect_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1309 unsafe extern "C" fn notify_reorderable_trampoline<F: Fn(&IconView) + 'static>(
1310 this: *mut ffi::GtkIconView,
1311 _param_spec: glib::ffi::gpointer,
1312 f: glib::ffi::gpointer,
1313 ) {
1314 let f: &F = &*(f as *const F);
1315 f(&from_glib_borrow(this))
1316 }
1317 unsafe {
1318 let f: Box_<F> = Box_::new(f);
1319 connect_raw(
1320 self.as_ptr() as *mut _,
1321 c"notify::reorderable".as_ptr() as *const _,
1322 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1323 notify_reorderable_trampoline::<F> as *const (),
1324 )),
1325 Box_::into_raw(f),
1326 )
1327 }
1328 }
1329
1330 #[doc(alias = "row-spacing")]
1331 pub fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1332 unsafe extern "C" fn notify_row_spacing_trampoline<F: Fn(&IconView) + 'static>(
1333 this: *mut ffi::GtkIconView,
1334 _param_spec: glib::ffi::gpointer,
1335 f: glib::ffi::gpointer,
1336 ) {
1337 let f: &F = &*(f as *const F);
1338 f(&from_glib_borrow(this))
1339 }
1340 unsafe {
1341 let f: Box_<F> = Box_::new(f);
1342 connect_raw(
1343 self.as_ptr() as *mut _,
1344 c"notify::row-spacing".as_ptr() as *const _,
1345 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1346 notify_row_spacing_trampoline::<F> as *const (),
1347 )),
1348 Box_::into_raw(f),
1349 )
1350 }
1351 }
1352
1353 #[doc(alias = "selection-mode")]
1354 pub fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1355 unsafe extern "C" fn notify_selection_mode_trampoline<F: Fn(&IconView) + 'static>(
1356 this: *mut ffi::GtkIconView,
1357 _param_spec: glib::ffi::gpointer,
1358 f: glib::ffi::gpointer,
1359 ) {
1360 let f: &F = &*(f as *const F);
1361 f(&from_glib_borrow(this))
1362 }
1363 unsafe {
1364 let f: Box_<F> = Box_::new(f);
1365 connect_raw(
1366 self.as_ptr() as *mut _,
1367 c"notify::selection-mode".as_ptr() as *const _,
1368 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1369 notify_selection_mode_trampoline::<F> as *const (),
1370 )),
1371 Box_::into_raw(f),
1372 )
1373 }
1374 }
1375
1376 #[doc(alias = "spacing")]
1377 pub fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1378 unsafe extern "C" fn notify_spacing_trampoline<F: Fn(&IconView) + 'static>(
1379 this: *mut ffi::GtkIconView,
1380 _param_spec: glib::ffi::gpointer,
1381 f: glib::ffi::gpointer,
1382 ) {
1383 let f: &F = &*(f as *const F);
1384 f(&from_glib_borrow(this))
1385 }
1386 unsafe {
1387 let f: Box_<F> = Box_::new(f);
1388 connect_raw(
1389 self.as_ptr() as *mut _,
1390 c"notify::spacing".as_ptr() as *const _,
1391 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1392 notify_spacing_trampoline::<F> as *const (),
1393 )),
1394 Box_::into_raw(f),
1395 )
1396 }
1397 }
1398
1399 #[doc(alias = "text-column")]
1400 pub fn connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1401 unsafe extern "C" fn notify_text_column_trampoline<F: Fn(&IconView) + 'static>(
1402 this: *mut ffi::GtkIconView,
1403 _param_spec: glib::ffi::gpointer,
1404 f: glib::ffi::gpointer,
1405 ) {
1406 let f: &F = &*(f as *const F);
1407 f(&from_glib_borrow(this))
1408 }
1409 unsafe {
1410 let f: Box_<F> = Box_::new(f);
1411 connect_raw(
1412 self.as_ptr() as *mut _,
1413 c"notify::text-column".as_ptr() as *const _,
1414 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1415 notify_text_column_trampoline::<F> as *const (),
1416 )),
1417 Box_::into_raw(f),
1418 )
1419 }
1420 }
1421
1422 #[doc(alias = "tooltip-column")]
1423 pub fn connect_tooltip_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1424 unsafe extern "C" fn notify_tooltip_column_trampoline<F: Fn(&IconView) + 'static>(
1425 this: *mut ffi::GtkIconView,
1426 _param_spec: glib::ffi::gpointer,
1427 f: glib::ffi::gpointer,
1428 ) {
1429 let f: &F = &*(f as *const F);
1430 f(&from_glib_borrow(this))
1431 }
1432 unsafe {
1433 let f: Box_<F> = Box_::new(f);
1434 connect_raw(
1435 self.as_ptr() as *mut _,
1436 c"notify::tooltip-column".as_ptr() as *const _,
1437 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1438 notify_tooltip_column_trampoline::<F> as *const (),
1439 )),
1440 Box_::into_raw(f),
1441 )
1442 }
1443 }
1444}
1445
1446impl Default for IconView {
1447 fn default() -> Self {
1448 Self::new()
1449 }
1450}
1451
1452#[must_use = "The builder must be built to be used"]
1457pub struct IconViewBuilder {
1458 builder: glib::object::ObjectBuilder<'static, IconView>,
1459}
1460
1461impl IconViewBuilder {
1462 fn new() -> Self {
1463 Self {
1464 builder: glib::object::Object::builder(),
1465 }
1466 }
1467
1468 pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
1469 Self {
1470 builder: self
1471 .builder
1472 .property("activate-on-single-click", activate_on_single_click),
1473 }
1474 }
1475
1476 pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
1477 Self {
1478 builder: self
1479 .builder
1480 .property("cell-area", cell_area.clone().upcast()),
1481 }
1482 }
1483
1484 pub fn column_spacing(self, column_spacing: i32) -> Self {
1485 Self {
1486 builder: self.builder.property("column-spacing", column_spacing),
1487 }
1488 }
1489
1490 pub fn columns(self, columns: i32) -> Self {
1491 Self {
1492 builder: self.builder.property("columns", columns),
1493 }
1494 }
1495
1496 pub fn item_orientation(self, item_orientation: Orientation) -> Self {
1497 Self {
1498 builder: self.builder.property("item-orientation", item_orientation),
1499 }
1500 }
1501
1502 pub fn item_padding(self, item_padding: i32) -> Self {
1503 Self {
1504 builder: self.builder.property("item-padding", item_padding),
1505 }
1506 }
1507
1508 pub fn item_width(self, item_width: i32) -> Self {
1509 Self {
1510 builder: self.builder.property("item-width", item_width),
1511 }
1512 }
1513
1514 pub fn margin(self, margin: i32) -> Self {
1515 Self {
1516 builder: self.builder.property("margin", margin),
1517 }
1518 }
1519
1520 pub fn markup_column(self, markup_column: i32) -> Self {
1521 Self {
1522 builder: self.builder.property("markup-column", markup_column),
1523 }
1524 }
1525
1526 pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
1527 Self {
1528 builder: self.builder.property("model", model.clone().upcast()),
1529 }
1530 }
1531
1532 pub fn pixbuf_column(self, pixbuf_column: i32) -> Self {
1533 Self {
1534 builder: self.builder.property("pixbuf-column", pixbuf_column),
1535 }
1536 }
1537
1538 pub fn reorderable(self, reorderable: bool) -> Self {
1539 Self {
1540 builder: self.builder.property("reorderable", reorderable),
1541 }
1542 }
1543
1544 pub fn row_spacing(self, row_spacing: i32) -> Self {
1545 Self {
1546 builder: self.builder.property("row-spacing", row_spacing),
1547 }
1548 }
1549
1550 pub fn selection_mode(self, selection_mode: SelectionMode) -> Self {
1551 Self {
1552 builder: self.builder.property("selection-mode", selection_mode),
1553 }
1554 }
1555
1556 pub fn spacing(self, spacing: i32) -> Self {
1557 Self {
1558 builder: self.builder.property("spacing", spacing),
1559 }
1560 }
1561
1562 pub fn text_column(self, text_column: i32) -> Self {
1563 Self {
1564 builder: self.builder.property("text-column", text_column),
1565 }
1566 }
1567
1568 pub fn tooltip_column(self, tooltip_column: i32) -> Self {
1569 Self {
1570 builder: self.builder.property("tooltip-column", tooltip_column),
1571 }
1572 }
1573
1574 pub fn can_focus(self, can_focus: bool) -> Self {
1575 Self {
1576 builder: self.builder.property("can-focus", can_focus),
1577 }
1578 }
1579
1580 pub fn can_target(self, can_target: bool) -> Self {
1581 Self {
1582 builder: self.builder.property("can-target", can_target),
1583 }
1584 }
1585
1586 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1587 Self {
1588 builder: self.builder.property("css-classes", css_classes.into()),
1589 }
1590 }
1591
1592 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1593 Self {
1594 builder: self.builder.property("css-name", css_name.into()),
1595 }
1596 }
1597
1598 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1599 Self {
1600 builder: self.builder.property("cursor", cursor.clone()),
1601 }
1602 }
1603
1604 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1605 Self {
1606 builder: self.builder.property("focus-on-click", focus_on_click),
1607 }
1608 }
1609
1610 pub fn focusable(self, focusable: bool) -> Self {
1611 Self {
1612 builder: self.builder.property("focusable", focusable),
1613 }
1614 }
1615
1616 pub fn halign(self, halign: Align) -> Self {
1617 Self {
1618 builder: self.builder.property("halign", halign),
1619 }
1620 }
1621
1622 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1623 Self {
1624 builder: self.builder.property("has-tooltip", has_tooltip),
1625 }
1626 }
1627
1628 pub fn height_request(self, height_request: i32) -> Self {
1629 Self {
1630 builder: self.builder.property("height-request", height_request),
1631 }
1632 }
1633
1634 pub fn hexpand(self, hexpand: bool) -> Self {
1635 Self {
1636 builder: self.builder.property("hexpand", hexpand),
1637 }
1638 }
1639
1640 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1641 Self {
1642 builder: self.builder.property("hexpand-set", hexpand_set),
1643 }
1644 }
1645
1646 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1647 Self {
1648 builder: self
1649 .builder
1650 .property("layout-manager", layout_manager.clone().upcast()),
1651 }
1652 }
1653
1654 #[cfg(feature = "v4_18")]
1655 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1656 pub fn limit_events(self, limit_events: bool) -> Self {
1657 Self {
1658 builder: self.builder.property("limit-events", limit_events),
1659 }
1660 }
1661
1662 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1663 Self {
1664 builder: self.builder.property("margin-bottom", margin_bottom),
1665 }
1666 }
1667
1668 pub fn margin_end(self, margin_end: i32) -> Self {
1669 Self {
1670 builder: self.builder.property("margin-end", margin_end),
1671 }
1672 }
1673
1674 pub fn margin_start(self, margin_start: i32) -> Self {
1675 Self {
1676 builder: self.builder.property("margin-start", margin_start),
1677 }
1678 }
1679
1680 pub fn margin_top(self, margin_top: i32) -> Self {
1681 Self {
1682 builder: self.builder.property("margin-top", margin_top),
1683 }
1684 }
1685
1686 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1687 Self {
1688 builder: self.builder.property("name", name.into()),
1689 }
1690 }
1691
1692 pub fn opacity(self, opacity: f64) -> Self {
1693 Self {
1694 builder: self.builder.property("opacity", opacity),
1695 }
1696 }
1697
1698 pub fn overflow(self, overflow: Overflow) -> Self {
1699 Self {
1700 builder: self.builder.property("overflow", overflow),
1701 }
1702 }
1703
1704 pub fn receives_default(self, receives_default: bool) -> Self {
1705 Self {
1706 builder: self.builder.property("receives-default", receives_default),
1707 }
1708 }
1709
1710 pub fn sensitive(self, sensitive: bool) -> Self {
1711 Self {
1712 builder: self.builder.property("sensitive", sensitive),
1713 }
1714 }
1715
1716 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1717 Self {
1718 builder: self
1719 .builder
1720 .property("tooltip-markup", tooltip_markup.into()),
1721 }
1722 }
1723
1724 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1725 Self {
1726 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1727 }
1728 }
1729
1730 pub fn valign(self, valign: Align) -> Self {
1731 Self {
1732 builder: self.builder.property("valign", valign),
1733 }
1734 }
1735
1736 pub fn vexpand(self, vexpand: bool) -> Self {
1737 Self {
1738 builder: self.builder.property("vexpand", vexpand),
1739 }
1740 }
1741
1742 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1743 Self {
1744 builder: self.builder.property("vexpand-set", vexpand_set),
1745 }
1746 }
1747
1748 pub fn visible(self, visible: bool) -> Self {
1749 Self {
1750 builder: self.builder.property("visible", visible),
1751 }
1752 }
1753
1754 pub fn width_request(self, width_request: i32) -> Self {
1755 Self {
1756 builder: self.builder.property("width-request", width_request),
1757 }
1758 }
1759
1760 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1761 Self {
1762 builder: self.builder.property("accessible-role", accessible_role),
1763 }
1764 }
1765
1766 pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1767 Self {
1768 builder: self
1769 .builder
1770 .property("hadjustment", hadjustment.clone().upcast()),
1771 }
1772 }
1773
1774 pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
1775 Self {
1776 builder: self.builder.property("hscroll-policy", hscroll_policy),
1777 }
1778 }
1779
1780 pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
1781 Self {
1782 builder: self
1783 .builder
1784 .property("vadjustment", vadjustment.clone().upcast()),
1785 }
1786 }
1787
1788 pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
1789 Self {
1790 builder: self.builder.property("vscroll-policy", vscroll_policy),
1791 }
1792 }
1793
1794 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1797 pub fn build(self) -> IconView {
1798 assert_initialized_main_thread!();
1799 self.builder.build()
1800 }
1801}