gtk/auto/
scale_button.rs

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
5use 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::Value;
17use glib_sys;
18use gobject_sys;
19use gtk_sys;
20use libc;
21use std::boxed::Box as Box_;
22use std::fmt;
23use std::mem::transmute;
24use Actionable;
25use Adjustment;
26use Align;
27use Bin;
28use Buildable;
29use Button;
30use Container;
31use IconSize;
32use Orientable;
33use PositionType;
34use ReliefStyle;
35use ResizeMode;
36use Widget;
37
38glib_wrapper! {
39    pub struct ScaleButton(Object<gtk_sys::GtkScaleButton, gtk_sys::GtkScaleButtonClass, ScaleButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable, Orientable;
40
41    match fn {
42        get_type => || gtk_sys::gtk_scale_button_get_type(),
43    }
44}
45
46impl ScaleButton {
47    pub fn new(size: IconSize, min: f64, max: f64, step: f64, icons: &[&str]) -> ScaleButton {
48        assert_initialized_main_thread!();
49        unsafe {
50            Widget::from_glib_none(gtk_sys::gtk_scale_button_new(
51                size.to_glib(),
52                min,
53                max,
54                step,
55                icons.to_glib_none().0,
56            ))
57            .unsafe_cast()
58        }
59    }
60}
61
62pub struct ScaleButtonBuilder {
63    adjustment: Option<Adjustment>,
64    icons: Option<Vec<String>>,
65    size: Option<IconSize>,
66    value: Option<f64>,
67    always_show_image: Option<bool>,
68    image: Option<Widget>,
69    image_position: Option<PositionType>,
70    label: Option<String>,
71    relief: Option<ReliefStyle>,
72    use_underline: Option<bool>,
73    border_width: Option<u32>,
74    child: Option<Widget>,
75    resize_mode: Option<ResizeMode>,
76    app_paintable: Option<bool>,
77    can_default: Option<bool>,
78    can_focus: Option<bool>,
79    events: Option<gdk::EventMask>,
80    expand: Option<bool>,
81    #[cfg(any(feature = "v3_20", feature = "dox"))]
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    //style: /*Unknown type*/,
103    tooltip_markup: Option<String>,
104    tooltip_text: Option<String>,
105    valign: Option<Align>,
106    vexpand: Option<bool>,
107    vexpand_set: Option<bool>,
108    visible: Option<bool>,
109    width_request: Option<i32>,
110}
111
112impl ScaleButtonBuilder {
113    pub fn new() -> Self {
114        Self {
115            adjustment: None,
116            icons: None,
117            size: None,
118            value: None,
119            always_show_image: None,
120            image: None,
121            image_position: None,
122            label: None,
123            relief: None,
124            use_underline: None,
125            border_width: None,
126            child: None,
127            resize_mode: None,
128            app_paintable: None,
129            can_default: None,
130            can_focus: None,
131            events: None,
132            expand: None,
133            #[cfg(any(feature = "v3_20", feature = "dox"))]
134            focus_on_click: None,
135            halign: None,
136            has_default: None,
137            has_focus: None,
138            has_tooltip: None,
139            height_request: None,
140            hexpand: None,
141            hexpand_set: None,
142            is_focus: None,
143            margin: None,
144            margin_bottom: None,
145            margin_end: None,
146            margin_start: None,
147            margin_top: None,
148            name: None,
149            no_show_all: None,
150            opacity: None,
151            parent: None,
152            receives_default: None,
153            sensitive: None,
154            tooltip_markup: None,
155            tooltip_text: None,
156            valign: None,
157            vexpand: None,
158            vexpand_set: None,
159            visible: None,
160            width_request: None,
161        }
162    }
163
164    pub fn build(self) -> ScaleButton {
165        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
166        if let Some(ref adjustment) = self.adjustment {
167            properties.push(("adjustment", adjustment));
168        }
169        if let Some(ref icons) = self.icons {
170            properties.push(("icons", icons));
171        }
172        if let Some(ref size) = self.size {
173            properties.push(("size", size));
174        }
175        if let Some(ref value) = self.value {
176            properties.push(("value", value));
177        }
178        if let Some(ref always_show_image) = self.always_show_image {
179            properties.push(("always-show-image", always_show_image));
180        }
181        if let Some(ref image) = self.image {
182            properties.push(("image", image));
183        }
184        if let Some(ref image_position) = self.image_position {
185            properties.push(("image-position", image_position));
186        }
187        if let Some(ref label) = self.label {
188            properties.push(("label", label));
189        }
190        if let Some(ref relief) = self.relief {
191            properties.push(("relief", relief));
192        }
193        if let Some(ref use_underline) = self.use_underline {
194            properties.push(("use-underline", use_underline));
195        }
196        if let Some(ref border_width) = self.border_width {
197            properties.push(("border-width", border_width));
198        }
199        if let Some(ref child) = self.child {
200            properties.push(("child", child));
201        }
202        if let Some(ref resize_mode) = self.resize_mode {
203            properties.push(("resize-mode", resize_mode));
204        }
205        if let Some(ref app_paintable) = self.app_paintable {
206            properties.push(("app-paintable", app_paintable));
207        }
208        if let Some(ref can_default) = self.can_default {
209            properties.push(("can-default", can_default));
210        }
211        if let Some(ref can_focus) = self.can_focus {
212            properties.push(("can-focus", can_focus));
213        }
214        if let Some(ref events) = self.events {
215            properties.push(("events", events));
216        }
217        if let Some(ref expand) = self.expand {
218            properties.push(("expand", expand));
219        }
220        #[cfg(any(feature = "v3_20", feature = "dox"))]
221        {
222            if let Some(ref focus_on_click) = self.focus_on_click {
223                properties.push(("focus-on-click", focus_on_click));
224            }
225        }
226        if let Some(ref halign) = self.halign {
227            properties.push(("halign", halign));
228        }
229        if let Some(ref has_default) = self.has_default {
230            properties.push(("has-default", has_default));
231        }
232        if let Some(ref has_focus) = self.has_focus {
233            properties.push(("has-focus", has_focus));
234        }
235        if let Some(ref has_tooltip) = self.has_tooltip {
236            properties.push(("has-tooltip", has_tooltip));
237        }
238        if let Some(ref height_request) = self.height_request {
239            properties.push(("height-request", height_request));
240        }
241        if let Some(ref hexpand) = self.hexpand {
242            properties.push(("hexpand", hexpand));
243        }
244        if let Some(ref hexpand_set) = self.hexpand_set {
245            properties.push(("hexpand-set", hexpand_set));
246        }
247        if let Some(ref is_focus) = self.is_focus {
248            properties.push(("is-focus", is_focus));
249        }
250        if let Some(ref margin) = self.margin {
251            properties.push(("margin", margin));
252        }
253        if let Some(ref margin_bottom) = self.margin_bottom {
254            properties.push(("margin-bottom", margin_bottom));
255        }
256        if let Some(ref margin_end) = self.margin_end {
257            properties.push(("margin-end", margin_end));
258        }
259        if let Some(ref margin_start) = self.margin_start {
260            properties.push(("margin-start", margin_start));
261        }
262        if let Some(ref margin_top) = self.margin_top {
263            properties.push(("margin-top", margin_top));
264        }
265        if let Some(ref name) = self.name {
266            properties.push(("name", name));
267        }
268        if let Some(ref no_show_all) = self.no_show_all {
269            properties.push(("no-show-all", no_show_all));
270        }
271        if let Some(ref opacity) = self.opacity {
272            properties.push(("opacity", opacity));
273        }
274        if let Some(ref parent) = self.parent {
275            properties.push(("parent", parent));
276        }
277        if let Some(ref receives_default) = self.receives_default {
278            properties.push(("receives-default", receives_default));
279        }
280        if let Some(ref sensitive) = self.sensitive {
281            properties.push(("sensitive", sensitive));
282        }
283        if let Some(ref tooltip_markup) = self.tooltip_markup {
284            properties.push(("tooltip-markup", tooltip_markup));
285        }
286        if let Some(ref tooltip_text) = self.tooltip_text {
287            properties.push(("tooltip-text", tooltip_text));
288        }
289        if let Some(ref valign) = self.valign {
290            properties.push(("valign", valign));
291        }
292        if let Some(ref vexpand) = self.vexpand {
293            properties.push(("vexpand", vexpand));
294        }
295        if let Some(ref vexpand_set) = self.vexpand_set {
296            properties.push(("vexpand-set", vexpand_set));
297        }
298        if let Some(ref visible) = self.visible {
299            properties.push(("visible", visible));
300        }
301        if let Some(ref width_request) = self.width_request {
302            properties.push(("width-request", width_request));
303        }
304        glib::Object::new(ScaleButton::static_type(), &properties)
305            .expect("object new")
306            .downcast()
307            .expect("downcast")
308    }
309
310    pub fn adjustment(mut self, adjustment: &Adjustment) -> Self {
311        self.adjustment = Some(adjustment.clone());
312        self
313    }
314
315    pub fn icons(mut self, icons: Vec<String>) -> Self {
316        self.icons = Some(icons);
317        self
318    }
319
320    pub fn size(mut self, size: IconSize) -> Self {
321        self.size = Some(size);
322        self
323    }
324
325    pub fn value(mut self, value: f64) -> Self {
326        self.value = Some(value);
327        self
328    }
329
330    pub fn always_show_image(mut self, always_show_image: bool) -> Self {
331        self.always_show_image = Some(always_show_image);
332        self
333    }
334
335    pub fn image(mut self, image: &Widget) -> Self {
336        self.image = Some(image.clone());
337        self
338    }
339
340    pub fn image_position(mut self, image_position: PositionType) -> Self {
341        self.image_position = Some(image_position);
342        self
343    }
344
345    pub fn label(mut self, label: &str) -> Self {
346        self.label = Some(label.to_string());
347        self
348    }
349
350    pub fn relief(mut self, relief: ReliefStyle) -> Self {
351        self.relief = Some(relief);
352        self
353    }
354
355    pub fn use_underline(mut self, use_underline: bool) -> Self {
356        self.use_underline = Some(use_underline);
357        self
358    }
359
360    pub fn border_width(mut self, border_width: u32) -> Self {
361        self.border_width = Some(border_width);
362        self
363    }
364
365    pub fn child(mut self, child: &Widget) -> Self {
366        self.child = Some(child.clone());
367        self
368    }
369
370    pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
371        self.resize_mode = Some(resize_mode);
372        self
373    }
374
375    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
376        self.app_paintable = Some(app_paintable);
377        self
378    }
379
380    pub fn can_default(mut self, can_default: bool) -> Self {
381        self.can_default = Some(can_default);
382        self
383    }
384
385    pub fn can_focus(mut self, can_focus: bool) -> Self {
386        self.can_focus = Some(can_focus);
387        self
388    }
389
390    pub fn events(mut self, events: gdk::EventMask) -> Self {
391        self.events = Some(events);
392        self
393    }
394
395    pub fn expand(mut self, expand: bool) -> Self {
396        self.expand = Some(expand);
397        self
398    }
399
400    #[cfg(any(feature = "v3_20", feature = "dox"))]
401    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
402        self.focus_on_click = Some(focus_on_click);
403        self
404    }
405
406    pub fn halign(mut self, halign: Align) -> Self {
407        self.halign = Some(halign);
408        self
409    }
410
411    pub fn has_default(mut self, has_default: bool) -> Self {
412        self.has_default = Some(has_default);
413        self
414    }
415
416    pub fn has_focus(mut self, has_focus: bool) -> Self {
417        self.has_focus = Some(has_focus);
418        self
419    }
420
421    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
422        self.has_tooltip = Some(has_tooltip);
423        self
424    }
425
426    pub fn height_request(mut self, height_request: i32) -> Self {
427        self.height_request = Some(height_request);
428        self
429    }
430
431    pub fn hexpand(mut self, hexpand: bool) -> Self {
432        self.hexpand = Some(hexpand);
433        self
434    }
435
436    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
437        self.hexpand_set = Some(hexpand_set);
438        self
439    }
440
441    pub fn is_focus(mut self, is_focus: bool) -> Self {
442        self.is_focus = Some(is_focus);
443        self
444    }
445
446    pub fn margin(mut self, margin: i32) -> Self {
447        self.margin = Some(margin);
448        self
449    }
450
451    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
452        self.margin_bottom = Some(margin_bottom);
453        self
454    }
455
456    pub fn margin_end(mut self, margin_end: i32) -> Self {
457        self.margin_end = Some(margin_end);
458        self
459    }
460
461    pub fn margin_start(mut self, margin_start: i32) -> Self {
462        self.margin_start = Some(margin_start);
463        self
464    }
465
466    pub fn margin_top(mut self, margin_top: i32) -> Self {
467        self.margin_top = Some(margin_top);
468        self
469    }
470
471    pub fn name(mut self, name: &str) -> Self {
472        self.name = Some(name.to_string());
473        self
474    }
475
476    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
477        self.no_show_all = Some(no_show_all);
478        self
479    }
480
481    pub fn opacity(mut self, opacity: f64) -> Self {
482        self.opacity = Some(opacity);
483        self
484    }
485
486    pub fn parent(mut self, parent: &Container) -> Self {
487        self.parent = Some(parent.clone());
488        self
489    }
490
491    pub fn receives_default(mut self, receives_default: bool) -> Self {
492        self.receives_default = Some(receives_default);
493        self
494    }
495
496    pub fn sensitive(mut self, sensitive: bool) -> Self {
497        self.sensitive = Some(sensitive);
498        self
499    }
500
501    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
502        self.tooltip_markup = Some(tooltip_markup.to_string());
503        self
504    }
505
506    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
507        self.tooltip_text = Some(tooltip_text.to_string());
508        self
509    }
510
511    pub fn valign(mut self, valign: Align) -> Self {
512        self.valign = Some(valign);
513        self
514    }
515
516    pub fn vexpand(mut self, vexpand: bool) -> Self {
517        self.vexpand = Some(vexpand);
518        self
519    }
520
521    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
522        self.vexpand_set = Some(vexpand_set);
523        self
524    }
525
526    pub fn visible(mut self, visible: bool) -> Self {
527        self.visible = Some(visible);
528        self
529    }
530
531    pub fn width_request(mut self, width_request: i32) -> Self {
532        self.width_request = Some(width_request);
533        self
534    }
535}
536
537pub const NONE_SCALE_BUTTON: Option<&ScaleButton> = None;
538
539pub trait ScaleButtonExt: 'static {
540    fn get_adjustment(&self) -> Adjustment;
541
542    fn get_minus_button(&self) -> Option<Button>;
543
544    fn get_plus_button(&self) -> Option<Button>;
545
546    fn get_popup(&self) -> Option<Widget>;
547
548    fn get_value(&self) -> f64;
549
550    fn set_adjustment<P: IsA<Adjustment>>(&self, adjustment: &P);
551
552    fn set_icons(&self, icons: &[&str]);
553
554    fn set_value(&self, value: f64);
555
556    fn get_property_icons(&self) -> Vec<GString>;
557
558    fn get_property_size(&self) -> IconSize;
559
560    fn set_property_size(&self, size: IconSize);
561
562    fn connect_popdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
563
564    fn emit_popdown(&self);
565
566    fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
567
568    fn emit_popup(&self);
569
570    fn connect_value_changed<F: Fn(&Self, f64) + 'static>(&self, f: F) -> SignalHandlerId;
571
572    fn connect_property_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
573
574    fn connect_property_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
575
576    fn connect_property_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
577
578    fn connect_property_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
579}
580
581impl<O: IsA<ScaleButton>> ScaleButtonExt for O {
582    fn get_adjustment(&self) -> Adjustment {
583        unsafe {
584            from_glib_none(gtk_sys::gtk_scale_button_get_adjustment(
585                self.as_ref().to_glib_none().0,
586            ))
587        }
588    }
589
590    fn get_minus_button(&self) -> Option<Button> {
591        unsafe {
592            from_glib_none(gtk_sys::gtk_scale_button_get_minus_button(
593                self.as_ref().to_glib_none().0,
594            ))
595        }
596    }
597
598    fn get_plus_button(&self) -> Option<Button> {
599        unsafe {
600            from_glib_none(gtk_sys::gtk_scale_button_get_plus_button(
601                self.as_ref().to_glib_none().0,
602            ))
603        }
604    }
605
606    fn get_popup(&self) -> Option<Widget> {
607        unsafe {
608            from_glib_none(gtk_sys::gtk_scale_button_get_popup(
609                self.as_ref().to_glib_none().0,
610            ))
611        }
612    }
613
614    fn get_value(&self) -> f64 {
615        unsafe { gtk_sys::gtk_scale_button_get_value(self.as_ref().to_glib_none().0) }
616    }
617
618    fn set_adjustment<P: IsA<Adjustment>>(&self, adjustment: &P) {
619        unsafe {
620            gtk_sys::gtk_scale_button_set_adjustment(
621                self.as_ref().to_glib_none().0,
622                adjustment.as_ref().to_glib_none().0,
623            );
624        }
625    }
626
627    fn set_icons(&self, icons: &[&str]) {
628        unsafe {
629            gtk_sys::gtk_scale_button_set_icons(
630                self.as_ref().to_glib_none().0,
631                icons.to_glib_none().0,
632            );
633        }
634    }
635
636    fn set_value(&self, value: f64) {
637        unsafe {
638            gtk_sys::gtk_scale_button_set_value(self.as_ref().to_glib_none().0, value);
639        }
640    }
641
642    fn get_property_icons(&self) -> Vec<GString> {
643        unsafe {
644            let mut value = Value::from_type(<Vec<GString> as StaticType>::static_type());
645            gobject_sys::g_object_get_property(
646                self.to_glib_none().0 as *mut gobject_sys::GObject,
647                b"icons\0".as_ptr() as *const _,
648                value.to_glib_none_mut().0,
649            );
650            value.get().unwrap()
651        }
652    }
653
654    fn get_property_size(&self) -> IconSize {
655        unsafe {
656            let mut value = Value::from_type(<IconSize as StaticType>::static_type());
657            gobject_sys::g_object_get_property(
658                self.to_glib_none().0 as *mut gobject_sys::GObject,
659                b"size\0".as_ptr() as *const _,
660                value.to_glib_none_mut().0,
661            );
662            value.get().unwrap()
663        }
664    }
665
666    fn set_property_size(&self, size: IconSize) {
667        unsafe {
668            gobject_sys::g_object_set_property(
669                self.to_glib_none().0 as *mut gobject_sys::GObject,
670                b"size\0".as_ptr() as *const _,
671                Value::from(&size).to_glib_none().0,
672            );
673        }
674    }
675
676    fn connect_popdown<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
677        unsafe extern "C" fn popdown_trampoline<P, F: Fn(&P) + 'static>(
678            this: *mut gtk_sys::GtkScaleButton,
679            f: glib_sys::gpointer,
680        ) where
681            P: IsA<ScaleButton>,
682        {
683            let f: &F = &*(f as *const F);
684            f(&ScaleButton::from_glib_borrow(this).unsafe_cast())
685        }
686        unsafe {
687            let f: Box_<F> = Box_::new(f);
688            connect_raw(
689                self.as_ptr() as *mut _,
690                b"popdown\0".as_ptr() as *const _,
691                Some(transmute(popdown_trampoline::<Self, F> as usize)),
692                Box_::into_raw(f),
693            )
694        }
695    }
696
697    fn emit_popdown(&self) {
698        let _ = unsafe {
699            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
700                .emit("popdown", &[])
701                .unwrap()
702        };
703    }
704
705    fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
706        unsafe extern "C" fn popup_trampoline<P, F: Fn(&P) + 'static>(
707            this: *mut gtk_sys::GtkScaleButton,
708            f: glib_sys::gpointer,
709        ) where
710            P: IsA<ScaleButton>,
711        {
712            let f: &F = &*(f as *const F);
713            f(&ScaleButton::from_glib_borrow(this).unsafe_cast())
714        }
715        unsafe {
716            let f: Box_<F> = Box_::new(f);
717            connect_raw(
718                self.as_ptr() as *mut _,
719                b"popup\0".as_ptr() as *const _,
720                Some(transmute(popup_trampoline::<Self, F> as usize)),
721                Box_::into_raw(f),
722            )
723        }
724    }
725
726    fn emit_popup(&self) {
727        let _ = unsafe {
728            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
729                .emit("popup", &[])
730                .unwrap()
731        };
732    }
733
734    fn connect_value_changed<F: Fn(&Self, f64) + 'static>(&self, f: F) -> SignalHandlerId {
735        unsafe extern "C" fn value_changed_trampoline<P, F: Fn(&P, f64) + 'static>(
736            this: *mut gtk_sys::GtkScaleButton,
737            value: libc::c_double,
738            f: glib_sys::gpointer,
739        ) where
740            P: IsA<ScaleButton>,
741        {
742            let f: &F = &*(f as *const F);
743            f(&ScaleButton::from_glib_borrow(this).unsafe_cast(), value)
744        }
745        unsafe {
746            let f: Box_<F> = Box_::new(f);
747            connect_raw(
748                self.as_ptr() as *mut _,
749                b"value-changed\0".as_ptr() as *const _,
750                Some(transmute(value_changed_trampoline::<Self, F> as usize)),
751                Box_::into_raw(f),
752            )
753        }
754    }
755
756    fn connect_property_adjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
757        unsafe extern "C" fn notify_adjustment_trampoline<P, F: Fn(&P) + 'static>(
758            this: *mut gtk_sys::GtkScaleButton,
759            _param_spec: glib_sys::gpointer,
760            f: glib_sys::gpointer,
761        ) where
762            P: IsA<ScaleButton>,
763        {
764            let f: &F = &*(f as *const F);
765            f(&ScaleButton::from_glib_borrow(this).unsafe_cast())
766        }
767        unsafe {
768            let f: Box_<F> = Box_::new(f);
769            connect_raw(
770                self.as_ptr() as *mut _,
771                b"notify::adjustment\0".as_ptr() as *const _,
772                Some(transmute(notify_adjustment_trampoline::<Self, F> as usize)),
773                Box_::into_raw(f),
774            )
775        }
776    }
777
778    fn connect_property_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
779        unsafe extern "C" fn notify_icons_trampoline<P, F: Fn(&P) + 'static>(
780            this: *mut gtk_sys::GtkScaleButton,
781            _param_spec: glib_sys::gpointer,
782            f: glib_sys::gpointer,
783        ) where
784            P: IsA<ScaleButton>,
785        {
786            let f: &F = &*(f as *const F);
787            f(&ScaleButton::from_glib_borrow(this).unsafe_cast())
788        }
789        unsafe {
790            let f: Box_<F> = Box_::new(f);
791            connect_raw(
792                self.as_ptr() as *mut _,
793                b"notify::icons\0".as_ptr() as *const _,
794                Some(transmute(notify_icons_trampoline::<Self, F> as usize)),
795                Box_::into_raw(f),
796            )
797        }
798    }
799
800    fn connect_property_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
801        unsafe extern "C" fn notify_size_trampoline<P, F: Fn(&P) + 'static>(
802            this: *mut gtk_sys::GtkScaleButton,
803            _param_spec: glib_sys::gpointer,
804            f: glib_sys::gpointer,
805        ) where
806            P: IsA<ScaleButton>,
807        {
808            let f: &F = &*(f as *const F);
809            f(&ScaleButton::from_glib_borrow(this).unsafe_cast())
810        }
811        unsafe {
812            let f: Box_<F> = Box_::new(f);
813            connect_raw(
814                self.as_ptr() as *mut _,
815                b"notify::size\0".as_ptr() as *const _,
816                Some(transmute(notify_size_trampoline::<Self, F> as usize)),
817                Box_::into_raw(f),
818            )
819        }
820    }
821
822    fn connect_property_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
823        unsafe extern "C" fn notify_value_trampoline<P, F: Fn(&P) + 'static>(
824            this: *mut gtk_sys::GtkScaleButton,
825            _param_spec: glib_sys::gpointer,
826            f: glib_sys::gpointer,
827        ) where
828            P: IsA<ScaleButton>,
829        {
830            let f: &F = &*(f as *const F);
831            f(&ScaleButton::from_glib_borrow(this).unsafe_cast())
832        }
833        unsafe {
834            let f: Box_<F> = Box_::new(f);
835            connect_raw(
836                self.as_ptr() as *mut _,
837                b"notify::value\0".as_ptr() as *const _,
838                Some(transmute(notify_value_trampoline::<Self, F> as usize)),
839                Box_::into_raw(f),
840            )
841        }
842    }
843}
844
845impl fmt::Display for ScaleButton {
846    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
847        write!(f, "ScaleButton")
848    }
849}