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 crate::Adjustment; 6 use crate::Align; 7 use crate::Buildable; 8 use crate::Container; 9 use crate::FlowBoxChild; 10 use crate::MovementStep; 11 use crate::Orientable; 12 use crate::Orientation; 13 use crate::ResizeMode; 14 use crate::SelectionMode; 15 use crate::Widget; 16 use glib::object::Cast; 17 use glib::object::IsA; 18 use glib::object::ObjectExt; 19 use glib::signal::connect_raw; 20 use glib::signal::SignalHandlerId; 21 use glib::translate::*; 22 use glib::StaticType; 23 use glib::ToValue; 24 use std::boxed::Box as Box_; 25 use std::fmt; 26 use std::mem::transmute; 27 28 glib::wrapper! { 29 #[doc(alias = "GtkFlowBox")] 30 pub struct FlowBox(Object<ffi::GtkFlowBox, ffi::GtkFlowBoxClass>) @extends Container, Widget, @implements Buildable, Orientable; 31 32 match fn { 33 type_ => || ffi::gtk_flow_box_get_type(), 34 } 35 } 36 37 impl FlowBox { 38 #[doc(alias = "gtk_flow_box_new")] new() -> FlowBox39 pub fn new() -> FlowBox { 40 assert_initialized_main_thread!(); 41 unsafe { Widget::from_glib_none(ffi::gtk_flow_box_new()).unsafe_cast() } 42 } 43 44 // rustdoc-stripper-ignore-next 45 /// Creates a new builder-pattern struct instance to construct [`FlowBox`] objects. 46 /// 47 /// This method returns an instance of [`FlowBoxBuilder`] which can be used to create [`FlowBox`] objects. builder() -> FlowBoxBuilder48 pub fn builder() -> FlowBoxBuilder { 49 FlowBoxBuilder::default() 50 } 51 } 52 53 impl Default for FlowBox { default() -> Self54 fn default() -> Self { 55 Self::new() 56 } 57 } 58 59 #[derive(Clone, Default)] 60 // rustdoc-stripper-ignore-next 61 /// A [builder-pattern] type to construct [`FlowBox`] objects. 62 /// 63 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 64 pub struct FlowBoxBuilder { 65 activate_on_single_click: Option<bool>, 66 column_spacing: Option<u32>, 67 homogeneous: Option<bool>, 68 max_children_per_line: Option<u32>, 69 min_children_per_line: Option<u32>, 70 row_spacing: Option<u32>, 71 selection_mode: Option<SelectionMode>, 72 border_width: Option<u32>, 73 child: Option<Widget>, 74 resize_mode: Option<ResizeMode>, 75 app_paintable: Option<bool>, 76 can_default: Option<bool>, 77 can_focus: Option<bool>, 78 events: Option<gdk::EventMask>, 79 expand: Option<bool>, 80 #[cfg(any(feature = "v3_20", feature = "dox"))] 81 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 82 focus_on_click: Option<bool>, 83 halign: Option<Align>, 84 has_default: Option<bool>, 85 has_focus: Option<bool>, 86 has_tooltip: Option<bool>, 87 height_request: Option<i32>, 88 hexpand: Option<bool>, 89 hexpand_set: Option<bool>, 90 is_focus: Option<bool>, 91 margin: Option<i32>, 92 margin_bottom: Option<i32>, 93 margin_end: Option<i32>, 94 margin_start: Option<i32>, 95 margin_top: Option<i32>, 96 name: Option<String>, 97 no_show_all: Option<bool>, 98 opacity: Option<f64>, 99 parent: Option<Container>, 100 receives_default: Option<bool>, 101 sensitive: Option<bool>, 102 tooltip_markup: Option<String>, 103 tooltip_text: Option<String>, 104 valign: Option<Align>, 105 vexpand: Option<bool>, 106 vexpand_set: Option<bool>, 107 visible: Option<bool>, 108 width_request: Option<i32>, 109 orientation: Option<Orientation>, 110 } 111 112 impl FlowBoxBuilder { 113 // rustdoc-stripper-ignore-next 114 /// Create a new [`FlowBoxBuilder`]. new() -> Self115 pub fn new() -> Self { 116 Self::default() 117 } 118 119 // rustdoc-stripper-ignore-next 120 /// Build the [`FlowBox`]. build(self) -> FlowBox121 pub fn build(self) -> FlowBox { 122 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 123 if let Some(ref activate_on_single_click) = self.activate_on_single_click { 124 properties.push(("activate-on-single-click", activate_on_single_click)); 125 } 126 if let Some(ref column_spacing) = self.column_spacing { 127 properties.push(("column-spacing", column_spacing)); 128 } 129 if let Some(ref homogeneous) = self.homogeneous { 130 properties.push(("homogeneous", homogeneous)); 131 } 132 if let Some(ref max_children_per_line) = self.max_children_per_line { 133 properties.push(("max-children-per-line", max_children_per_line)); 134 } 135 if let Some(ref min_children_per_line) = self.min_children_per_line { 136 properties.push(("min-children-per-line", min_children_per_line)); 137 } 138 if let Some(ref row_spacing) = self.row_spacing { 139 properties.push(("row-spacing", row_spacing)); 140 } 141 if let Some(ref selection_mode) = self.selection_mode { 142 properties.push(("selection-mode", selection_mode)); 143 } 144 if let Some(ref border_width) = self.border_width { 145 properties.push(("border-width", border_width)); 146 } 147 if let Some(ref child) = self.child { 148 properties.push(("child", child)); 149 } 150 if let Some(ref resize_mode) = self.resize_mode { 151 properties.push(("resize-mode", resize_mode)); 152 } 153 if let Some(ref app_paintable) = self.app_paintable { 154 properties.push(("app-paintable", app_paintable)); 155 } 156 if let Some(ref can_default) = self.can_default { 157 properties.push(("can-default", can_default)); 158 } 159 if let Some(ref can_focus) = self.can_focus { 160 properties.push(("can-focus", can_focus)); 161 } 162 if let Some(ref events) = self.events { 163 properties.push(("events", events)); 164 } 165 if let Some(ref expand) = self.expand { 166 properties.push(("expand", expand)); 167 } 168 #[cfg(any(feature = "v3_20", feature = "dox"))] 169 if let Some(ref focus_on_click) = self.focus_on_click { 170 properties.push(("focus-on-click", focus_on_click)); 171 } 172 if let Some(ref halign) = self.halign { 173 properties.push(("halign", halign)); 174 } 175 if let Some(ref has_default) = self.has_default { 176 properties.push(("has-default", has_default)); 177 } 178 if let Some(ref has_focus) = self.has_focus { 179 properties.push(("has-focus", has_focus)); 180 } 181 if let Some(ref has_tooltip) = self.has_tooltip { 182 properties.push(("has-tooltip", has_tooltip)); 183 } 184 if let Some(ref height_request) = self.height_request { 185 properties.push(("height-request", height_request)); 186 } 187 if let Some(ref hexpand) = self.hexpand { 188 properties.push(("hexpand", hexpand)); 189 } 190 if let Some(ref hexpand_set) = self.hexpand_set { 191 properties.push(("hexpand-set", hexpand_set)); 192 } 193 if let Some(ref is_focus) = self.is_focus { 194 properties.push(("is-focus", is_focus)); 195 } 196 if let Some(ref margin) = self.margin { 197 properties.push(("margin", margin)); 198 } 199 if let Some(ref margin_bottom) = self.margin_bottom { 200 properties.push(("margin-bottom", margin_bottom)); 201 } 202 if let Some(ref margin_end) = self.margin_end { 203 properties.push(("margin-end", margin_end)); 204 } 205 if let Some(ref margin_start) = self.margin_start { 206 properties.push(("margin-start", margin_start)); 207 } 208 if let Some(ref margin_top) = self.margin_top { 209 properties.push(("margin-top", margin_top)); 210 } 211 if let Some(ref name) = self.name { 212 properties.push(("name", name)); 213 } 214 if let Some(ref no_show_all) = self.no_show_all { 215 properties.push(("no-show-all", no_show_all)); 216 } 217 if let Some(ref opacity) = self.opacity { 218 properties.push(("opacity", opacity)); 219 } 220 if let Some(ref parent) = self.parent { 221 properties.push(("parent", parent)); 222 } 223 if let Some(ref receives_default) = self.receives_default { 224 properties.push(("receives-default", receives_default)); 225 } 226 if let Some(ref sensitive) = self.sensitive { 227 properties.push(("sensitive", sensitive)); 228 } 229 if let Some(ref tooltip_markup) = self.tooltip_markup { 230 properties.push(("tooltip-markup", tooltip_markup)); 231 } 232 if let Some(ref tooltip_text) = self.tooltip_text { 233 properties.push(("tooltip-text", tooltip_text)); 234 } 235 if let Some(ref valign) = self.valign { 236 properties.push(("valign", valign)); 237 } 238 if let Some(ref vexpand) = self.vexpand { 239 properties.push(("vexpand", vexpand)); 240 } 241 if let Some(ref vexpand_set) = self.vexpand_set { 242 properties.push(("vexpand-set", vexpand_set)); 243 } 244 if let Some(ref visible) = self.visible { 245 properties.push(("visible", visible)); 246 } 247 if let Some(ref width_request) = self.width_request { 248 properties.push(("width-request", width_request)); 249 } 250 if let Some(ref orientation) = self.orientation { 251 properties.push(("orientation", orientation)); 252 } 253 glib::Object::new::<FlowBox>(&properties).expect("Failed to create an instance of FlowBox") 254 } 255 activate_on_single_click(mut self, activate_on_single_click: bool) -> Self256 pub fn activate_on_single_click(mut self, activate_on_single_click: bool) -> Self { 257 self.activate_on_single_click = Some(activate_on_single_click); 258 self 259 } 260 column_spacing(mut self, column_spacing: u32) -> Self261 pub fn column_spacing(mut self, column_spacing: u32) -> Self { 262 self.column_spacing = Some(column_spacing); 263 self 264 } 265 homogeneous(mut self, homogeneous: bool) -> Self266 pub fn homogeneous(mut self, homogeneous: bool) -> Self { 267 self.homogeneous = Some(homogeneous); 268 self 269 } 270 max_children_per_line(mut self, max_children_per_line: u32) -> Self271 pub fn max_children_per_line(mut self, max_children_per_line: u32) -> Self { 272 self.max_children_per_line = Some(max_children_per_line); 273 self 274 } 275 min_children_per_line(mut self, min_children_per_line: u32) -> Self276 pub fn min_children_per_line(mut self, min_children_per_line: u32) -> Self { 277 self.min_children_per_line = Some(min_children_per_line); 278 self 279 } 280 row_spacing(mut self, row_spacing: u32) -> Self281 pub fn row_spacing(mut self, row_spacing: u32) -> Self { 282 self.row_spacing = Some(row_spacing); 283 self 284 } 285 selection_mode(mut self, selection_mode: SelectionMode) -> Self286 pub fn selection_mode(mut self, selection_mode: SelectionMode) -> Self { 287 self.selection_mode = Some(selection_mode); 288 self 289 } 290 border_width(mut self, border_width: u32) -> Self291 pub fn border_width(mut self, border_width: u32) -> Self { 292 self.border_width = Some(border_width); 293 self 294 } 295 child<P: IsA<Widget>>(mut self, child: &P) -> Self296 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 297 self.child = Some(child.clone().upcast()); 298 self 299 } 300 resize_mode(mut self, resize_mode: ResizeMode) -> Self301 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 302 self.resize_mode = Some(resize_mode); 303 self 304 } 305 app_paintable(mut self, app_paintable: bool) -> Self306 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 307 self.app_paintable = Some(app_paintable); 308 self 309 } 310 can_default(mut self, can_default: bool) -> Self311 pub fn can_default(mut self, can_default: bool) -> Self { 312 self.can_default = Some(can_default); 313 self 314 } 315 can_focus(mut self, can_focus: bool) -> Self316 pub fn can_focus(mut self, can_focus: bool) -> Self { 317 self.can_focus = Some(can_focus); 318 self 319 } 320 events(mut self, events: gdk::EventMask) -> Self321 pub fn events(mut self, events: gdk::EventMask) -> Self { 322 self.events = Some(events); 323 self 324 } 325 expand(mut self, expand: bool) -> Self326 pub fn expand(mut self, expand: bool) -> Self { 327 self.expand = Some(expand); 328 self 329 } 330 331 #[cfg(any(feature = "v3_20", feature = "dox"))] 332 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self333 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 334 self.focus_on_click = Some(focus_on_click); 335 self 336 } 337 halign(mut self, halign: Align) -> Self338 pub fn halign(mut self, halign: Align) -> Self { 339 self.halign = Some(halign); 340 self 341 } 342 has_default(mut self, has_default: bool) -> Self343 pub fn has_default(mut self, has_default: bool) -> Self { 344 self.has_default = Some(has_default); 345 self 346 } 347 has_focus(mut self, has_focus: bool) -> Self348 pub fn has_focus(mut self, has_focus: bool) -> Self { 349 self.has_focus = Some(has_focus); 350 self 351 } 352 has_tooltip(mut self, has_tooltip: bool) -> Self353 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 354 self.has_tooltip = Some(has_tooltip); 355 self 356 } 357 height_request(mut self, height_request: i32) -> Self358 pub fn height_request(mut self, height_request: i32) -> Self { 359 self.height_request = Some(height_request); 360 self 361 } 362 hexpand(mut self, hexpand: bool) -> Self363 pub fn hexpand(mut self, hexpand: bool) -> Self { 364 self.hexpand = Some(hexpand); 365 self 366 } 367 hexpand_set(mut self, hexpand_set: bool) -> Self368 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 369 self.hexpand_set = Some(hexpand_set); 370 self 371 } 372 is_focus(mut self, is_focus: bool) -> Self373 pub fn is_focus(mut self, is_focus: bool) -> Self { 374 self.is_focus = Some(is_focus); 375 self 376 } 377 margin(mut self, margin: i32) -> Self378 pub fn margin(mut self, margin: i32) -> Self { 379 self.margin = Some(margin); 380 self 381 } 382 margin_bottom(mut self, margin_bottom: i32) -> Self383 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 384 self.margin_bottom = Some(margin_bottom); 385 self 386 } 387 margin_end(mut self, margin_end: i32) -> Self388 pub fn margin_end(mut self, margin_end: i32) -> Self { 389 self.margin_end = Some(margin_end); 390 self 391 } 392 margin_start(mut self, margin_start: i32) -> Self393 pub fn margin_start(mut self, margin_start: i32) -> Self { 394 self.margin_start = Some(margin_start); 395 self 396 } 397 margin_top(mut self, margin_top: i32) -> Self398 pub fn margin_top(mut self, margin_top: i32) -> Self { 399 self.margin_top = Some(margin_top); 400 self 401 } 402 name(mut self, name: &str) -> Self403 pub fn name(mut self, name: &str) -> Self { 404 self.name = Some(name.to_string()); 405 self 406 } 407 no_show_all(mut self, no_show_all: bool) -> Self408 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 409 self.no_show_all = Some(no_show_all); 410 self 411 } 412 opacity(mut self, opacity: f64) -> Self413 pub fn opacity(mut self, opacity: f64) -> Self { 414 self.opacity = Some(opacity); 415 self 416 } 417 parent<P: IsA<Container>>(mut self, parent: &P) -> Self418 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 419 self.parent = Some(parent.clone().upcast()); 420 self 421 } 422 receives_default(mut self, receives_default: bool) -> Self423 pub fn receives_default(mut self, receives_default: bool) -> Self { 424 self.receives_default = Some(receives_default); 425 self 426 } 427 sensitive(mut self, sensitive: bool) -> Self428 pub fn sensitive(mut self, sensitive: bool) -> Self { 429 self.sensitive = Some(sensitive); 430 self 431 } 432 tooltip_markup(mut self, tooltip_markup: &str) -> Self433 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 434 self.tooltip_markup = Some(tooltip_markup.to_string()); 435 self 436 } 437 tooltip_text(mut self, tooltip_text: &str) -> Self438 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 439 self.tooltip_text = Some(tooltip_text.to_string()); 440 self 441 } 442 valign(mut self, valign: Align) -> Self443 pub fn valign(mut self, valign: Align) -> Self { 444 self.valign = Some(valign); 445 self 446 } 447 vexpand(mut self, vexpand: bool) -> Self448 pub fn vexpand(mut self, vexpand: bool) -> Self { 449 self.vexpand = Some(vexpand); 450 self 451 } 452 vexpand_set(mut self, vexpand_set: bool) -> Self453 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 454 self.vexpand_set = Some(vexpand_set); 455 self 456 } 457 visible(mut self, visible: bool) -> Self458 pub fn visible(mut self, visible: bool) -> Self { 459 self.visible = Some(visible); 460 self 461 } 462 width_request(mut self, width_request: i32) -> Self463 pub fn width_request(mut self, width_request: i32) -> Self { 464 self.width_request = Some(width_request); 465 self 466 } 467 orientation(mut self, orientation: Orientation) -> Self468 pub fn orientation(mut self, orientation: Orientation) -> Self { 469 self.orientation = Some(orientation); 470 self 471 } 472 } 473 474 pub const NONE_FLOW_BOX: Option<&FlowBox> = None; 475 476 pub trait FlowBoxExt: 'static { 477 #[doc(alias = "gtk_flow_box_bind_model")] bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( &self, model: Option<&P>, create_widget_func: Q, )478 fn bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( 479 &self, 480 model: Option<&P>, 481 create_widget_func: Q, 482 ); 483 484 #[doc(alias = "gtk_flow_box_get_activate_on_single_click")] 485 #[doc(alias = "get_activate_on_single_click")] activates_on_single_click(&self) -> bool486 fn activates_on_single_click(&self) -> bool; 487 488 #[doc(alias = "gtk_flow_box_get_child_at_index")] 489 #[doc(alias = "get_child_at_index")] child_at_index(&self, idx: i32) -> Option<FlowBoxChild>490 fn child_at_index(&self, idx: i32) -> Option<FlowBoxChild>; 491 492 #[cfg(any(feature = "v3_22_6", feature = "dox"))] 493 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_6")))] 494 #[doc(alias = "gtk_flow_box_get_child_at_pos")] 495 #[doc(alias = "get_child_at_pos")] child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>496 fn child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>; 497 498 #[doc(alias = "gtk_flow_box_get_column_spacing")] 499 #[doc(alias = "get_column_spacing")] column_spacing(&self) -> u32500 fn column_spacing(&self) -> u32; 501 502 #[doc(alias = "gtk_flow_box_get_homogeneous")] 503 #[doc(alias = "get_homogeneous")] is_homogeneous(&self) -> bool504 fn is_homogeneous(&self) -> bool; 505 506 #[doc(alias = "gtk_flow_box_get_max_children_per_line")] 507 #[doc(alias = "get_max_children_per_line")] max_children_per_line(&self) -> u32508 fn max_children_per_line(&self) -> u32; 509 510 #[doc(alias = "gtk_flow_box_get_min_children_per_line")] 511 #[doc(alias = "get_min_children_per_line")] min_children_per_line(&self) -> u32512 fn min_children_per_line(&self) -> u32; 513 514 #[doc(alias = "gtk_flow_box_get_row_spacing")] 515 #[doc(alias = "get_row_spacing")] row_spacing(&self) -> u32516 fn row_spacing(&self) -> u32; 517 518 #[doc(alias = "gtk_flow_box_get_selected_children")] 519 #[doc(alias = "get_selected_children")] selected_children(&self) -> Vec<FlowBoxChild>520 fn selected_children(&self) -> Vec<FlowBoxChild>; 521 522 #[doc(alias = "gtk_flow_box_get_selection_mode")] 523 #[doc(alias = "get_selection_mode")] selection_mode(&self) -> SelectionMode524 fn selection_mode(&self) -> SelectionMode; 525 526 #[doc(alias = "gtk_flow_box_insert")] insert<P: IsA<Widget>>(&self, widget: &P, position: i32)527 fn insert<P: IsA<Widget>>(&self, widget: &P, position: i32); 528 529 #[doc(alias = "gtk_flow_box_invalidate_filter")] invalidate_filter(&self)530 fn invalidate_filter(&self); 531 532 #[doc(alias = "gtk_flow_box_invalidate_sort")] invalidate_sort(&self)533 fn invalidate_sort(&self); 534 535 #[doc(alias = "gtk_flow_box_select_all")] select_all(&self)536 fn select_all(&self); 537 538 #[doc(alias = "gtk_flow_box_select_child")] select_child<P: IsA<FlowBoxChild>>(&self, child: &P)539 fn select_child<P: IsA<FlowBoxChild>>(&self, child: &P); 540 541 #[doc(alias = "gtk_flow_box_selected_foreach")] selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P)542 fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P); 543 544 #[doc(alias = "gtk_flow_box_set_activate_on_single_click")] set_activate_on_single_click(&self, single: bool)545 fn set_activate_on_single_click(&self, single: bool); 546 547 #[doc(alias = "gtk_flow_box_set_column_spacing")] set_column_spacing(&self, spacing: u32)548 fn set_column_spacing(&self, spacing: u32); 549 550 #[doc(alias = "gtk_flow_box_set_filter_func")] set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>)551 fn set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>); 552 553 #[doc(alias = "gtk_flow_box_set_hadjustment")] set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)554 fn set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P); 555 556 #[doc(alias = "gtk_flow_box_set_homogeneous")] set_homogeneous(&self, homogeneous: bool)557 fn set_homogeneous(&self, homogeneous: bool); 558 559 #[doc(alias = "gtk_flow_box_set_max_children_per_line")] set_max_children_per_line(&self, n_children: u32)560 fn set_max_children_per_line(&self, n_children: u32); 561 562 #[doc(alias = "gtk_flow_box_set_min_children_per_line")] set_min_children_per_line(&self, n_children: u32)563 fn set_min_children_per_line(&self, n_children: u32); 564 565 #[doc(alias = "gtk_flow_box_set_row_spacing")] set_row_spacing(&self, spacing: u32)566 fn set_row_spacing(&self, spacing: u32); 567 568 #[doc(alias = "gtk_flow_box_set_selection_mode")] set_selection_mode(&self, mode: SelectionMode)569 fn set_selection_mode(&self, mode: SelectionMode); 570 571 #[doc(alias = "gtk_flow_box_set_sort_func")] set_sort_func( &self, sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, )572 fn set_sort_func( 573 &self, 574 sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 575 ); 576 577 #[doc(alias = "gtk_flow_box_set_vadjustment")] set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)578 fn set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P); 579 580 #[doc(alias = "gtk_flow_box_unselect_all")] unselect_all(&self)581 fn unselect_all(&self); 582 583 #[doc(alias = "gtk_flow_box_unselect_child")] unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P)584 fn unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P); 585 586 #[doc(alias = "activate-cursor-child")] connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId587 fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 588 emit_activate_cursor_child(&self)589 fn emit_activate_cursor_child(&self); 590 591 #[doc(alias = "child-activated")] connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( &self, f: F, ) -> SignalHandlerId592 fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( 593 &self, 594 f: F, 595 ) -> SignalHandlerId; 596 597 #[doc(alias = "move-cursor")] connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId598 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( 599 &self, 600 f: F, 601 ) -> SignalHandlerId; 602 emit_move_cursor(&self, step: MovementStep, count: i32) -> bool603 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool; 604 605 #[doc(alias = "select-all")] connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId606 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 607 emit_select_all(&self)608 fn emit_select_all(&self); 609 610 #[doc(alias = "selected-children-changed")] connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId611 fn connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 612 613 #[doc(alias = "toggle-cursor-child")] connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId614 fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 615 emit_toggle_cursor_child(&self)616 fn emit_toggle_cursor_child(&self); 617 618 #[doc(alias = "unselect-all")] connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId619 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 620 emit_unselect_all(&self)621 fn emit_unselect_all(&self); 622 623 #[doc(alias = "activate-on-single-click")] connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId624 fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>( 625 &self, 626 f: F, 627 ) -> SignalHandlerId; 628 629 #[doc(alias = "column-spacing")] connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId630 fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 631 632 #[doc(alias = "homogeneous")] connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId633 fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 634 635 #[doc(alias = "max-children-per-line")] connect_max_children_per_line_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId636 fn connect_max_children_per_line_notify<F: Fn(&Self) + 'static>(&self, f: F) 637 -> SignalHandlerId; 638 639 #[doc(alias = "min-children-per-line")] connect_min_children_per_line_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId640 fn connect_min_children_per_line_notify<F: Fn(&Self) + 'static>(&self, f: F) 641 -> SignalHandlerId; 642 643 #[doc(alias = "row-spacing")] connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId644 fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 645 646 #[doc(alias = "selection-mode")] connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId647 fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 648 } 649 650 impl<O: IsA<FlowBox>> FlowBoxExt for O { bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( &self, model: Option<&P>, create_widget_func: Q, )651 fn bind_model<P: IsA<gio::ListModel>, Q: Fn(&glib::Object) -> Widget + 'static>( 652 &self, 653 model: Option<&P>, 654 create_widget_func: Q, 655 ) { 656 let create_widget_func_data: Box_<Q> = Box_::new(create_widget_func); 657 unsafe extern "C" fn create_widget_func_func< 658 P: IsA<gio::ListModel>, 659 Q: Fn(&glib::Object) -> Widget + 'static, 660 >( 661 item: *mut glib::gobject_ffi::GObject, 662 user_data: glib::ffi::gpointer, 663 ) -> *mut ffi::GtkWidget { 664 let item = from_glib_borrow(item); 665 let callback: &Q = &*(user_data as *mut _); 666 let res = (*callback)(&item); 667 res.to_glib_full() 668 } 669 let create_widget_func = Some(create_widget_func_func::<P, Q> as _); 670 unsafe extern "C" fn user_data_free_func_func< 671 P: IsA<gio::ListModel>, 672 Q: Fn(&glib::Object) -> Widget + 'static, 673 >( 674 data: glib::ffi::gpointer, 675 ) { 676 let _callback: Box_<Q> = Box_::from_raw(data as *mut _); 677 } 678 let destroy_call4 = Some(user_data_free_func_func::<P, Q> as _); 679 let super_callback0: Box_<Q> = create_widget_func_data; 680 unsafe { 681 ffi::gtk_flow_box_bind_model( 682 self.as_ref().to_glib_none().0, 683 model.map(|p| p.as_ref()).to_glib_none().0, 684 create_widget_func, 685 Box_::into_raw(super_callback0) as *mut _, 686 destroy_call4, 687 ); 688 } 689 } 690 activates_on_single_click(&self) -> bool691 fn activates_on_single_click(&self) -> bool { 692 unsafe { 693 from_glib(ffi::gtk_flow_box_get_activate_on_single_click( 694 self.as_ref().to_glib_none().0, 695 )) 696 } 697 } 698 child_at_index(&self, idx: i32) -> Option<FlowBoxChild>699 fn child_at_index(&self, idx: i32) -> Option<FlowBoxChild> { 700 unsafe { 701 from_glib_none(ffi::gtk_flow_box_get_child_at_index( 702 self.as_ref().to_glib_none().0, 703 idx, 704 )) 705 } 706 } 707 708 #[cfg(any(feature = "v3_22_6", feature = "dox"))] 709 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22_6")))] child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>710 fn child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild> { 711 unsafe { 712 from_glib_none(ffi::gtk_flow_box_get_child_at_pos( 713 self.as_ref().to_glib_none().0, 714 x, 715 y, 716 )) 717 } 718 } 719 column_spacing(&self) -> u32720 fn column_spacing(&self) -> u32 { 721 unsafe { ffi::gtk_flow_box_get_column_spacing(self.as_ref().to_glib_none().0) } 722 } 723 is_homogeneous(&self) -> bool724 fn is_homogeneous(&self) -> bool { 725 unsafe { 726 from_glib(ffi::gtk_flow_box_get_homogeneous( 727 self.as_ref().to_glib_none().0, 728 )) 729 } 730 } 731 max_children_per_line(&self) -> u32732 fn max_children_per_line(&self) -> u32 { 733 unsafe { ffi::gtk_flow_box_get_max_children_per_line(self.as_ref().to_glib_none().0) } 734 } 735 min_children_per_line(&self) -> u32736 fn min_children_per_line(&self) -> u32 { 737 unsafe { ffi::gtk_flow_box_get_min_children_per_line(self.as_ref().to_glib_none().0) } 738 } 739 row_spacing(&self) -> u32740 fn row_spacing(&self) -> u32 { 741 unsafe { ffi::gtk_flow_box_get_row_spacing(self.as_ref().to_glib_none().0) } 742 } 743 selected_children(&self) -> Vec<FlowBoxChild>744 fn selected_children(&self) -> Vec<FlowBoxChild> { 745 unsafe { 746 FromGlibPtrContainer::from_glib_container(ffi::gtk_flow_box_get_selected_children( 747 self.as_ref().to_glib_none().0, 748 )) 749 } 750 } 751 selection_mode(&self) -> SelectionMode752 fn selection_mode(&self) -> SelectionMode { 753 unsafe { 754 from_glib(ffi::gtk_flow_box_get_selection_mode( 755 self.as_ref().to_glib_none().0, 756 )) 757 } 758 } 759 insert<P: IsA<Widget>>(&self, widget: &P, position: i32)760 fn insert<P: IsA<Widget>>(&self, widget: &P, position: i32) { 761 unsafe { 762 ffi::gtk_flow_box_insert( 763 self.as_ref().to_glib_none().0, 764 widget.as_ref().to_glib_none().0, 765 position, 766 ); 767 } 768 } 769 invalidate_filter(&self)770 fn invalidate_filter(&self) { 771 unsafe { 772 ffi::gtk_flow_box_invalidate_filter(self.as_ref().to_glib_none().0); 773 } 774 } 775 invalidate_sort(&self)776 fn invalidate_sort(&self) { 777 unsafe { 778 ffi::gtk_flow_box_invalidate_sort(self.as_ref().to_glib_none().0); 779 } 780 } 781 select_all(&self)782 fn select_all(&self) { 783 unsafe { 784 ffi::gtk_flow_box_select_all(self.as_ref().to_glib_none().0); 785 } 786 } 787 select_child<P: IsA<FlowBoxChild>>(&self, child: &P)788 fn select_child<P: IsA<FlowBoxChild>>(&self, child: &P) { 789 unsafe { 790 ffi::gtk_flow_box_select_child( 791 self.as_ref().to_glib_none().0, 792 child.as_ref().to_glib_none().0, 793 ); 794 } 795 } 796 selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P)797 fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P) { 798 let func_data: P = func; 799 unsafe extern "C" fn func_func<P: FnMut(&FlowBox, &FlowBoxChild)>( 800 box_: *mut ffi::GtkFlowBox, 801 child: *mut ffi::GtkFlowBoxChild, 802 user_data: glib::ffi::gpointer, 803 ) { 804 let box_ = from_glib_borrow(box_); 805 let child = from_glib_borrow(child); 806 let callback: *mut P = user_data as *const _ as usize as *mut P; 807 (*callback)(&box_, &child); 808 } 809 let func = Some(func_func::<P> as _); 810 let super_callback0: &P = &func_data; 811 unsafe { 812 ffi::gtk_flow_box_selected_foreach( 813 self.as_ref().to_glib_none().0, 814 func, 815 super_callback0 as *const _ as usize as *mut _, 816 ); 817 } 818 } 819 set_activate_on_single_click(&self, single: bool)820 fn set_activate_on_single_click(&self, single: bool) { 821 unsafe { 822 ffi::gtk_flow_box_set_activate_on_single_click( 823 self.as_ref().to_glib_none().0, 824 single.into_glib(), 825 ); 826 } 827 } 828 set_column_spacing(&self, spacing: u32)829 fn set_column_spacing(&self, spacing: u32) { 830 unsafe { 831 ffi::gtk_flow_box_set_column_spacing(self.as_ref().to_glib_none().0, spacing); 832 } 833 } 834 set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>)835 fn set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>) { 836 let filter_func_data: Box_<Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 837 Box_::new(filter_func); 838 unsafe extern "C" fn filter_func_func( 839 child: *mut ffi::GtkFlowBoxChild, 840 user_data: glib::ffi::gpointer, 841 ) -> glib::ffi::gboolean { 842 let child = from_glib_borrow(child); 843 let callback: &Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>> = 844 &*(user_data as *mut _); 845 let res = if let Some(ref callback) = *callback { 846 callback(&child) 847 } else { 848 panic!("cannot get closure...") 849 }; 850 res.into_glib() 851 } 852 let filter_func = if filter_func_data.is_some() { 853 Some(filter_func_func as _) 854 } else { 855 None 856 }; 857 unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) { 858 let _callback: Box_<Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 859 Box_::from_raw(data as *mut _); 860 } 861 let destroy_call3 = Some(destroy_func as _); 862 let super_callback0: Box_<Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>> = 863 filter_func_data; 864 unsafe { 865 ffi::gtk_flow_box_set_filter_func( 866 self.as_ref().to_glib_none().0, 867 filter_func, 868 Box_::into_raw(super_callback0) as *mut _, 869 destroy_call3, 870 ); 871 } 872 } 873 set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)874 fn set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P) { 875 unsafe { 876 ffi::gtk_flow_box_set_hadjustment( 877 self.as_ref().to_glib_none().0, 878 adjustment.as_ref().to_glib_none().0, 879 ); 880 } 881 } 882 set_homogeneous(&self, homogeneous: bool)883 fn set_homogeneous(&self, homogeneous: bool) { 884 unsafe { 885 ffi::gtk_flow_box_set_homogeneous( 886 self.as_ref().to_glib_none().0, 887 homogeneous.into_glib(), 888 ); 889 } 890 } 891 set_max_children_per_line(&self, n_children: u32)892 fn set_max_children_per_line(&self, n_children: u32) { 893 unsafe { 894 ffi::gtk_flow_box_set_max_children_per_line(self.as_ref().to_glib_none().0, n_children); 895 } 896 } 897 set_min_children_per_line(&self, n_children: u32)898 fn set_min_children_per_line(&self, n_children: u32) { 899 unsafe { 900 ffi::gtk_flow_box_set_min_children_per_line(self.as_ref().to_glib_none().0, n_children); 901 } 902 } 903 set_row_spacing(&self, spacing: u32)904 fn set_row_spacing(&self, spacing: u32) { 905 unsafe { 906 ffi::gtk_flow_box_set_row_spacing(self.as_ref().to_glib_none().0, spacing); 907 } 908 } 909 set_selection_mode(&self, mode: SelectionMode)910 fn set_selection_mode(&self, mode: SelectionMode) { 911 unsafe { 912 ffi::gtk_flow_box_set_selection_mode(self.as_ref().to_glib_none().0, mode.into_glib()); 913 } 914 } 915 set_sort_func( &self, sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, )916 fn set_sort_func( 917 &self, 918 sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 919 ) { 920 let sort_func_data: Box_< 921 Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 922 > = Box_::new(sort_func); 923 unsafe extern "C" fn sort_func_func( 924 child1: *mut ffi::GtkFlowBoxChild, 925 child2: *mut ffi::GtkFlowBoxChild, 926 user_data: glib::ffi::gpointer, 927 ) -> libc::c_int { 928 let child1 = from_glib_borrow(child1); 929 let child2 = from_glib_borrow(child2); 930 let callback: &Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>> = 931 &*(user_data as *mut _); 932 let res = if let Some(ref callback) = *callback { 933 callback(&child1, &child2) 934 } else { 935 panic!("cannot get closure...") 936 }; 937 res 938 } 939 let sort_func = if sort_func_data.is_some() { 940 Some(sort_func_func as _) 941 } else { 942 None 943 }; 944 unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) { 945 let _callback: Box_< 946 Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 947 > = Box_::from_raw(data as *mut _); 948 } 949 let destroy_call3 = Some(destroy_func as _); 950 let super_callback0: Box_< 951 Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>, 952 > = sort_func_data; 953 unsafe { 954 ffi::gtk_flow_box_set_sort_func( 955 self.as_ref().to_glib_none().0, 956 sort_func, 957 Box_::into_raw(super_callback0) as *mut _, 958 destroy_call3, 959 ); 960 } 961 } 962 set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)963 fn set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P) { 964 unsafe { 965 ffi::gtk_flow_box_set_vadjustment( 966 self.as_ref().to_glib_none().0, 967 adjustment.as_ref().to_glib_none().0, 968 ); 969 } 970 } 971 unselect_all(&self)972 fn unselect_all(&self) { 973 unsafe { 974 ffi::gtk_flow_box_unselect_all(self.as_ref().to_glib_none().0); 975 } 976 } 977 unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P)978 fn unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P) { 979 unsafe { 980 ffi::gtk_flow_box_unselect_child( 981 self.as_ref().to_glib_none().0, 982 child.as_ref().to_glib_none().0, 983 ); 984 } 985 } 986 connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId987 fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 988 unsafe extern "C" fn activate_cursor_child_trampoline< 989 P: IsA<FlowBox>, 990 F: Fn(&P) + 'static, 991 >( 992 this: *mut ffi::GtkFlowBox, 993 f: glib::ffi::gpointer, 994 ) { 995 let f: &F = &*(f as *const F); 996 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 997 } 998 unsafe { 999 let f: Box_<F> = Box_::new(f); 1000 connect_raw( 1001 self.as_ptr() as *mut _, 1002 b"activate-cursor-child\0".as_ptr() as *const _, 1003 Some(transmute::<_, unsafe extern "C" fn()>( 1004 activate_cursor_child_trampoline::<Self, F> as *const (), 1005 )), 1006 Box_::into_raw(f), 1007 ) 1008 } 1009 } 1010 emit_activate_cursor_child(&self)1011 fn emit_activate_cursor_child(&self) { 1012 let _ = unsafe { 1013 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1014 .emit_by_name("activate-cursor-child", &[]) 1015 .unwrap() 1016 }; 1017 } 1018 connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( &self, f: F, ) -> SignalHandlerId1019 fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>( 1020 &self, 1021 f: F, 1022 ) -> SignalHandlerId { 1023 unsafe extern "C" fn child_activated_trampoline< 1024 P: IsA<FlowBox>, 1025 F: Fn(&P, &FlowBoxChild) + 'static, 1026 >( 1027 this: *mut ffi::GtkFlowBox, 1028 child: *mut ffi::GtkFlowBoxChild, 1029 f: glib::ffi::gpointer, 1030 ) { 1031 let f: &F = &*(f as *const F); 1032 f( 1033 FlowBox::from_glib_borrow(this).unsafe_cast_ref(), 1034 &from_glib_borrow(child), 1035 ) 1036 } 1037 unsafe { 1038 let f: Box_<F> = Box_::new(f); 1039 connect_raw( 1040 self.as_ptr() as *mut _, 1041 b"child-activated\0".as_ptr() as *const _, 1042 Some(transmute::<_, unsafe extern "C" fn()>( 1043 child_activated_trampoline::<Self, F> as *const (), 1044 )), 1045 Box_::into_raw(f), 1046 ) 1047 } 1048 } 1049 connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId1050 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>( 1051 &self, 1052 f: F, 1053 ) -> SignalHandlerId { 1054 unsafe extern "C" fn move_cursor_trampoline< 1055 P: IsA<FlowBox>, 1056 F: Fn(&P, MovementStep, i32) -> bool + 'static, 1057 >( 1058 this: *mut ffi::GtkFlowBox, 1059 step: ffi::GtkMovementStep, 1060 count: libc::c_int, 1061 f: glib::ffi::gpointer, 1062 ) -> glib::ffi::gboolean { 1063 let f: &F = &*(f as *const F); 1064 f( 1065 FlowBox::from_glib_borrow(this).unsafe_cast_ref(), 1066 from_glib(step), 1067 count, 1068 ) 1069 .into_glib() 1070 } 1071 unsafe { 1072 let f: Box_<F> = Box_::new(f); 1073 connect_raw( 1074 self.as_ptr() as *mut _, 1075 b"move-cursor\0".as_ptr() as *const _, 1076 Some(transmute::<_, unsafe extern "C" fn()>( 1077 move_cursor_trampoline::<Self, F> as *const (), 1078 )), 1079 Box_::into_raw(f), 1080 ) 1081 } 1082 } 1083 emit_move_cursor(&self, step: MovementStep, count: i32) -> bool1084 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool { 1085 let res = unsafe { 1086 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1087 .emit_by_name("move-cursor", &[&step, &count]) 1088 .unwrap() 1089 }; 1090 res.unwrap() 1091 .get() 1092 .expect("Return Value for `emit_move_cursor`") 1093 } 1094 connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1095 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1096 unsafe extern "C" fn select_all_trampoline<P: IsA<FlowBox>, F: Fn(&P) + 'static>( 1097 this: *mut ffi::GtkFlowBox, 1098 f: glib::ffi::gpointer, 1099 ) { 1100 let f: &F = &*(f as *const F); 1101 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1102 } 1103 unsafe { 1104 let f: Box_<F> = Box_::new(f); 1105 connect_raw( 1106 self.as_ptr() as *mut _, 1107 b"select-all\0".as_ptr() as *const _, 1108 Some(transmute::<_, unsafe extern "C" fn()>( 1109 select_all_trampoline::<Self, F> as *const (), 1110 )), 1111 Box_::into_raw(f), 1112 ) 1113 } 1114 } 1115 emit_select_all(&self)1116 fn emit_select_all(&self) { 1117 let _ = unsafe { 1118 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1119 .emit_by_name("select-all", &[]) 1120 .unwrap() 1121 }; 1122 } 1123 connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1124 fn connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1125 unsafe extern "C" fn selected_children_changed_trampoline< 1126 P: IsA<FlowBox>, 1127 F: Fn(&P) + 'static, 1128 >( 1129 this: *mut ffi::GtkFlowBox, 1130 f: glib::ffi::gpointer, 1131 ) { 1132 let f: &F = &*(f as *const F); 1133 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1134 } 1135 unsafe { 1136 let f: Box_<F> = Box_::new(f); 1137 connect_raw( 1138 self.as_ptr() as *mut _, 1139 b"selected-children-changed\0".as_ptr() as *const _, 1140 Some(transmute::<_, unsafe extern "C" fn()>( 1141 selected_children_changed_trampoline::<Self, F> as *const (), 1142 )), 1143 Box_::into_raw(f), 1144 ) 1145 } 1146 } 1147 connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1148 fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1149 unsafe extern "C" fn toggle_cursor_child_trampoline< 1150 P: IsA<FlowBox>, 1151 F: Fn(&P) + 'static, 1152 >( 1153 this: *mut ffi::GtkFlowBox, 1154 f: glib::ffi::gpointer, 1155 ) { 1156 let f: &F = &*(f as *const F); 1157 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1158 } 1159 unsafe { 1160 let f: Box_<F> = Box_::new(f); 1161 connect_raw( 1162 self.as_ptr() as *mut _, 1163 b"toggle-cursor-child\0".as_ptr() as *const _, 1164 Some(transmute::<_, unsafe extern "C" fn()>( 1165 toggle_cursor_child_trampoline::<Self, F> as *const (), 1166 )), 1167 Box_::into_raw(f), 1168 ) 1169 } 1170 } 1171 emit_toggle_cursor_child(&self)1172 fn emit_toggle_cursor_child(&self) { 1173 let _ = unsafe { 1174 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1175 .emit_by_name("toggle-cursor-child", &[]) 1176 .unwrap() 1177 }; 1178 } 1179 connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1180 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1181 unsafe extern "C" fn unselect_all_trampoline<P: IsA<FlowBox>, F: Fn(&P) + 'static>( 1182 this: *mut ffi::GtkFlowBox, 1183 f: glib::ffi::gpointer, 1184 ) { 1185 let f: &F = &*(f as *const F); 1186 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1187 } 1188 unsafe { 1189 let f: Box_<F> = Box_::new(f); 1190 connect_raw( 1191 self.as_ptr() as *mut _, 1192 b"unselect-all\0".as_ptr() as *const _, 1193 Some(transmute::<_, unsafe extern "C" fn()>( 1194 unselect_all_trampoline::<Self, F> as *const (), 1195 )), 1196 Box_::into_raw(f), 1197 ) 1198 } 1199 } 1200 emit_unselect_all(&self)1201 fn emit_unselect_all(&self) { 1202 let _ = unsafe { 1203 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1204 .emit_by_name("unselect-all", &[]) 1205 .unwrap() 1206 }; 1207 } 1208 connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1209 fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>( 1210 &self, 1211 f: F, 1212 ) -> SignalHandlerId { 1213 unsafe extern "C" fn notify_activate_on_single_click_trampoline< 1214 P: IsA<FlowBox>, 1215 F: Fn(&P) + 'static, 1216 >( 1217 this: *mut ffi::GtkFlowBox, 1218 _param_spec: glib::ffi::gpointer, 1219 f: glib::ffi::gpointer, 1220 ) { 1221 let f: &F = &*(f as *const F); 1222 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1223 } 1224 unsafe { 1225 let f: Box_<F> = Box_::new(f); 1226 connect_raw( 1227 self.as_ptr() as *mut _, 1228 b"notify::activate-on-single-click\0".as_ptr() as *const _, 1229 Some(transmute::<_, unsafe extern "C" fn()>( 1230 notify_activate_on_single_click_trampoline::<Self, F> as *const (), 1231 )), 1232 Box_::into_raw(f), 1233 ) 1234 } 1235 } 1236 connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1237 fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1238 unsafe extern "C" fn notify_column_spacing_trampoline< 1239 P: IsA<FlowBox>, 1240 F: Fn(&P) + 'static, 1241 >( 1242 this: *mut ffi::GtkFlowBox, 1243 _param_spec: glib::ffi::gpointer, 1244 f: glib::ffi::gpointer, 1245 ) { 1246 let f: &F = &*(f as *const F); 1247 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1248 } 1249 unsafe { 1250 let f: Box_<F> = Box_::new(f); 1251 connect_raw( 1252 self.as_ptr() as *mut _, 1253 b"notify::column-spacing\0".as_ptr() as *const _, 1254 Some(transmute::<_, unsafe extern "C" fn()>( 1255 notify_column_spacing_trampoline::<Self, F> as *const (), 1256 )), 1257 Box_::into_raw(f), 1258 ) 1259 } 1260 } 1261 connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1262 fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1263 unsafe extern "C" fn notify_homogeneous_trampoline<P: IsA<FlowBox>, F: Fn(&P) + 'static>( 1264 this: *mut ffi::GtkFlowBox, 1265 _param_spec: glib::ffi::gpointer, 1266 f: glib::ffi::gpointer, 1267 ) { 1268 let f: &F = &*(f as *const F); 1269 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1270 } 1271 unsafe { 1272 let f: Box_<F> = Box_::new(f); 1273 connect_raw( 1274 self.as_ptr() as *mut _, 1275 b"notify::homogeneous\0".as_ptr() as *const _, 1276 Some(transmute::<_, unsafe extern "C" fn()>( 1277 notify_homogeneous_trampoline::<Self, F> as *const (), 1278 )), 1279 Box_::into_raw(f), 1280 ) 1281 } 1282 } 1283 connect_max_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1284 fn connect_max_children_per_line_notify<F: Fn(&Self) + 'static>( 1285 &self, 1286 f: F, 1287 ) -> SignalHandlerId { 1288 unsafe extern "C" fn notify_max_children_per_line_trampoline< 1289 P: IsA<FlowBox>, 1290 F: Fn(&P) + 'static, 1291 >( 1292 this: *mut ffi::GtkFlowBox, 1293 _param_spec: glib::ffi::gpointer, 1294 f: glib::ffi::gpointer, 1295 ) { 1296 let f: &F = &*(f as *const F); 1297 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1298 } 1299 unsafe { 1300 let f: Box_<F> = Box_::new(f); 1301 connect_raw( 1302 self.as_ptr() as *mut _, 1303 b"notify::max-children-per-line\0".as_ptr() as *const _, 1304 Some(transmute::<_, unsafe extern "C" fn()>( 1305 notify_max_children_per_line_trampoline::<Self, F> as *const (), 1306 )), 1307 Box_::into_raw(f), 1308 ) 1309 } 1310 } 1311 connect_min_children_per_line_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1312 fn connect_min_children_per_line_notify<F: Fn(&Self) + 'static>( 1313 &self, 1314 f: F, 1315 ) -> SignalHandlerId { 1316 unsafe extern "C" fn notify_min_children_per_line_trampoline< 1317 P: IsA<FlowBox>, 1318 F: Fn(&P) + 'static, 1319 >( 1320 this: *mut ffi::GtkFlowBox, 1321 _param_spec: glib::ffi::gpointer, 1322 f: glib::ffi::gpointer, 1323 ) { 1324 let f: &F = &*(f as *const F); 1325 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1326 } 1327 unsafe { 1328 let f: Box_<F> = Box_::new(f); 1329 connect_raw( 1330 self.as_ptr() as *mut _, 1331 b"notify::min-children-per-line\0".as_ptr() as *const _, 1332 Some(transmute::<_, unsafe extern "C" fn()>( 1333 notify_min_children_per_line_trampoline::<Self, F> as *const (), 1334 )), 1335 Box_::into_raw(f), 1336 ) 1337 } 1338 } 1339 connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1340 fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1341 unsafe extern "C" fn notify_row_spacing_trampoline<P: IsA<FlowBox>, F: Fn(&P) + 'static>( 1342 this: *mut ffi::GtkFlowBox, 1343 _param_spec: glib::ffi::gpointer, 1344 f: glib::ffi::gpointer, 1345 ) { 1346 let f: &F = &*(f as *const F); 1347 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1348 } 1349 unsafe { 1350 let f: Box_<F> = Box_::new(f); 1351 connect_raw( 1352 self.as_ptr() as *mut _, 1353 b"notify::row-spacing\0".as_ptr() as *const _, 1354 Some(transmute::<_, unsafe extern "C" fn()>( 1355 notify_row_spacing_trampoline::<Self, F> as *const (), 1356 )), 1357 Box_::into_raw(f), 1358 ) 1359 } 1360 } 1361 connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1362 fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1363 unsafe extern "C" fn notify_selection_mode_trampoline< 1364 P: IsA<FlowBox>, 1365 F: Fn(&P) + 'static, 1366 >( 1367 this: *mut ffi::GtkFlowBox, 1368 _param_spec: glib::ffi::gpointer, 1369 f: glib::ffi::gpointer, 1370 ) { 1371 let f: &F = &*(f as *const F); 1372 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref()) 1373 } 1374 unsafe { 1375 let f: Box_<F> = Box_::new(f); 1376 connect_raw( 1377 self.as_ptr() as *mut _, 1378 b"notify::selection-mode\0".as_ptr() as *const _, 1379 Some(transmute::<_, unsafe extern "C" fn()>( 1380 notify_selection_mode_trampoline::<Self, F> as *const (), 1381 )), 1382 Box_::into_raw(f), 1383 ) 1384 } 1385 } 1386 } 1387 1388 impl fmt::Display for FlowBox { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1389 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1390 f.write_str("FlowBox") 1391 } 1392 } 1393