1use gdk;
6use glib;
7use glib::object::Cast;
8use glib::object::IsA;
9use glib::object::ObjectExt;
10use glib::signal::connect_raw;
11use glib::signal::SignalHandlerId;
12use glib::translate::*;
13use glib::GString;
14use glib::StaticType;
15use glib::ToValue;
16use glib_sys;
17use gobject_sys;
18use gtk_sys;
19use std::boxed::Box as Box_;
20use std::fmt;
21use std::mem::transmute;
22use Align;
23use Bin;
24use Buildable;
25use Container;
26use ResizeMode;
27use Widget;
28
29glib_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
37impl Expander {
38 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
45 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
56pub 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 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
104impl ExpanderBuilder {
105 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
154 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
294 pub fn expanded(mut self, expanded: bool) -> Self {
295 self.expanded = Some(expanded);
296 self
297 }
298
299 pub fn label(mut self, label: &str) -> Self {
300 self.label = Some(label.to_string());
301 self
302 }
303
304 pub fn label_fill(mut self, label_fill: bool) -> Self {
305 self.label_fill = Some(label_fill);
306 self
307 }
308
309 pub fn label_widget(mut self, label_widget: &Widget) -> Self {
310 self.label_widget = Some(label_widget.clone());
311 self
312 }
313
314 pub fn resize_toplevel(mut self, resize_toplevel: bool) -> Self {
315 self.resize_toplevel = Some(resize_toplevel);
316 self
317 }
318
319 pub fn spacing(mut self, spacing: i32) -> Self {
320 self.spacing = Some(spacing);
321 self
322 }
323
324 pub fn use_markup(mut self, use_markup: bool) -> Self {
325 self.use_markup = Some(use_markup);
326 self
327 }
328
329 pub fn use_underline(mut self, use_underline: bool) -> Self {
330 self.use_underline = Some(use_underline);
331 self
332 }
333
334 pub fn border_width(mut self, border_width: u32) -> Self {
335 self.border_width = Some(border_width);
336 self
337 }
338
339 pub fn child(mut self, child: &Widget) -> Self {
340 self.child = Some(child.clone());
341 self
342 }
343
344 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
345 self.resize_mode = Some(resize_mode);
346 self
347 }
348
349 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
350 self.app_paintable = Some(app_paintable);
351 self
352 }
353
354 pub fn can_default(mut self, can_default: bool) -> Self {
355 self.can_default = Some(can_default);
356 self
357 }
358
359 pub fn can_focus(mut self, can_focus: bool) -> Self {
360 self.can_focus = Some(can_focus);
361 self
362 }
363
364 pub fn events(mut self, events: gdk::EventMask) -> Self {
365 self.events = Some(events);
366 self
367 }
368
369 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"))]
375 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
380 pub fn halign(mut self, halign: Align) -> Self {
381 self.halign = Some(halign);
382 self
383 }
384
385 pub fn has_default(mut self, has_default: bool) -> Self {
386 self.has_default = Some(has_default);
387 self
388 }
389
390 pub fn has_focus(mut self, has_focus: bool) -> Self {
391 self.has_focus = Some(has_focus);
392 self
393 }
394
395 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
396 self.has_tooltip = Some(has_tooltip);
397 self
398 }
399
400 pub fn height_request(mut self, height_request: i32) -> Self {
401 self.height_request = Some(height_request);
402 self
403 }
404
405 pub fn hexpand(mut self, hexpand: bool) -> Self {
406 self.hexpand = Some(hexpand);
407 self
408 }
409
410 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
411 self.hexpand_set = Some(hexpand_set);
412 self
413 }
414
415 pub fn is_focus(mut self, is_focus: bool) -> Self {
416 self.is_focus = Some(is_focus);
417 self
418 }
419
420 pub fn margin(mut self, margin: i32) -> Self {
421 self.margin = Some(margin);
422 self
423 }
424
425 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
426 self.margin_bottom = Some(margin_bottom);
427 self
428 }
429
430 pub fn margin_end(mut self, margin_end: i32) -> Self {
431 self.margin_end = Some(margin_end);
432 self
433 }
434
435 pub fn margin_start(mut self, margin_start: i32) -> Self {
436 self.margin_start = Some(margin_start);
437 self
438 }
439
440 pub fn margin_top(mut self, margin_top: i32) -> Self {
441 self.margin_top = Some(margin_top);
442 self
443 }
444
445 pub fn name(mut self, name: &str) -> Self {
446 self.name = Some(name.to_string());
447 self
448 }
449
450 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
455 pub fn opacity(mut self, opacity: f64) -> Self {
456 self.opacity = Some(opacity);
457 self
458 }
459
460 pub fn parent(mut self, parent: &Container) -> Self {
461 self.parent = Some(parent.clone());
462 self
463 }
464
465 pub fn receives_default(mut self, receives_default: bool) -> Self {
466 self.receives_default = Some(receives_default);
467 self
468 }
469
470 pub fn sensitive(mut self, sensitive: bool) -> Self {
471 self.sensitive = Some(sensitive);
472 self
473 }
474
475 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
476 self.tooltip_markup = Some(tooltip_markup.to_string());
477 self
478 }
479
480 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
481 self.tooltip_text = Some(tooltip_text.to_string());
482 self
483 }
484
485 pub fn valign(mut self, valign: Align) -> Self {
486 self.valign = Some(valign);
487 self
488 }
489
490 pub fn vexpand(mut self, vexpand: bool) -> Self {
491 self.vexpand = Some(vexpand);
492 self
493 }
494
495 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
496 self.vexpand_set = Some(vexpand_set);
497 self
498 }
499
500 pub fn visible(mut self, visible: bool) -> Self {
501 self.visible = Some(visible);
502 self
503 }
504
505 pub fn width_request(mut self, width_request: i32) -> Self {
506 self.width_request = Some(width_request);
507 self
508 }
509}
510
511pub const NONE_EXPANDER: Option<&Expander> = None;
512
513pub trait ExpanderExt: 'static {
514 fn get_expanded(&self) -> bool;
515
516 fn get_label(&self) -> Option<GString>;
517
518 fn get_label_fill(&self) -> bool;
519
520 fn get_label_widget(&self) -> Option<Widget>;
521
522 fn get_resize_toplevel(&self) -> bool;
523
524 #[cfg_attr(feature = "v3_20", deprecated)]
525 fn get_spacing(&self) -> i32;
526
527 fn get_use_markup(&self) -> bool;
528
529 fn get_use_underline(&self) -> bool;
530
531 fn set_expanded(&self, expanded: bool);
532
533 fn set_label(&self, label: Option<&str>);
534
535 fn set_label_fill(&self, label_fill: bool);
536
537 fn set_label_widget<P: IsA<Widget>>(&self, label_widget: Option<&P>);
538
539 fn set_resize_toplevel(&self, resize_toplevel: bool);
540
541 #[cfg_attr(feature = "v3_20", deprecated)]
542 fn set_spacing(&self, spacing: i32);
543
544 fn set_use_markup(&self, use_markup: bool);
545
546 fn set_use_underline(&self, use_underline: bool);
547
548 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
549
550 fn emit_activate(&self);
551
552 fn connect_property_expanded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
553
554 fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
555
556 fn connect_property_label_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
557
558 fn connect_property_label_widget_notify<F: Fn(&Self) + 'static>(&self, f: F)
559 -> SignalHandlerId;
560
561 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)]
567 fn connect_property_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
568
569 fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
570
571 fn connect_property_use_underline_notify<F: Fn(&Self) + 'static>(
572 &self,
573 f: F,
574 ) -> SignalHandlerId;
575}
576
577impl<O: IsA<Expander>> ExpanderExt for O {
578 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
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
594 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
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
610 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
618 fn get_spacing(&self) -> i32 {
619 unsafe { gtk_sys::gtk_expander_get_spacing(self.as_ref().to_glib_none().0) }
620 }
621
622 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
630 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
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
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
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
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
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
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
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
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
701 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
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
730 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
752 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
774 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
796 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
823 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
850 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
872 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
894 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
922impl fmt::Display for Expander {
923 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
924 write!(f, "Expander")
925 }
926}