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::Align; 6 use crate::Bin; 7 use crate::Buildable; 8 use crate::Container; 9 use crate::ResizeMode; 10 use crate::Widget; 11 use glib::object::Cast; 12 use glib::object::IsA; 13 use glib::object::ObjectExt; 14 use glib::signal::connect_raw; 15 use glib::signal::SignalHandlerId; 16 use glib::translate::*; 17 use glib::StaticType; 18 use glib::ToValue; 19 use std::boxed::Box as Box_; 20 use std::fmt; 21 use std::mem::transmute; 22 23 glib::wrapper! { 24 #[doc(alias = "GtkExpander")] 25 pub struct Expander(Object<ffi::GtkExpander, ffi::GtkExpanderClass>) @extends Bin, Container, Widget, @implements Buildable; 26 27 match fn { 28 type_ => || ffi::gtk_expander_get_type(), 29 } 30 } 31 32 impl Expander { 33 #[doc(alias = "gtk_expander_new")] new(label: Option<&str>) -> Expander34 pub fn new(label: Option<&str>) -> Expander { 35 assert_initialized_main_thread!(); 36 unsafe { 37 Widget::from_glib_none(ffi::gtk_expander_new(label.to_glib_none().0)).unsafe_cast() 38 } 39 } 40 41 #[doc(alias = "gtk_expander_new_with_mnemonic")] 42 #[doc(alias = "new_with_mnemonic")] with_mnemonic(label: &str) -> Expander43 pub fn with_mnemonic(label: &str) -> Expander { 44 assert_initialized_main_thread!(); 45 unsafe { 46 Widget::from_glib_none(ffi::gtk_expander_new_with_mnemonic(label.to_glib_none().0)) 47 .unsafe_cast() 48 } 49 } 50 51 // rustdoc-stripper-ignore-next 52 /// Creates a new builder-pattern struct instance to construct [`Expander`] objects. 53 /// 54 /// This method returns an instance of [`ExpanderBuilder`] which can be used to create [`Expander`] objects. builder() -> ExpanderBuilder55 pub fn builder() -> ExpanderBuilder { 56 ExpanderBuilder::default() 57 } 58 } 59 60 #[derive(Clone, Default)] 61 // rustdoc-stripper-ignore-next 62 /// A [builder-pattern] type to construct [`Expander`] objects. 63 /// 64 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 65 pub struct ExpanderBuilder { 66 expanded: Option<bool>, 67 label: Option<String>, 68 label_fill: Option<bool>, 69 label_widget: Option<Widget>, 70 resize_toplevel: Option<bool>, 71 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] 72 spacing: Option<i32>, 73 use_markup: Option<bool>, 74 use_underline: Option<bool>, 75 border_width: Option<u32>, 76 child: Option<Widget>, 77 resize_mode: Option<ResizeMode>, 78 app_paintable: Option<bool>, 79 can_default: Option<bool>, 80 can_focus: Option<bool>, 81 events: Option<gdk::EventMask>, 82 expand: Option<bool>, 83 #[cfg(any(feature = "v3_20", feature = "dox"))] 84 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 85 focus_on_click: Option<bool>, 86 halign: Option<Align>, 87 has_default: Option<bool>, 88 has_focus: Option<bool>, 89 has_tooltip: Option<bool>, 90 height_request: Option<i32>, 91 hexpand: Option<bool>, 92 hexpand_set: Option<bool>, 93 is_focus: Option<bool>, 94 margin: Option<i32>, 95 margin_bottom: Option<i32>, 96 margin_end: Option<i32>, 97 margin_start: Option<i32>, 98 margin_top: Option<i32>, 99 name: Option<String>, 100 no_show_all: Option<bool>, 101 opacity: Option<f64>, 102 parent: Option<Container>, 103 receives_default: Option<bool>, 104 sensitive: Option<bool>, 105 tooltip_markup: Option<String>, 106 tooltip_text: Option<String>, 107 valign: Option<Align>, 108 vexpand: Option<bool>, 109 vexpand_set: Option<bool>, 110 visible: Option<bool>, 111 width_request: Option<i32>, 112 } 113 114 impl ExpanderBuilder { 115 // rustdoc-stripper-ignore-next 116 /// Create a new [`ExpanderBuilder`]. new() -> Self117 pub fn new() -> Self { 118 Self::default() 119 } 120 121 // rustdoc-stripper-ignore-next 122 /// Build the [`Expander`]. build(self) -> Expander123 pub fn build(self) -> Expander { 124 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 125 if let Some(ref expanded) = self.expanded { 126 properties.push(("expanded", expanded)); 127 } 128 if let Some(ref label) = self.label { 129 properties.push(("label", label)); 130 } 131 if let Some(ref label_fill) = self.label_fill { 132 properties.push(("label-fill", label_fill)); 133 } 134 if let Some(ref label_widget) = self.label_widget { 135 properties.push(("label-widget", label_widget)); 136 } 137 if let Some(ref resize_toplevel) = self.resize_toplevel { 138 properties.push(("resize-toplevel", resize_toplevel)); 139 } 140 if let Some(ref spacing) = self.spacing { 141 properties.push(("spacing", spacing)); 142 } 143 if let Some(ref use_markup) = self.use_markup { 144 properties.push(("use-markup", use_markup)); 145 } 146 if let Some(ref use_underline) = self.use_underline { 147 properties.push(("use-underline", use_underline)); 148 } 149 if let Some(ref border_width) = self.border_width { 150 properties.push(("border-width", border_width)); 151 } 152 if let Some(ref child) = self.child { 153 properties.push(("child", child)); 154 } 155 if let Some(ref resize_mode) = self.resize_mode { 156 properties.push(("resize-mode", resize_mode)); 157 } 158 if let Some(ref app_paintable) = self.app_paintable { 159 properties.push(("app-paintable", app_paintable)); 160 } 161 if let Some(ref can_default) = self.can_default { 162 properties.push(("can-default", can_default)); 163 } 164 if let Some(ref can_focus) = self.can_focus { 165 properties.push(("can-focus", can_focus)); 166 } 167 if let Some(ref events) = self.events { 168 properties.push(("events", events)); 169 } 170 if let Some(ref expand) = self.expand { 171 properties.push(("expand", expand)); 172 } 173 #[cfg(any(feature = "v3_20", feature = "dox"))] 174 if let Some(ref focus_on_click) = self.focus_on_click { 175 properties.push(("focus-on-click", focus_on_click)); 176 } 177 if let Some(ref halign) = self.halign { 178 properties.push(("halign", halign)); 179 } 180 if let Some(ref has_default) = self.has_default { 181 properties.push(("has-default", has_default)); 182 } 183 if let Some(ref has_focus) = self.has_focus { 184 properties.push(("has-focus", has_focus)); 185 } 186 if let Some(ref has_tooltip) = self.has_tooltip { 187 properties.push(("has-tooltip", has_tooltip)); 188 } 189 if let Some(ref height_request) = self.height_request { 190 properties.push(("height-request", height_request)); 191 } 192 if let Some(ref hexpand) = self.hexpand { 193 properties.push(("hexpand", hexpand)); 194 } 195 if let Some(ref hexpand_set) = self.hexpand_set { 196 properties.push(("hexpand-set", hexpand_set)); 197 } 198 if let Some(ref is_focus) = self.is_focus { 199 properties.push(("is-focus", is_focus)); 200 } 201 if let Some(ref margin) = self.margin { 202 properties.push(("margin", margin)); 203 } 204 if let Some(ref margin_bottom) = self.margin_bottom { 205 properties.push(("margin-bottom", margin_bottom)); 206 } 207 if let Some(ref margin_end) = self.margin_end { 208 properties.push(("margin-end", margin_end)); 209 } 210 if let Some(ref margin_start) = self.margin_start { 211 properties.push(("margin-start", margin_start)); 212 } 213 if let Some(ref margin_top) = self.margin_top { 214 properties.push(("margin-top", margin_top)); 215 } 216 if let Some(ref name) = self.name { 217 properties.push(("name", name)); 218 } 219 if let Some(ref no_show_all) = self.no_show_all { 220 properties.push(("no-show-all", no_show_all)); 221 } 222 if let Some(ref opacity) = self.opacity { 223 properties.push(("opacity", opacity)); 224 } 225 if let Some(ref parent) = self.parent { 226 properties.push(("parent", parent)); 227 } 228 if let Some(ref receives_default) = self.receives_default { 229 properties.push(("receives-default", receives_default)); 230 } 231 if let Some(ref sensitive) = self.sensitive { 232 properties.push(("sensitive", sensitive)); 233 } 234 if let Some(ref tooltip_markup) = self.tooltip_markup { 235 properties.push(("tooltip-markup", tooltip_markup)); 236 } 237 if let Some(ref tooltip_text) = self.tooltip_text { 238 properties.push(("tooltip-text", tooltip_text)); 239 } 240 if let Some(ref valign) = self.valign { 241 properties.push(("valign", valign)); 242 } 243 if let Some(ref vexpand) = self.vexpand { 244 properties.push(("vexpand", vexpand)); 245 } 246 if let Some(ref vexpand_set) = self.vexpand_set { 247 properties.push(("vexpand-set", vexpand_set)); 248 } 249 if let Some(ref visible) = self.visible { 250 properties.push(("visible", visible)); 251 } 252 if let Some(ref width_request) = self.width_request { 253 properties.push(("width-request", width_request)); 254 } 255 glib::Object::new::<Expander>(&properties) 256 .expect("Failed to create an instance of Expander") 257 } 258 expanded(mut self, expanded: bool) -> Self259 pub fn expanded(mut self, expanded: bool) -> Self { 260 self.expanded = Some(expanded); 261 self 262 } 263 label(mut self, label: &str) -> Self264 pub fn label(mut self, label: &str) -> Self { 265 self.label = Some(label.to_string()); 266 self 267 } 268 label_fill(mut self, label_fill: bool) -> Self269 pub fn label_fill(mut self, label_fill: bool) -> Self { 270 self.label_fill = Some(label_fill); 271 self 272 } 273 label_widget<P: IsA<Widget>>(mut self, label_widget: &P) -> Self274 pub fn label_widget<P: IsA<Widget>>(mut self, label_widget: &P) -> Self { 275 self.label_widget = Some(label_widget.clone().upcast()); 276 self 277 } 278 resize_toplevel(mut self, resize_toplevel: bool) -> Self279 pub fn resize_toplevel(mut self, resize_toplevel: bool) -> Self { 280 self.resize_toplevel = Some(resize_toplevel); 281 self 282 } 283 284 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] spacing(mut self, spacing: i32) -> Self285 pub fn spacing(mut self, spacing: i32) -> Self { 286 self.spacing = Some(spacing); 287 self 288 } 289 use_markup(mut self, use_markup: bool) -> Self290 pub fn use_markup(mut self, use_markup: bool) -> Self { 291 self.use_markup = Some(use_markup); 292 self 293 } 294 use_underline(mut self, use_underline: bool) -> Self295 pub fn use_underline(mut self, use_underline: bool) -> Self { 296 self.use_underline = Some(use_underline); 297 self 298 } 299 border_width(mut self, border_width: u32) -> Self300 pub fn border_width(mut self, border_width: u32) -> Self { 301 self.border_width = Some(border_width); 302 self 303 } 304 child<P: IsA<Widget>>(mut self, child: &P) -> Self305 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 306 self.child = Some(child.clone().upcast()); 307 self 308 } 309 resize_mode(mut self, resize_mode: ResizeMode) -> Self310 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 311 self.resize_mode = Some(resize_mode); 312 self 313 } 314 app_paintable(mut self, app_paintable: bool) -> Self315 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 316 self.app_paintable = Some(app_paintable); 317 self 318 } 319 can_default(mut self, can_default: bool) -> Self320 pub fn can_default(mut self, can_default: bool) -> Self { 321 self.can_default = Some(can_default); 322 self 323 } 324 can_focus(mut self, can_focus: bool) -> Self325 pub fn can_focus(mut self, can_focus: bool) -> Self { 326 self.can_focus = Some(can_focus); 327 self 328 } 329 events(mut self, events: gdk::EventMask) -> Self330 pub fn events(mut self, events: gdk::EventMask) -> Self { 331 self.events = Some(events); 332 self 333 } 334 expand(mut self, expand: bool) -> Self335 pub fn expand(mut self, expand: bool) -> Self { 336 self.expand = Some(expand); 337 self 338 } 339 340 #[cfg(any(feature = "v3_20", feature = "dox"))] 341 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self342 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 343 self.focus_on_click = Some(focus_on_click); 344 self 345 } 346 halign(mut self, halign: Align) -> Self347 pub fn halign(mut self, halign: Align) -> Self { 348 self.halign = Some(halign); 349 self 350 } 351 has_default(mut self, has_default: bool) -> Self352 pub fn has_default(mut self, has_default: bool) -> Self { 353 self.has_default = Some(has_default); 354 self 355 } 356 has_focus(mut self, has_focus: bool) -> Self357 pub fn has_focus(mut self, has_focus: bool) -> Self { 358 self.has_focus = Some(has_focus); 359 self 360 } 361 has_tooltip(mut self, has_tooltip: bool) -> Self362 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 363 self.has_tooltip = Some(has_tooltip); 364 self 365 } 366 height_request(mut self, height_request: i32) -> Self367 pub fn height_request(mut self, height_request: i32) -> Self { 368 self.height_request = Some(height_request); 369 self 370 } 371 hexpand(mut self, hexpand: bool) -> Self372 pub fn hexpand(mut self, hexpand: bool) -> Self { 373 self.hexpand = Some(hexpand); 374 self 375 } 376 hexpand_set(mut self, hexpand_set: bool) -> Self377 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 378 self.hexpand_set = Some(hexpand_set); 379 self 380 } 381 is_focus(mut self, is_focus: bool) -> Self382 pub fn is_focus(mut self, is_focus: bool) -> Self { 383 self.is_focus = Some(is_focus); 384 self 385 } 386 margin(mut self, margin: i32) -> Self387 pub fn margin(mut self, margin: i32) -> Self { 388 self.margin = Some(margin); 389 self 390 } 391 margin_bottom(mut self, margin_bottom: i32) -> Self392 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 393 self.margin_bottom = Some(margin_bottom); 394 self 395 } 396 margin_end(mut self, margin_end: i32) -> Self397 pub fn margin_end(mut self, margin_end: i32) -> Self { 398 self.margin_end = Some(margin_end); 399 self 400 } 401 margin_start(mut self, margin_start: i32) -> Self402 pub fn margin_start(mut self, margin_start: i32) -> Self { 403 self.margin_start = Some(margin_start); 404 self 405 } 406 margin_top(mut self, margin_top: i32) -> Self407 pub fn margin_top(mut self, margin_top: i32) -> Self { 408 self.margin_top = Some(margin_top); 409 self 410 } 411 name(mut self, name: &str) -> Self412 pub fn name(mut self, name: &str) -> Self { 413 self.name = Some(name.to_string()); 414 self 415 } 416 no_show_all(mut self, no_show_all: bool) -> Self417 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 418 self.no_show_all = Some(no_show_all); 419 self 420 } 421 opacity(mut self, opacity: f64) -> Self422 pub fn opacity(mut self, opacity: f64) -> Self { 423 self.opacity = Some(opacity); 424 self 425 } 426 parent<P: IsA<Container>>(mut self, parent: &P) -> Self427 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 428 self.parent = Some(parent.clone().upcast()); 429 self 430 } 431 receives_default(mut self, receives_default: bool) -> Self432 pub fn receives_default(mut self, receives_default: bool) -> Self { 433 self.receives_default = Some(receives_default); 434 self 435 } 436 sensitive(mut self, sensitive: bool) -> Self437 pub fn sensitive(mut self, sensitive: bool) -> Self { 438 self.sensitive = Some(sensitive); 439 self 440 } 441 tooltip_markup(mut self, tooltip_markup: &str) -> Self442 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 443 self.tooltip_markup = Some(tooltip_markup.to_string()); 444 self 445 } 446 tooltip_text(mut self, tooltip_text: &str) -> Self447 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 448 self.tooltip_text = Some(tooltip_text.to_string()); 449 self 450 } 451 valign(mut self, valign: Align) -> Self452 pub fn valign(mut self, valign: Align) -> Self { 453 self.valign = Some(valign); 454 self 455 } 456 vexpand(mut self, vexpand: bool) -> Self457 pub fn vexpand(mut self, vexpand: bool) -> Self { 458 self.vexpand = Some(vexpand); 459 self 460 } 461 vexpand_set(mut self, vexpand_set: bool) -> Self462 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 463 self.vexpand_set = Some(vexpand_set); 464 self 465 } 466 visible(mut self, visible: bool) -> Self467 pub fn visible(mut self, visible: bool) -> Self { 468 self.visible = Some(visible); 469 self 470 } 471 width_request(mut self, width_request: i32) -> Self472 pub fn width_request(mut self, width_request: i32) -> Self { 473 self.width_request = Some(width_request); 474 self 475 } 476 } 477 478 pub const NONE_EXPANDER: Option<&Expander> = None; 479 480 pub trait ExpanderExt: 'static { 481 #[doc(alias = "gtk_expander_get_expanded")] 482 #[doc(alias = "get_expanded")] is_expanded(&self) -> bool483 fn is_expanded(&self) -> bool; 484 485 #[doc(alias = "gtk_expander_get_label")] 486 #[doc(alias = "get_label")] label(&self) -> Option<glib::GString>487 fn label(&self) -> Option<glib::GString>; 488 489 #[doc(alias = "gtk_expander_get_label_fill")] 490 #[doc(alias = "get_label_fill")] is_label_fill(&self) -> bool491 fn is_label_fill(&self) -> bool; 492 493 #[doc(alias = "gtk_expander_get_label_widget")] 494 #[doc(alias = "get_label_widget")] label_widget(&self) -> Option<Widget>495 fn label_widget(&self) -> Option<Widget>; 496 497 #[doc(alias = "gtk_expander_get_resize_toplevel")] 498 #[doc(alias = "get_resize_toplevel")] resizes_toplevel(&self) -> bool499 fn resizes_toplevel(&self) -> bool; 500 501 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] 502 #[doc(alias = "gtk_expander_get_spacing")] 503 #[doc(alias = "get_spacing")] spacing(&self) -> i32504 fn spacing(&self) -> i32; 505 506 #[doc(alias = "gtk_expander_get_use_markup")] 507 #[doc(alias = "get_use_markup")] uses_markup(&self) -> bool508 fn uses_markup(&self) -> bool; 509 510 #[doc(alias = "gtk_expander_get_use_underline")] 511 #[doc(alias = "get_use_underline")] uses_underline(&self) -> bool512 fn uses_underline(&self) -> bool; 513 514 #[doc(alias = "gtk_expander_set_expanded")] set_expanded(&self, expanded: bool)515 fn set_expanded(&self, expanded: bool); 516 517 #[doc(alias = "gtk_expander_set_label")] set_label(&self, label: Option<&str>)518 fn set_label(&self, label: Option<&str>); 519 520 #[doc(alias = "gtk_expander_set_label_fill")] set_label_fill(&self, label_fill: bool)521 fn set_label_fill(&self, label_fill: bool); 522 523 #[doc(alias = "gtk_expander_set_label_widget")] set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>)524 fn set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>); 525 526 #[doc(alias = "gtk_expander_set_resize_toplevel")] set_resize_toplevel(&self, resize_toplevel: bool)527 fn set_resize_toplevel(&self, resize_toplevel: bool); 528 529 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] 530 #[doc(alias = "gtk_expander_set_spacing")] set_spacing(&self, spacing: i32)531 fn set_spacing(&self, spacing: i32); 532 533 #[doc(alias = "gtk_expander_set_use_markup")] set_use_markup(&self, use_markup: bool)534 fn set_use_markup(&self, use_markup: bool); 535 536 #[doc(alias = "gtk_expander_set_use_underline")] set_use_underline(&self, use_underline: bool)537 fn set_use_underline(&self, use_underline: bool); 538 539 #[doc(alias = "activate")] connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId540 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 541 emit_activate(&self)542 fn emit_activate(&self); 543 544 #[doc(alias = "expanded")] connect_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId545 fn connect_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 546 547 #[doc(alias = "label")] connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId548 fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 549 550 #[doc(alias = "label-fill")] connect_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId551 fn connect_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 552 553 #[doc(alias = "label-widget")] connect_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId554 fn connect_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 555 556 #[doc(alias = "resize-toplevel")] connect_resize_toplevel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId557 fn connect_resize_toplevel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 558 559 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] 560 #[doc(alias = "spacing")] connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId561 fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 562 563 #[doc(alias = "use-markup")] connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId564 fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 565 566 #[doc(alias = "use-underline")] connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId567 fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 568 } 569 570 impl<O: IsA<Expander>> ExpanderExt for O { is_expanded(&self) -> bool571 fn is_expanded(&self) -> bool { 572 unsafe { 573 from_glib(ffi::gtk_expander_get_expanded( 574 self.as_ref().to_glib_none().0, 575 )) 576 } 577 } 578 label(&self) -> Option<glib::GString>579 fn label(&self) -> Option<glib::GString> { 580 unsafe { from_glib_none(ffi::gtk_expander_get_label(self.as_ref().to_glib_none().0)) } 581 } 582 is_label_fill(&self) -> bool583 fn is_label_fill(&self) -> bool { 584 unsafe { 585 from_glib(ffi::gtk_expander_get_label_fill( 586 self.as_ref().to_glib_none().0, 587 )) 588 } 589 } 590 label_widget(&self) -> Option<Widget>591 fn label_widget(&self) -> Option<Widget> { 592 unsafe { 593 from_glib_none(ffi::gtk_expander_get_label_widget( 594 self.as_ref().to_glib_none().0, 595 )) 596 } 597 } 598 resizes_toplevel(&self) -> bool599 fn resizes_toplevel(&self) -> bool { 600 unsafe { 601 from_glib(ffi::gtk_expander_get_resize_toplevel( 602 self.as_ref().to_glib_none().0, 603 )) 604 } 605 } 606 spacing(&self) -> i32607 fn spacing(&self) -> i32 { 608 unsafe { ffi::gtk_expander_get_spacing(self.as_ref().to_glib_none().0) } 609 } 610 uses_markup(&self) -> bool611 fn uses_markup(&self) -> bool { 612 unsafe { 613 from_glib(ffi::gtk_expander_get_use_markup( 614 self.as_ref().to_glib_none().0, 615 )) 616 } 617 } 618 uses_underline(&self) -> bool619 fn uses_underline(&self) -> bool { 620 unsafe { 621 from_glib(ffi::gtk_expander_get_use_underline( 622 self.as_ref().to_glib_none().0, 623 )) 624 } 625 } 626 set_expanded(&self, expanded: bool)627 fn set_expanded(&self, expanded: bool) { 628 unsafe { 629 ffi::gtk_expander_set_expanded(self.as_ref().to_glib_none().0, expanded.into_glib()); 630 } 631 } 632 set_label(&self, label: Option<&str>)633 fn set_label(&self, label: Option<&str>) { 634 unsafe { 635 ffi::gtk_expander_set_label(self.as_ref().to_glib_none().0, label.to_glib_none().0); 636 } 637 } 638 set_label_fill(&self, label_fill: bool)639 fn set_label_fill(&self, label_fill: bool) { 640 unsafe { 641 ffi::gtk_expander_set_label_fill( 642 self.as_ref().to_glib_none().0, 643 label_fill.into_glib(), 644 ); 645 } 646 } 647 set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>)648 fn set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>) { 649 unsafe { 650 ffi::gtk_expander_set_label_widget( 651 self.as_ref().to_glib_none().0, 652 label_widget.map(|p| p.as_ref()).to_glib_none().0, 653 ); 654 } 655 } 656 set_resize_toplevel(&self, resize_toplevel: bool)657 fn set_resize_toplevel(&self, resize_toplevel: bool) { 658 unsafe { 659 ffi::gtk_expander_set_resize_toplevel( 660 self.as_ref().to_glib_none().0, 661 resize_toplevel.into_glib(), 662 ); 663 } 664 } 665 set_spacing(&self, spacing: i32)666 fn set_spacing(&self, spacing: i32) { 667 unsafe { 668 ffi::gtk_expander_set_spacing(self.as_ref().to_glib_none().0, spacing); 669 } 670 } 671 set_use_markup(&self, use_markup: bool)672 fn set_use_markup(&self, use_markup: bool) { 673 unsafe { 674 ffi::gtk_expander_set_use_markup( 675 self.as_ref().to_glib_none().0, 676 use_markup.into_glib(), 677 ); 678 } 679 } 680 set_use_underline(&self, use_underline: bool)681 fn set_use_underline(&self, use_underline: bool) { 682 unsafe { 683 ffi::gtk_expander_set_use_underline( 684 self.as_ref().to_glib_none().0, 685 use_underline.into_glib(), 686 ); 687 } 688 } 689 connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId690 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 691 unsafe extern "C" fn activate_trampoline<P: IsA<Expander>, F: Fn(&P) + 'static>( 692 this: *mut ffi::GtkExpander, 693 f: glib::ffi::gpointer, 694 ) { 695 let f: &F = &*(f as *const F); 696 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 697 } 698 unsafe { 699 let f: Box_<F> = Box_::new(f); 700 connect_raw( 701 self.as_ptr() as *mut _, 702 b"activate\0".as_ptr() as *const _, 703 Some(transmute::<_, unsafe extern "C" fn()>( 704 activate_trampoline::<Self, F> as *const (), 705 )), 706 Box_::into_raw(f), 707 ) 708 } 709 } 710 emit_activate(&self)711 fn emit_activate(&self) { 712 let _ = unsafe { 713 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 714 .emit_by_name("activate", &[]) 715 .unwrap() 716 }; 717 } 718 connect_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId719 fn connect_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 720 unsafe extern "C" fn notify_expanded_trampoline<P: IsA<Expander>, F: Fn(&P) + 'static>( 721 this: *mut ffi::GtkExpander, 722 _param_spec: glib::ffi::gpointer, 723 f: glib::ffi::gpointer, 724 ) { 725 let f: &F = &*(f as *const F); 726 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 727 } 728 unsafe { 729 let f: Box_<F> = Box_::new(f); 730 connect_raw( 731 self.as_ptr() as *mut _, 732 b"notify::expanded\0".as_ptr() as *const _, 733 Some(transmute::<_, unsafe extern "C" fn()>( 734 notify_expanded_trampoline::<Self, F> as *const (), 735 )), 736 Box_::into_raw(f), 737 ) 738 } 739 } 740 connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId741 fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 742 unsafe extern "C" fn notify_label_trampoline<P: IsA<Expander>, F: Fn(&P) + 'static>( 743 this: *mut ffi::GtkExpander, 744 _param_spec: glib::ffi::gpointer, 745 f: glib::ffi::gpointer, 746 ) { 747 let f: &F = &*(f as *const F); 748 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 749 } 750 unsafe { 751 let f: Box_<F> = Box_::new(f); 752 connect_raw( 753 self.as_ptr() as *mut _, 754 b"notify::label\0".as_ptr() as *const _, 755 Some(transmute::<_, unsafe extern "C" fn()>( 756 notify_label_trampoline::<Self, F> as *const (), 757 )), 758 Box_::into_raw(f), 759 ) 760 } 761 } 762 connect_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId763 fn connect_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 764 unsafe extern "C" fn notify_label_fill_trampoline<P: IsA<Expander>, F: Fn(&P) + 'static>( 765 this: *mut ffi::GtkExpander, 766 _param_spec: glib::ffi::gpointer, 767 f: glib::ffi::gpointer, 768 ) { 769 let f: &F = &*(f as *const F); 770 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 771 } 772 unsafe { 773 let f: Box_<F> = Box_::new(f); 774 connect_raw( 775 self.as_ptr() as *mut _, 776 b"notify::label-fill\0".as_ptr() as *const _, 777 Some(transmute::<_, unsafe extern "C" fn()>( 778 notify_label_fill_trampoline::<Self, F> as *const (), 779 )), 780 Box_::into_raw(f), 781 ) 782 } 783 } 784 connect_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId785 fn connect_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 786 unsafe extern "C" fn notify_label_widget_trampoline< 787 P: IsA<Expander>, 788 F: Fn(&P) + 'static, 789 >( 790 this: *mut ffi::GtkExpander, 791 _param_spec: glib::ffi::gpointer, 792 f: glib::ffi::gpointer, 793 ) { 794 let f: &F = &*(f as *const F); 795 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 796 } 797 unsafe { 798 let f: Box_<F> = Box_::new(f); 799 connect_raw( 800 self.as_ptr() as *mut _, 801 b"notify::label-widget\0".as_ptr() as *const _, 802 Some(transmute::<_, unsafe extern "C" fn()>( 803 notify_label_widget_trampoline::<Self, F> as *const (), 804 )), 805 Box_::into_raw(f), 806 ) 807 } 808 } 809 connect_resize_toplevel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId810 fn connect_resize_toplevel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 811 unsafe extern "C" fn notify_resize_toplevel_trampoline< 812 P: IsA<Expander>, 813 F: Fn(&P) + 'static, 814 >( 815 this: *mut ffi::GtkExpander, 816 _param_spec: glib::ffi::gpointer, 817 f: glib::ffi::gpointer, 818 ) { 819 let f: &F = &*(f as *const F); 820 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 821 } 822 unsafe { 823 let f: Box_<F> = Box_::new(f); 824 connect_raw( 825 self.as_ptr() as *mut _, 826 b"notify::resize-toplevel\0".as_ptr() as *const _, 827 Some(transmute::<_, unsafe extern "C" fn()>( 828 notify_resize_toplevel_trampoline::<Self, F> as *const (), 829 )), 830 Box_::into_raw(f), 831 ) 832 } 833 } 834 connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId835 fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 836 unsafe extern "C" fn notify_spacing_trampoline<P: IsA<Expander>, F: Fn(&P) + 'static>( 837 this: *mut ffi::GtkExpander, 838 _param_spec: glib::ffi::gpointer, 839 f: glib::ffi::gpointer, 840 ) { 841 let f: &F = &*(f as *const F); 842 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 843 } 844 unsafe { 845 let f: Box_<F> = Box_::new(f); 846 connect_raw( 847 self.as_ptr() as *mut _, 848 b"notify::spacing\0".as_ptr() as *const _, 849 Some(transmute::<_, unsafe extern "C" fn()>( 850 notify_spacing_trampoline::<Self, F> as *const (), 851 )), 852 Box_::into_raw(f), 853 ) 854 } 855 } 856 connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId857 fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 858 unsafe extern "C" fn notify_use_markup_trampoline<P: IsA<Expander>, F: Fn(&P) + 'static>( 859 this: *mut ffi::GtkExpander, 860 _param_spec: glib::ffi::gpointer, 861 f: glib::ffi::gpointer, 862 ) { 863 let f: &F = &*(f as *const F); 864 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 865 } 866 unsafe { 867 let f: Box_<F> = Box_::new(f); 868 connect_raw( 869 self.as_ptr() as *mut _, 870 b"notify::use-markup\0".as_ptr() as *const _, 871 Some(transmute::<_, unsafe extern "C" fn()>( 872 notify_use_markup_trampoline::<Self, F> as *const (), 873 )), 874 Box_::into_raw(f), 875 ) 876 } 877 } 878 connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId879 fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 880 unsafe extern "C" fn notify_use_underline_trampoline< 881 P: IsA<Expander>, 882 F: Fn(&P) + 'static, 883 >( 884 this: *mut ffi::GtkExpander, 885 _param_spec: glib::ffi::gpointer, 886 f: glib::ffi::gpointer, 887 ) { 888 let f: &F = &*(f as *const F); 889 f(Expander::from_glib_borrow(this).unsafe_cast_ref()) 890 } 891 unsafe { 892 let f: Box_<F> = Box_::new(f); 893 connect_raw( 894 self.as_ptr() as *mut _, 895 b"notify::use-underline\0".as_ptr() as *const _, 896 Some(transmute::<_, unsafe extern "C" fn()>( 897 notify_use_underline_trampoline::<Self, F> as *const (), 898 )), 899 Box_::into_raw(f), 900 ) 901 } 902 } 903 } 904 905 impl fmt::Display for Expander { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result906 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 907 f.write_str("Expander") 908 } 909 } 910