1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use cairo; 6 use gdk; 7 use glib; 8 use glib::object::Cast; 9 use glib::object::IsA; 10 use glib::object::ObjectExt; 11 use glib::signal::connect_raw; 12 use glib::signal::SignalHandlerId; 13 use glib::translate::*; 14 use glib::StaticType; 15 use glib::Value; 16 use glib_sys; 17 use gobject_sys; 18 use gtk_sys; 19 use libc; 20 use std::boxed::Box as Box_; 21 use std::fmt; 22 use std::mem; 23 use std::mem::transmute; 24 use std::ptr; 25 use Buildable; 26 use CellArea; 27 use CellLayout; 28 use CellRenderer; 29 use Container; 30 use IconViewDropPosition; 31 use MovementStep; 32 use Orientation; 33 use Scrollable; 34 use SelectionMode; 35 use Tooltip; 36 use TreeIter; 37 use TreeModel; 38 use TreePath; 39 use Widget; 40 41 glib_wrapper! { 42 pub struct IconView(Object<gtk_sys::GtkIconView, gtk_sys::GtkIconViewClass, IconViewClass>) @extends Container, Widget, @implements Buildable, CellLayout, Scrollable; 43 44 match fn { 45 get_type => || gtk_sys::gtk_icon_view_get_type(), 46 } 47 } 48 49 impl IconView { new() -> IconView50 pub fn new() -> IconView { 51 assert_initialized_main_thread!(); 52 unsafe { Widget::from_glib_none(gtk_sys::gtk_icon_view_new()).unsafe_cast() } 53 } 54 new_with_area<P: IsA<CellArea>>(area: &P) -> IconView55 pub fn new_with_area<P: IsA<CellArea>>(area: &P) -> IconView { 56 skip_assert_initialized!(); 57 unsafe { 58 Widget::from_glib_none(gtk_sys::gtk_icon_view_new_with_area( 59 area.as_ref().to_glib_none().0, 60 )) 61 .unsafe_cast() 62 } 63 } 64 new_with_model<P: IsA<TreeModel>>(model: &P) -> IconView65 pub fn new_with_model<P: IsA<TreeModel>>(model: &P) -> IconView { 66 skip_assert_initialized!(); 67 unsafe { 68 Widget::from_glib_none(gtk_sys::gtk_icon_view_new_with_model( 69 model.as_ref().to_glib_none().0, 70 )) 71 .unsafe_cast() 72 } 73 } 74 } 75 76 impl Default for IconView { default() -> Self77 fn default() -> Self { 78 Self::new() 79 } 80 } 81 82 pub const NONE_ICON_VIEW: Option<&IconView> = None; 83 84 pub trait IconViewExt: 'static { convert_widget_to_bin_window_coords(&self, wx: i32, wy: i32) -> (i32, i32)85 fn convert_widget_to_bin_window_coords(&self, wx: i32, wy: i32) -> (i32, i32); 86 create_drag_icon(&self, path: &TreePath) -> Option<cairo::Surface>87 fn create_drag_icon(&self, path: &TreePath) -> Option<cairo::Surface>; 88 get_activate_on_single_click(&self) -> bool89 fn get_activate_on_single_click(&self) -> bool; 90 get_cell_rect<P: IsA<CellRenderer>>( &self, path: &TreePath, cell: Option<&P>, ) -> Option<gdk::Rectangle>91 fn get_cell_rect<P: IsA<CellRenderer>>( 92 &self, 93 path: &TreePath, 94 cell: Option<&P>, 95 ) -> Option<gdk::Rectangle>; 96 get_column_spacing(&self) -> i3297 fn get_column_spacing(&self) -> i32; 98 get_columns(&self) -> i3299 fn get_columns(&self) -> i32; 100 get_cursor(&self) -> Option<(TreePath, CellRenderer)>101 fn get_cursor(&self) -> Option<(TreePath, CellRenderer)>; 102 get_dest_item_at_pos( &self, drag_x: i32, drag_y: i32, ) -> Option<(TreePath, IconViewDropPosition)>103 fn get_dest_item_at_pos( 104 &self, 105 drag_x: i32, 106 drag_y: i32, 107 ) -> Option<(TreePath, IconViewDropPosition)>; 108 get_drag_dest_item(&self) -> (TreePath, IconViewDropPosition)109 fn get_drag_dest_item(&self) -> (TreePath, IconViewDropPosition); 110 get_item_at_pos(&self, x: i32, y: i32) -> Option<(TreePath, CellRenderer)>111 fn get_item_at_pos(&self, x: i32, y: i32) -> Option<(TreePath, CellRenderer)>; 112 get_item_column(&self, path: &TreePath) -> i32113 fn get_item_column(&self, path: &TreePath) -> i32; 114 get_item_orientation(&self) -> Orientation115 fn get_item_orientation(&self) -> Orientation; 116 get_item_padding(&self) -> i32117 fn get_item_padding(&self) -> i32; 118 get_item_row(&self, path: &TreePath) -> i32119 fn get_item_row(&self, path: &TreePath) -> i32; 120 get_item_width(&self) -> i32121 fn get_item_width(&self) -> i32; 122 get_margin(&self) -> i32123 fn get_margin(&self) -> i32; 124 get_markup_column(&self) -> i32125 fn get_markup_column(&self) -> i32; 126 get_model(&self) -> Option<TreeModel>127 fn get_model(&self) -> Option<TreeModel>; 128 get_path_at_pos(&self, x: i32, y: i32) -> Option<TreePath>129 fn get_path_at_pos(&self, x: i32, y: i32) -> Option<TreePath>; 130 get_pixbuf_column(&self) -> i32131 fn get_pixbuf_column(&self) -> i32; 132 get_reorderable(&self) -> bool133 fn get_reorderable(&self) -> bool; 134 get_row_spacing(&self) -> i32135 fn get_row_spacing(&self) -> i32; 136 get_selected_items(&self) -> Vec<TreePath>137 fn get_selected_items(&self) -> Vec<TreePath>; 138 get_selection_mode(&self) -> SelectionMode139 fn get_selection_mode(&self) -> SelectionMode; 140 get_spacing(&self) -> i32141 fn get_spacing(&self) -> i32; 142 get_text_column(&self) -> i32143 fn get_text_column(&self) -> i32; 144 get_tooltip_column(&self) -> i32145 fn get_tooltip_column(&self) -> i32; 146 get_tooltip_context( &self, x: &mut i32, y: &mut i32, keyboard_tip: bool, ) -> Option<(TreeModel, TreePath, TreeIter)>147 fn get_tooltip_context( 148 &self, 149 x: &mut i32, 150 y: &mut i32, 151 keyboard_tip: bool, 152 ) -> Option<(TreeModel, TreePath, TreeIter)>; 153 get_visible_range(&self) -> Option<(TreePath, TreePath)>154 fn get_visible_range(&self) -> Option<(TreePath, TreePath)>; 155 item_activated(&self, path: &TreePath)156 fn item_activated(&self, path: &TreePath); 157 path_is_selected(&self, path: &TreePath) -> bool158 fn path_is_selected(&self, path: &TreePath) -> bool; 159 scroll_to_path(&self, path: &TreePath, use_align: bool, row_align: f32, col_align: f32)160 fn scroll_to_path(&self, path: &TreePath, use_align: bool, row_align: f32, col_align: f32); 161 select_all(&self)162 fn select_all(&self); 163 select_path(&self, path: &TreePath)164 fn select_path(&self, path: &TreePath); 165 selected_foreach<P: FnMut(&IconView, &TreePath)>(&self, func: P)166 fn selected_foreach<P: FnMut(&IconView, &TreePath)>(&self, func: P); 167 set_activate_on_single_click(&self, single: bool)168 fn set_activate_on_single_click(&self, single: bool); 169 set_column_spacing(&self, column_spacing: i32)170 fn set_column_spacing(&self, column_spacing: i32); 171 set_columns(&self, columns: i32)172 fn set_columns(&self, columns: i32); 173 set_cursor<P: IsA<CellRenderer>>( &self, path: &TreePath, cell: Option<&P>, start_editing: bool, )174 fn set_cursor<P: IsA<CellRenderer>>( 175 &self, 176 path: &TreePath, 177 cell: Option<&P>, 178 start_editing: bool, 179 ); 180 set_drag_dest_item(&self, path: Option<&TreePath>, pos: IconViewDropPosition)181 fn set_drag_dest_item(&self, path: Option<&TreePath>, pos: IconViewDropPosition); 182 set_item_orientation(&self, orientation: Orientation)183 fn set_item_orientation(&self, orientation: Orientation); 184 set_item_padding(&self, item_padding: i32)185 fn set_item_padding(&self, item_padding: i32); 186 set_item_width(&self, item_width: i32)187 fn set_item_width(&self, item_width: i32); 188 set_margin(&self, margin: i32)189 fn set_margin(&self, margin: i32); 190 set_markup_column(&self, column: i32)191 fn set_markup_column(&self, column: i32); 192 set_model<P: IsA<TreeModel>>(&self, model: Option<&P>)193 fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>); 194 set_pixbuf_column(&self, column: i32)195 fn set_pixbuf_column(&self, column: i32); 196 set_reorderable(&self, reorderable: bool)197 fn set_reorderable(&self, reorderable: bool); 198 set_row_spacing(&self, row_spacing: i32)199 fn set_row_spacing(&self, row_spacing: i32); 200 set_selection_mode(&self, mode: SelectionMode)201 fn set_selection_mode(&self, mode: SelectionMode); 202 set_spacing(&self, spacing: i32)203 fn set_spacing(&self, spacing: i32); 204 set_text_column(&self, column: i32)205 fn set_text_column(&self, column: i32); 206 set_tooltip_cell<P: IsA<CellRenderer>>( &self, tooltip: &Tooltip, path: &TreePath, cell: Option<&P>, )207 fn set_tooltip_cell<P: IsA<CellRenderer>>( 208 &self, 209 tooltip: &Tooltip, 210 path: &TreePath, 211 cell: Option<&P>, 212 ); 213 set_tooltip_column(&self, column: i32)214 fn set_tooltip_column(&self, column: i32); 215 set_tooltip_item(&self, tooltip: &Tooltip, path: &TreePath)216 fn set_tooltip_item(&self, tooltip: &Tooltip, path: &TreePath); 217 unselect_all(&self)218 fn unselect_all(&self); 219 unselect_path(&self, path: &TreePath)220 fn unselect_path(&self, path: &TreePath); 221 unset_model_drag_dest(&self)222 fn unset_model_drag_dest(&self); 223 unset_model_drag_source(&self)224 fn unset_model_drag_source(&self); 225 get_property_cell_area(&self) -> Option<CellArea>226 fn get_property_cell_area(&self) -> Option<CellArea>; 227 connect_activate_cursor_item<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId228 fn connect_activate_cursor_item<F: Fn(&Self) -> bool + 'static>(&self, f: F) 229 -> SignalHandlerId; 230 emit_activate_cursor_item(&self) -> bool231 fn emit_activate_cursor_item(&self) -> bool; 232 connect_item_activated<F: Fn(&Self, &TreePath) + 'static>(&self, f: F) -> SignalHandlerId233 fn connect_item_activated<F: Fn(&Self, &TreePath) + 'static>(&self, f: F) -> SignalHandlerId; 234 connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId235 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( 236 &self, 237 f: F, 238 ) -> SignalHandlerId; 239 emit_move_cursor(&self, step: MovementStep, count: i32) -> bool240 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool; 241 connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId242 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 243 emit_select_all(&self)244 fn emit_select_all(&self); 245 connect_select_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId246 fn connect_select_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 247 emit_select_cursor_item(&self)248 fn emit_select_cursor_item(&self); 249 connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId250 fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 251 connect_toggle_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId252 fn connect_toggle_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 253 emit_toggle_cursor_item(&self)254 fn emit_toggle_cursor_item(&self); 255 connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId256 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 257 emit_unselect_all(&self)258 fn emit_unselect_all(&self); 259 connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId260 fn connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( 261 &self, 262 f: F, 263 ) -> SignalHandlerId; 264 connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId265 fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( 266 &self, 267 f: F, 268 ) -> SignalHandlerId; 269 connect_property_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId270 fn connect_property_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 271 connect_property_item_orientation_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId272 fn connect_property_item_orientation_notify<F: Fn(&Self) + 'static>( 273 &self, 274 f: F, 275 ) -> SignalHandlerId; 276 connect_property_item_padding_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId277 fn connect_property_item_padding_notify<F: Fn(&Self) + 'static>(&self, f: F) 278 -> SignalHandlerId; 279 connect_property_item_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId280 fn connect_property_item_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 281 connect_property_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId282 fn connect_property_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 283 connect_property_markup_column_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId284 fn connect_property_markup_column_notify<F: Fn(&Self) + 'static>( 285 &self, 286 f: F, 287 ) -> SignalHandlerId; 288 connect_property_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId289 fn connect_property_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 290 connect_property_pixbuf_column_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId291 fn connect_property_pixbuf_column_notify<F: Fn(&Self) + 'static>( 292 &self, 293 f: F, 294 ) -> SignalHandlerId; 295 connect_property_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId296 fn connect_property_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 297 connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId298 fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 299 connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId300 fn connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( 301 &self, 302 f: F, 303 ) -> SignalHandlerId; 304 connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId305 fn connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 306 connect_property_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId307 fn connect_property_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 308 connect_property_tooltip_column_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId309 fn connect_property_tooltip_column_notify<F: Fn(&Self) + 'static>( 310 &self, 311 f: F, 312 ) -> SignalHandlerId; 313 } 314 315 impl<O: IsA<IconView>> IconViewExt for O { convert_widget_to_bin_window_coords(&self, wx: i32, wy: i32) -> (i32, i32)316 fn convert_widget_to_bin_window_coords(&self, wx: i32, wy: i32) -> (i32, i32) { 317 unsafe { 318 let mut bx = mem::MaybeUninit::uninit(); 319 let mut by = mem::MaybeUninit::uninit(); 320 gtk_sys::gtk_icon_view_convert_widget_to_bin_window_coords( 321 self.as_ref().to_glib_none().0, 322 wx, 323 wy, 324 bx.as_mut_ptr(), 325 by.as_mut_ptr(), 326 ); 327 let bx = bx.assume_init(); 328 let by = by.assume_init(); 329 (bx, by) 330 } 331 } 332 create_drag_icon(&self, path: &TreePath) -> Option<cairo::Surface>333 fn create_drag_icon(&self, path: &TreePath) -> Option<cairo::Surface> { 334 unsafe { 335 from_glib_full(gtk_sys::gtk_icon_view_create_drag_icon( 336 self.as_ref().to_glib_none().0, 337 mut_override(path.to_glib_none().0), 338 )) 339 } 340 } 341 get_activate_on_single_click(&self) -> bool342 fn get_activate_on_single_click(&self) -> bool { 343 unsafe { 344 from_glib(gtk_sys::gtk_icon_view_get_activate_on_single_click( 345 self.as_ref().to_glib_none().0, 346 )) 347 } 348 } 349 get_cell_rect<P: IsA<CellRenderer>>( &self, path: &TreePath, cell: Option<&P>, ) -> Option<gdk::Rectangle>350 fn get_cell_rect<P: IsA<CellRenderer>>( 351 &self, 352 path: &TreePath, 353 cell: Option<&P>, 354 ) -> Option<gdk::Rectangle> { 355 unsafe { 356 let mut rect = gdk::Rectangle::uninitialized(); 357 let ret = from_glib(gtk_sys::gtk_icon_view_get_cell_rect( 358 self.as_ref().to_glib_none().0, 359 mut_override(path.to_glib_none().0), 360 cell.map(|p| p.as_ref()).to_glib_none().0, 361 rect.to_glib_none_mut().0, 362 )); 363 if ret { 364 Some(rect) 365 } else { 366 None 367 } 368 } 369 } 370 get_column_spacing(&self) -> i32371 fn get_column_spacing(&self) -> i32 { 372 unsafe { gtk_sys::gtk_icon_view_get_column_spacing(self.as_ref().to_glib_none().0) } 373 } 374 get_columns(&self) -> i32375 fn get_columns(&self) -> i32 { 376 unsafe { gtk_sys::gtk_icon_view_get_columns(self.as_ref().to_glib_none().0) } 377 } 378 get_cursor(&self) -> Option<(TreePath, CellRenderer)>379 fn get_cursor(&self) -> Option<(TreePath, CellRenderer)> { 380 unsafe { 381 let mut path = ptr::null_mut(); 382 let mut cell = ptr::null_mut(); 383 let ret = from_glib(gtk_sys::gtk_icon_view_get_cursor( 384 self.as_ref().to_glib_none().0, 385 &mut path, 386 &mut cell, 387 )); 388 if ret { 389 Some((from_glib_full(path), from_glib_none(cell))) 390 } else { 391 None 392 } 393 } 394 } 395 get_dest_item_at_pos( &self, drag_x: i32, drag_y: i32, ) -> Option<(TreePath, IconViewDropPosition)>396 fn get_dest_item_at_pos( 397 &self, 398 drag_x: i32, 399 drag_y: i32, 400 ) -> Option<(TreePath, IconViewDropPosition)> { 401 unsafe { 402 let mut path = ptr::null_mut(); 403 let mut pos = mem::MaybeUninit::uninit(); 404 let ret = from_glib(gtk_sys::gtk_icon_view_get_dest_item_at_pos( 405 self.as_ref().to_glib_none().0, 406 drag_x, 407 drag_y, 408 &mut path, 409 pos.as_mut_ptr(), 410 )); 411 let pos = pos.assume_init(); 412 if ret { 413 Some((from_glib_full(path), from_glib(pos))) 414 } else { 415 None 416 } 417 } 418 } 419 get_drag_dest_item(&self) -> (TreePath, IconViewDropPosition)420 fn get_drag_dest_item(&self) -> (TreePath, IconViewDropPosition) { 421 unsafe { 422 let mut path = ptr::null_mut(); 423 let mut pos = mem::MaybeUninit::uninit(); 424 gtk_sys::gtk_icon_view_get_drag_dest_item( 425 self.as_ref().to_glib_none().0, 426 &mut path, 427 pos.as_mut_ptr(), 428 ); 429 let pos = pos.assume_init(); 430 (from_glib_full(path), from_glib(pos)) 431 } 432 } 433 get_item_at_pos(&self, x: i32, y: i32) -> Option<(TreePath, CellRenderer)>434 fn get_item_at_pos(&self, x: i32, y: i32) -> Option<(TreePath, CellRenderer)> { 435 unsafe { 436 let mut path = ptr::null_mut(); 437 let mut cell = ptr::null_mut(); 438 let ret = from_glib(gtk_sys::gtk_icon_view_get_item_at_pos( 439 self.as_ref().to_glib_none().0, 440 x, 441 y, 442 &mut path, 443 &mut cell, 444 )); 445 if ret { 446 Some((from_glib_full(path), from_glib_none(cell))) 447 } else { 448 None 449 } 450 } 451 } 452 get_item_column(&self, path: &TreePath) -> i32453 fn get_item_column(&self, path: &TreePath) -> i32 { 454 unsafe { 455 gtk_sys::gtk_icon_view_get_item_column( 456 self.as_ref().to_glib_none().0, 457 mut_override(path.to_glib_none().0), 458 ) 459 } 460 } 461 get_item_orientation(&self) -> Orientation462 fn get_item_orientation(&self) -> Orientation { 463 unsafe { 464 from_glib(gtk_sys::gtk_icon_view_get_item_orientation( 465 self.as_ref().to_glib_none().0, 466 )) 467 } 468 } 469 get_item_padding(&self) -> i32470 fn get_item_padding(&self) -> i32 { 471 unsafe { gtk_sys::gtk_icon_view_get_item_padding(self.as_ref().to_glib_none().0) } 472 } 473 get_item_row(&self, path: &TreePath) -> i32474 fn get_item_row(&self, path: &TreePath) -> i32 { 475 unsafe { 476 gtk_sys::gtk_icon_view_get_item_row( 477 self.as_ref().to_glib_none().0, 478 mut_override(path.to_glib_none().0), 479 ) 480 } 481 } 482 get_item_width(&self) -> i32483 fn get_item_width(&self) -> i32 { 484 unsafe { gtk_sys::gtk_icon_view_get_item_width(self.as_ref().to_glib_none().0) } 485 } 486 get_margin(&self) -> i32487 fn get_margin(&self) -> i32 { 488 unsafe { gtk_sys::gtk_icon_view_get_margin(self.as_ref().to_glib_none().0) } 489 } 490 get_markup_column(&self) -> i32491 fn get_markup_column(&self) -> i32 { 492 unsafe { gtk_sys::gtk_icon_view_get_markup_column(self.as_ref().to_glib_none().0) } 493 } 494 get_model(&self) -> Option<TreeModel>495 fn get_model(&self) -> Option<TreeModel> { 496 unsafe { 497 from_glib_none(gtk_sys::gtk_icon_view_get_model( 498 self.as_ref().to_glib_none().0, 499 )) 500 } 501 } 502 get_path_at_pos(&self, x: i32, y: i32) -> Option<TreePath>503 fn get_path_at_pos(&self, x: i32, y: i32) -> Option<TreePath> { 504 unsafe { 505 from_glib_full(gtk_sys::gtk_icon_view_get_path_at_pos( 506 self.as_ref().to_glib_none().0, 507 x, 508 y, 509 )) 510 } 511 } 512 get_pixbuf_column(&self) -> i32513 fn get_pixbuf_column(&self) -> i32 { 514 unsafe { gtk_sys::gtk_icon_view_get_pixbuf_column(self.as_ref().to_glib_none().0) } 515 } 516 get_reorderable(&self) -> bool517 fn get_reorderable(&self) -> bool { 518 unsafe { 519 from_glib(gtk_sys::gtk_icon_view_get_reorderable( 520 self.as_ref().to_glib_none().0, 521 )) 522 } 523 } 524 get_row_spacing(&self) -> i32525 fn get_row_spacing(&self) -> i32 { 526 unsafe { gtk_sys::gtk_icon_view_get_row_spacing(self.as_ref().to_glib_none().0) } 527 } 528 get_selected_items(&self) -> Vec<TreePath>529 fn get_selected_items(&self) -> Vec<TreePath> { 530 unsafe { 531 FromGlibPtrContainer::from_glib_full(gtk_sys::gtk_icon_view_get_selected_items( 532 self.as_ref().to_glib_none().0, 533 )) 534 } 535 } 536 get_selection_mode(&self) -> SelectionMode537 fn get_selection_mode(&self) -> SelectionMode { 538 unsafe { 539 from_glib(gtk_sys::gtk_icon_view_get_selection_mode( 540 self.as_ref().to_glib_none().0, 541 )) 542 } 543 } 544 get_spacing(&self) -> i32545 fn get_spacing(&self) -> i32 { 546 unsafe { gtk_sys::gtk_icon_view_get_spacing(self.as_ref().to_glib_none().0) } 547 } 548 get_text_column(&self) -> i32549 fn get_text_column(&self) -> i32 { 550 unsafe { gtk_sys::gtk_icon_view_get_text_column(self.as_ref().to_glib_none().0) } 551 } 552 get_tooltip_column(&self) -> i32553 fn get_tooltip_column(&self) -> i32 { 554 unsafe { gtk_sys::gtk_icon_view_get_tooltip_column(self.as_ref().to_glib_none().0) } 555 } 556 get_tooltip_context( &self, x: &mut i32, y: &mut i32, keyboard_tip: bool, ) -> Option<(TreeModel, TreePath, TreeIter)>557 fn get_tooltip_context( 558 &self, 559 x: &mut i32, 560 y: &mut i32, 561 keyboard_tip: bool, 562 ) -> Option<(TreeModel, TreePath, TreeIter)> { 563 unsafe { 564 let mut model = ptr::null_mut(); 565 let mut path = ptr::null_mut(); 566 let mut iter = TreeIter::uninitialized(); 567 let ret = from_glib(gtk_sys::gtk_icon_view_get_tooltip_context( 568 self.as_ref().to_glib_none().0, 569 x, 570 y, 571 keyboard_tip.to_glib(), 572 &mut model, 573 &mut path, 574 iter.to_glib_none_mut().0, 575 )); 576 if ret { 577 Some((from_glib_none(model), from_glib_full(path), iter)) 578 } else { 579 None 580 } 581 } 582 } 583 get_visible_range(&self) -> Option<(TreePath, TreePath)>584 fn get_visible_range(&self) -> Option<(TreePath, TreePath)> { 585 unsafe { 586 let mut start_path = ptr::null_mut(); 587 let mut end_path = ptr::null_mut(); 588 let ret = from_glib(gtk_sys::gtk_icon_view_get_visible_range( 589 self.as_ref().to_glib_none().0, 590 &mut start_path, 591 &mut end_path, 592 )); 593 if ret { 594 Some((from_glib_full(start_path), from_glib_full(end_path))) 595 } else { 596 None 597 } 598 } 599 } 600 item_activated(&self, path: &TreePath)601 fn item_activated(&self, path: &TreePath) { 602 unsafe { 603 gtk_sys::gtk_icon_view_item_activated( 604 self.as_ref().to_glib_none().0, 605 mut_override(path.to_glib_none().0), 606 ); 607 } 608 } 609 path_is_selected(&self, path: &TreePath) -> bool610 fn path_is_selected(&self, path: &TreePath) -> bool { 611 unsafe { 612 from_glib(gtk_sys::gtk_icon_view_path_is_selected( 613 self.as_ref().to_glib_none().0, 614 mut_override(path.to_glib_none().0), 615 )) 616 } 617 } 618 scroll_to_path(&self, path: &TreePath, use_align: bool, row_align: f32, col_align: f32)619 fn scroll_to_path(&self, path: &TreePath, use_align: bool, row_align: f32, col_align: f32) { 620 unsafe { 621 gtk_sys::gtk_icon_view_scroll_to_path( 622 self.as_ref().to_glib_none().0, 623 mut_override(path.to_glib_none().0), 624 use_align.to_glib(), 625 row_align, 626 col_align, 627 ); 628 } 629 } 630 select_all(&self)631 fn select_all(&self) { 632 unsafe { 633 gtk_sys::gtk_icon_view_select_all(self.as_ref().to_glib_none().0); 634 } 635 } 636 select_path(&self, path: &TreePath)637 fn select_path(&self, path: &TreePath) { 638 unsafe { 639 gtk_sys::gtk_icon_view_select_path( 640 self.as_ref().to_glib_none().0, 641 mut_override(path.to_glib_none().0), 642 ); 643 } 644 } 645 selected_foreach<P: FnMut(&IconView, &TreePath)>(&self, func: P)646 fn selected_foreach<P: FnMut(&IconView, &TreePath)>(&self, func: P) { 647 let func_data: P = func; 648 unsafe extern "C" fn func_func<P: FnMut(&IconView, &TreePath)>( 649 icon_view: *mut gtk_sys::GtkIconView, 650 path: *mut gtk_sys::GtkTreePath, 651 data: glib_sys::gpointer, 652 ) { 653 let icon_view = from_glib_borrow(icon_view); 654 let path = from_glib_borrow(path); 655 let callback: *mut P = data as *const _ as usize as *mut P; 656 (*callback)(&icon_view, &path); 657 } 658 let func = Some(func_func::<P> as _); 659 let super_callback0: &P = &func_data; 660 unsafe { 661 gtk_sys::gtk_icon_view_selected_foreach( 662 self.as_ref().to_glib_none().0, 663 func, 664 super_callback0 as *const _ as usize as *mut _, 665 ); 666 } 667 } 668 set_activate_on_single_click(&self, single: bool)669 fn set_activate_on_single_click(&self, single: bool) { 670 unsafe { 671 gtk_sys::gtk_icon_view_set_activate_on_single_click( 672 self.as_ref().to_glib_none().0, 673 single.to_glib(), 674 ); 675 } 676 } 677 set_column_spacing(&self, column_spacing: i32)678 fn set_column_spacing(&self, column_spacing: i32) { 679 unsafe { 680 gtk_sys::gtk_icon_view_set_column_spacing( 681 self.as_ref().to_glib_none().0, 682 column_spacing, 683 ); 684 } 685 } 686 set_columns(&self, columns: i32)687 fn set_columns(&self, columns: i32) { 688 unsafe { 689 gtk_sys::gtk_icon_view_set_columns(self.as_ref().to_glib_none().0, columns); 690 } 691 } 692 set_cursor<P: IsA<CellRenderer>>( &self, path: &TreePath, cell: Option<&P>, start_editing: bool, )693 fn set_cursor<P: IsA<CellRenderer>>( 694 &self, 695 path: &TreePath, 696 cell: Option<&P>, 697 start_editing: bool, 698 ) { 699 unsafe { 700 gtk_sys::gtk_icon_view_set_cursor( 701 self.as_ref().to_glib_none().0, 702 mut_override(path.to_glib_none().0), 703 cell.map(|p| p.as_ref()).to_glib_none().0, 704 start_editing.to_glib(), 705 ); 706 } 707 } 708 set_drag_dest_item(&self, path: Option<&TreePath>, pos: IconViewDropPosition)709 fn set_drag_dest_item(&self, path: Option<&TreePath>, pos: IconViewDropPosition) { 710 unsafe { 711 gtk_sys::gtk_icon_view_set_drag_dest_item( 712 self.as_ref().to_glib_none().0, 713 mut_override(path.to_glib_none().0), 714 pos.to_glib(), 715 ); 716 } 717 } 718 set_item_orientation(&self, orientation: Orientation)719 fn set_item_orientation(&self, orientation: Orientation) { 720 unsafe { 721 gtk_sys::gtk_icon_view_set_item_orientation( 722 self.as_ref().to_glib_none().0, 723 orientation.to_glib(), 724 ); 725 } 726 } 727 set_item_padding(&self, item_padding: i32)728 fn set_item_padding(&self, item_padding: i32) { 729 unsafe { 730 gtk_sys::gtk_icon_view_set_item_padding(self.as_ref().to_glib_none().0, item_padding); 731 } 732 } 733 set_item_width(&self, item_width: i32)734 fn set_item_width(&self, item_width: i32) { 735 unsafe { 736 gtk_sys::gtk_icon_view_set_item_width(self.as_ref().to_glib_none().0, item_width); 737 } 738 } 739 set_margin(&self, margin: i32)740 fn set_margin(&self, margin: i32) { 741 unsafe { 742 gtk_sys::gtk_icon_view_set_margin(self.as_ref().to_glib_none().0, margin); 743 } 744 } 745 set_markup_column(&self, column: i32)746 fn set_markup_column(&self, column: i32) { 747 unsafe { 748 gtk_sys::gtk_icon_view_set_markup_column(self.as_ref().to_glib_none().0, column); 749 } 750 } 751 set_model<P: IsA<TreeModel>>(&self, model: Option<&P>)752 fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>) { 753 unsafe { 754 gtk_sys::gtk_icon_view_set_model( 755 self.as_ref().to_glib_none().0, 756 model.map(|p| p.as_ref()).to_glib_none().0, 757 ); 758 } 759 } 760 set_pixbuf_column(&self, column: i32)761 fn set_pixbuf_column(&self, column: i32) { 762 unsafe { 763 gtk_sys::gtk_icon_view_set_pixbuf_column(self.as_ref().to_glib_none().0, column); 764 } 765 } 766 set_reorderable(&self, reorderable: bool)767 fn set_reorderable(&self, reorderable: bool) { 768 unsafe { 769 gtk_sys::gtk_icon_view_set_reorderable( 770 self.as_ref().to_glib_none().0, 771 reorderable.to_glib(), 772 ); 773 } 774 } 775 set_row_spacing(&self, row_spacing: i32)776 fn set_row_spacing(&self, row_spacing: i32) { 777 unsafe { 778 gtk_sys::gtk_icon_view_set_row_spacing(self.as_ref().to_glib_none().0, row_spacing); 779 } 780 } 781 set_selection_mode(&self, mode: SelectionMode)782 fn set_selection_mode(&self, mode: SelectionMode) { 783 unsafe { 784 gtk_sys::gtk_icon_view_set_selection_mode( 785 self.as_ref().to_glib_none().0, 786 mode.to_glib(), 787 ); 788 } 789 } 790 set_spacing(&self, spacing: i32)791 fn set_spacing(&self, spacing: i32) { 792 unsafe { 793 gtk_sys::gtk_icon_view_set_spacing(self.as_ref().to_glib_none().0, spacing); 794 } 795 } 796 set_text_column(&self, column: i32)797 fn set_text_column(&self, column: i32) { 798 unsafe { 799 gtk_sys::gtk_icon_view_set_text_column(self.as_ref().to_glib_none().0, column); 800 } 801 } 802 set_tooltip_cell<P: IsA<CellRenderer>>( &self, tooltip: &Tooltip, path: &TreePath, cell: Option<&P>, )803 fn set_tooltip_cell<P: IsA<CellRenderer>>( 804 &self, 805 tooltip: &Tooltip, 806 path: &TreePath, 807 cell: Option<&P>, 808 ) { 809 unsafe { 810 gtk_sys::gtk_icon_view_set_tooltip_cell( 811 self.as_ref().to_glib_none().0, 812 tooltip.to_glib_none().0, 813 mut_override(path.to_glib_none().0), 814 cell.map(|p| p.as_ref()).to_glib_none().0, 815 ); 816 } 817 } 818 set_tooltip_column(&self, column: i32)819 fn set_tooltip_column(&self, column: i32) { 820 unsafe { 821 gtk_sys::gtk_icon_view_set_tooltip_column(self.as_ref().to_glib_none().0, column); 822 } 823 } 824 set_tooltip_item(&self, tooltip: &Tooltip, path: &TreePath)825 fn set_tooltip_item(&self, tooltip: &Tooltip, path: &TreePath) { 826 unsafe { 827 gtk_sys::gtk_icon_view_set_tooltip_item( 828 self.as_ref().to_glib_none().0, 829 tooltip.to_glib_none().0, 830 mut_override(path.to_glib_none().0), 831 ); 832 } 833 } 834 unselect_all(&self)835 fn unselect_all(&self) { 836 unsafe { 837 gtk_sys::gtk_icon_view_unselect_all(self.as_ref().to_glib_none().0); 838 } 839 } 840 unselect_path(&self, path: &TreePath)841 fn unselect_path(&self, path: &TreePath) { 842 unsafe { 843 gtk_sys::gtk_icon_view_unselect_path( 844 self.as_ref().to_glib_none().0, 845 mut_override(path.to_glib_none().0), 846 ); 847 } 848 } 849 unset_model_drag_dest(&self)850 fn unset_model_drag_dest(&self) { 851 unsafe { 852 gtk_sys::gtk_icon_view_unset_model_drag_dest(self.as_ref().to_glib_none().0); 853 } 854 } 855 unset_model_drag_source(&self)856 fn unset_model_drag_source(&self) { 857 unsafe { 858 gtk_sys::gtk_icon_view_unset_model_drag_source(self.as_ref().to_glib_none().0); 859 } 860 } 861 get_property_cell_area(&self) -> Option<CellArea>862 fn get_property_cell_area(&self) -> Option<CellArea> { 863 unsafe { 864 let mut value = Value::from_type(<CellArea as StaticType>::static_type()); 865 gobject_sys::g_object_get_property( 866 self.to_glib_none().0 as *mut gobject_sys::GObject, 867 b"cell-area\0".as_ptr() as *const _, 868 value.to_glib_none_mut().0, 869 ); 870 value 871 .get() 872 .expect("Return Value for property `cell-area` getter") 873 } 874 } 875 connect_activate_cursor_item<F: Fn(&Self) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId876 fn connect_activate_cursor_item<F: Fn(&Self) -> bool + 'static>( 877 &self, 878 f: F, 879 ) -> SignalHandlerId { 880 unsafe extern "C" fn activate_cursor_item_trampoline<P, F: Fn(&P) -> bool + 'static>( 881 this: *mut gtk_sys::GtkIconView, 882 f: glib_sys::gpointer, 883 ) -> glib_sys::gboolean 884 where 885 P: IsA<IconView>, 886 { 887 let f: &F = &*(f as *const F); 888 f(&IconView::from_glib_borrow(this).unsafe_cast()).to_glib() 889 } 890 unsafe { 891 let f: Box_<F> = Box_::new(f); 892 connect_raw( 893 self.as_ptr() as *mut _, 894 b"activate-cursor-item\0".as_ptr() as *const _, 895 Some(transmute( 896 activate_cursor_item_trampoline::<Self, F> as usize, 897 )), 898 Box_::into_raw(f), 899 ) 900 } 901 } 902 emit_activate_cursor_item(&self) -> bool903 fn emit_activate_cursor_item(&self) -> bool { 904 let res = unsafe { 905 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 906 .emit("activate-cursor-item", &[]) 907 .unwrap() 908 }; 909 res.unwrap() 910 .get() 911 .expect("Return Value for `emit_activate_cursor_item`") 912 .unwrap() 913 } 914 connect_item_activated<F: Fn(&Self, &TreePath) + 'static>(&self, f: F) -> SignalHandlerId915 fn connect_item_activated<F: Fn(&Self, &TreePath) + 'static>(&self, f: F) -> SignalHandlerId { 916 unsafe extern "C" fn item_activated_trampoline<P, F: Fn(&P, &TreePath) + 'static>( 917 this: *mut gtk_sys::GtkIconView, 918 path: *mut gtk_sys::GtkTreePath, 919 f: glib_sys::gpointer, 920 ) where 921 P: IsA<IconView>, 922 { 923 let f: &F = &*(f as *const F); 924 f( 925 &IconView::from_glib_borrow(this).unsafe_cast(), 926 &from_glib_borrow(path), 927 ) 928 } 929 unsafe { 930 let f: Box_<F> = Box_::new(f); 931 connect_raw( 932 self.as_ptr() as *mut _, 933 b"item-activated\0".as_ptr() as *const _, 934 Some(transmute(item_activated_trampoline::<Self, F> as usize)), 935 Box_::into_raw(f), 936 ) 937 } 938 } 939 connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId940 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( 941 &self, 942 f: F, 943 ) -> SignalHandlerId { 944 unsafe extern "C" fn move_cursor_trampoline< 945 P, 946 F: Fn(&P, MovementStep, i32) -> bool + 'static, 947 >( 948 this: *mut gtk_sys::GtkIconView, 949 step: gtk_sys::GtkMovementStep, 950 count: libc::c_int, 951 f: glib_sys::gpointer, 952 ) -> glib_sys::gboolean 953 where 954 P: IsA<IconView>, 955 { 956 let f: &F = &*(f as *const F); 957 f( 958 &IconView::from_glib_borrow(this).unsafe_cast(), 959 from_glib(step), 960 count, 961 ) 962 .to_glib() 963 } 964 unsafe { 965 let f: Box_<F> = Box_::new(f); 966 connect_raw( 967 self.as_ptr() as *mut _, 968 b"move-cursor\0".as_ptr() as *const _, 969 Some(transmute(move_cursor_trampoline::<Self, F> as usize)), 970 Box_::into_raw(f), 971 ) 972 } 973 } 974 emit_move_cursor(&self, step: MovementStep, count: i32) -> bool975 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool { 976 let res = unsafe { 977 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 978 .emit("move-cursor", &[&step, &count]) 979 .unwrap() 980 }; 981 res.unwrap() 982 .get() 983 .expect("Return Value for `emit_move_cursor`") 984 .unwrap() 985 } 986 connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId987 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 988 unsafe extern "C" fn select_all_trampoline<P, F: Fn(&P) + 'static>( 989 this: *mut gtk_sys::GtkIconView, 990 f: glib_sys::gpointer, 991 ) where 992 P: IsA<IconView>, 993 { 994 let f: &F = &*(f as *const F); 995 f(&IconView::from_glib_borrow(this).unsafe_cast()) 996 } 997 unsafe { 998 let f: Box_<F> = Box_::new(f); 999 connect_raw( 1000 self.as_ptr() as *mut _, 1001 b"select-all\0".as_ptr() as *const _, 1002 Some(transmute(select_all_trampoline::<Self, F> as usize)), 1003 Box_::into_raw(f), 1004 ) 1005 } 1006 } 1007 emit_select_all(&self)1008 fn emit_select_all(&self) { 1009 let _ = unsafe { 1010 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1011 .emit("select-all", &[]) 1012 .unwrap() 1013 }; 1014 } 1015 connect_select_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1016 fn connect_select_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1017 unsafe extern "C" fn select_cursor_item_trampoline<P, F: Fn(&P) + 'static>( 1018 this: *mut gtk_sys::GtkIconView, 1019 f: glib_sys::gpointer, 1020 ) where 1021 P: IsA<IconView>, 1022 { 1023 let f: &F = &*(f as *const F); 1024 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1025 } 1026 unsafe { 1027 let f: Box_<F> = Box_::new(f); 1028 connect_raw( 1029 self.as_ptr() as *mut _, 1030 b"select-cursor-item\0".as_ptr() as *const _, 1031 Some(transmute(select_cursor_item_trampoline::<Self, F> as usize)), 1032 Box_::into_raw(f), 1033 ) 1034 } 1035 } 1036 emit_select_cursor_item(&self)1037 fn emit_select_cursor_item(&self) { 1038 let _ = unsafe { 1039 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1040 .emit("select-cursor-item", &[]) 1041 .unwrap() 1042 }; 1043 } 1044 connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1045 fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1046 unsafe extern "C" fn selection_changed_trampoline<P, F: Fn(&P) + 'static>( 1047 this: *mut gtk_sys::GtkIconView, 1048 f: glib_sys::gpointer, 1049 ) where 1050 P: IsA<IconView>, 1051 { 1052 let f: &F = &*(f as *const F); 1053 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1054 } 1055 unsafe { 1056 let f: Box_<F> = Box_::new(f); 1057 connect_raw( 1058 self.as_ptr() as *mut _, 1059 b"selection-changed\0".as_ptr() as *const _, 1060 Some(transmute(selection_changed_trampoline::<Self, F> as usize)), 1061 Box_::into_raw(f), 1062 ) 1063 } 1064 } 1065 connect_toggle_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1066 fn connect_toggle_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1067 unsafe extern "C" fn toggle_cursor_item_trampoline<P, F: Fn(&P) + 'static>( 1068 this: *mut gtk_sys::GtkIconView, 1069 f: glib_sys::gpointer, 1070 ) where 1071 P: IsA<IconView>, 1072 { 1073 let f: &F = &*(f as *const F); 1074 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1075 } 1076 unsafe { 1077 let f: Box_<F> = Box_::new(f); 1078 connect_raw( 1079 self.as_ptr() as *mut _, 1080 b"toggle-cursor-item\0".as_ptr() as *const _, 1081 Some(transmute(toggle_cursor_item_trampoline::<Self, F> as usize)), 1082 Box_::into_raw(f), 1083 ) 1084 } 1085 } 1086 emit_toggle_cursor_item(&self)1087 fn emit_toggle_cursor_item(&self) { 1088 let _ = unsafe { 1089 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1090 .emit("toggle-cursor-item", &[]) 1091 .unwrap() 1092 }; 1093 } 1094 connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1095 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1096 unsafe extern "C" fn unselect_all_trampoline<P, F: Fn(&P) + 'static>( 1097 this: *mut gtk_sys::GtkIconView, 1098 f: glib_sys::gpointer, 1099 ) where 1100 P: IsA<IconView>, 1101 { 1102 let f: &F = &*(f as *const F); 1103 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1104 } 1105 unsafe { 1106 let f: Box_<F> = Box_::new(f); 1107 connect_raw( 1108 self.as_ptr() as *mut _, 1109 b"unselect-all\0".as_ptr() as *const _, 1110 Some(transmute(unselect_all_trampoline::<Self, F> as usize)), 1111 Box_::into_raw(f), 1112 ) 1113 } 1114 } 1115 emit_unselect_all(&self)1116 fn emit_unselect_all(&self) { 1117 let _ = unsafe { 1118 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1119 .emit("unselect-all", &[]) 1120 .unwrap() 1121 }; 1122 } 1123 connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1124 fn connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( 1125 &self, 1126 f: F, 1127 ) -> SignalHandlerId { 1128 unsafe extern "C" fn notify_activate_on_single_click_trampoline<P, F: Fn(&P) + 'static>( 1129 this: *mut gtk_sys::GtkIconView, 1130 _param_spec: glib_sys::gpointer, 1131 f: glib_sys::gpointer, 1132 ) where 1133 P: IsA<IconView>, 1134 { 1135 let f: &F = &*(f as *const F); 1136 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1137 } 1138 unsafe { 1139 let f: Box_<F> = Box_::new(f); 1140 connect_raw( 1141 self.as_ptr() as *mut _, 1142 b"notify::activate-on-single-click\0".as_ptr() as *const _, 1143 Some(transmute( 1144 notify_activate_on_single_click_trampoline::<Self, F> as usize, 1145 )), 1146 Box_::into_raw(f), 1147 ) 1148 } 1149 } 1150 connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1151 fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( 1152 &self, 1153 f: F, 1154 ) -> SignalHandlerId { 1155 unsafe extern "C" fn notify_column_spacing_trampoline<P, F: Fn(&P) + 'static>( 1156 this: *mut gtk_sys::GtkIconView, 1157 _param_spec: glib_sys::gpointer, 1158 f: glib_sys::gpointer, 1159 ) where 1160 P: IsA<IconView>, 1161 { 1162 let f: &F = &*(f as *const F); 1163 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1164 } 1165 unsafe { 1166 let f: Box_<F> = Box_::new(f); 1167 connect_raw( 1168 self.as_ptr() as *mut _, 1169 b"notify::column-spacing\0".as_ptr() as *const _, 1170 Some(transmute( 1171 notify_column_spacing_trampoline::<Self, F> as usize, 1172 )), 1173 Box_::into_raw(f), 1174 ) 1175 } 1176 } 1177 connect_property_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1178 fn connect_property_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1179 unsafe extern "C" fn notify_columns_trampoline<P, F: Fn(&P) + 'static>( 1180 this: *mut gtk_sys::GtkIconView, 1181 _param_spec: glib_sys::gpointer, 1182 f: glib_sys::gpointer, 1183 ) where 1184 P: IsA<IconView>, 1185 { 1186 let f: &F = &*(f as *const F); 1187 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1188 } 1189 unsafe { 1190 let f: Box_<F> = Box_::new(f); 1191 connect_raw( 1192 self.as_ptr() as *mut _, 1193 b"notify::columns\0".as_ptr() as *const _, 1194 Some(transmute(notify_columns_trampoline::<Self, F> as usize)), 1195 Box_::into_raw(f), 1196 ) 1197 } 1198 } 1199 connect_property_item_orientation_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1200 fn connect_property_item_orientation_notify<F: Fn(&Self) + 'static>( 1201 &self, 1202 f: F, 1203 ) -> SignalHandlerId { 1204 unsafe extern "C" fn notify_item_orientation_trampoline<P, F: Fn(&P) + 'static>( 1205 this: *mut gtk_sys::GtkIconView, 1206 _param_spec: glib_sys::gpointer, 1207 f: glib_sys::gpointer, 1208 ) where 1209 P: IsA<IconView>, 1210 { 1211 let f: &F = &*(f as *const F); 1212 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1213 } 1214 unsafe { 1215 let f: Box_<F> = Box_::new(f); 1216 connect_raw( 1217 self.as_ptr() as *mut _, 1218 b"notify::item-orientation\0".as_ptr() as *const _, 1219 Some(transmute( 1220 notify_item_orientation_trampoline::<Self, F> as usize, 1221 )), 1222 Box_::into_raw(f), 1223 ) 1224 } 1225 } 1226 connect_property_item_padding_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1227 fn connect_property_item_padding_notify<F: Fn(&Self) + 'static>( 1228 &self, 1229 f: F, 1230 ) -> SignalHandlerId { 1231 unsafe extern "C" fn notify_item_padding_trampoline<P, F: Fn(&P) + 'static>( 1232 this: *mut gtk_sys::GtkIconView, 1233 _param_spec: glib_sys::gpointer, 1234 f: glib_sys::gpointer, 1235 ) where 1236 P: IsA<IconView>, 1237 { 1238 let f: &F = &*(f as *const F); 1239 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1240 } 1241 unsafe { 1242 let f: Box_<F> = Box_::new(f); 1243 connect_raw( 1244 self.as_ptr() as *mut _, 1245 b"notify::item-padding\0".as_ptr() as *const _, 1246 Some(transmute( 1247 notify_item_padding_trampoline::<Self, F> as usize, 1248 )), 1249 Box_::into_raw(f), 1250 ) 1251 } 1252 } 1253 connect_property_item_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1254 fn connect_property_item_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1255 unsafe extern "C" fn notify_item_width_trampoline<P, F: Fn(&P) + 'static>( 1256 this: *mut gtk_sys::GtkIconView, 1257 _param_spec: glib_sys::gpointer, 1258 f: glib_sys::gpointer, 1259 ) where 1260 P: IsA<IconView>, 1261 { 1262 let f: &F = &*(f as *const F); 1263 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1264 } 1265 unsafe { 1266 let f: Box_<F> = Box_::new(f); 1267 connect_raw( 1268 self.as_ptr() as *mut _, 1269 b"notify::item-width\0".as_ptr() as *const _, 1270 Some(transmute(notify_item_width_trampoline::<Self, F> as usize)), 1271 Box_::into_raw(f), 1272 ) 1273 } 1274 } 1275 connect_property_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1276 fn connect_property_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1277 unsafe extern "C" fn notify_margin_trampoline<P, F: Fn(&P) + 'static>( 1278 this: *mut gtk_sys::GtkIconView, 1279 _param_spec: glib_sys::gpointer, 1280 f: glib_sys::gpointer, 1281 ) where 1282 P: IsA<IconView>, 1283 { 1284 let f: &F = &*(f as *const F); 1285 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1286 } 1287 unsafe { 1288 let f: Box_<F> = Box_::new(f); 1289 connect_raw( 1290 self.as_ptr() as *mut _, 1291 b"notify::margin\0".as_ptr() as *const _, 1292 Some(transmute(notify_margin_trampoline::<Self, F> as usize)), 1293 Box_::into_raw(f), 1294 ) 1295 } 1296 } 1297 connect_property_markup_column_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1298 fn connect_property_markup_column_notify<F: Fn(&Self) + 'static>( 1299 &self, 1300 f: F, 1301 ) -> SignalHandlerId { 1302 unsafe extern "C" fn notify_markup_column_trampoline<P, F: Fn(&P) + 'static>( 1303 this: *mut gtk_sys::GtkIconView, 1304 _param_spec: glib_sys::gpointer, 1305 f: glib_sys::gpointer, 1306 ) where 1307 P: IsA<IconView>, 1308 { 1309 let f: &F = &*(f as *const F); 1310 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1311 } 1312 unsafe { 1313 let f: Box_<F> = Box_::new(f); 1314 connect_raw( 1315 self.as_ptr() as *mut _, 1316 b"notify::markup-column\0".as_ptr() as *const _, 1317 Some(transmute( 1318 notify_markup_column_trampoline::<Self, F> as usize, 1319 )), 1320 Box_::into_raw(f), 1321 ) 1322 } 1323 } 1324 connect_property_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1325 fn connect_property_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1326 unsafe extern "C" fn notify_model_trampoline<P, F: Fn(&P) + 'static>( 1327 this: *mut gtk_sys::GtkIconView, 1328 _param_spec: glib_sys::gpointer, 1329 f: glib_sys::gpointer, 1330 ) where 1331 P: IsA<IconView>, 1332 { 1333 let f: &F = &*(f as *const F); 1334 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1335 } 1336 unsafe { 1337 let f: Box_<F> = Box_::new(f); 1338 connect_raw( 1339 self.as_ptr() as *mut _, 1340 b"notify::model\0".as_ptr() as *const _, 1341 Some(transmute(notify_model_trampoline::<Self, F> as usize)), 1342 Box_::into_raw(f), 1343 ) 1344 } 1345 } 1346 connect_property_pixbuf_column_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1347 fn connect_property_pixbuf_column_notify<F: Fn(&Self) + 'static>( 1348 &self, 1349 f: F, 1350 ) -> SignalHandlerId { 1351 unsafe extern "C" fn notify_pixbuf_column_trampoline<P, F: Fn(&P) + 'static>( 1352 this: *mut gtk_sys::GtkIconView, 1353 _param_spec: glib_sys::gpointer, 1354 f: glib_sys::gpointer, 1355 ) where 1356 P: IsA<IconView>, 1357 { 1358 let f: &F = &*(f as *const F); 1359 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1360 } 1361 unsafe { 1362 let f: Box_<F> = Box_::new(f); 1363 connect_raw( 1364 self.as_ptr() as *mut _, 1365 b"notify::pixbuf-column\0".as_ptr() as *const _, 1366 Some(transmute( 1367 notify_pixbuf_column_trampoline::<Self, F> as usize, 1368 )), 1369 Box_::into_raw(f), 1370 ) 1371 } 1372 } 1373 connect_property_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1374 fn connect_property_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1375 unsafe extern "C" fn notify_reorderable_trampoline<P, F: Fn(&P) + 'static>( 1376 this: *mut gtk_sys::GtkIconView, 1377 _param_spec: glib_sys::gpointer, 1378 f: glib_sys::gpointer, 1379 ) where 1380 P: IsA<IconView>, 1381 { 1382 let f: &F = &*(f as *const F); 1383 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1384 } 1385 unsafe { 1386 let f: Box_<F> = Box_::new(f); 1387 connect_raw( 1388 self.as_ptr() as *mut _, 1389 b"notify::reorderable\0".as_ptr() as *const _, 1390 Some(transmute(notify_reorderable_trampoline::<Self, F> as usize)), 1391 Box_::into_raw(f), 1392 ) 1393 } 1394 } 1395 connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1396 fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1397 unsafe extern "C" fn notify_row_spacing_trampoline<P, F: Fn(&P) + 'static>( 1398 this: *mut gtk_sys::GtkIconView, 1399 _param_spec: glib_sys::gpointer, 1400 f: glib_sys::gpointer, 1401 ) where 1402 P: IsA<IconView>, 1403 { 1404 let f: &F = &*(f as *const F); 1405 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1406 } 1407 unsafe { 1408 let f: Box_<F> = Box_::new(f); 1409 connect_raw( 1410 self.as_ptr() as *mut _, 1411 b"notify::row-spacing\0".as_ptr() as *const _, 1412 Some(transmute(notify_row_spacing_trampoline::<Self, F> as usize)), 1413 Box_::into_raw(f), 1414 ) 1415 } 1416 } 1417 connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1418 fn connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( 1419 &self, 1420 f: F, 1421 ) -> SignalHandlerId { 1422 unsafe extern "C" fn notify_selection_mode_trampoline<P, F: Fn(&P) + 'static>( 1423 this: *mut gtk_sys::GtkIconView, 1424 _param_spec: glib_sys::gpointer, 1425 f: glib_sys::gpointer, 1426 ) where 1427 P: IsA<IconView>, 1428 { 1429 let f: &F = &*(f as *const F); 1430 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1431 } 1432 unsafe { 1433 let f: Box_<F> = Box_::new(f); 1434 connect_raw( 1435 self.as_ptr() as *mut _, 1436 b"notify::selection-mode\0".as_ptr() as *const _, 1437 Some(transmute( 1438 notify_selection_mode_trampoline::<Self, F> as usize, 1439 )), 1440 Box_::into_raw(f), 1441 ) 1442 } 1443 } 1444 connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1445 fn connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1446 unsafe extern "C" fn notify_spacing_trampoline<P, F: Fn(&P) + 'static>( 1447 this: *mut gtk_sys::GtkIconView, 1448 _param_spec: glib_sys::gpointer, 1449 f: glib_sys::gpointer, 1450 ) where 1451 P: IsA<IconView>, 1452 { 1453 let f: &F = &*(f as *const F); 1454 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1455 } 1456 unsafe { 1457 let f: Box_<F> = Box_::new(f); 1458 connect_raw( 1459 self.as_ptr() as *mut _, 1460 b"notify::spacing\0".as_ptr() as *const _, 1461 Some(transmute(notify_spacing_trampoline::<Self, F> as usize)), 1462 Box_::into_raw(f), 1463 ) 1464 } 1465 } 1466 connect_property_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1467 fn connect_property_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1468 unsafe extern "C" fn notify_text_column_trampoline<P, F: Fn(&P) + 'static>( 1469 this: *mut gtk_sys::GtkIconView, 1470 _param_spec: glib_sys::gpointer, 1471 f: glib_sys::gpointer, 1472 ) where 1473 P: IsA<IconView>, 1474 { 1475 let f: &F = &*(f as *const F); 1476 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1477 } 1478 unsafe { 1479 let f: Box_<F> = Box_::new(f); 1480 connect_raw( 1481 self.as_ptr() as *mut _, 1482 b"notify::text-column\0".as_ptr() as *const _, 1483 Some(transmute(notify_text_column_trampoline::<Self, F> as usize)), 1484 Box_::into_raw(f), 1485 ) 1486 } 1487 } 1488 connect_property_tooltip_column_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1489 fn connect_property_tooltip_column_notify<F: Fn(&Self) + 'static>( 1490 &self, 1491 f: F, 1492 ) -> SignalHandlerId { 1493 unsafe extern "C" fn notify_tooltip_column_trampoline<P, F: Fn(&P) + 'static>( 1494 this: *mut gtk_sys::GtkIconView, 1495 _param_spec: glib_sys::gpointer, 1496 f: glib_sys::gpointer, 1497 ) where 1498 P: IsA<IconView>, 1499 { 1500 let f: &F = &*(f as *const F); 1501 f(&IconView::from_glib_borrow(this).unsafe_cast()) 1502 } 1503 unsafe { 1504 let f: Box_<F> = Box_::new(f); 1505 connect_raw( 1506 self.as_ptr() as *mut _, 1507 b"notify::tooltip-column\0".as_ptr() as *const _, 1508 Some(transmute( 1509 notify_tooltip_column_trampoline::<Self, F> as usize, 1510 )), 1511 Box_::into_raw(f), 1512 ) 1513 } 1514 } 1515 } 1516 1517 impl fmt::Display for IconView { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1518 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1519 write!(f, "IconView") 1520 } 1521 } 1522