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 use glib; 7 use glib::object::Cast; 8 use glib::object::IsA; 9 use glib::object::ObjectExt; 10 use glib::signal::connect_raw; 11 use glib::signal::SignalHandlerId; 12 use glib::translate::*; 13 use glib::GString; 14 use glib::StaticType; 15 use glib::ToValue; 16 use glib_sys; 17 use gobject_sys; 18 use gtk_sys; 19 use std::boxed::Box as Box_; 20 use std::fmt; 21 use std::mem::transmute; 22 use Align; 23 use Bin; 24 use Buildable; 25 use Container; 26 use ResizeMode; 27 use Widget; 28 29 glib_wrapper! { 30 pub struct Expander(Object<gtk_sys::GtkExpander, gtk_sys::GtkExpanderClass, ExpanderClass>) @extends Bin, Container, Widget, @implements Buildable; 31 32 match fn { 33 get_type => || gtk_sys::gtk_expander_get_type(), 34 } 35 } 36 37 impl Expander { new(label: Option<&str>) -> Expander38 pub fn new(label: Option<&str>) -> Expander { 39 assert_initialized_main_thread!(); 40 unsafe { 41 Widget::from_glib_none(gtk_sys::gtk_expander_new(label.to_glib_none().0)).unsafe_cast() 42 } 43 } 44 new_with_mnemonic(label: &str) -> Expander45 pub fn new_with_mnemonic(label: &str) -> Expander { 46 assert_initialized_main_thread!(); 47 unsafe { 48 Widget::from_glib_none(gtk_sys::gtk_expander_new_with_mnemonic( 49 label.to_glib_none().0, 50 )) 51 .unsafe_cast() 52 } 53 } 54 } 55 56 pub struct ExpanderBuilder { 57 expanded: Option<bool>, 58 label: Option<String>, 59 label_fill: Option<bool>, 60 label_widget: Option<Widget>, 61 resize_toplevel: Option<bool>, 62 spacing: Option<i32>, 63 use_markup: Option<bool>, 64 use_underline: Option<bool>, 65 border_width: Option<u32>, 66 child: Option<Widget>, 67 resize_mode: Option<ResizeMode>, 68 app_paintable: Option<bool>, 69 can_default: Option<bool>, 70 can_focus: Option<bool>, 71 events: Option<gdk::EventMask>, 72 expand: Option<bool>, 73 #[cfg(any(feature = "v3_20", feature = "dox"))] 74 focus_on_click: Option<bool>, 75 halign: Option<Align>, 76 has_default: Option<bool>, 77 has_focus: Option<bool>, 78 has_tooltip: Option<bool>, 79 height_request: Option<i32>, 80 hexpand: Option<bool>, 81 hexpand_set: Option<bool>, 82 is_focus: Option<bool>, 83 margin: Option<i32>, 84 margin_bottom: Option<i32>, 85 margin_end: Option<i32>, 86 margin_start: Option<i32>, 87 margin_top: Option<i32>, 88 name: Option<String>, 89 no_show_all: Option<bool>, 90 opacity: Option<f64>, 91 parent: Option<Container>, 92 receives_default: Option<bool>, 93 sensitive: Option<bool>, 94 //style: /*Unknown type*/, 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 } 103 104 impl ExpanderBuilder { new() -> Self105 pub fn new() -> Self { 106 Self { 107 expanded: None, 108 label: None, 109 label_fill: None, 110 label_widget: None, 111 resize_toplevel: None, 112 spacing: None, 113 use_markup: None, 114 use_underline: None, 115 border_width: None, 116 child: None, 117 resize_mode: None, 118 app_paintable: None, 119 can_default: None, 120 can_focus: None, 121 events: None, 122 expand: None, 123 #[cfg(any(feature = "v3_20", feature = "dox"))] 124 focus_on_click: None, 125 halign: None, 126 has_default: None, 127 has_focus: None, 128 has_tooltip: None, 129 height_request: None, 130 hexpand: None, 131 hexpand_set: None, 132 is_focus: None, 133 margin: None, 134 margin_bottom: None, 135 margin_end: None, 136 margin_start: None, 137 margin_top: None, 138 name: None, 139 no_show_all: None, 140 opacity: None, 141 parent: None, 142 receives_default: None, 143 sensitive: None, 144 tooltip_markup: None, 145 tooltip_text: None, 146 valign: None, 147 vexpand: None, 148 vexpand_set: None, 149 visible: None, 150 width_request: None, 151 } 152 } 153 build(self) -> Expander154 pub fn build(self) -> Expander { 155 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 156 if let Some(ref expanded) = self.expanded { 157 properties.push(("expanded", expanded)); 158 } 159 if let Some(ref label) = self.label { 160 properties.push(("label", label)); 161 } 162 if let Some(ref label_fill) = self.label_fill { 163 properties.push(("label-fill", label_fill)); 164 } 165 if let Some(ref label_widget) = self.label_widget { 166 properties.push(("label-widget", label_widget)); 167 } 168 if let Some(ref resize_toplevel) = self.resize_toplevel { 169 properties.push(("resize-toplevel", resize_toplevel)); 170 } 171 if let Some(ref spacing) = self.spacing { 172 properties.push(("spacing", spacing)); 173 } 174 if let Some(ref use_markup) = self.use_markup { 175 properties.push(("use-markup", use_markup)); 176 } 177 if let Some(ref use_underline) = self.use_underline { 178 properties.push(("use-underline", use_underline)); 179 } 180 if let Some(ref border_width) = self.border_width { 181 properties.push(("border-width", border_width)); 182 } 183 if let Some(ref child) = self.child { 184 properties.push(("child", child)); 185 } 186 if let Some(ref resize_mode) = self.resize_mode { 187 properties.push(("resize-mode", resize_mode)); 188 } 189 if let Some(ref app_paintable) = self.app_paintable { 190 properties.push(("app-paintable", app_paintable)); 191 } 192 if let Some(ref can_default) = self.can_default { 193 properties.push(("can-default", can_default)); 194 } 195 if let Some(ref can_focus) = self.can_focus { 196 properties.push(("can-focus", can_focus)); 197 } 198 if let Some(ref events) = self.events { 199 properties.push(("events", events)); 200 } 201 if let Some(ref expand) = self.expand { 202 properties.push(("expand", expand)); 203 } 204 #[cfg(any(feature = "v3_20", feature = "dox"))] 205 { 206 if let Some(ref focus_on_click) = self.focus_on_click { 207 properties.push(("focus-on-click", focus_on_click)); 208 } 209 } 210 if let Some(ref halign) = self.halign { 211 properties.push(("halign", halign)); 212 } 213 if let Some(ref has_default) = self.has_default { 214 properties.push(("has-default", has_default)); 215 } 216 if let Some(ref has_focus) = self.has_focus { 217 properties.push(("has-focus", has_focus)); 218 } 219 if let Some(ref has_tooltip) = self.has_tooltip { 220 properties.push(("has-tooltip", has_tooltip)); 221 } 222 if let Some(ref height_request) = self.height_request { 223 properties.push(("height-request", height_request)); 224 } 225 if let Some(ref hexpand) = self.hexpand { 226 properties.push(("hexpand", hexpand)); 227 } 228 if let Some(ref hexpand_set) = self.hexpand_set { 229 properties.push(("hexpand-set", hexpand_set)); 230 } 231 if let Some(ref is_focus) = self.is_focus { 232 properties.push(("is-focus", is_focus)); 233 } 234 if let Some(ref margin) = self.margin { 235 properties.push(("margin", margin)); 236 } 237 if let Some(ref margin_bottom) = self.margin_bottom { 238 properties.push(("margin-bottom", margin_bottom)); 239 } 240 if let Some(ref margin_end) = self.margin_end { 241 properties.push(("margin-end", margin_end)); 242 } 243 if let Some(ref margin_start) = self.margin_start { 244 properties.push(("margin-start", margin_start)); 245 } 246 if let Some(ref margin_top) = self.margin_top { 247 properties.push(("margin-top", margin_top)); 248 } 249 if let Some(ref name) = self.name { 250 properties.push(("name", name)); 251 } 252 if let Some(ref no_show_all) = self.no_show_all { 253 properties.push(("no-show-all", no_show_all)); 254 } 255 if let Some(ref opacity) = self.opacity { 256 properties.push(("opacity", opacity)); 257 } 258 if let Some(ref parent) = self.parent { 259 properties.push(("parent", parent)); 260 } 261 if let Some(ref receives_default) = self.receives_default { 262 properties.push(("receives-default", receives_default)); 263 } 264 if let Some(ref sensitive) = self.sensitive { 265 properties.push(("sensitive", sensitive)); 266 } 267 if let Some(ref tooltip_markup) = self.tooltip_markup { 268 properties.push(("tooltip-markup", tooltip_markup)); 269 } 270 if let Some(ref tooltip_text) = self.tooltip_text { 271 properties.push(("tooltip-text", tooltip_text)); 272 } 273 if let Some(ref valign) = self.valign { 274 properties.push(("valign", valign)); 275 } 276 if let Some(ref vexpand) = self.vexpand { 277 properties.push(("vexpand", vexpand)); 278 } 279 if let Some(ref vexpand_set) = self.vexpand_set { 280 properties.push(("vexpand-set", vexpand_set)); 281 } 282 if let Some(ref visible) = self.visible { 283 properties.push(("visible", visible)); 284 } 285 if let Some(ref width_request) = self.width_request { 286 properties.push(("width-request", width_request)); 287 } 288 glib::Object::new(Expander::static_type(), &properties) 289 .expect("object new") 290 .downcast() 291 .expect("downcast") 292 } 293 expanded(mut self, expanded: bool) -> Self294 pub fn expanded(mut self, expanded: bool) -> Self { 295 self.expanded = Some(expanded); 296 self 297 } 298 label(mut self, label: &str) -> Self299 pub fn label(mut self, label: &str) -> Self { 300 self.label = Some(label.to_string()); 301 self 302 } 303 label_fill(mut self, label_fill: bool) -> Self304 pub fn label_fill(mut self, label_fill: bool) -> Self { 305 self.label_fill = Some(label_fill); 306 self 307 } 308 label_widget(mut self, label_widget: &Widget) -> Self309 pub fn label_widget(mut self, label_widget: &Widget) -> Self { 310 self.label_widget = Some(label_widget.clone()); 311 self 312 } 313 resize_toplevel(mut self, resize_toplevel: bool) -> Self314 pub fn resize_toplevel(mut self, resize_toplevel: bool) -> Self { 315 self.resize_toplevel = Some(resize_toplevel); 316 self 317 } 318 spacing(mut self, spacing: i32) -> Self319 pub fn spacing(mut self, spacing: i32) -> Self { 320 self.spacing = Some(spacing); 321 self 322 } 323 use_markup(mut self, use_markup: bool) -> Self324 pub fn use_markup(mut self, use_markup: bool) -> Self { 325 self.use_markup = Some(use_markup); 326 self 327 } 328 use_underline(mut self, use_underline: bool) -> Self329 pub fn use_underline(mut self, use_underline: bool) -> Self { 330 self.use_underline = Some(use_underline); 331 self 332 } 333 border_width(mut self, border_width: u32) -> Self334 pub fn border_width(mut self, border_width: u32) -> Self { 335 self.border_width = Some(border_width); 336 self 337 } 338 child(mut self, child: &Widget) -> Self339 pub fn child(mut self, child: &Widget) -> Self { 340 self.child = Some(child.clone()); 341 self 342 } 343 resize_mode(mut self, resize_mode: ResizeMode) -> Self344 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 345 self.resize_mode = Some(resize_mode); 346 self 347 } 348 app_paintable(mut self, app_paintable: bool) -> Self349 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 350 self.app_paintable = Some(app_paintable); 351 self 352 } 353 can_default(mut self, can_default: bool) -> Self354 pub fn can_default(mut self, can_default: bool) -> Self { 355 self.can_default = Some(can_default); 356 self 357 } 358 can_focus(mut self, can_focus: bool) -> Self359 pub fn can_focus(mut self, can_focus: bool) -> Self { 360 self.can_focus = Some(can_focus); 361 self 362 } 363 events(mut self, events: gdk::EventMask) -> Self364 pub fn events(mut self, events: gdk::EventMask) -> Self { 365 self.events = Some(events); 366 self 367 } 368 expand(mut self, expand: bool) -> Self369 pub fn expand(mut self, expand: bool) -> Self { 370 self.expand = Some(expand); 371 self 372 } 373 374 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self375 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 376 self.focus_on_click = Some(focus_on_click); 377 self 378 } 379 halign(mut self, halign: Align) -> Self380 pub fn halign(mut self, halign: Align) -> Self { 381 self.halign = Some(halign); 382 self 383 } 384 has_default(mut self, has_default: bool) -> Self385 pub fn has_default(mut self, has_default: bool) -> Self { 386 self.has_default = Some(has_default); 387 self 388 } 389 has_focus(mut self, has_focus: bool) -> Self390 pub fn has_focus(mut self, has_focus: bool) -> Self { 391 self.has_focus = Some(has_focus); 392 self 393 } 394 has_tooltip(mut self, has_tooltip: bool) -> Self395 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 396 self.has_tooltip = Some(has_tooltip); 397 self 398 } 399 height_request(mut self, height_request: i32) -> Self400 pub fn height_request(mut self, height_request: i32) -> Self { 401 self.height_request = Some(height_request); 402 self 403 } 404 hexpand(mut self, hexpand: bool) -> Self405 pub fn hexpand(mut self, hexpand: bool) -> Self { 406 self.hexpand = Some(hexpand); 407 self 408 } 409 hexpand_set(mut self, hexpand_set: bool) -> Self410 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 411 self.hexpand_set = Some(hexpand_set); 412 self 413 } 414 is_focus(mut self, is_focus: bool) -> Self415 pub fn is_focus(mut self, is_focus: bool) -> Self { 416 self.is_focus = Some(is_focus); 417 self 418 } 419 margin(mut self, margin: i32) -> Self420 pub fn margin(mut self, margin: i32) -> Self { 421 self.margin = Some(margin); 422 self 423 } 424 margin_bottom(mut self, margin_bottom: i32) -> Self425 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 426 self.margin_bottom = Some(margin_bottom); 427 self 428 } 429 margin_end(mut self, margin_end: i32) -> Self430 pub fn margin_end(mut self, margin_end: i32) -> Self { 431 self.margin_end = Some(margin_end); 432 self 433 } 434 margin_start(mut self, margin_start: i32) -> Self435 pub fn margin_start(mut self, margin_start: i32) -> Self { 436 self.margin_start = Some(margin_start); 437 self 438 } 439 margin_top(mut self, margin_top: i32) -> Self440 pub fn margin_top(mut self, margin_top: i32) -> Self { 441 self.margin_top = Some(margin_top); 442 self 443 } 444 name(mut self, name: &str) -> Self445 pub fn name(mut self, name: &str) -> Self { 446 self.name = Some(name.to_string()); 447 self 448 } 449 no_show_all(mut self, no_show_all: bool) -> Self450 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 451 self.no_show_all = Some(no_show_all); 452 self 453 } 454 opacity(mut self, opacity: f64) -> Self455 pub fn opacity(mut self, opacity: f64) -> Self { 456 self.opacity = Some(opacity); 457 self 458 } 459 parent(mut self, parent: &Container) -> Self460 pub fn parent(mut self, parent: &Container) -> Self { 461 self.parent = Some(parent.clone()); 462 self 463 } 464 receives_default(mut self, receives_default: bool) -> Self465 pub fn receives_default(mut self, receives_default: bool) -> Self { 466 self.receives_default = Some(receives_default); 467 self 468 } 469 sensitive(mut self, sensitive: bool) -> Self470 pub fn sensitive(mut self, sensitive: bool) -> Self { 471 self.sensitive = Some(sensitive); 472 self 473 } 474 tooltip_markup(mut self, tooltip_markup: &str) -> Self475 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 476 self.tooltip_markup = Some(tooltip_markup.to_string()); 477 self 478 } 479 tooltip_text(mut self, tooltip_text: &str) -> Self480 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 481 self.tooltip_text = Some(tooltip_text.to_string()); 482 self 483 } 484 valign(mut self, valign: Align) -> Self485 pub fn valign(mut self, valign: Align) -> Self { 486 self.valign = Some(valign); 487 self 488 } 489 vexpand(mut self, vexpand: bool) -> Self490 pub fn vexpand(mut self, vexpand: bool) -> Self { 491 self.vexpand = Some(vexpand); 492 self 493 } 494 vexpand_set(mut self, vexpand_set: bool) -> Self495 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 496 self.vexpand_set = Some(vexpand_set); 497 self 498 } 499 visible(mut self, visible: bool) -> Self500 pub fn visible(mut self, visible: bool) -> Self { 501 self.visible = Some(visible); 502 self 503 } 504 width_request(mut self, width_request: i32) -> Self505 pub fn width_request(mut self, width_request: i32) -> Self { 506 self.width_request = Some(width_request); 507 self 508 } 509 } 510 511 pub const NONE_EXPANDER: Option<&Expander> = None; 512 513 pub trait ExpanderExt: 'static { get_expanded(&self) -> bool514 fn get_expanded(&self) -> bool; 515 get_label(&self) -> Option<GString>516 fn get_label(&self) -> Option<GString>; 517 get_label_fill(&self) -> bool518 fn get_label_fill(&self) -> bool; 519 get_label_widget(&self) -> Option<Widget>520 fn get_label_widget(&self) -> Option<Widget>; 521 get_resize_toplevel(&self) -> bool522 fn get_resize_toplevel(&self) -> bool; 523 524 #[cfg_attr(feature = "v3_20", deprecated)] get_spacing(&self) -> i32525 fn get_spacing(&self) -> i32; 526 get_use_markup(&self) -> bool527 fn get_use_markup(&self) -> bool; 528 get_use_underline(&self) -> bool529 fn get_use_underline(&self) -> bool; 530 set_expanded(&self, expanded: bool)531 fn set_expanded(&self, expanded: bool); 532 set_label(&self, label: Option<&str>)533 fn set_label(&self, label: Option<&str>); 534 set_label_fill(&self, label_fill: bool)535 fn set_label_fill(&self, label_fill: bool); 536 set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>)537 fn set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>); 538 set_resize_toplevel(&self, resize_toplevel: bool)539 fn set_resize_toplevel(&self, resize_toplevel: bool); 540 541 #[cfg_attr(feature = "v3_20", deprecated)] set_spacing(&self, spacing: i32)542 fn set_spacing(&self, spacing: i32); 543 set_use_markup(&self, use_markup: bool)544 fn set_use_markup(&self, use_markup: bool); 545 set_use_underline(&self, use_underline: bool)546 fn set_use_underline(&self, use_underline: bool); 547 connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId548 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 549 emit_activate(&self)550 fn emit_activate(&self); 551 connect_property_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId552 fn connect_property_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 553 connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId554 fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 555 connect_property_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId556 fn connect_property_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 557 connect_property_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId558 fn connect_property_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) 559 -> SignalHandlerId; 560 connect_property_resize_toplevel_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId561 fn connect_property_resize_toplevel_notify<F: Fn(&Self) + 'static>( 562 &self, 563 f: F, 564 ) -> SignalHandlerId; 565 566 #[cfg_attr(feature = "v3_20", deprecated)] connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId567 fn connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 568 connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId569 fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 570 connect_property_use_underline_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId571 fn connect_property_use_underline_notify<F: Fn(&Self) + 'static>( 572 &self, 573 f: F, 574 ) -> SignalHandlerId; 575 } 576 577 impl<O: IsA<Expander>> ExpanderExt for O { get_expanded(&self) -> bool578 fn get_expanded(&self) -> bool { 579 unsafe { 580 from_glib(gtk_sys::gtk_expander_get_expanded( 581 self.as_ref().to_glib_none().0, 582 )) 583 } 584 } 585 get_label(&self) -> Option<GString>586 fn get_label(&self) -> Option<GString> { 587 unsafe { 588 from_glib_none(gtk_sys::gtk_expander_get_label( 589 self.as_ref().to_glib_none().0, 590 )) 591 } 592 } 593 get_label_fill(&self) -> bool594 fn get_label_fill(&self) -> bool { 595 unsafe { 596 from_glib(gtk_sys::gtk_expander_get_label_fill( 597 self.as_ref().to_glib_none().0, 598 )) 599 } 600 } 601 get_label_widget(&self) -> Option<Widget>602 fn get_label_widget(&self) -> Option<Widget> { 603 unsafe { 604 from_glib_none(gtk_sys::gtk_expander_get_label_widget( 605 self.as_ref().to_glib_none().0, 606 )) 607 } 608 } 609 get_resize_toplevel(&self) -> bool610 fn get_resize_toplevel(&self) -> bool { 611 unsafe { 612 from_glib(gtk_sys::gtk_expander_get_resize_toplevel( 613 self.as_ref().to_glib_none().0, 614 )) 615 } 616 } 617 get_spacing(&self) -> i32618 fn get_spacing(&self) -> i32 { 619 unsafe { gtk_sys::gtk_expander_get_spacing(self.as_ref().to_glib_none().0) } 620 } 621 get_use_markup(&self) -> bool622 fn get_use_markup(&self) -> bool { 623 unsafe { 624 from_glib(gtk_sys::gtk_expander_get_use_markup( 625 self.as_ref().to_glib_none().0, 626 )) 627 } 628 } 629 get_use_underline(&self) -> bool630 fn get_use_underline(&self) -> bool { 631 unsafe { 632 from_glib(gtk_sys::gtk_expander_get_use_underline( 633 self.as_ref().to_glib_none().0, 634 )) 635 } 636 } 637 set_expanded(&self, expanded: bool)638 fn set_expanded(&self, expanded: bool) { 639 unsafe { 640 gtk_sys::gtk_expander_set_expanded(self.as_ref().to_glib_none().0, expanded.to_glib()); 641 } 642 } 643 set_label(&self, label: Option<&str>)644 fn set_label(&self, label: Option<&str>) { 645 unsafe { 646 gtk_sys::gtk_expander_set_label(self.as_ref().to_glib_none().0, label.to_glib_none().0); 647 } 648 } 649 set_label_fill(&self, label_fill: bool)650 fn set_label_fill(&self, label_fill: bool) { 651 unsafe { 652 gtk_sys::gtk_expander_set_label_fill( 653 self.as_ref().to_glib_none().0, 654 label_fill.to_glib(), 655 ); 656 } 657 } 658 set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>)659 fn set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>) { 660 unsafe { 661 gtk_sys::gtk_expander_set_label_widget( 662 self.as_ref().to_glib_none().0, 663 label_widget.map(|p| p.as_ref()).to_glib_none().0, 664 ); 665 } 666 } 667 set_resize_toplevel(&self, resize_toplevel: bool)668 fn set_resize_toplevel(&self, resize_toplevel: bool) { 669 unsafe { 670 gtk_sys::gtk_expander_set_resize_toplevel( 671 self.as_ref().to_glib_none().0, 672 resize_toplevel.to_glib(), 673 ); 674 } 675 } 676 set_spacing(&self, spacing: i32)677 fn set_spacing(&self, spacing: i32) { 678 unsafe { 679 gtk_sys::gtk_expander_set_spacing(self.as_ref().to_glib_none().0, spacing); 680 } 681 } 682 set_use_markup(&self, use_markup: bool)683 fn set_use_markup(&self, use_markup: bool) { 684 unsafe { 685 gtk_sys::gtk_expander_set_use_markup( 686 self.as_ref().to_glib_none().0, 687 use_markup.to_glib(), 688 ); 689 } 690 } 691 set_use_underline(&self, use_underline: bool)692 fn set_use_underline(&self, use_underline: bool) { 693 unsafe { 694 gtk_sys::gtk_expander_set_use_underline( 695 self.as_ref().to_glib_none().0, 696 use_underline.to_glib(), 697 ); 698 } 699 } 700 connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId701 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 702 unsafe extern "C" fn activate_trampoline<P, F: Fn(&P) + 'static>( 703 this: *mut gtk_sys::GtkExpander, 704 f: glib_sys::gpointer, 705 ) where 706 P: IsA<Expander>, 707 { 708 let f: &F = &*(f as *const F); 709 f(&Expander::from_glib_borrow(this).unsafe_cast()) 710 } 711 unsafe { 712 let f: Box_<F> = Box_::new(f); 713 connect_raw( 714 self.as_ptr() as *mut _, 715 b"activate\0".as_ptr() as *const _, 716 Some(transmute(activate_trampoline::<Self, F> as usize)), 717 Box_::into_raw(f), 718 ) 719 } 720 } 721 emit_activate(&self)722 fn emit_activate(&self) { 723 let _ = unsafe { 724 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject) 725 .emit("activate", &[]) 726 .unwrap() 727 }; 728 } 729 connect_property_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId730 fn connect_property_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 731 unsafe extern "C" fn notify_expanded_trampoline<P, F: Fn(&P) + 'static>( 732 this: *mut gtk_sys::GtkExpander, 733 _param_spec: glib_sys::gpointer, 734 f: glib_sys::gpointer, 735 ) where 736 P: IsA<Expander>, 737 { 738 let f: &F = &*(f as *const F); 739 f(&Expander::from_glib_borrow(this).unsafe_cast()) 740 } 741 unsafe { 742 let f: Box_<F> = Box_::new(f); 743 connect_raw( 744 self.as_ptr() as *mut _, 745 b"notify::expanded\0".as_ptr() as *const _, 746 Some(transmute(notify_expanded_trampoline::<Self, F> as usize)), 747 Box_::into_raw(f), 748 ) 749 } 750 } 751 connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId752 fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 753 unsafe extern "C" fn notify_label_trampoline<P, F: Fn(&P) + 'static>( 754 this: *mut gtk_sys::GtkExpander, 755 _param_spec: glib_sys::gpointer, 756 f: glib_sys::gpointer, 757 ) where 758 P: IsA<Expander>, 759 { 760 let f: &F = &*(f as *const F); 761 f(&Expander::from_glib_borrow(this).unsafe_cast()) 762 } 763 unsafe { 764 let f: Box_<F> = Box_::new(f); 765 connect_raw( 766 self.as_ptr() as *mut _, 767 b"notify::label\0".as_ptr() as *const _, 768 Some(transmute(notify_label_trampoline::<Self, F> as usize)), 769 Box_::into_raw(f), 770 ) 771 } 772 } 773 connect_property_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId774 fn connect_property_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 775 unsafe extern "C" fn notify_label_fill_trampoline<P, F: Fn(&P) + 'static>( 776 this: *mut gtk_sys::GtkExpander, 777 _param_spec: glib_sys::gpointer, 778 f: glib_sys::gpointer, 779 ) where 780 P: IsA<Expander>, 781 { 782 let f: &F = &*(f as *const F); 783 f(&Expander::from_glib_borrow(this).unsafe_cast()) 784 } 785 unsafe { 786 let f: Box_<F> = Box_::new(f); 787 connect_raw( 788 self.as_ptr() as *mut _, 789 b"notify::label-fill\0".as_ptr() as *const _, 790 Some(transmute(notify_label_fill_trampoline::<Self, F> as usize)), 791 Box_::into_raw(f), 792 ) 793 } 794 } 795 connect_property_label_widget_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId796 fn connect_property_label_widget_notify<F: Fn(&Self) + 'static>( 797 &self, 798 f: F, 799 ) -> SignalHandlerId { 800 unsafe extern "C" fn notify_label_widget_trampoline<P, F: Fn(&P) + 'static>( 801 this: *mut gtk_sys::GtkExpander, 802 _param_spec: glib_sys::gpointer, 803 f: glib_sys::gpointer, 804 ) where 805 P: IsA<Expander>, 806 { 807 let f: &F = &*(f as *const F); 808 f(&Expander::from_glib_borrow(this).unsafe_cast()) 809 } 810 unsafe { 811 let f: Box_<F> = Box_::new(f); 812 connect_raw( 813 self.as_ptr() as *mut _, 814 b"notify::label-widget\0".as_ptr() as *const _, 815 Some(transmute( 816 notify_label_widget_trampoline::<Self, F> as usize, 817 )), 818 Box_::into_raw(f), 819 ) 820 } 821 } 822 connect_property_resize_toplevel_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId823 fn connect_property_resize_toplevel_notify<F: Fn(&Self) + 'static>( 824 &self, 825 f: F, 826 ) -> SignalHandlerId { 827 unsafe extern "C" fn notify_resize_toplevel_trampoline<P, F: Fn(&P) + 'static>( 828 this: *mut gtk_sys::GtkExpander, 829 _param_spec: glib_sys::gpointer, 830 f: glib_sys::gpointer, 831 ) where 832 P: IsA<Expander>, 833 { 834 let f: &F = &*(f as *const F); 835 f(&Expander::from_glib_borrow(this).unsafe_cast()) 836 } 837 unsafe { 838 let f: Box_<F> = Box_::new(f); 839 connect_raw( 840 self.as_ptr() as *mut _, 841 b"notify::resize-toplevel\0".as_ptr() as *const _, 842 Some(transmute( 843 notify_resize_toplevel_trampoline::<Self, F> as usize, 844 )), 845 Box_::into_raw(f), 846 ) 847 } 848 } 849 connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId850 fn connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 851 unsafe extern "C" fn notify_spacing_trampoline<P, F: Fn(&P) + 'static>( 852 this: *mut gtk_sys::GtkExpander, 853 _param_spec: glib_sys::gpointer, 854 f: glib_sys::gpointer, 855 ) where 856 P: IsA<Expander>, 857 { 858 let f: &F = &*(f as *const F); 859 f(&Expander::from_glib_borrow(this).unsafe_cast()) 860 } 861 unsafe { 862 let f: Box_<F> = Box_::new(f); 863 connect_raw( 864 self.as_ptr() as *mut _, 865 b"notify::spacing\0".as_ptr() as *const _, 866 Some(transmute(notify_spacing_trampoline::<Self, F> as usize)), 867 Box_::into_raw(f), 868 ) 869 } 870 } 871 connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId872 fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 873 unsafe extern "C" fn notify_use_markup_trampoline<P, F: Fn(&P) + 'static>( 874 this: *mut gtk_sys::GtkExpander, 875 _param_spec: glib_sys::gpointer, 876 f: glib_sys::gpointer, 877 ) where 878 P: IsA<Expander>, 879 { 880 let f: &F = &*(f as *const F); 881 f(&Expander::from_glib_borrow(this).unsafe_cast()) 882 } 883 unsafe { 884 let f: Box_<F> = Box_::new(f); 885 connect_raw( 886 self.as_ptr() as *mut _, 887 b"notify::use-markup\0".as_ptr() as *const _, 888 Some(transmute(notify_use_markup_trampoline::<Self, F> as usize)), 889 Box_::into_raw(f), 890 ) 891 } 892 } 893 connect_property_use_underline_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId894 fn connect_property_use_underline_notify<F: Fn(&Self) + 'static>( 895 &self, 896 f: F, 897 ) -> SignalHandlerId { 898 unsafe extern "C" fn notify_use_underline_trampoline<P, F: Fn(&P) + 'static>( 899 this: *mut gtk_sys::GtkExpander, 900 _param_spec: glib_sys::gpointer, 901 f: glib_sys::gpointer, 902 ) where 903 P: IsA<Expander>, 904 { 905 let f: &F = &*(f as *const F); 906 f(&Expander::from_glib_borrow(this).unsafe_cast()) 907 } 908 unsafe { 909 let f: Box_<F> = Box_::new(f); 910 connect_raw( 911 self.as_ptr() as *mut _, 912 b"notify::use-underline\0".as_ptr() as *const _, 913 Some(transmute( 914 notify_use_underline_trampoline::<Self, F> as usize, 915 )), 916 Box_::into_raw(f), 917 ) 918 } 919 } 920 } 921 922 impl fmt::Display for Expander { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result923 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 924 write!(f, "Expander") 925 } 926 } 927