gtk/auto/
scale.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::object::Cast;
7use glib::object::IsA;
8use glib::signal::connect_raw;
9use glib::signal::SignalHandlerId;
10use glib::translate::*;
11use glib::StaticType;
12use glib::ToValue;
13use glib_sys;
14use gtk_sys;
15use libc;
16use pango;
17use std::boxed::Box as Box_;
18use std::fmt;
19use std::mem;
20use std::mem::transmute;
21use Adjustment;
22use Align;
23use Buildable;
24use Container;
25use Orientable;
26use Orientation;
27use PositionType;
28use Range;
29use SensitivityType;
30use Widget;
31
32glib_wrapper! {
33    pub struct Scale(Object<gtk_sys::GtkScale, gtk_sys::GtkScaleClass, ScaleClass>) @extends Range, Widget, @implements Buildable, Orientable;
34
35    match fn {
36        get_type => || gtk_sys::gtk_scale_get_type(),
37    }
38}
39
40impl Scale {
41    pub fn new<P: IsA<Adjustment>>(orientation: Orientation, adjustment: Option<&P>) -> Scale {
42        assert_initialized_main_thread!();
43        unsafe {
44            Widget::from_glib_none(gtk_sys::gtk_scale_new(
45                orientation.to_glib(),
46                adjustment.map(|p| p.as_ref()).to_glib_none().0,
47            ))
48            .unsafe_cast()
49        }
50    }
51
52    pub fn new_with_range(orientation: Orientation, min: f64, max: f64, step: f64) -> Scale {
53        assert_initialized_main_thread!();
54        unsafe {
55            Widget::from_glib_none(gtk_sys::gtk_scale_new_with_range(
56                orientation.to_glib(),
57                min,
58                max,
59                step,
60            ))
61            .unsafe_cast()
62        }
63    }
64}
65
66pub struct ScaleBuilder {
67    digits: Option<i32>,
68    draw_value: Option<bool>,
69    has_origin: Option<bool>,
70    value_pos: Option<PositionType>,
71    adjustment: Option<Adjustment>,
72    fill_level: Option<f64>,
73    inverted: Option<bool>,
74    lower_stepper_sensitivity: Option<SensitivityType>,
75    restrict_to_fill_level: Option<bool>,
76    round_digits: Option<i32>,
77    show_fill_level: Option<bool>,
78    upper_stepper_sensitivity: Option<SensitivityType>,
79    app_paintable: Option<bool>,
80    can_default: Option<bool>,
81    can_focus: Option<bool>,
82    events: Option<gdk::EventMask>,
83    expand: Option<bool>,
84    #[cfg(any(feature = "v3_20", feature = "dox"))]
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    //style: /*Unknown type*/,
106    tooltip_markup: Option<String>,
107    tooltip_text: Option<String>,
108    valign: Option<Align>,
109    vexpand: Option<bool>,
110    vexpand_set: Option<bool>,
111    visible: Option<bool>,
112    width_request: Option<i32>,
113}
114
115impl ScaleBuilder {
116    pub fn new() -> Self {
117        Self {
118            digits: None,
119            draw_value: None,
120            has_origin: None,
121            value_pos: None,
122            adjustment: None,
123            fill_level: None,
124            inverted: None,
125            lower_stepper_sensitivity: None,
126            restrict_to_fill_level: None,
127            round_digits: None,
128            show_fill_level: None,
129            upper_stepper_sensitivity: None,
130            app_paintable: None,
131            can_default: None,
132            can_focus: None,
133            events: None,
134            expand: None,
135            #[cfg(any(feature = "v3_20", feature = "dox"))]
136            focus_on_click: None,
137            halign: None,
138            has_default: None,
139            has_focus: None,
140            has_tooltip: None,
141            height_request: None,
142            hexpand: None,
143            hexpand_set: None,
144            is_focus: None,
145            margin: None,
146            margin_bottom: None,
147            margin_end: None,
148            margin_start: None,
149            margin_top: None,
150            name: None,
151            no_show_all: None,
152            opacity: None,
153            parent: None,
154            receives_default: None,
155            sensitive: None,
156            tooltip_markup: None,
157            tooltip_text: None,
158            valign: None,
159            vexpand: None,
160            vexpand_set: None,
161            visible: None,
162            width_request: None,
163        }
164    }
165
166    pub fn build(self) -> Scale {
167        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
168        if let Some(ref digits) = self.digits {
169            properties.push(("digits", digits));
170        }
171        if let Some(ref draw_value) = self.draw_value {
172            properties.push(("draw-value", draw_value));
173        }
174        if let Some(ref has_origin) = self.has_origin {
175            properties.push(("has-origin", has_origin));
176        }
177        if let Some(ref value_pos) = self.value_pos {
178            properties.push(("value-pos", value_pos));
179        }
180        if let Some(ref adjustment) = self.adjustment {
181            properties.push(("adjustment", adjustment));
182        }
183        if let Some(ref fill_level) = self.fill_level {
184            properties.push(("fill-level", fill_level));
185        }
186        if let Some(ref inverted) = self.inverted {
187            properties.push(("inverted", inverted));
188        }
189        if let Some(ref lower_stepper_sensitivity) = self.lower_stepper_sensitivity {
190            properties.push(("lower-stepper-sensitivity", lower_stepper_sensitivity));
191        }
192        if let Some(ref restrict_to_fill_level) = self.restrict_to_fill_level {
193            properties.push(("restrict-to-fill-level", restrict_to_fill_level));
194        }
195        if let Some(ref round_digits) = self.round_digits {
196            properties.push(("round-digits", round_digits));
197        }
198        if let Some(ref show_fill_level) = self.show_fill_level {
199            properties.push(("show-fill-level", show_fill_level));
200        }
201        if let Some(ref upper_stepper_sensitivity) = self.upper_stepper_sensitivity {
202            properties.push(("upper-stepper-sensitivity", upper_stepper_sensitivity));
203        }
204        if let Some(ref app_paintable) = self.app_paintable {
205            properties.push(("app-paintable", app_paintable));
206        }
207        if let Some(ref can_default) = self.can_default {
208            properties.push(("can-default", can_default));
209        }
210        if let Some(ref can_focus) = self.can_focus {
211            properties.push(("can-focus", can_focus));
212        }
213        if let Some(ref events) = self.events {
214            properties.push(("events", events));
215        }
216        if let Some(ref expand) = self.expand {
217            properties.push(("expand", expand));
218        }
219        #[cfg(any(feature = "v3_20", feature = "dox"))]
220        {
221            if let Some(ref focus_on_click) = self.focus_on_click {
222                properties.push(("focus-on-click", focus_on_click));
223            }
224        }
225        if let Some(ref halign) = self.halign {
226            properties.push(("halign", halign));
227        }
228        if let Some(ref has_default) = self.has_default {
229            properties.push(("has-default", has_default));
230        }
231        if let Some(ref has_focus) = self.has_focus {
232            properties.push(("has-focus", has_focus));
233        }
234        if let Some(ref has_tooltip) = self.has_tooltip {
235            properties.push(("has-tooltip", has_tooltip));
236        }
237        if let Some(ref height_request) = self.height_request {
238            properties.push(("height-request", height_request));
239        }
240        if let Some(ref hexpand) = self.hexpand {
241            properties.push(("hexpand", hexpand));
242        }
243        if let Some(ref hexpand_set) = self.hexpand_set {
244            properties.push(("hexpand-set", hexpand_set));
245        }
246        if let Some(ref is_focus) = self.is_focus {
247            properties.push(("is-focus", is_focus));
248        }
249        if let Some(ref margin) = self.margin {
250            properties.push(("margin", margin));
251        }
252        if let Some(ref margin_bottom) = self.margin_bottom {
253            properties.push(("margin-bottom", margin_bottom));
254        }
255        if let Some(ref margin_end) = self.margin_end {
256            properties.push(("margin-end", margin_end));
257        }
258        if let Some(ref margin_start) = self.margin_start {
259            properties.push(("margin-start", margin_start));
260        }
261        if let Some(ref margin_top) = self.margin_top {
262            properties.push(("margin-top", margin_top));
263        }
264        if let Some(ref name) = self.name {
265            properties.push(("name", name));
266        }
267        if let Some(ref no_show_all) = self.no_show_all {
268            properties.push(("no-show-all", no_show_all));
269        }
270        if let Some(ref opacity) = self.opacity {
271            properties.push(("opacity", opacity));
272        }
273        if let Some(ref parent) = self.parent {
274            properties.push(("parent", parent));
275        }
276        if let Some(ref receives_default) = self.receives_default {
277            properties.push(("receives-default", receives_default));
278        }
279        if let Some(ref sensitive) = self.sensitive {
280            properties.push(("sensitive", sensitive));
281        }
282        if let Some(ref tooltip_markup) = self.tooltip_markup {
283            properties.push(("tooltip-markup", tooltip_markup));
284        }
285        if let Some(ref tooltip_text) = self.tooltip_text {
286            properties.push(("tooltip-text", tooltip_text));
287        }
288        if let Some(ref valign) = self.valign {
289            properties.push(("valign", valign));
290        }
291        if let Some(ref vexpand) = self.vexpand {
292            properties.push(("vexpand", vexpand));
293        }
294        if let Some(ref vexpand_set) = self.vexpand_set {
295            properties.push(("vexpand-set", vexpand_set));
296        }
297        if let Some(ref visible) = self.visible {
298            properties.push(("visible", visible));
299        }
300        if let Some(ref width_request) = self.width_request {
301            properties.push(("width-request", width_request));
302        }
303        glib::Object::new(Scale::static_type(), &properties)
304            .expect("object new")
305            .downcast()
306            .expect("downcast")
307    }
308
309    pub fn digits(mut self, digits: i32) -> Self {
310        self.digits = Some(digits);
311        self
312    }
313
314    pub fn draw_value(mut self, draw_value: bool) -> Self {
315        self.draw_value = Some(draw_value);
316        self
317    }
318
319    pub fn has_origin(mut self, has_origin: bool) -> Self {
320        self.has_origin = Some(has_origin);
321        self
322    }
323
324    pub fn value_pos(mut self, value_pos: PositionType) -> Self {
325        self.value_pos = Some(value_pos);
326        self
327    }
328
329    pub fn adjustment(mut self, adjustment: &Adjustment) -> Self {
330        self.adjustment = Some(adjustment.clone());
331        self
332    }
333
334    pub fn fill_level(mut self, fill_level: f64) -> Self {
335        self.fill_level = Some(fill_level);
336        self
337    }
338
339    pub fn inverted(mut self, inverted: bool) -> Self {
340        self.inverted = Some(inverted);
341        self
342    }
343
344    pub fn lower_stepper_sensitivity(mut self, lower_stepper_sensitivity: SensitivityType) -> Self {
345        self.lower_stepper_sensitivity = Some(lower_stepper_sensitivity);
346        self
347    }
348
349    pub fn restrict_to_fill_level(mut self, restrict_to_fill_level: bool) -> Self {
350        self.restrict_to_fill_level = Some(restrict_to_fill_level);
351        self
352    }
353
354    pub fn round_digits(mut self, round_digits: i32) -> Self {
355        self.round_digits = Some(round_digits);
356        self
357    }
358
359    pub fn show_fill_level(mut self, show_fill_level: bool) -> Self {
360        self.show_fill_level = Some(show_fill_level);
361        self
362    }
363
364    pub fn upper_stepper_sensitivity(mut self, upper_stepper_sensitivity: SensitivityType) -> Self {
365        self.upper_stepper_sensitivity = Some(upper_stepper_sensitivity);
366        self
367    }
368
369    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
370        self.app_paintable = Some(app_paintable);
371        self
372    }
373
374    pub fn can_default(mut self, can_default: bool) -> Self {
375        self.can_default = Some(can_default);
376        self
377    }
378
379    pub fn can_focus(mut self, can_focus: bool) -> Self {
380        self.can_focus = Some(can_focus);
381        self
382    }
383
384    pub fn events(mut self, events: gdk::EventMask) -> Self {
385        self.events = Some(events);
386        self
387    }
388
389    pub fn expand(mut self, expand: bool) -> Self {
390        self.expand = Some(expand);
391        self
392    }
393
394    #[cfg(any(feature = "v3_20", feature = "dox"))]
395    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
396        self.focus_on_click = Some(focus_on_click);
397        self
398    }
399
400    pub fn halign(mut self, halign: Align) -> Self {
401        self.halign = Some(halign);
402        self
403    }
404
405    pub fn has_default(mut self, has_default: bool) -> Self {
406        self.has_default = Some(has_default);
407        self
408    }
409
410    pub fn has_focus(mut self, has_focus: bool) -> Self {
411        self.has_focus = Some(has_focus);
412        self
413    }
414
415    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
416        self.has_tooltip = Some(has_tooltip);
417        self
418    }
419
420    pub fn height_request(mut self, height_request: i32) -> Self {
421        self.height_request = Some(height_request);
422        self
423    }
424
425    pub fn hexpand(mut self, hexpand: bool) -> Self {
426        self.hexpand = Some(hexpand);
427        self
428    }
429
430    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
431        self.hexpand_set = Some(hexpand_set);
432        self
433    }
434
435    pub fn is_focus(mut self, is_focus: bool) -> Self {
436        self.is_focus = Some(is_focus);
437        self
438    }
439
440    pub fn margin(mut self, margin: i32) -> Self {
441        self.margin = Some(margin);
442        self
443    }
444
445    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
446        self.margin_bottom = Some(margin_bottom);
447        self
448    }
449
450    pub fn margin_end(mut self, margin_end: i32) -> Self {
451        self.margin_end = Some(margin_end);
452        self
453    }
454
455    pub fn margin_start(mut self, margin_start: i32) -> Self {
456        self.margin_start = Some(margin_start);
457        self
458    }
459
460    pub fn margin_top(mut self, margin_top: i32) -> Self {
461        self.margin_top = Some(margin_top);
462        self
463    }
464
465    pub fn name(mut self, name: &str) -> Self {
466        self.name = Some(name.to_string());
467        self
468    }
469
470    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
471        self.no_show_all = Some(no_show_all);
472        self
473    }
474
475    pub fn opacity(mut self, opacity: f64) -> Self {
476        self.opacity = Some(opacity);
477        self
478    }
479
480    pub fn parent(mut self, parent: &Container) -> Self {
481        self.parent = Some(parent.clone());
482        self
483    }
484
485    pub fn receives_default(mut self, receives_default: bool) -> Self {
486        self.receives_default = Some(receives_default);
487        self
488    }
489
490    pub fn sensitive(mut self, sensitive: bool) -> Self {
491        self.sensitive = Some(sensitive);
492        self
493    }
494
495    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
496        self.tooltip_markup = Some(tooltip_markup.to_string());
497        self
498    }
499
500    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
501        self.tooltip_text = Some(tooltip_text.to_string());
502        self
503    }
504
505    pub fn valign(mut self, valign: Align) -> Self {
506        self.valign = Some(valign);
507        self
508    }
509
510    pub fn vexpand(mut self, vexpand: bool) -> Self {
511        self.vexpand = Some(vexpand);
512        self
513    }
514
515    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
516        self.vexpand_set = Some(vexpand_set);
517        self
518    }
519
520    pub fn visible(mut self, visible: bool) -> Self {
521        self.visible = Some(visible);
522        self
523    }
524
525    pub fn width_request(mut self, width_request: i32) -> Self {
526        self.width_request = Some(width_request);
527        self
528    }
529}
530
531pub const NONE_SCALE: Option<&Scale> = None;
532
533pub trait ScaleExt: 'static {
534    fn add_mark(&self, value: f64, position: PositionType, markup: Option<&str>);
535
536    fn clear_marks(&self);
537
538    fn get_digits(&self) -> i32;
539
540    fn get_draw_value(&self) -> bool;
541
542    fn get_has_origin(&self) -> bool;
543
544    fn get_layout(&self) -> Option<pango::Layout>;
545
546    fn get_layout_offsets(&self) -> (i32, i32);
547
548    fn get_value_pos(&self) -> PositionType;
549
550    fn set_digits(&self, digits: i32);
551
552    fn set_draw_value(&self, draw_value: bool);
553
554    fn set_has_origin(&self, has_origin: bool);
555
556    fn set_value_pos(&self, pos: PositionType);
557
558    fn connect_format_value<F: Fn(&Self, f64) -> String + 'static>(&self, f: F) -> SignalHandlerId;
559
560    fn connect_property_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
561
562    fn connect_property_draw_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
563
564    fn connect_property_has_origin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
565
566    fn connect_property_value_pos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
567}
568
569impl<O: IsA<Scale>> ScaleExt for O {
570    fn add_mark(&self, value: f64, position: PositionType, markup: Option<&str>) {
571        unsafe {
572            gtk_sys::gtk_scale_add_mark(
573                self.as_ref().to_glib_none().0,
574                value,
575                position.to_glib(),
576                markup.to_glib_none().0,
577            );
578        }
579    }
580
581    fn clear_marks(&self) {
582        unsafe {
583            gtk_sys::gtk_scale_clear_marks(self.as_ref().to_glib_none().0);
584        }
585    }
586
587    fn get_digits(&self) -> i32 {
588        unsafe { gtk_sys::gtk_scale_get_digits(self.as_ref().to_glib_none().0) }
589    }
590
591    fn get_draw_value(&self) -> bool {
592        unsafe {
593            from_glib(gtk_sys::gtk_scale_get_draw_value(
594                self.as_ref().to_glib_none().0,
595            ))
596        }
597    }
598
599    fn get_has_origin(&self) -> bool {
600        unsafe {
601            from_glib(gtk_sys::gtk_scale_get_has_origin(
602                self.as_ref().to_glib_none().0,
603            ))
604        }
605    }
606
607    fn get_layout(&self) -> Option<pango::Layout> {
608        unsafe {
609            from_glib_none(gtk_sys::gtk_scale_get_layout(
610                self.as_ref().to_glib_none().0,
611            ))
612        }
613    }
614
615    fn get_layout_offsets(&self) -> (i32, i32) {
616        unsafe {
617            let mut x = mem::uninitialized();
618            let mut y = mem::uninitialized();
619            gtk_sys::gtk_scale_get_layout_offsets(self.as_ref().to_glib_none().0, &mut x, &mut y);
620            (x, y)
621        }
622    }
623
624    fn get_value_pos(&self) -> PositionType {
625        unsafe {
626            from_glib(gtk_sys::gtk_scale_get_value_pos(
627                self.as_ref().to_glib_none().0,
628            ))
629        }
630    }
631
632    fn set_digits(&self, digits: i32) {
633        unsafe {
634            gtk_sys::gtk_scale_set_digits(self.as_ref().to_glib_none().0, digits);
635        }
636    }
637
638    fn set_draw_value(&self, draw_value: bool) {
639        unsafe {
640            gtk_sys::gtk_scale_set_draw_value(self.as_ref().to_glib_none().0, draw_value.to_glib());
641        }
642    }
643
644    fn set_has_origin(&self, has_origin: bool) {
645        unsafe {
646            gtk_sys::gtk_scale_set_has_origin(self.as_ref().to_glib_none().0, has_origin.to_glib());
647        }
648    }
649
650    fn set_value_pos(&self, pos: PositionType) {
651        unsafe {
652            gtk_sys::gtk_scale_set_value_pos(self.as_ref().to_glib_none().0, pos.to_glib());
653        }
654    }
655
656    fn connect_format_value<F: Fn(&Self, f64) -> String + 'static>(&self, f: F) -> SignalHandlerId {
657        unsafe extern "C" fn format_value_trampoline<P, F: Fn(&P, f64) -> String + 'static>(
658            this: *mut gtk_sys::GtkScale,
659            value: libc::c_double,
660            f: glib_sys::gpointer,
661        ) -> *mut libc::c_char
662        where
663            P: IsA<Scale>,
664        {
665            let f: &F = &*(f as *const F);
666            f(&Scale::from_glib_borrow(this).unsafe_cast(), value).to_glib_full()
667        }
668        unsafe {
669            let f: Box_<F> = Box_::new(f);
670            connect_raw(
671                self.as_ptr() as *mut _,
672                b"format-value\0".as_ptr() as *const _,
673                Some(transmute(format_value_trampoline::<Self, F> as usize)),
674                Box_::into_raw(f),
675            )
676        }
677    }
678
679    fn connect_property_digits_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
680        unsafe extern "C" fn notify_digits_trampoline<P, F: Fn(&P) + 'static>(
681            this: *mut gtk_sys::GtkScale,
682            _param_spec: glib_sys::gpointer,
683            f: glib_sys::gpointer,
684        ) where
685            P: IsA<Scale>,
686        {
687            let f: &F = &*(f as *const F);
688            f(&Scale::from_glib_borrow(this).unsafe_cast())
689        }
690        unsafe {
691            let f: Box_<F> = Box_::new(f);
692            connect_raw(
693                self.as_ptr() as *mut _,
694                b"notify::digits\0".as_ptr() as *const _,
695                Some(transmute(notify_digits_trampoline::<Self, F> as usize)),
696                Box_::into_raw(f),
697            )
698        }
699    }
700
701    fn connect_property_draw_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
702        unsafe extern "C" fn notify_draw_value_trampoline<P, F: Fn(&P) + 'static>(
703            this: *mut gtk_sys::GtkScale,
704            _param_spec: glib_sys::gpointer,
705            f: glib_sys::gpointer,
706        ) where
707            P: IsA<Scale>,
708        {
709            let f: &F = &*(f as *const F);
710            f(&Scale::from_glib_borrow(this).unsafe_cast())
711        }
712        unsafe {
713            let f: Box_<F> = Box_::new(f);
714            connect_raw(
715                self.as_ptr() as *mut _,
716                b"notify::draw-value\0".as_ptr() as *const _,
717                Some(transmute(notify_draw_value_trampoline::<Self, F> as usize)),
718                Box_::into_raw(f),
719            )
720        }
721    }
722
723    fn connect_property_has_origin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
724        unsafe extern "C" fn notify_has_origin_trampoline<P, F: Fn(&P) + 'static>(
725            this: *mut gtk_sys::GtkScale,
726            _param_spec: glib_sys::gpointer,
727            f: glib_sys::gpointer,
728        ) where
729            P: IsA<Scale>,
730        {
731            let f: &F = &*(f as *const F);
732            f(&Scale::from_glib_borrow(this).unsafe_cast())
733        }
734        unsafe {
735            let f: Box_<F> = Box_::new(f);
736            connect_raw(
737                self.as_ptr() as *mut _,
738                b"notify::has-origin\0".as_ptr() as *const _,
739                Some(transmute(notify_has_origin_trampoline::<Self, F> as usize)),
740                Box_::into_raw(f),
741            )
742        }
743    }
744
745    fn connect_property_value_pos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
746        unsafe extern "C" fn notify_value_pos_trampoline<P, F: Fn(&P) + 'static>(
747            this: *mut gtk_sys::GtkScale,
748            _param_spec: glib_sys::gpointer,
749            f: glib_sys::gpointer,
750        ) where
751            P: IsA<Scale>,
752        {
753            let f: &F = &*(f as *const F);
754            f(&Scale::from_glib_borrow(this).unsafe_cast())
755        }
756        unsafe {
757            let f: Box_<F> = Box_::new(f);
758            connect_raw(
759                self.as_ptr() as *mut _,
760                b"notify::value-pos\0".as_ptr() as *const _,
761                Some(transmute(notify_value_pos_trampoline::<Self, F> as usize)),
762                Box_::into_raw(f),
763            )
764        }
765    }
766}
767
768impl fmt::Display for Scale {
769    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
770        write!(f, "Scale")
771    }
772}