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 Orientation; 32 use ResizeMode; 33 use SelectionMode; 34 use Widget; 35 36 glib_wrapper! { 37 pub struct FlowBox(Object<gtk_sys::GtkFlowBox, gtk_sys::GtkFlowBoxClass, FlowBoxClass>) @extends Container, Widget, @implements Buildable, Orientable; 38 39 match fn { 40 get_type => || gtk_sys::gtk_flow_box_get_type(), 41 } 42 } 43 44 impl FlowBox { new() -> FlowBox45 pub fn new() -> FlowBox { 46 assert_initialized_main_thread!(); 47 unsafe { Widget::from_glib_none(gtk_sys::gtk_flow_box_new()).unsafe_cast() } 48 } 49 } 50 51 impl Default for FlowBox { default() -> Self52 fn default() -> Self { 53 Self::new() 54 } 55 } 56 57 #[derive(Clone, Default)] 58 pub struct FlowBoxBuilder { 59 activate_on_single_click: Option<bool>, 60 column_spacing: Option<u32>, 61 homogeneous: Option<bool>, 62 max_children_per_line: Option<u32>, 63 min_children_per_line: Option<u32>, 64 row_spacing: Option<u32>, 65 selection_mode: Option<SelectionMode>, 66 border_width: Option<u32>, 67 child: Option<Widget>, 68 resize_mode: Option<ResizeMode>, 69 app_paintable: Option<bool>, 70 can_default: Option<bool>, 71 can_focus: Option<bool>, 72 events: Option<gdk::EventMask>, 73 expand: Option<bool>, 74 #[cfg(any(feature = "v3_20", feature = "dox"))] 75 focus_on_click: Option<bool>, 76 halign: Option<Align>, 77 has_default: Option<bool>, 78 has_focus: Option<bool>, 79 has_tooltip: Option<bool>, 80 height_request: Option<i32>, 81 hexpand: Option<bool>, 82 hexpand_set: Option<bool>, 83 is_focus: Option<bool>, 84 margin: Option<i32>, 85 margin_bottom: Option<i32>, 86 margin_end: Option<i32>, 87 margin_start: Option<i32>, 88 margin_top: Option<i32>, 89 name: Option<String>, 90 no_show_all: Option<bool>, 91 opacity: Option<f64>, 92 parent: Option<Container>, 93 receives_default: Option<bool>, 94 sensitive: Option<bool>, 95 tooltip_markup: Option<String>, 96 tooltip_text: Option<String>, 97 valign: Option<Align>, 98 vexpand: Option<bool>, 99 vexpand_set: Option<bool>, 100 visible: Option<bool>, 101 width_request: Option<i32>, 102 orientation: Option<Orientation>, 103 } 104 105 impl FlowBoxBuilder { new() -> Self106 pub fn new() -> Self { 107 Self::default() 108 } 109 build(self) -> FlowBox110 pub fn build(self) -> FlowBox { 111 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 112 if let Some(ref activate_on_single_click) = self.activate_on_single_click { 113 properties.push(("activate-on-single-click", activate_on_single_click)); 114 } 115 if let Some(ref column_spacing) = self.column_spacing { 116 properties.push(("column-spacing", column_spacing)); 117 } 118 if let Some(ref homogeneous) = self.homogeneous { 119 properties.push(("homogeneous", homogeneous)); 120 } 121 if let Some(ref max_children_per_line) = self.max_children_per_line { 122 properties.push(("max-children-per-line", max_children_per_line)); 123 } 124 if let Some(ref min_children_per_line) = self.min_children_per_line { 125 properties.push(("min-children-per-line", min_children_per_line)); 126 } 127 if let Some(ref row_spacing) = self.row_spacing { 128 properties.push(("row-spacing", row_spacing)); 129 } 130 if let Some(ref selection_mode) = self.selection_mode { 131 properties.push(("selection-mode", selection_mode)); 132 } 133 if let Some(ref border_width) = self.border_width { 134 properties.push(("border-width", border_width)); 135 } 136 if let Some(ref child) = self.child { 137 properties.push(("child", child)); 138 } 139 if let Some(ref resize_mode) = self.resize_mode { 140 properties.push(("resize-mode", resize_mode)); 141 } 142 if let Some(ref app_paintable) = self.app_paintable { 143 properties.push(("app-paintable", app_paintable)); 144 } 145 if let Some(ref can_default) = self.can_default { 146 properties.push(("can-default", can_default)); 147 } 148 if let Some(ref can_focus) = self.can_focus { 149 properties.push(("can-focus", can_focus)); 150 } 151 if let Some(ref events) = self.events { 152 properties.push(("events", events)); 153 } 154 if let Some(ref expand) = self.expand { 155 properties.push(("expand", expand)); 156 } 157 #[cfg(any(feature = "v3_20", feature = "dox"))] 158 { 159 if let Some(ref focus_on_click) = self.focus_on_click { 160 properties.push(("focus-on-click", focus_on_click)); 161 } 162 } 163 if let Some(ref halign) = self.halign { 164 properties.push(("halign", halign)); 165 } 166 if let Some(ref has_default) = self.has_default { 167 properties.push(("has-default", has_default)); 168 } 169 if let Some(ref has_focus) = self.has_focus { 170 properties.push(("has-focus", has_focus)); 171 } 172 if let Some(ref has_tooltip) = self.has_tooltip { 173 properties.push(("has-tooltip", has_tooltip)); 174 } 175 if let Some(ref height_request) = self.height_request { 176 properties.push(("height-request", height_request)); 177 } 178 if let Some(ref hexpand) = self.hexpand { 179 properties.push(("hexpand", hexpand)); 180 } 181 if let Some(ref hexpand_set) = self.hexpand_set { 182 properties.push(("hexpand-set", hexpand_set)); 183 } 184 if let Some(ref is_focus) = self.is_focus { 185 properties.push(("is-focus", is_focus)); 186 } 187 if let Some(ref margin) = self.margin { 188 properties.push(("margin", margin)); 189 } 190 if let Some(ref margin_bottom) = self.margin_bottom { 191 properties.push(("margin-bottom", margin_bottom)); 192 } 193 if let Some(ref margin_end) = self.margin_end { 194 properties.push(("margin-end", margin_end)); 195 } 196 if let Some(ref margin_start) = self.margin_start { 197 properties.push(("margin-start", margin_start)); 198 } 199 if let Some(ref margin_top) = self.margin_top { 200 properties.push(("margin-top", margin_top)); 201 } 202 if let Some(ref name) = self.name { 203 properties.push(("name", name)); 204 } 205 if let Some(ref no_show_all) = self.no_show_all { 206 properties.push(("no-show-all", no_show_all)); 207 } 208 if let Some(ref opacity) = self.opacity { 209 properties.push(("opacity", opacity)); 210 } 211 if let Some(ref parent) = self.parent { 212 properties.push(("parent", parent)); 213 } 214 if let Some(ref receives_default) = self.receives_default { 215 properties.push(("receives-default", receives_default)); 216 } 217 if let Some(ref sensitive) = self.sensitive { 218 properties.push(("sensitive", sensitive)); 219 } 220 if let Some(ref tooltip_markup) = self.tooltip_markup { 221 properties.push(("tooltip-markup", tooltip_markup)); 222 } 223 if let Some(ref tooltip_text) = self.tooltip_text { 224 properties.push(("tooltip-text", tooltip_text)); 225 } 226 if let Some(ref valign) = self.valign { 227 properties.push(("valign", valign)); 228 } 229 if let Some(ref vexpand) = self.vexpand { 230 properties.push(("vexpand", vexpand)); 231 } 232 if let Some(ref vexpand_set) = self.vexpand_set { 233 properties.push(("vexpand-set", vexpand_set)); 234 } 235 if let Some(ref visible) = self.visible { 236 properties.push(("visible", visible)); 237 } 238 if let Some(ref width_request) = self.width_request { 239 properties.push(("width-request", width_request)); 240 } 241 if let Some(ref orientation) = self.orientation { 242 properties.push(("orientation", orientation)); 243 } 244 glib::Object::new(FlowBox::static_type(), &properties) 245 .expect("object new") 246 .downcast() 247 .expect("downcast") 248 } 249 activate_on_single_click(mut self, activate_on_single_click: bool) -> Self250 pub fn activate_on_single_click(mut self, activate_on_single_click: bool) -> Self { 251 self.activate_on_single_click = Some(activate_on_single_click); 252 self 253 } 254 column_spacing(mut self, column_spacing: u32) -> Self255 pub fn column_spacing(mut self, column_spacing: u32) -> Self { 256 self.column_spacing = Some(column_spacing); 257 self 258 } 259 homogeneous(mut self, homogeneous: bool) -> Self260 pub fn homogeneous(mut self, homogeneous: bool) -> Self { 261 self.homogeneous = Some(homogeneous); 262 self 263 } 264 max_children_per_line(mut self, max_children_per_line: u32) -> Self265 pub fn max_children_per_line(mut self, max_children_per_line: u32) -> Self { 266 self.max_children_per_line = Some(max_children_per_line); 267 self 268 } 269 min_children_per_line(mut self, min_children_per_line: u32) -> Self270 pub fn min_children_per_line(mut self, min_children_per_line: u32) -> Self { 271 self.min_children_per_line = Some(min_children_per_line); 272 self 273 } 274 row_spacing(mut self, row_spacing: u32) -> Self275 pub fn row_spacing(mut self, row_spacing: u32) -> Self { 276 self.row_spacing = Some(row_spacing); 277 self 278 } 279 selection_mode(mut self, selection_mode: SelectionMode) -> Self280 pub fn selection_mode(mut self, selection_mode: SelectionMode) -> Self { 281 self.selection_mode = Some(selection_mode); 282 self 283 } 284 border_width(mut self, border_width: u32) -> Self285 pub fn border_width(mut self, border_width: u32) -> Self { 286 self.border_width = Some(border_width); 287 self 288 } 289 child<P: IsA<Widget>>(mut self, child: &P) -> Self290 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 291 self.child = Some(child.clone().upcast()); 292 self 293 } 294 resize_mode(mut self, resize_mode: ResizeMode) -> Self295 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 296 self.resize_mode = Some(resize_mode); 297 self 298 } 299 app_paintable(mut self, app_paintable: bool) -> Self300 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 301 self.app_paintable = Some(app_paintable); 302 self 303 } 304 can_default(mut self, can_default: bool) -> Self305 pub fn can_default(mut self, can_default: bool) -> Self { 306 self.can_default = Some(can_default); 307 self 308 } 309 can_focus(mut self, can_focus: bool) -> Self310 pub fn can_focus(mut self, can_focus: bool) -> Self { 311 self.can_focus = Some(can_focus); 312 self 313 } 314 events(mut self, events: gdk::EventMask) -> Self315 pub fn events(mut self, events: gdk::EventMask) -> Self { 316 self.events = Some(events); 317 self 318 } 319 expand(mut self, expand: bool) -> Self320 pub fn expand(mut self, expand: bool) -> Self { 321 self.expand = Some(expand); 322 self 323 } 324 325 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self326 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 327 self.focus_on_click = Some(focus_on_click); 328 self 329 } 330 halign(mut self, halign: Align) -> Self331 pub fn halign(mut self, halign: Align) -> Self { 332 self.halign = Some(halign); 333 self 334 } 335 has_default(mut self, has_default: bool) -> Self336 pub fn has_default(mut self, has_default: bool) -> Self { 337 self.has_default = Some(has_default); 338 self 339 } 340 has_focus(mut self, has_focus: bool) -> Self341 pub fn has_focus(mut self, has_focus: bool) -> Self { 342 self.has_focus = Some(has_focus); 343 self 344 } 345 has_tooltip(mut self, has_tooltip: bool) -> Self346 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 347 self.has_tooltip = Some(has_tooltip); 348 self 349 } 350 height_request(mut self, height_request: i32) -> Self351 pub fn height_request(mut self, height_request: i32) -> Self { 352 self.height_request = Some(height_request); 353 self 354 } 355 hexpand(mut self, hexpand: bool) -> Self356 pub fn hexpand(mut self, hexpand: bool) -> Self { 357 self.hexpand = Some(hexpand); 358 self 359 } 360 hexpand_set(mut self, hexpand_set: bool) -> Self361 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 362 self.hexpand_set = Some(hexpand_set); 363 self 364 } 365 is_focus(mut self, is_focus: bool) -> Self366 pub fn is_focus(mut self, is_focus: bool) -> Self { 367 self.is_focus = Some(is_focus); 368 self 369 } 370 margin(mut self, margin: i32) -> Self371 pub fn margin(mut self, margin: i32) -> Self { 372 self.margin = Some(margin); 373 self 374 } 375 margin_bottom(mut self, margin_bottom: i32) -> Self376 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 377 self.margin_bottom = Some(margin_bottom); 378 self 379 } 380 margin_end(mut self, margin_end: i32) -> Self381 pub fn margin_end(mut self, margin_end: i32) -> Self { 382 self.margin_end = Some(margin_end); 383 self 384 } 385 margin_start(mut self, margin_start: i32) -> Self386 pub fn margin_start(mut self, margin_start: i32) -> Self { 387 self.margin_start = Some(margin_start); 388 self 389 } 390 margin_top(mut self, margin_top: i32) -> Self391 pub fn margin_top(mut self, margin_top: i32) -> Self { 392 self.margin_top = Some(margin_top); 393 self 394 } 395 name(mut self, name: &str) -> Self396 pub fn name(mut self, name: &str) -> Self { 397 self.name = Some(name.to_string()); 398 self 399 } 400 no_show_all(mut self, no_show_all: bool) -> Self401 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 402 self.no_show_all = Some(no_show_all); 403 self 404 } 405 opacity(mut self, opacity: f64) -> Self406 pub fn opacity(mut self, opacity: f64) -> Self { 407 self.opacity = Some(opacity); 408 self 409 } 410 parent<P: IsA<Container>>(mut self, parent: &P) -> Self411 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 412 self.parent = Some(parent.clone().upcast()); 413 self 414 } 415 receives_default(mut self, receives_default: bool) -> Self416 pub fn receives_default(mut self, receives_default: bool) -> Self { 417 self.receives_default = Some(receives_default); 418 self 419 } 420 sensitive(mut self, sensitive: bool) -> Self421 pub fn sensitive(mut self, sensitive: bool) -> Self { 422 self.sensitive = Some(sensitive); 423 self 424 } 425 tooltip_markup(mut self, tooltip_markup: &str) -> Self426 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 427 self.tooltip_markup = Some(tooltip_markup.to_string()); 428 self 429 } 430 tooltip_text(mut self, tooltip_text: &str) -> Self431 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 432 self.tooltip_text = Some(tooltip_text.to_string()); 433 self 434 } 435 valign(mut self, valign: Align) -> Self436 pub fn valign(mut self, valign: Align) -> Self { 437 self.valign = Some(valign); 438 self 439 } 440 vexpand(mut self, vexpand: bool) -> Self441 pub fn vexpand(mut self, vexpand: bool) -> Self { 442 self.vexpand = Some(vexpand); 443 self 444 } 445 vexpand_set(mut self, vexpand_set: bool) -> Self446 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 447 self.vexpand_set = Some(vexpand_set); 448 self 449 } 450 visible(mut self, visible: bool) -> Self451 pub fn visible(mut self, visible: bool) -> Self { 452 self.visible = Some(visible); 453 self 454 } 455 width_request(mut self, width_request: i32) -> Self456 pub fn width_request(mut self, width_request: i32) -> Self { 457 self.width_request = Some(width_request); 458 self 459 } 460 orientation(mut self, orientation: Orientation) -> Self461 pub fn orientation(mut self, orientation: Orientation) -> Self { 462 self.orientation = Some(orientation); 463 self 464 } 465 } 466 467 pub const NONE_FLOW_BOX: Option<&FlowBox> = None; 468 469 pub trait FlowBoxExt: 'static { 470 #[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, )471 fn bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( 472 &self, 473 model: Option<&P>, 474 create_widget_func: Q, 475 ); 476 get_activate_on_single_click(&self) -> bool477 fn get_activate_on_single_click(&self) -> bool; 478 get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild>479 fn get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild>; 480 481 #[cfg(any(feature = "v3_22_6", feature = "dox"))] get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>482 fn get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>; 483 get_column_spacing(&self) -> u32484 fn get_column_spacing(&self) -> u32; 485 get_homogeneous(&self) -> bool486 fn get_homogeneous(&self) -> bool; 487 get_max_children_per_line(&self) -> u32488 fn get_max_children_per_line(&self) -> u32; 489 get_min_children_per_line(&self) -> u32490 fn get_min_children_per_line(&self) -> u32; 491 get_row_spacing(&self) -> u32492 fn get_row_spacing(&self) -> u32; 493 get_selected_children(&self) -> Vec<FlowBoxChild>494 fn get_selected_children(&self) -> Vec<FlowBoxChild>; 495 get_selection_mode(&self) -> SelectionMode496 fn get_selection_mode(&self) -> SelectionMode; 497 insert<P: IsA<Widget>>(&self, widget: &P, position: i32)498 fn insert<P: IsA<Widget>>(&self, widget: &P, position: i32); 499 invalidate_filter(&self)500 fn invalidate_filter(&self); 501 invalidate_sort(&self)502 fn invalidate_sort(&self); 503 select_all(&self)504 fn select_all(&self); 505 select_child<P: IsA<FlowBoxChild>>(&self, child: &P)506 fn select_child<P: IsA<FlowBoxChild>>(&self, child: &P); 507 selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P)508 fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P); 509 set_activate_on_single_click(&self, single: bool)510 fn set_activate_on_single_click(&self, single: bool); 511 set_column_spacing(&self, spacing: u32)512 fn set_column_spacing(&self, spacing: u32); 513 set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>)514 fn set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>); 515 set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)516 fn set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P); 517 set_homogeneous(&self, homogeneous: bool)518 fn set_homogeneous(&self, homogeneous: bool); 519 set_max_children_per_line(&self, n_children: u32)520 fn set_max_children_per_line(&self, n_children: u32); 521 set_min_children_per_line(&self, n_children: u32)522 fn set_min_children_per_line(&self, n_children: u32); 523 set_row_spacing(&self, spacing: u32)524 fn set_row_spacing(&self, spacing: u32); 525 set_selection_mode(&self, mode: SelectionMode)526 fn set_selection_mode(&self, mode: SelectionMode); 527 set_sort_func( &self, sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, )528 fn set_sort_func( 529 &self, 530 sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 531 ); 532 set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)533 fn set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P); 534 unselect_all(&self)535 fn unselect_all(&self); 536 unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P)537 fn unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P); 538 connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId539 fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 540 emit_activate_cursor_child(&self)541 fn emit_activate_cursor_child(&self); 542 connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( &self, f: F, ) -> SignalHandlerId543 fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( 544 &self, 545 f: F, 546 ) -> SignalHandlerId; 547 connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId548 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( 549 &self, 550 f: F, 551 ) -> SignalHandlerId; 552 emit_move_cursor(&self, step: MovementStep, count: i32) -> bool553 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool; 554 connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId555 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 556 emit_select_all(&self)557 fn emit_select_all(&self); 558 connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId559 fn connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 560 connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId561 fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 562 emit_toggle_cursor_child(&self)563 fn emit_toggle_cursor_child(&self); 564 connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId565 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 566 emit_unselect_all(&self)567 fn emit_unselect_all(&self); 568 connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId569 fn connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( 570 &self, 571 f: F, 572 ) -> SignalHandlerId; 573 connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId574 fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( 575 &self, 576 f: F, 577 ) -> SignalHandlerId; 578 connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId579 fn connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 580 connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId581 fn connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>( 582 &self, 583 f: F, 584 ) -> SignalHandlerId; 585 connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId586 fn connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>( 587 &self, 588 f: F, 589 ) -> SignalHandlerId; 590 connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId591 fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 592 connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId593 fn connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( 594 &self, 595 f: F, 596 ) -> SignalHandlerId; 597 } 598 599 impl<O: IsA<FlowBox>> FlowBoxExt for O { 600 #[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, )601 fn bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( 602 &self, 603 model: Option<&P>, 604 create_widget_func: Q, 605 ) { 606 let create_widget_func_data: Box_<Q> = Box_::new(create_widget_func); 607 unsafe extern "C" fn create_widget_func_func< 608 P: IsA<gio::ListModel>, 609 Q: Fn(&glib::Object) -> Widget + 'static, 610 >( 611 item: *mut gobject_sys::GObject, 612 user_data: glib_sys::gpointer, 613 ) -> *mut gtk_sys::GtkWidget { 614 let item = from_glib_borrow(item); 615 let callback: &Q = &*(user_data as *mut _); 616 let res = (*callback)(&item); 617 res.to_glib_full() 618 } 619 let create_widget_func = Some(create_widget_func_func::<P, Q> as _); 620 unsafe extern "C" fn user_data_free_func_func< 621 P: IsA<gio::ListModel>, 622 Q: Fn(&glib::Object) -> Widget + 'static, 623 >( 624 data: glib_sys::gpointer, 625 ) { 626 let _callback: Box_<Q> = Box_::from_raw(data as *mut _); 627 } 628 let destroy_call4 = Some(user_data_free_func_func::<P, Q> as _); 629 let super_callback0: Box_<Q> = create_widget_func_data; 630 unsafe { 631 gtk_sys::gtk_flow_box_bind_model( 632 self.as_ref().to_glib_none().0, 633 model.map(|p| p.as_ref()).to_glib_none().0, 634 create_widget_func, 635 Box_::into_raw(super_callback0) as *mut _, 636 destroy_call4, 637 ); 638 } 639 } 640 get_activate_on_single_click(&self) -> bool641 fn get_activate_on_single_click(&self) -> bool { 642 unsafe { 643 from_glib(gtk_sys::gtk_flow_box_get_activate_on_single_click( 644 self.as_ref().to_glib_none().0, 645 )) 646 } 647 } 648 get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild>649 fn get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild> { 650 unsafe { 651 from_glib_none(gtk_sys::gtk_flow_box_get_child_at_index( 652 self.as_ref().to_glib_none().0, 653 idx, 654 )) 655 } 656 } 657 658 #[cfg(any(feature = "v3_22_6", feature = "dox"))] get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>659 fn get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild> { 660 unsafe { 661 from_glib_none(gtk_sys::gtk_flow_box_get_child_at_pos( 662 self.as_ref().to_glib_none().0, 663 x, 664 y, 665 )) 666 } 667 } 668 get_column_spacing(&self) -> u32669 fn get_column_spacing(&self) -> u32 { 670 unsafe { gtk_sys::gtk_flow_box_get_column_spacing(self.as_ref().to_glib_none().0) } 671 } 672 get_homogeneous(&self) -> bool673 fn get_homogeneous(&self) -> bool { 674 unsafe { 675 from_glib(gtk_sys::gtk_flow_box_get_homogeneous( 676 self.as_ref().to_glib_none().0, 677 )) 678 } 679 } 680 get_max_children_per_line(&self) -> u32681 fn get_max_children_per_line(&self) -> u32 { 682 unsafe { gtk_sys::gtk_flow_box_get_max_children_per_line(self.as_ref().to_glib_none().0) } 683 } 684 get_min_children_per_line(&self) -> u32685 fn get_min_children_per_line(&self) -> u32 { 686 unsafe { gtk_sys::gtk_flow_box_get_min_children_per_line(self.as_ref().to_glib_none().0) } 687 } 688 get_row_spacing(&self) -> u32689 fn get_row_spacing(&self) -> u32 { 690 unsafe { gtk_sys::gtk_flow_box_get_row_spacing(self.as_ref().to_glib_none().0) } 691 } 692 get_selected_children(&self) -> Vec<FlowBoxChild>693 fn get_selected_children(&self) -> Vec<FlowBoxChild> { 694 unsafe { 695 FromGlibPtrContainer::from_glib_container(gtk_sys::gtk_flow_box_get_selected_children( 696 self.as_ref().to_glib_none().0, 697 )) 698 } 699 } 700 get_selection_mode(&self) -> SelectionMode701 fn get_selection_mode(&self) -> SelectionMode { 702 unsafe { 703 from_glib(gtk_sys::gtk_flow_box_get_selection_mode( 704 self.as_ref().to_glib_none().0, 705 )) 706 } 707 } 708 insert<P: IsA<Widget>>(&self, widget: &P, position: i32)709 fn insert<P: IsA<Widget>>(&self, widget: &P, position: i32) { 710 unsafe { 711 gtk_sys::gtk_flow_box_insert( 712 self.as_ref().to_glib_none().0, 713 widget.as_ref().to_glib_none().0, 714 position, 715 ); 716 } 717 } 718 invalidate_filter(&self)719 fn invalidate_filter(&self) { 720 unsafe { 721 gtk_sys::gtk_flow_box_invalidate_filter(self.as_ref().to_glib_none().0); 722 } 723 } 724 invalidate_sort(&self)725 fn invalidate_sort(&self) { 726 unsafe { 727 gtk_sys::gtk_flow_box_invalidate_sort(self.as_ref().to_glib_none().0); 728 } 729 } 730 select_all(&self)731 fn select_all(&self) { 732 unsafe { 733 gtk_sys::gtk_flow_box_select_all(self.as_ref().to_glib_none().0); 734 } 735 } 736 select_child<P: IsA<FlowBoxChild>>(&self, child: &P)737 fn select_child<P: IsA<FlowBoxChild>>(&self, child: &P) { 738 unsafe { 739 gtk_sys::gtk_flow_box_select_child( 740 self.as_ref().to_glib_none().0, 741 child.as_ref().to_glib_none().0, 742 ); 743 } 744 } 745 selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P)746 fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P) { 747 let func_data: P = func; 748 unsafe extern "C" fn func_func<P: FnMut(&FlowBox, &FlowBoxChild)>( 749 box_: *mut gtk_sys::GtkFlowBox, 750 child: *mut gtk_sys::GtkFlowBoxChild, 751 user_data: glib_sys::gpointer, 752 ) { 753 let box_ = from_glib_borrow(box_); 754 let child = from_glib_borrow(child); 755 let callback: *mut P = user_data as *const _ as usize as *mut P; 756 (*callback)(&box_, &child); 757 } 758 let func = Some(func_func::<P> as _); 759 let super_callback0: &P = &func_data; 760 unsafe { 761 gtk_sys::gtk_flow_box_selected_foreach( 762 self.as_ref().to_glib_none().0, 763 func, 764 super_callback0 as *const _ as usize as *mut _, 765 ); 766 } 767 } 768 set_activate_on_single_click(&self, single: bool)769 fn set_activate_on_single_click(&self, single: bool) { 770 unsafe { 771 gtk_sys::gtk_flow_box_set_activate_on_single_click( 772 self.as_ref().to_glib_none().0, 773 single.to_glib(), 774 ); 775 } 776 } 777 set_column_spacing(&self, spacing: u32)778 fn set_column_spacing(&self, spacing: u32) { 779 unsafe { 780 gtk_sys::gtk_flow_box_set_column_spacing(self.as_ref().to_glib_none().0, spacing); 781 } 782 } 783 set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>)784 fn set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>) { 785 let filter_func_data: Box_<Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 786 Box_::new(filter_func); 787 unsafe extern "C" fn filter_func_func( 788 child: *mut gtk_sys::GtkFlowBoxChild, 789 user_data: glib_sys::gpointer, 790 ) -> glib_sys::gboolean { 791 let child = from_glib_borrow(child); 792 let callback: &Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>> = 793 &*(user_data as *mut _); 794 let res = if let Some(ref callback) = *callback { 795 callback(&child) 796 } else { 797 panic!("cannot get closure...") 798 }; 799 res.to_glib() 800 } 801 let filter_func = if filter_func_data.is_some() { 802 Some(filter_func_func as _) 803 } else { 804 None 805 }; 806 unsafe extern "C" fn destroy_func(data: glib_sys::gpointer) { 807 let _callback: Box_<Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 808 Box_::from_raw(data as *mut _); 809 } 810 let destroy_call3 = Some(destroy_func as _); 811 let super_callback0: Box_<Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 812 filter_func_data; 813 unsafe { 814 gtk_sys::gtk_flow_box_set_filter_func( 815 self.as_ref().to_glib_none().0, 816 filter_func, 817 Box_::into_raw(super_callback0) as *mut _, 818 destroy_call3, 819 ); 820 } 821 } 822 set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)823 fn set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P) { 824 unsafe { 825 gtk_sys::gtk_flow_box_set_hadjustment( 826 self.as_ref().to_glib_none().0, 827 adjustment.as_ref().to_glib_none().0, 828 ); 829 } 830 } 831 set_homogeneous(&self, homogeneous: bool)832 fn set_homogeneous(&self, homogeneous: bool) { 833 unsafe { 834 gtk_sys::gtk_flow_box_set_homogeneous( 835 self.as_ref().to_glib_none().0, 836 homogeneous.to_glib(), 837 ); 838 } 839 } 840 set_max_children_per_line(&self, n_children: u32)841 fn set_max_children_per_line(&self, n_children: u32) { 842 unsafe { 843 gtk_sys::gtk_flow_box_set_max_children_per_line( 844 self.as_ref().to_glib_none().0, 845 n_children, 846 ); 847 } 848 } 849 set_min_children_per_line(&self, n_children: u32)850 fn set_min_children_per_line(&self, n_children: u32) { 851 unsafe { 852 gtk_sys::gtk_flow_box_set_min_children_per_line( 853 self.as_ref().to_glib_none().0, 854 n_children, 855 ); 856 } 857 } 858 set_row_spacing(&self, spacing: u32)859 fn set_row_spacing(&self, spacing: u32) { 860 unsafe { 861 gtk_sys::gtk_flow_box_set_row_spacing(self.as_ref().to_glib_none().0, spacing); 862 } 863 } 864 set_selection_mode(&self, mode: SelectionMode)865 fn set_selection_mode(&self, mode: SelectionMode) { 866 unsafe { 867 gtk_sys::gtk_flow_box_set_selection_mode( 868 self.as_ref().to_glib_none().0, 869 mode.to_glib(), 870 ); 871 } 872 } 873 set_sort_func( &self, sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, )874 fn set_sort_func( 875 &self, 876 sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 877 ) { 878 let sort_func_data: Box_< 879 Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 880 > = Box_::new(sort_func); 881 unsafe extern "C" fn sort_func_func( 882 child1: *mut gtk_sys::GtkFlowBoxChild, 883 child2: *mut gtk_sys::GtkFlowBoxChild, 884 user_data: glib_sys::gpointer, 885 ) -> libc::c_int { 886 let child1 = from_glib_borrow(child1); 887 let child2 = from_glib_borrow(child2); 888 let callback: &Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>> = 889 &*(user_data as *mut _); 890 let res = if let Some(ref callback) = *callback { 891 callback(&child1, &child2) 892 } else { 893 panic!("cannot get closure...") 894 }; 895 res 896 } 897 let sort_func = if sort_func_data.is_some() { 898 Some(sort_func_func as _) 899 } else { 900 None 901 }; 902 unsafe extern "C" fn destroy_func(data: glib_sys::gpointer) { 903 let _callback: Box_< 904 Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 905 > = Box_::from_raw(data as *mut _); 906 } 907 let destroy_call3 = Some(destroy_func as _); 908 let super_callback0: Box_< 909 Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 910 > = sort_func_data; 911 unsafe { 912 gtk_sys::gtk_flow_box_set_sort_func( 913 self.as_ref().to_glib_none().0, 914 sort_func, 915 Box_::into_raw(super_callback0) as *mut _, 916 destroy_call3, 917 ); 918 } 919 } 920 set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)921 fn set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P) { 922 unsafe { 923 gtk_sys::gtk_flow_box_set_vadjustment( 924 self.as_ref().to_glib_none().0, 925 adjustment.as_ref().to_glib_none().0, 926 ); 927 } 928 } 929 unselect_all(&self)930 fn unselect_all(&self) { 931 unsafe { 932 gtk_sys::gtk_flow_box_unselect_all(self.as_ref().to_glib_none().0); 933 } 934 } 935 unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P)936 fn unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P) { 937 unsafe { 938 gtk_sys::gtk_flow_box_unselect_child( 939 self.as_ref().to_glib_none().0, 940 child.as_ref().to_glib_none().0, 941 ); 942 } 943 } 944 connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId945 fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 946 unsafe extern "C" fn activate_cursor_child_trampoline<P, F: Fn(&P) + 'static>( 947 this: *mut gtk_sys::GtkFlowBox, 948 f: glib_sys::gpointer, 949 ) where 950 P: IsA<FlowBox>, 951 { 952 let f: &F = &*(f as *const F); 953 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 954 } 955 unsafe { 956 let f: Box_<F> = Box_::new(f); 957 connect_raw( 958 self.as_ptr() as *mut _, 959 b"activate-cursor-child\0".as_ptr() as *const _, 960 Some(transmute( 961 activate_cursor_child_trampoline::<Self, F> as usize, 962 )), 963 Box_::into_raw(f), 964 ) 965 } 966 } 967 emit_activate_cursor_child(&self)968 fn emit_activate_cursor_child(&self) { 969 let _ = unsafe { 970 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 971 .emit("activate-cursor-child", &[]) 972 .unwrap() 973 }; 974 } 975 connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( &self, f: F, ) -> SignalHandlerId976 fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( 977 &self, 978 f: F, 979 ) -> SignalHandlerId { 980 unsafe extern "C" fn child_activated_trampoline<P, F: Fn(&P, &FlowBoxChild) + 'static>( 981 this: *mut gtk_sys::GtkFlowBox, 982 child: *mut gtk_sys::GtkFlowBoxChild, 983 f: glib_sys::gpointer, 984 ) where 985 P: IsA<FlowBox>, 986 { 987 let f: &F = &*(f as *const F); 988 f( 989 &FlowBox::from_glib_borrow(this).unsafe_cast(), 990 &from_glib_borrow(child), 991 ) 992 } 993 unsafe { 994 let f: Box_<F> = Box_::new(f); 995 connect_raw( 996 self.as_ptr() as *mut _, 997 b"child-activated\0".as_ptr() as *const _, 998 Some(transmute(child_activated_trampoline::<Self, F> as usize)), 999 Box_::into_raw(f), 1000 ) 1001 } 1002 } 1003 connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId1004 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( 1005 &self, 1006 f: F, 1007 ) -> SignalHandlerId { 1008 unsafe extern "C" fn move_cursor_trampoline< 1009 P, 1010 F: Fn(&P, MovementStep, i32) -> bool + 'static, 1011 >( 1012 this: *mut gtk_sys::GtkFlowBox, 1013 step: gtk_sys::GtkMovementStep, 1014 count: libc::c_int, 1015 f: glib_sys::gpointer, 1016 ) -> glib_sys::gboolean 1017 where 1018 P: IsA<FlowBox>, 1019 { 1020 let f: &F = &*(f as *const F); 1021 f( 1022 &FlowBox::from_glib_borrow(this).unsafe_cast(), 1023 from_glib(step), 1024 count, 1025 ) 1026 .to_glib() 1027 } 1028 unsafe { 1029 let f: Box_<F> = Box_::new(f); 1030 connect_raw( 1031 self.as_ptr() as *mut _, 1032 b"move-cursor\0".as_ptr() as *const _, 1033 Some(transmute(move_cursor_trampoline::<Self, F> as usize)), 1034 Box_::into_raw(f), 1035 ) 1036 } 1037 } 1038 emit_move_cursor(&self, step: MovementStep, count: i32) -> bool1039 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool { 1040 let res = unsafe { 1041 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1042 .emit("move-cursor", &[&step, &count]) 1043 .unwrap() 1044 }; 1045 res.unwrap() 1046 .get() 1047 .expect("Return Value for `emit_move_cursor`") 1048 .unwrap() 1049 } 1050 connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1051 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1052 unsafe extern "C" fn select_all_trampoline<P, F: Fn(&P) + 'static>( 1053 this: *mut gtk_sys::GtkFlowBox, 1054 f: glib_sys::gpointer, 1055 ) where 1056 P: IsA<FlowBox>, 1057 { 1058 let f: &F = &*(f as *const F); 1059 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1060 } 1061 unsafe { 1062 let f: Box_<F> = Box_::new(f); 1063 connect_raw( 1064 self.as_ptr() as *mut _, 1065 b"select-all\0".as_ptr() as *const _, 1066 Some(transmute(select_all_trampoline::<Self, F> as usize)), 1067 Box_::into_raw(f), 1068 ) 1069 } 1070 } 1071 emit_select_all(&self)1072 fn emit_select_all(&self) { 1073 let _ = unsafe { 1074 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1075 .emit("select-all", &[]) 1076 .unwrap() 1077 }; 1078 } 1079 connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1080 fn connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1081 unsafe extern "C" fn selected_children_changed_trampoline<P, F: Fn(&P) + 'static>( 1082 this: *mut gtk_sys::GtkFlowBox, 1083 f: glib_sys::gpointer, 1084 ) where 1085 P: IsA<FlowBox>, 1086 { 1087 let f: &F = &*(f as *const F); 1088 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1089 } 1090 unsafe { 1091 let f: Box_<F> = Box_::new(f); 1092 connect_raw( 1093 self.as_ptr() as *mut _, 1094 b"selected-children-changed\0".as_ptr() as *const _, 1095 Some(transmute( 1096 selected_children_changed_trampoline::<Self, F> as usize, 1097 )), 1098 Box_::into_raw(f), 1099 ) 1100 } 1101 } 1102 connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1103 fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1104 unsafe extern "C" fn toggle_cursor_child_trampoline<P, F: Fn(&P) + 'static>( 1105 this: *mut gtk_sys::GtkFlowBox, 1106 f: glib_sys::gpointer, 1107 ) where 1108 P: IsA<FlowBox>, 1109 { 1110 let f: &F = &*(f as *const F); 1111 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1112 } 1113 unsafe { 1114 let f: Box_<F> = Box_::new(f); 1115 connect_raw( 1116 self.as_ptr() as *mut _, 1117 b"toggle-cursor-child\0".as_ptr() as *const _, 1118 Some(transmute( 1119 toggle_cursor_child_trampoline::<Self, F> as usize, 1120 )), 1121 Box_::into_raw(f), 1122 ) 1123 } 1124 } 1125 emit_toggle_cursor_child(&self)1126 fn emit_toggle_cursor_child(&self) { 1127 let _ = unsafe { 1128 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1129 .emit("toggle-cursor-child", &[]) 1130 .unwrap() 1131 }; 1132 } 1133 connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1134 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1135 unsafe extern "C" fn unselect_all_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"unselect-all\0".as_ptr() as *const _, 1149 Some(transmute(unselect_all_trampoline::<Self, F> as usize)), 1150 Box_::into_raw(f), 1151 ) 1152 } 1153 } 1154 emit_unselect_all(&self)1155 fn emit_unselect_all(&self) { 1156 let _ = unsafe { 1157 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 1158 .emit("unselect-all", &[]) 1159 .unwrap() 1160 }; 1161 } 1162 connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1163 fn connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>( 1164 &self, 1165 f: F, 1166 ) -> SignalHandlerId { 1167 unsafe extern "C" fn notify_activate_on_single_click_trampoline<P, F: Fn(&P) + 'static>( 1168 this: *mut gtk_sys::GtkFlowBox, 1169 _param_spec: glib_sys::gpointer, 1170 f: glib_sys::gpointer, 1171 ) where 1172 P: IsA<FlowBox>, 1173 { 1174 let f: &F = &*(f as *const F); 1175 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1176 } 1177 unsafe { 1178 let f: Box_<F> = Box_::new(f); 1179 connect_raw( 1180 self.as_ptr() as *mut _, 1181 b"notify::activate-on-single-click\0".as_ptr() as *const _, 1182 Some(transmute( 1183 notify_activate_on_single_click_trampoline::<Self, F> as usize, 1184 )), 1185 Box_::into_raw(f), 1186 ) 1187 } 1188 } 1189 connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1190 fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>( 1191 &self, 1192 f: F, 1193 ) -> SignalHandlerId { 1194 unsafe extern "C" fn notify_column_spacing_trampoline<P, F: Fn(&P) + 'static>( 1195 this: *mut gtk_sys::GtkFlowBox, 1196 _param_spec: glib_sys::gpointer, 1197 f: glib_sys::gpointer, 1198 ) where 1199 P: IsA<FlowBox>, 1200 { 1201 let f: &F = &*(f as *const F); 1202 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1203 } 1204 unsafe { 1205 let f: Box_<F> = Box_::new(f); 1206 connect_raw( 1207 self.as_ptr() as *mut _, 1208 b"notify::column-spacing\0".as_ptr() as *const _, 1209 Some(transmute( 1210 notify_column_spacing_trampoline::<Self, F> as usize, 1211 )), 1212 Box_::into_raw(f), 1213 ) 1214 } 1215 } 1216 connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1217 fn connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1218 unsafe extern "C" fn notify_homogeneous_trampoline<P, F: Fn(&P) + 'static>( 1219 this: *mut gtk_sys::GtkFlowBox, 1220 _param_spec: glib_sys::gpointer, 1221 f: glib_sys::gpointer, 1222 ) where 1223 P: IsA<FlowBox>, 1224 { 1225 let f: &F = &*(f as *const F); 1226 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1227 } 1228 unsafe { 1229 let f: Box_<F> = Box_::new(f); 1230 connect_raw( 1231 self.as_ptr() as *mut _, 1232 b"notify::homogeneous\0".as_ptr() as *const _, 1233 Some(transmute(notify_homogeneous_trampoline::<Self, F> as usize)), 1234 Box_::into_raw(f), 1235 ) 1236 } 1237 } 1238 connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1239 fn connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>( 1240 &self, 1241 f: F, 1242 ) -> SignalHandlerId { 1243 unsafe extern "C" fn notify_max_children_per_line_trampoline<P, F: Fn(&P) + 'static>( 1244 this: *mut gtk_sys::GtkFlowBox, 1245 _param_spec: glib_sys::gpointer, 1246 f: glib_sys::gpointer, 1247 ) where 1248 P: IsA<FlowBox>, 1249 { 1250 let f: &F = &*(f as *const F); 1251 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1252 } 1253 unsafe { 1254 let f: Box_<F> = Box_::new(f); 1255 connect_raw( 1256 self.as_ptr() as *mut _, 1257 b"notify::max-children-per-line\0".as_ptr() as *const _, 1258 Some(transmute( 1259 notify_max_children_per_line_trampoline::<Self, F> as usize, 1260 )), 1261 Box_::into_raw(f), 1262 ) 1263 } 1264 } 1265 connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1266 fn connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>( 1267 &self, 1268 f: F, 1269 ) -> SignalHandlerId { 1270 unsafe extern "C" fn notify_min_children_per_line_trampoline<P, F: Fn(&P) + 'static>( 1271 this: *mut gtk_sys::GtkFlowBox, 1272 _param_spec: glib_sys::gpointer, 1273 f: glib_sys::gpointer, 1274 ) where 1275 P: IsA<FlowBox>, 1276 { 1277 let f: &F = &*(f as *const F); 1278 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1279 } 1280 unsafe { 1281 let f: Box_<F> = Box_::new(f); 1282 connect_raw( 1283 self.as_ptr() as *mut _, 1284 b"notify::min-children-per-line\0".as_ptr() as *const _, 1285 Some(transmute( 1286 notify_min_children_per_line_trampoline::<Self, F> as usize, 1287 )), 1288 Box_::into_raw(f), 1289 ) 1290 } 1291 } 1292 connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1293 fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1294 unsafe extern "C" fn notify_row_spacing_trampoline<P, F: Fn(&P) + 'static>( 1295 this: *mut gtk_sys::GtkFlowBox, 1296 _param_spec: glib_sys::gpointer, 1297 f: glib_sys::gpointer, 1298 ) where 1299 P: IsA<FlowBox>, 1300 { 1301 let f: &F = &*(f as *const F); 1302 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1303 } 1304 unsafe { 1305 let f: Box_<F> = Box_::new(f); 1306 connect_raw( 1307 self.as_ptr() as *mut _, 1308 b"notify::row-spacing\0".as_ptr() as *const _, 1309 Some(transmute(notify_row_spacing_trampoline::<Self, F> as usize)), 1310 Box_::into_raw(f), 1311 ) 1312 } 1313 } 1314 connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1315 fn connect_property_selection_mode_notify<F: Fn(&Self) + 'static>( 1316 &self, 1317 f: F, 1318 ) -> SignalHandlerId { 1319 unsafe extern "C" fn notify_selection_mode_trampoline<P, F: Fn(&P) + 'static>( 1320 this: *mut gtk_sys::GtkFlowBox, 1321 _param_spec: glib_sys::gpointer, 1322 f: glib_sys::gpointer, 1323 ) where 1324 P: IsA<FlowBox>, 1325 { 1326 let f: &F = &*(f as *const F); 1327 f(&FlowBox::from_glib_borrow(this).unsafe_cast()) 1328 } 1329 unsafe { 1330 let f: Box_<F> = Box_::new(f); 1331 connect_raw( 1332 self.as_ptr() as *mut _, 1333 b"notify::selection-mode\0".as_ptr() as *const _, 1334 Some(transmute( 1335 notify_selection_mode_trampoline::<Self, F> as usize, 1336 )), 1337 Box_::into_raw(f), 1338 ) 1339 } 1340 } 1341 } 1342 1343 impl fmt::Display for FlowBox { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1344 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1345 write!(f, "FlowBox") 1346 } 1347 } 1348