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 gdk; 6 #[cfg(any(feature = "v3_18", feature = "dox"))] 7 use gio; 8 use glib; 9 use glib::object::Cast; 10 use glib::object::IsA; 11 use glib::object::ObjectExt; 12 use glib::signal::connect_raw; 13 use glib::signal::SignalHandlerId; 14 use glib::translate::*; 15 use glib::StaticType; 16 use glib::ToValue; 17 use glib_sys; 18 use gobject_sys; 19 use gtk_sys; 20 use libc; 21 use std::boxed::Box as Box_; 22 use std::fmt; 23 use std::mem::transmute; 24 use Adjustment; 25 use Align; 26 use Buildable; 27 use Container; 28 use FlowBoxChild; 29 use MovementStep; 30 use Orientable; 31 use ResizeMode; 32 use SelectionMode; 33 use Widget; 34 35 glib_wrapper! { 36 pub struct FlowBox(Object<gtk_sys::GtkFlowBox, gtk_sys::GtkFlowBoxClass, FlowBoxClass>) @extends Container, Widget, @implements Buildable, Orientable; 37 38 match fn { 39 get_type => || gtk_sys::gtk_flow_box_get_type(), 40 } 41 } 42 43 impl FlowBox { new() -> FlowBox44 pub fn new() -> FlowBox { 45 assert_initialized_main_thread!(); 46 unsafe { Widget::from_glib_none(gtk_sys::gtk_flow_box_new()).unsafe_cast() } 47 } 48 } 49 50 impl Default for FlowBox { default() -> Self51 fn default() -> Self { 52 Self::new() 53 } 54 } 55 56 pub struct FlowBoxBuilder { 57 activate_on_single_click: Option<bool>, 58 column_spacing: Option<u32>, 59 homogeneous: Option<bool>, 60 max_children_per_line: Option<u32>, 61 min_children_per_line: Option<u32>, 62 row_spacing: Option<u32>, 63 selection_mode: Option<SelectionMode>, 64 border_width: Option<u32>, 65 child: Option<Widget>, 66 resize_mode: Option<ResizeMode>, 67 app_paintable: Option<bool>, 68 can_default: Option<bool>, 69 can_focus: Option<bool>, 70 events: Option<gdk::EventMask>, 71 expand: Option<bool>, 72 #[cfg(any(feature = "v3_20", feature = "dox"))] 73 focus_on_click: Option<bool>, 74 halign: Option<Align>, 75 has_default: Option<bool>, 76 has_focus: Option<bool>, 77 has_tooltip: Option<bool>, 78 height_request: Option<i32>, 79 hexpand: Option<bool>, 80 hexpand_set: Option<bool>, 81 is_focus: Option<bool>, 82 margin: Option<i32>, 83 margin_bottom: Option<i32>, 84 margin_end: Option<i32>, 85 margin_start: Option<i32>, 86 margin_top: Option<i32>, 87 name: Option<String>, 88 no_show_all: Option<bool>, 89 opacity: Option<f64>, 90 parent: Option<Container>, 91 receives_default: Option<bool>, 92 sensitive: Option<bool>, 93 //style: /*Unknown type*/, 94 tooltip_markup: Option<String>, 95 tooltip_text: Option<String>, 96 valign: Option<Align>, 97 vexpand: Option<bool>, 98 vexpand_set: Option<bool>, 99 visible: Option<bool>, 100 width_request: Option<i32>, 101 } 102 103 impl FlowBoxBuilder { new() -> Self104 pub fn new() -> Self { 105 Self { 106 activate_on_single_click: None, 107 column_spacing: None, 108 homogeneous: None, 109 max_children_per_line: None, 110 min_children_per_line: None, 111 row_spacing: None, 112 selection_mode: None, 113 border_width: None, 114 child: None, 115 resize_mode: None, 116 app_paintable: None, 117 can_default: None, 118 can_focus: None, 119 events: None, 120 expand: None, 121 #[cfg(any(feature = "v3_20", feature = "dox"))] 122 focus_on_click: None, 123 halign: None, 124 has_default: None, 125 has_focus: None, 126 has_tooltip: None, 127 height_request: None, 128 hexpand: None, 129 hexpand_set: None, 130 is_focus: None, 131 margin: None, 132 margin_bottom: None, 133 margin_end: None, 134 margin_start: None, 135 margin_top: None, 136 name: None, 137 no_show_all: None, 138 opacity: None, 139 parent: None, 140 receives_default: None, 141 sensitive: None, 142 tooltip_markup: None, 143 tooltip_text: None, 144 valign: None, 145 vexpand: None, 146 vexpand_set: None, 147 visible: None, 148 width_request: None, 149 } 150 } 151 build(self) -> FlowBox152 pub fn build(self) -> FlowBox { 153 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 154 if let Some(ref activate_on_single_click) = self.activate_on_single_click { 155 properties.push(("activate-on-single-click", activate_on_single_click)); 156 } 157 if let Some(ref column_spacing) = self.column_spacing { 158 properties.push(("column-spacing", column_spacing)); 159 } 160 if let Some(ref homogeneous) = self.homogeneous { 161 properties.push(("homogeneous", homogeneous)); 162 } 163 if let Some(ref max_children_per_line) = self.max_children_per_line { 164 properties.push(("max-children-per-line", max_children_per_line)); 165 } 166 if let Some(ref min_children_per_line) = self.min_children_per_line { 167 properties.push(("min-children-per-line", min_children_per_line)); 168 } 169 if let Some(ref row_spacing) = self.row_spacing { 170 properties.push(("row-spacing", row_spacing)); 171 } 172 if let Some(ref selection_mode) = self.selection_mode { 173 properties.push(("selection-mode", selection_mode)); 174 } 175 if let Some(ref border_width) = self.border_width { 176 properties.push(("border-width", border_width)); 177 } 178 if let Some(ref child) = self.child { 179 properties.push(("child", child)); 180 } 181 if let Some(ref resize_mode) = self.resize_mode { 182 properties.push(("resize-mode", resize_mode)); 183 } 184 if let Some(ref app_paintable) = self.app_paintable { 185 properties.push(("app-paintable", app_paintable)); 186 } 187 if let Some(ref can_default) = self.can_default { 188 properties.push(("can-default", can_default)); 189 } 190 if let Some(ref can_focus) = self.can_focus { 191 properties.push(("can-focus", can_focus)); 192 } 193 if let Some(ref events) = self.events { 194 properties.push(("events", events)); 195 } 196 if let Some(ref expand) = self.expand { 197 properties.push(("expand", expand)); 198 } 199 #[cfg(any(feature = "v3_20", feature = "dox"))] 200 { 201 if let Some(ref focus_on_click) = self.focus_on_click { 202 properties.push(("focus-on-click", focus_on_click)); 203 } 204 } 205 if let Some(ref halign) = self.halign { 206 properties.push(("halign", halign)); 207 } 208 if let Some(ref has_default) = self.has_default { 209 properties.push(("has-default", has_default)); 210 } 211 if let Some(ref has_focus) = self.has_focus { 212 properties.push(("has-focus", has_focus)); 213 } 214 if let Some(ref has_tooltip) = self.has_tooltip { 215 properties.push(("has-tooltip", has_tooltip)); 216 } 217 if let Some(ref height_request) = self.height_request { 218 properties.push(("height-request", height_request)); 219 } 220 if let Some(ref hexpand) = self.hexpand { 221 properties.push(("hexpand", hexpand)); 222 } 223 if let Some(ref hexpand_set) = self.hexpand_set { 224 properties.push(("hexpand-set", hexpand_set)); 225 } 226 if let Some(ref is_focus) = self.is_focus { 227 properties.push(("is-focus", is_focus)); 228 } 229 if let Some(ref margin) = self.margin { 230 properties.push(("margin", margin)); 231 } 232 if let Some(ref margin_bottom) = self.margin_bottom { 233 properties.push(("margin-bottom", margin_bottom)); 234 } 235 if let Some(ref margin_end) = self.margin_end { 236 properties.push(("margin-end", margin_end)); 237 } 238 if let Some(ref margin_start) = self.margin_start { 239 properties.push(("margin-start", margin_start)); 240 } 241 if let Some(ref margin_top) = self.margin_top { 242 properties.push(("margin-top", margin_top)); 243 } 244 if let Some(ref name) = self.name { 245 properties.push(("name", name)); 246 } 247 if let Some(ref no_show_all) = self.no_show_all { 248 properties.push(("no-show-all", no_show_all)); 249 } 250 if let Some(ref opacity) = self.opacity { 251 properties.push(("opacity", opacity)); 252 } 253 if let Some(ref parent) = self.parent { 254 properties.push(("parent", parent)); 255 } 256 if let Some(ref receives_default) = self.receives_default { 257 properties.push(("receives-default", receives_default)); 258 } 259 if let Some(ref sensitive) = self.sensitive { 260 properties.push(("sensitive", sensitive)); 261 } 262 if let Some(ref tooltip_markup) = self.tooltip_markup { 263 properties.push(("tooltip-markup", tooltip_markup)); 264 } 265 if let Some(ref tooltip_text) = self.tooltip_text { 266 properties.push(("tooltip-text", tooltip_text)); 267 } 268 if let Some(ref valign) = self.valign { 269 properties.push(("valign", valign)); 270 } 271 if let Some(ref vexpand) = self.vexpand { 272 properties.push(("vexpand", vexpand)); 273 } 274 if let Some(ref vexpand_set) = self.vexpand_set { 275 properties.push(("vexpand-set", vexpand_set)); 276 } 277 if let Some(ref visible) = self.visible { 278 properties.push(("visible", visible)); 279 } 280 if let Some(ref width_request) = self.width_request { 281 properties.push(("width-request", width_request)); 282 } 283 glib::Object::new(FlowBox::static_type(), &properties) 284 .expect("object new") 285 .downcast() 286 .expect("downcast") 287 } 288 activate_on_single_click(mut self, activate_on_single_click: bool) -> Self289 pub fn activate_on_single_click(mut self, activate_on_single_click: bool) -> Self { 290 self.activate_on_single_click = Some(activate_on_single_click); 291 self 292 } 293 column_spacing(mut self, column_spacing: u32) -> Self294 pub fn column_spacing(mut self, column_spacing: u32) -> Self { 295 self.column_spacing = Some(column_spacing); 296 self 297 } 298 homogeneous(mut self, homogeneous: bool) -> Self299 pub fn homogeneous(mut self, homogeneous: bool) -> Self { 300 self.homogeneous = Some(homogeneous); 301 self 302 } 303 max_children_per_line(mut self, max_children_per_line: u32) -> Self304 pub fn max_children_per_line(mut self, max_children_per_line: u32) -> Self { 305 self.max_children_per_line = Some(max_children_per_line); 306 self 307 } 308 min_children_per_line(mut self, min_children_per_line: u32) -> Self309 pub fn min_children_per_line(mut self, min_children_per_line: u32) -> Self { 310 self.min_children_per_line = Some(min_children_per_line); 311 self 312 } 313 row_spacing(mut self, row_spacing: u32) -> Self314 pub fn row_spacing(mut self, row_spacing: u32) -> Self { 315 self.row_spacing = Some(row_spacing); 316 self 317 } 318 selection_mode(mut self, selection_mode: SelectionMode) -> Self319 pub fn selection_mode(mut self, selection_mode: SelectionMode) -> Self { 320 self.selection_mode = Some(selection_mode); 321 self 322 } 323 border_width(mut self, border_width: u32) -> Self324 pub fn border_width(mut self, border_width: u32) -> Self { 325 self.border_width = Some(border_width); 326 self 327 } 328 child(mut self, child: &Widget) -> Self329 pub fn child(mut self, child: &Widget) -> Self { 330 self.child = Some(child.clone()); 331 self 332 } 333 resize_mode(mut self, resize_mode: ResizeMode) -> Self334 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 335 self.resize_mode = Some(resize_mode); 336 self 337 } 338 app_paintable(mut self, app_paintable: bool) -> Self339 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 340 self.app_paintable = Some(app_paintable); 341 self 342 } 343 can_default(mut self, can_default: bool) -> Self344 pub fn can_default(mut self, can_default: bool) -> Self { 345 self.can_default = Some(can_default); 346 self 347 } 348 can_focus(mut self, can_focus: bool) -> Self349 pub fn can_focus(mut self, can_focus: bool) -> Self { 350 self.can_focus = Some(can_focus); 351 self 352 } 353 events(mut self, events: gdk::EventMask) -> Self354 pub fn events(mut self, events: gdk::EventMask) -> Self { 355 self.events = Some(events); 356 self 357 } 358 expand(mut self, expand: bool) -> Self359 pub fn expand(mut self, expand: bool) -> Self { 360 self.expand = Some(expand); 361 self 362 } 363 364 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self365 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 366 self.focus_on_click = Some(focus_on_click); 367 self 368 } 369 halign(mut self, halign: Align) -> Self370 pub fn halign(mut self, halign: Align) -> Self { 371 self.halign = Some(halign); 372 self 373 } 374 has_default(mut self, has_default: bool) -> Self375 pub fn has_default(mut self, has_default: bool) -> Self { 376 self.has_default = Some(has_default); 377 self 378 } 379 has_focus(mut self, has_focus: bool) -> Self380 pub fn has_focus(mut self, has_focus: bool) -> Self { 381 self.has_focus = Some(has_focus); 382 self 383 } 384 has_tooltip(mut self, has_tooltip: bool) -> Self385 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 386 self.has_tooltip = Some(has_tooltip); 387 self 388 } 389 height_request(mut self, height_request: i32) -> Self390 pub fn height_request(mut self, height_request: i32) -> Self { 391 self.height_request = Some(height_request); 392 self 393 } 394 hexpand(mut self, hexpand: bool) -> Self395 pub fn hexpand(mut self, hexpand: bool) -> Self { 396 self.hexpand = Some(hexpand); 397 self 398 } 399 hexpand_set(mut self, hexpand_set: bool) -> Self400 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 401 self.hexpand_set = Some(hexpand_set); 402 self 403 } 404 is_focus(mut self, is_focus: bool) -> Self405 pub fn is_focus(mut self, is_focus: bool) -> Self { 406 self.is_focus = Some(is_focus); 407 self 408 } 409 margin(mut self, margin: i32) -> Self410 pub fn margin(mut self, margin: i32) -> Self { 411 self.margin = Some(margin); 412 self 413 } 414 margin_bottom(mut self, margin_bottom: i32) -> Self415 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 416 self.margin_bottom = Some(margin_bottom); 417 self 418 } 419 margin_end(mut self, margin_end: i32) -> Self420 pub fn margin_end(mut self, margin_end: i32) -> Self { 421 self.margin_end = Some(margin_end); 422 self 423 } 424 margin_start(mut self, margin_start: i32) -> Self425 pub fn margin_start(mut self, margin_start: i32) -> Self { 426 self.margin_start = Some(margin_start); 427 self 428 } 429 margin_top(mut self, margin_top: i32) -> Self430 pub fn margin_top(mut self, margin_top: i32) -> Self { 431 self.margin_top = Some(margin_top); 432 self 433 } 434 name(mut self, name: &str) -> Self435 pub fn name(mut self, name: &str) -> Self { 436 self.name = Some(name.to_string()); 437 self 438 } 439 no_show_all(mut self, no_show_all: bool) -> Self440 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 441 self.no_show_all = Some(no_show_all); 442 self 443 } 444 opacity(mut self, opacity: f64) -> Self445 pub fn opacity(mut self, opacity: f64) -> Self { 446 self.opacity = Some(opacity); 447 self 448 } 449 parent(mut self, parent: &Container) -> Self450 pub fn parent(mut self, parent: &Container) -> Self { 451 self.parent = Some(parent.clone()); 452 self 453 } 454 receives_default(mut self, receives_default: bool) -> Self455 pub fn receives_default(mut self, receives_default: bool) -> Self { 456 self.receives_default = Some(receives_default); 457 self 458 } 459 sensitive(mut self, sensitive: bool) -> Self460 pub fn sensitive(mut self, sensitive: bool) -> Self { 461 self.sensitive = Some(sensitive); 462 self 463 } 464 tooltip_markup(mut self, tooltip_markup: &str) -> Self465 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 466 self.tooltip_markup = Some(tooltip_markup.to_string()); 467 self 468 } 469 tooltip_text(mut self, tooltip_text: &str) -> Self470 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 471 self.tooltip_text = Some(tooltip_text.to_string()); 472 self 473 } 474 valign(mut self, valign: Align) -> Self475 pub fn valign(mut self, valign: Align) -> Self { 476 self.valign = Some(valign); 477 self 478 } 479 vexpand(mut self, vexpand: bool) -> Self480 pub fn vexpand(mut self, vexpand: bool) -> Self { 481 self.vexpand = Some(vexpand); 482 self 483 } 484 vexpand_set(mut self, vexpand_set: bool) -> Self485 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 486 self.vexpand_set = Some(vexpand_set); 487 self 488 } 489 visible(mut self, visible: bool) -> Self490 pub fn visible(mut self, visible: bool) -> Self { 491 self.visible = Some(visible); 492 self 493 } 494 width_request(mut self, width_request: i32) -> Self495 pub fn width_request(mut self, width_request: i32) -> Self { 496 self.width_request = Some(width_request); 497 self 498 } 499 } 500 501 pub const NONE_FLOW_BOX: Option<&FlowBox> = None; 502 503 pub trait FlowBoxExt: 'static { 504 #[cfg(any(feature = "v3_18", feature = "dox"))] bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( &self, model: Option<&P>, create_widget_func: Q, )505 fn bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( 506 &self, 507 model: Option<&P>, 508 create_widget_func: Q, 509 ); 510 get_activate_on_single_click(&self) -> bool511 fn get_activate_on_single_click(&self) -> bool; 512 get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild>513 fn get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild>; 514 515 #[cfg(any(feature = "v3_22_6", feature = "dox"))] get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>516 fn get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>; 517 get_column_spacing(&self) -> u32518 fn get_column_spacing(&self) -> u32; 519 get_homogeneous(&self) -> bool520 fn get_homogeneous(&self) -> bool; 521 get_max_children_per_line(&self) -> u32522 fn get_max_children_per_line(&self) -> u32; 523 get_min_children_per_line(&self) -> u32524 fn get_min_children_per_line(&self) -> u32; 525 get_row_spacing(&self) -> u32526 fn get_row_spacing(&self) -> u32; 527 get_selected_children(&self) -> Vec<FlowBoxChild>528 fn get_selected_children(&self) -> Vec<FlowBoxChild>; 529 get_selection_mode(&self) -> SelectionMode530 fn get_selection_mode(&self) -> SelectionMode; 531 insert<P: IsA<Widget>>(&self, widget: &P, position: i32)532 fn insert<P: IsA<Widget>>(&self, widget: &P, position: i32); 533 invalidate_filter(&self)534 fn invalidate_filter(&self); 535 invalidate_sort(&self)536 fn invalidate_sort(&self); 537 select_all(&self)538 fn select_all(&self); 539 select_child<P: IsA<FlowBoxChild>>(&self, child: &P)540 fn select_child<P: IsA<FlowBoxChild>>(&self, child: &P); 541 selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P)542 fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P); 543 set_activate_on_single_click(&self, single: bool)544 fn set_activate_on_single_click(&self, single: bool); 545 set_column_spacing(&self, spacing: u32)546 fn set_column_spacing(&self, spacing: u32); 547 set_filter_func(&self, filter_func: Option<Box<dyn Fn(&FlowBoxChild) -> bool + 'static>>)548 fn set_filter_func(&self, filter_func: Option<Box<dyn Fn(&FlowBoxChild) -> bool + 'static>>); 549 set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)550 fn set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P); 551 set_homogeneous(&self, homogeneous: bool)552 fn set_homogeneous(&self, homogeneous: bool); 553 set_max_children_per_line(&self, n_children: u32)554 fn set_max_children_per_line(&self, n_children: u32); 555 set_min_children_per_line(&self, n_children: u32)556 fn set_min_children_per_line(&self, n_children: u32); 557 set_row_spacing(&self, spacing: u32)558 fn set_row_spacing(&self, spacing: u32); 559 set_selection_mode(&self, mode: SelectionMode)560 fn set_selection_mode(&self, mode: SelectionMode); 561 set_sort_func( &self, sort_func: Option<Box<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, )562 fn set_sort_func( 563 &self, 564 sort_func: Option<Box<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 565 ); 566 set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)567 fn set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P); 568 unselect_all(&self)569 fn unselect_all(&self); 570 unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P)571 fn unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P); 572 connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId573 fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 574 emit_activate_cursor_child(&self)575 fn emit_activate_cursor_child(&self); 576 connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( &self, f: F, ) -> SignalHandlerId577 fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( 578 &self, 579 f: F, 580 ) -> SignalHandlerId; 581 connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId582 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( 583 &self, 584 f: F, 585 ) -> SignalHandlerId; 586 emit_move_cursor(&self, step: MovementStep, count: i32) -> bool587 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool; 588 connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId589 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 590 emit_select_all(&self)591 fn emit_select_all(&self); 592 connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId593 fn connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 594 connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId595 fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 596 emit_toggle_cursor_child(&self)597 fn emit_toggle_cursor_child(&self); 598 connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId599 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 600 emit_unselect_all(&self)601 fn emit_unselect_all(&self); 602 connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId603 fn connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( 604 &self, 605 f: F, 606 ) -> SignalHandlerId; 607 connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId608 fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( 609 &self, 610 f: F, 611 ) -> SignalHandlerId; 612 connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId613 fn connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 614 connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId615 fn connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>( 616 &self, 617 f: F, 618 ) -> SignalHandlerId; 619 connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId620 fn connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>( 621 &self, 622 f: F, 623 ) -> SignalHandlerId; 624 connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId625 fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 626 connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId627 fn connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( 628 &self, 629 f: F, 630 ) -> SignalHandlerId; 631 } 632 633 impl<O: IsA<FlowBox>> FlowBoxExt for O { 634 #[cfg(any(feature = "v3_18", feature = "dox"))] bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( &self, model: Option<&P>, create_widget_func: Q, )635 fn bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( 636 &self, 637 model: Option<&P>, 638 create_widget_func: Q, 639 ) { 640 let create_widget_func_data: Box_<Q> = Box::new(create_widget_func); 641 unsafe extern "C" fn create_widget_func_func< 642 P: IsA<gio::ListModel>, 643 Q: Fn(&glib::Object) -> Widget + 'static, 644 >( 645 item: *mut gobject_sys::GObject, 646 user_data: glib_sys::gpointer, 647 ) -> *mut gtk_sys::GtkWidget { 648 let item = from_glib_borrow(item); 649 let callback: &Q = &*(user_data as *mut _); 650 let res = (*callback)(&item); 651 res.to_glib_full() 652 } 653 let create_widget_func = Some(create_widget_func_func::<P, Q> as _); 654 unsafe extern "C" fn user_data_free_func_func< 655 P: IsA<gio::ListModel>, 656 Q: Fn(&glib::Object) -> Widget + 'static, 657 >( 658 data: glib_sys::gpointer, 659 ) { 660 let _callback: Box_<Q> = Box_::from_raw(data as *mut _); 661 } 662 let destroy_call4 = Some(user_data_free_func_func::<P, Q> as _); 663 let super_callback0: Box_<Q> = create_widget_func_data; 664 unsafe { 665 gtk_sys::gtk_flow_box_bind_model( 666 self.as_ref().to_glib_none().0, 667 model.map(|p| p.as_ref()).to_glib_none().0, 668 create_widget_func, 669 Box::into_raw(super_callback0) as *mut _, 670 destroy_call4, 671 ); 672 } 673 } 674 get_activate_on_single_click(&self) -> bool675 fn get_activate_on_single_click(&self) -> bool { 676 unsafe { 677 from_glib(gtk_sys::gtk_flow_box_get_activate_on_single_click( 678 self.as_ref().to_glib_none().0, 679 )) 680 } 681 } 682 get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild>683 fn get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild> { 684 unsafe { 685 from_glib_none(gtk_sys::gtk_flow_box_get_child_at_index( 686 self.as_ref().to_glib_none().0, 687 idx, 688 )) 689 } 690 } 691 692 #[cfg(any(feature = "v3_22_6", feature = "dox"))] get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>693 fn get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild> { 694 unsafe { 695 from_glib_none(gtk_sys::gtk_flow_box_get_child_at_pos( 696 self.as_ref().to_glib_none().0, 697 x, 698 y, 699 )) 700 } 701 } 702 get_column_spacing(&self) -> u32703 fn get_column_spacing(&self) -> u32 { 704 unsafe { gtk_sys::gtk_flow_box_get_column_spacing(self.as_ref().to_glib_none().0) } 705 } 706 get_homogeneous(&self) -> bool707 fn get_homogeneous(&self) -> bool { 708 unsafe { 709 from_glib(gtk_sys::gtk_flow_box_get_homogeneous( 710 self.as_ref().to_glib_none().0, 711 )) 712 } 713 } 714 get_max_children_per_line(&self) -> u32715 fn get_max_children_per_line(&self) -> u32 { 716 unsafe { gtk_sys::gtk_flow_box_get_max_children_per_line(self.as_ref().to_glib_none().0) } 717 } 718 get_min_children_per_line(&self) -> u32719 fn get_min_children_per_line(&self) -> u32 { 720 unsafe { gtk_sys::gtk_flow_box_get_min_children_per_line(self.as_ref().to_glib_none().0) } 721 } 722 get_row_spacing(&self) -> u32723 fn get_row_spacing(&self) -> u32 { 724 unsafe { gtk_sys::gtk_flow_box_get_row_spacing(self.as_ref().to_glib_none().0) } 725 } 726 get_selected_children(&self) -> Vec<FlowBoxChild>727 fn get_selected_children(&self) -> Vec<FlowBoxChild> { 728 unsafe { 729 FromGlibPtrContainer::from_glib_container(gtk_sys::gtk_flow_box_get_selected_children( 730 self.as_ref().to_glib_none().0, 731 )) 732 } 733 } 734 get_selection_mode(&self) -> SelectionMode735 fn get_selection_mode(&self) -> SelectionMode { 736 unsafe { 737 from_glib(gtk_sys::gtk_flow_box_get_selection_mode( 738 self.as_ref().to_glib_none().0, 739 )) 740 } 741 } 742 insert<P: IsA<Widget>>(&self, widget: &P, position: i32)743 fn insert<P: IsA<Widget>>(&self, widget: &P, position: i32) { 744 unsafe { 745 gtk_sys::gtk_flow_box_insert( 746 self.as_ref().to_glib_none().0, 747 widget.as_ref().to_glib_none().0, 748 position, 749 ); 750 } 751 } 752 invalidate_filter(&self)753 fn invalidate_filter(&self) { 754 unsafe { 755 gtk_sys::gtk_flow_box_invalidate_filter(self.as_ref().to_glib_none().0); 756 } 757 } 758 invalidate_sort(&self)759 fn invalidate_sort(&self) { 760 unsafe { 761 gtk_sys::gtk_flow_box_invalidate_sort(self.as_ref().to_glib_none().0); 762 } 763 } 764 select_all(&self)765 fn select_all(&self) { 766 unsafe { 767 gtk_sys::gtk_flow_box_select_all(self.as_ref().to_glib_none().0); 768 } 769 } 770 select_child<P: IsA<FlowBoxChild>>(&self, child: &P)771 fn select_child<P: IsA<FlowBoxChild>>(&self, child: &P) { 772 unsafe { 773 gtk_sys::gtk_flow_box_select_child( 774 self.as_ref().to_glib_none().0, 775 child.as_ref().to_glib_none().0, 776 ); 777 } 778 } 779 selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P)780 fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P) { 781 let func_data: P = func; 782 unsafe extern "C" fn func_func<P: FnMut(&FlowBox, &FlowBoxChild)>( 783 box_: *mut gtk_sys::GtkFlowBox, 784 child: *mut gtk_sys::GtkFlowBoxChild, 785 user_data: glib_sys::gpointer, 786 ) { 787 let box_ = from_glib_borrow(box_); 788 let child = from_glib_borrow(child); 789 let callback: *mut P = user_data as *const _ as usize as *mut P; 790 (*callback)(&box_, &child); 791 } 792 let func = Some(func_func::<P> as _); 793 let super_callback0: &P = &func_data; 794 unsafe { 795 gtk_sys::gtk_flow_box_selected_foreach( 796 self.as_ref().to_glib_none().0, 797 func, 798 super_callback0 as *const _ as usize as *mut _, 799 ); 800 } 801 } 802 set_activate_on_single_click(&self, single: bool)803 fn set_activate_on_single_click(&self, single: bool) { 804 unsafe { 805 gtk_sys::gtk_flow_box_set_activate_on_single_click( 806 self.as_ref().to_glib_none().0, 807 single.to_glib(), 808 ); 809 } 810 } 811 set_column_spacing(&self, spacing: u32)812 fn set_column_spacing(&self, spacing: u32) { 813 unsafe { 814 gtk_sys::gtk_flow_box_set_column_spacing(self.as_ref().to_glib_none().0, spacing); 815 } 816 } 817 set_filter_func(&self, filter_func: Option<Box<dyn Fn(&FlowBoxChild) -> bool + 'static>>)818 fn set_filter_func(&self, filter_func: Option<Box<dyn Fn(&FlowBoxChild) -> bool + 'static>>) { 819 let filter_func_data: Box_<Option<Box<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 820 Box::new(filter_func); 821 unsafe extern "C" fn filter_func_func( 822 child: *mut gtk_sys::GtkFlowBoxChild, 823 user_data: glib_sys::gpointer, 824 ) -> glib_sys::gboolean { 825 let child = from_glib_borrow(child); 826 let callback: &Option<Box<dyn Fn(&FlowBoxChild) -> bool + 'static>> = 827 &*(user_data as *mut _); 828 let res = if let Some(ref callback) = *callback { 829 callback(&child) 830 } else { 831 panic!("cannot get closure...") 832 }; 833 res.to_glib() 834 } 835 let filter_func = if filter_func_data.is_some() { 836 Some(filter_func_func as _) 837 } else { 838 None 839 }; 840 unsafe extern "C" fn destroy_func(data: glib_sys::gpointer) { 841 let _callback: Box_<Option<Box<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 842 Box_::from_raw(data as *mut _); 843 } 844 let destroy_call3 = Some(destroy_func as _); 845 let super_callback0: Box_<Option<Box<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 846 filter_func_data; 847 unsafe { 848 gtk_sys::gtk_flow_box_set_filter_func( 849 self.as_ref().to_glib_none().0, 850 filter_func, 851 Box::into_raw(super_callback0) as *mut _, 852 destroy_call3, 853 ); 854 } 855 } 856 set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)857 fn set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P) { 858 unsafe { 859 gtk_sys::gtk_flow_box_set_hadjustment( 860 self.as_ref().to_glib_none().0, 861 adjustment.as_ref().to_glib_none().0, 862 ); 863 } 864 } 865 set_homogeneous(&self, homogeneous: bool)866 fn set_homogeneous(&self, homogeneous: bool) { 867 unsafe { 868 gtk_sys::gtk_flow_box_set_homogeneous( 869 self.as_ref().to_glib_none().0, 870 homogeneous.to_glib(), 871 ); 872 } 873 } 874 set_max_children_per_line(&self, n_children: u32)875 fn set_max_children_per_line(&self, n_children: u32) { 876 unsafe { 877 gtk_sys::gtk_flow_box_set_max_children_per_line( 878 self.as_ref().to_glib_none().0, 879 n_children, 880 ); 881 } 882 } 883 set_min_children_per_line(&self, n_children: u32)884 fn set_min_children_per_line(&self, n_children: u32) { 885 unsafe { 886 gtk_sys::gtk_flow_box_set_min_children_per_line( 887 self.as_ref().to_glib_none().0, 888 n_children, 889 ); 890 } 891 } 892 set_row_spacing(&self, spacing: u32)893 fn set_row_spacing(&self, spacing: u32) { 894 unsafe { 895 gtk_sys::gtk_flow_box_set_row_spacing(self.as_ref().to_glib_none().0, spacing); 896 } 897 } 898 set_selection_mode(&self, mode: SelectionMode)899 fn set_selection_mode(&self, mode: SelectionMode) { 900 unsafe { 901 gtk_sys::gtk_flow_box_set_selection_mode( 902 self.as_ref().to_glib_none().0, 903 mode.to_glib(), 904 ); 905 } 906 } 907 set_sort_func( &self, sort_func: Option<Box<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, )908 fn set_sort_func( 909 &self, 910 sort_func: Option<Box<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 911 ) { 912 let sort_func_data: Box_< 913 Option<Box<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 914 > = Box::new(sort_func); 915 unsafe extern "C" fn sort_func_func( 916 child1: *mut gtk_sys::GtkFlowBoxChild, 917 child2: *mut gtk_sys::GtkFlowBoxChild, 918 user_data: glib_sys::gpointer, 919 ) -> libc::c_int { 920 let child1 = from_glib_borrow(child1); 921 let child2 = from_glib_borrow(child2); 922 let callback: &Option<Box<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>> = 923 &*(user_data as *mut _); 924 let res = if let Some(ref callback) = *callback { 925 callback(&child1, &child2) 926 } else { 927 panic!("cannot get closure...") 928 }; 929 res 930 } 931 let sort_func = if sort_func_data.is_some() { 932 Some(sort_func_func as _) 933 } else { 934 None 935 }; 936 unsafe extern "C" fn destroy_func(data: glib_sys::gpointer) { 937 let _callback: Box_< 938 Option<Box<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 939 > = Box_::from_raw(data as *mut _); 940 } 941 let destroy_call3 = Some(destroy_func as _); 942 let super_callback0: Box_< 943 Option<Box<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 944 > = sort_func_data; 945 unsafe { 946 gtk_sys::gtk_flow_box_set_sort_func( 947 self.as_ref().to_glib_none().0, 948 sort_func, 949 Box::into_raw(super_callback0) as *mut _, 950 destroy_call3, 951 ); 952 } 953 } 954 set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)955 fn set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P) { 956 unsafe { 957 gtk_sys::gtk_flow_box_set_vadjustment( 958 self.as_ref().to_glib_none().0, 959 adjustment.as_ref().to_glib_none().0, 960 ); 961 } 962 } 963 unselect_all(&self)964 fn unselect_all(&self) { 965 unsafe { 966 gtk_sys::gtk_flow_box_unselect_all(self.as_ref().to_glib_none().0); 967 } 968 } 969 unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P)970 fn unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P) { 971 unsafe { 972 gtk_sys::gtk_flow_box_unselect_child( 973 self.as_ref().to_glib_none().0, 974 child.as_ref().to_glib_none().0, 975 ); 976 } 977 } 978 connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId979 fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 980 unsafe extern "C" fn activate_cursor_child_trampoline<P, F: Fn(&P) + 'static>( 981 this: *mut gtk_sys::GtkFlowBox, 982 f: glib_sys::gpointer, 983 ) where 984 P: IsA<FlowBox>, 985 { 986 let f: &F = &*(f as *const F); 987 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 988 } 989 unsafe { 990 let f: Box_<F> = Box_::new(f); 991 connect_raw( 992 self.as_ptr() as *mut _, 993 b"activate-cursor-child\0".as_ptr() as *const _, 994 Some(transmute( 995 activate_cursor_child_trampoline::<Self, F> as usize, 996 )), 997 Box_::into_raw(f), 998 ) 999 } 1000 } 1001 emit_activate_cursor_child(&self)1002 fn emit_activate_cursor_child(&self) { 1003 let _ = unsafe { 1004 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1005 .emit("activate-cursor-child", &[]) 1006 .unwrap() 1007 }; 1008 } 1009 connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( &self, f: F, ) -> SignalHandlerId1010 fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( 1011 &self, 1012 f: F, 1013 ) -> SignalHandlerId { 1014 unsafe extern "C" fn child_activated_trampoline<P, F: Fn(&P, &FlowBoxChild) + 'static>( 1015 this: *mut gtk_sys::GtkFlowBox, 1016 child: *mut gtk_sys::GtkFlowBoxChild, 1017 f: glib_sys::gpointer, 1018 ) where 1019 P: IsA<FlowBox>, 1020 { 1021 let f: &F = &*(f as *const F); 1022 f( 1023 &FlowBox::from_glib_borrow(this).unsafe_cast(), 1024 &from_glib_borrow(child), 1025 ) 1026 } 1027 unsafe { 1028 let f: Box_<F> = Box_::new(f); 1029 connect_raw( 1030 self.as_ptr() as *mut _, 1031 b"child-activated\0".as_ptr() as *const _, 1032 Some(transmute(child_activated_trampoline::<Self, F> as usize)), 1033 Box_::into_raw(f), 1034 ) 1035 } 1036 } 1037 connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId1038 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( 1039 &self, 1040 f: F, 1041 ) -> SignalHandlerId { 1042 unsafe extern "C" fn move_cursor_trampoline< 1043 P, 1044 F: Fn(&P, MovementStep, i32) -> bool + 'static, 1045 >( 1046 this: *mut gtk_sys::GtkFlowBox, 1047 step: gtk_sys::GtkMovementStep, 1048 count: libc::c_int, 1049 f: glib_sys::gpointer, 1050 ) -> glib_sys::gboolean 1051 where 1052 P: IsA<FlowBox>, 1053 { 1054 let f: &F = &*(f as *const F); 1055 f( 1056 &FlowBox::from_glib_borrow(this).unsafe_cast(), 1057 from_glib(step), 1058 count, 1059 ) 1060 .to_glib() 1061 } 1062 unsafe { 1063 let f: Box_<F> = Box_::new(f); 1064 connect_raw( 1065 self.as_ptr() as *mut _, 1066 b"move-cursor\0".as_ptr() as *const _, 1067 Some(transmute(move_cursor_trampoline::<Self, F> as usize)), 1068 Box_::into_raw(f), 1069 ) 1070 } 1071 } 1072 emit_move_cursor(&self, step: MovementStep, count: i32) -> bool1073 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool { 1074 let res = unsafe { 1075 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1076 .emit("move-cursor", &[&step, &count]) 1077 .unwrap() 1078 }; 1079 res.unwrap().get().unwrap() 1080 } 1081 connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1082 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1083 unsafe extern "C" fn select_all_trampoline<P, F: Fn(&P) + 'static>( 1084 this: *mut gtk_sys::GtkFlowBox, 1085 f: glib_sys::gpointer, 1086 ) where 1087 P: IsA<FlowBox>, 1088 { 1089 let f: &F = &*(f as *const F); 1090 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1091 } 1092 unsafe { 1093 let f: Box_<F> = Box_::new(f); 1094 connect_raw( 1095 self.as_ptr() as *mut _, 1096 b"select-all\0".as_ptr() as *const _, 1097 Some(transmute(select_all_trampoline::<Self, F> as usize)), 1098 Box_::into_raw(f), 1099 ) 1100 } 1101 } 1102 emit_select_all(&self)1103 fn emit_select_all(&self) { 1104 let _ = unsafe { 1105 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1106 .emit("select-all", &[]) 1107 .unwrap() 1108 }; 1109 } 1110 connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1111 fn connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1112 unsafe extern "C" fn selected_children_changed_trampoline<P, F: Fn(&P) + 'static>( 1113 this: *mut gtk_sys::GtkFlowBox, 1114 f: glib_sys::gpointer, 1115 ) where 1116 P: IsA<FlowBox>, 1117 { 1118 let f: &F = &*(f as *const F); 1119 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1120 } 1121 unsafe { 1122 let f: Box_<F> = Box_::new(f); 1123 connect_raw( 1124 self.as_ptr() as *mut _, 1125 b"selected-children-changed\0".as_ptr() as *const _, 1126 Some(transmute( 1127 selected_children_changed_trampoline::<Self, F> as usize, 1128 )), 1129 Box_::into_raw(f), 1130 ) 1131 } 1132 } 1133 connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1134 fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1135 unsafe extern "C" fn toggle_cursor_child_trampoline<P, F: Fn(&P) + 'static>( 1136 this: *mut gtk_sys::GtkFlowBox, 1137 f: glib_sys::gpointer, 1138 ) where 1139 P: IsA<FlowBox>, 1140 { 1141 let f: &F = &*(f as *const F); 1142 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1143 } 1144 unsafe { 1145 let f: Box_<F> = Box_::new(f); 1146 connect_raw( 1147 self.as_ptr() as *mut _, 1148 b"toggle-cursor-child\0".as_ptr() as *const _, 1149 Some(transmute( 1150 toggle_cursor_child_trampoline::<Self, F> as usize, 1151 )), 1152 Box_::into_raw(f), 1153 ) 1154 } 1155 } 1156 emit_toggle_cursor_child(&self)1157 fn emit_toggle_cursor_child(&self) { 1158 let _ = unsafe { 1159 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1160 .emit("toggle-cursor-child", &[]) 1161 .unwrap() 1162 }; 1163 } 1164 connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1165 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1166 unsafe extern "C" fn unselect_all_trampoline<P, F: Fn(&P) + 'static>( 1167 this: *mut gtk_sys::GtkFlowBox, 1168 f: glib_sys::gpointer, 1169 ) where 1170 P: IsA<FlowBox>, 1171 { 1172 let f: &F = &*(f as *const F); 1173 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1174 } 1175 unsafe { 1176 let f: Box_<F> = Box_::new(f); 1177 connect_raw( 1178 self.as_ptr() as *mut _, 1179 b"unselect-all\0".as_ptr() as *const _, 1180 Some(transmute(unselect_all_trampoline::<Self, F> as usize)), 1181 Box_::into_raw(f), 1182 ) 1183 } 1184 } 1185 emit_unselect_all(&self)1186 fn emit_unselect_all(&self) { 1187 let _ = unsafe { 1188 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1189 .emit("unselect-all", &[]) 1190 .unwrap() 1191 }; 1192 } 1193 connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1194 fn connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( 1195 &self, 1196 f: F, 1197 ) -> SignalHandlerId { 1198 unsafe extern "C" fn notify_activate_on_single_click_trampoline<P, F: Fn(&P) + 'static>( 1199 this: *mut gtk_sys::GtkFlowBox, 1200 _param_spec: glib_sys::gpointer, 1201 f: glib_sys::gpointer, 1202 ) where 1203 P: IsA<FlowBox>, 1204 { 1205 let f: &F = &*(f as *const F); 1206 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1207 } 1208 unsafe { 1209 let f: Box_<F> = Box_::new(f); 1210 connect_raw( 1211 self.as_ptr() as *mut _, 1212 b"notify::activate-on-single-click\0".as_ptr() as *const _, 1213 Some(transmute( 1214 notify_activate_on_single_click_trampoline::<Self, F> as usize, 1215 )), 1216 Box_::into_raw(f), 1217 ) 1218 } 1219 } 1220 connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1221 fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( 1222 &self, 1223 f: F, 1224 ) -> SignalHandlerId { 1225 unsafe extern "C" fn notify_column_spacing_trampoline<P, F: Fn(&P) + 'static>( 1226 this: *mut gtk_sys::GtkFlowBox, 1227 _param_spec: glib_sys::gpointer, 1228 f: glib_sys::gpointer, 1229 ) where 1230 P: IsA<FlowBox>, 1231 { 1232 let f: &F = &*(f as *const F); 1233 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1234 } 1235 unsafe { 1236 let f: Box_<F> = Box_::new(f); 1237 connect_raw( 1238 self.as_ptr() as *mut _, 1239 b"notify::column-spacing\0".as_ptr() as *const _, 1240 Some(transmute( 1241 notify_column_spacing_trampoline::<Self, F> as usize, 1242 )), 1243 Box_::into_raw(f), 1244 ) 1245 } 1246 } 1247 connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1248 fn connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1249 unsafe extern "C" fn notify_homogeneous_trampoline<P, F: Fn(&P) + 'static>( 1250 this: *mut gtk_sys::GtkFlowBox, 1251 _param_spec: glib_sys::gpointer, 1252 f: glib_sys::gpointer, 1253 ) where 1254 P: IsA<FlowBox>, 1255 { 1256 let f: &F = &*(f as *const F); 1257 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1258 } 1259 unsafe { 1260 let f: Box_<F> = Box_::new(f); 1261 connect_raw( 1262 self.as_ptr() as *mut _, 1263 b"notify::homogeneous\0".as_ptr() as *const _, 1264 Some(transmute(notify_homogeneous_trampoline::<Self, F> as usize)), 1265 Box_::into_raw(f), 1266 ) 1267 } 1268 } 1269 connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1270 fn connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>( 1271 &self, 1272 f: F, 1273 ) -> SignalHandlerId { 1274 unsafe extern "C" fn notify_max_children_per_line_trampoline<P, F: Fn(&P) + 'static>( 1275 this: *mut gtk_sys::GtkFlowBox, 1276 _param_spec: glib_sys::gpointer, 1277 f: glib_sys::gpointer, 1278 ) where 1279 P: IsA<FlowBox>, 1280 { 1281 let f: &F = &*(f as *const F); 1282 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1283 } 1284 unsafe { 1285 let f: Box_<F> = Box_::new(f); 1286 connect_raw( 1287 self.as_ptr() as *mut _, 1288 b"notify::max-children-per-line\0".as_ptr() as *const _, 1289 Some(transmute( 1290 notify_max_children_per_line_trampoline::<Self, F> as usize, 1291 )), 1292 Box_::into_raw(f), 1293 ) 1294 } 1295 } 1296 connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1297 fn connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>( 1298 &self, 1299 f: F, 1300 ) -> SignalHandlerId { 1301 unsafe extern "C" fn notify_min_children_per_line_trampoline<P, F: Fn(&P) + 'static>( 1302 this: *mut gtk_sys::GtkFlowBox, 1303 _param_spec: glib_sys::gpointer, 1304 f: glib_sys::gpointer, 1305 ) where 1306 P: IsA<FlowBox>, 1307 { 1308 let f: &F = &*(f as *const F); 1309 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1310 } 1311 unsafe { 1312 let f: Box_<F> = Box_::new(f); 1313 connect_raw( 1314 self.as_ptr() as *mut _, 1315 b"notify::min-children-per-line\0".as_ptr() as *const _, 1316 Some(transmute( 1317 notify_min_children_per_line_trampoline::<Self, F> as usize, 1318 )), 1319 Box_::into_raw(f), 1320 ) 1321 } 1322 } 1323 connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1324 fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1325 unsafe extern "C" fn notify_row_spacing_trampoline<P, F: Fn(&P) + 'static>( 1326 this: *mut gtk_sys::GtkFlowBox, 1327 _param_spec: glib_sys::gpointer, 1328 f: glib_sys::gpointer, 1329 ) where 1330 P: IsA<FlowBox>, 1331 { 1332 let f: &F = &*(f as *const F); 1333 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1334 } 1335 unsafe { 1336 let f: Box_<F> = Box_::new(f); 1337 connect_raw( 1338 self.as_ptr() as *mut _, 1339 b"notify::row-spacing\0".as_ptr() as *const _, 1340 Some(transmute(notify_row_spacing_trampoline::<Self, F> as usize)), 1341 Box_::into_raw(f), 1342 ) 1343 } 1344 } 1345 connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1346 fn connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( 1347 &self, 1348 f: F, 1349 ) -> SignalHandlerId { 1350 unsafe extern "C" fn notify_selection_mode_trampoline<P, F: Fn(&P) + 'static>( 1351 this: *mut gtk_sys::GtkFlowBox, 1352 _param_spec: glib_sys::gpointer, 1353 f: glib_sys::gpointer, 1354 ) where 1355 P: IsA<FlowBox>, 1356 { 1357 let f: &F = &*(f as *const F); 1358 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1359 } 1360 unsafe { 1361 let f: Box_<F> = Box_::new(f); 1362 connect_raw( 1363 self.as_ptr() as *mut _, 1364 b"notify::selection-mode\0".as_ptr() as *const _, 1365 Some(transmute( 1366 notify_selection_mode_trampoline::<Self, F> as usize, 1367 )), 1368 Box_::into_raw(f), 1369 ) 1370 } 1371 } 1372 } 1373 1374 impl fmt::Display for FlowBox { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1375 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1376 write!(f, "FlowBox") 1377 } 1378 } 1379