Skip to main content

gtk/auto/
adjustment.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 crate::ffi;
6use glib::{
7    object::ObjectType as _,
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// The [`Adjustment`][crate::Adjustment] object represents a value which has an associated lower
16    /// and upper bound, together with step and page increments, and a page size.
17    /// It is used within several GTK+ widgets, including [`SpinButton`][crate::SpinButton], [`Viewport`][crate::Viewport],
18    /// and [`Range`][crate::Range] (which is a base class for [`Scrollbar`][crate::Scrollbar] and [`Scale`][crate::Scale]).
19    ///
20    /// The [`Adjustment`][crate::Adjustment] object does not update the value itself. Instead
21    /// it is left up to the owner of the [`Adjustment`][crate::Adjustment] to control the value.
22    ///
23    /// ## Properties
24    ///
25    ///
26    /// #### `lower`
27    ///  The minimum value of the adjustment.
28    ///
29    /// Readable | Writable
30    ///
31    ///
32    /// #### `page-increment`
33    ///  The page increment of the adjustment.
34    ///
35    /// Readable | Writable
36    ///
37    ///
38    /// #### `page-size`
39    ///  The page size of the adjustment.
40    /// Note that the page-size is irrelevant and should be set to zero
41    /// if the adjustment is used for a simple scalar value, e.g. in a
42    /// [`SpinButton`][crate::SpinButton].
43    ///
44    /// Readable | Writable
45    ///
46    ///
47    /// #### `step-increment`
48    ///  The step increment of the adjustment.
49    ///
50    /// Readable | Writable
51    ///
52    ///
53    /// #### `upper`
54    ///  The maximum value of the adjustment.
55    /// Note that values will be restricted by
56    /// `upper - page-size` if the page-size
57    /// property is nonzero.
58    ///
59    /// Readable | Writable
60    ///
61    ///
62    /// #### `value`
63    ///  The value of the adjustment.
64    ///
65    /// Readable | Writable
66    ///
67    /// ## Signals
68    ///
69    ///
70    /// #### `changed`
71    ///  Emitted when one or more of the [`Adjustment`][crate::Adjustment] properties have been
72    /// changed, other than the [`value`][struct@crate::Adjustment#value] property.
73    ///
74    ///
75    ///
76    ///
77    /// #### `value-changed`
78    ///  Emitted when the [`value`][struct@crate::Adjustment#value] property has been changed.
79    ///
80    ///
81    ///
82    /// # Implements
83    ///
84    /// [`AdjustmentExt`][trait@crate::prelude::AdjustmentExt], [`trait@glib::ObjectExt`]
85    #[doc(alias = "GtkAdjustment")]
86    pub struct Adjustment(Object<ffi::GtkAdjustment, ffi::GtkAdjustmentClass>);
87
88    match fn {
89        type_ => || ffi::gtk_adjustment_get_type(),
90    }
91}
92
93impl Adjustment {
94    pub const NONE: Option<&'static Adjustment> = None;
95
96    /// Creates a new [`Adjustment`][crate::Adjustment].
97    /// ## `value`
98    /// the initial value
99    /// ## `lower`
100    /// the minimum value
101    /// ## `upper`
102    /// the maximum value
103    /// ## `step_increment`
104    /// the step increment
105    /// ## `page_increment`
106    /// the page increment
107    /// ## `page_size`
108    /// the page size
109    ///
110    /// # Returns
111    ///
112    /// a new [`Adjustment`][crate::Adjustment]
113    #[doc(alias = "gtk_adjustment_new")]
114    pub fn new(
115        value: f64,
116        lower: f64,
117        upper: f64,
118        step_increment: f64,
119        page_increment: f64,
120        page_size: f64,
121    ) -> Adjustment {
122        assert_initialized_main_thread!();
123        unsafe {
124            from_glib_none(ffi::gtk_adjustment_new(
125                value,
126                lower,
127                upper,
128                step_increment,
129                page_increment,
130                page_size,
131            ))
132        }
133    }
134
135    // rustdoc-stripper-ignore-next
136    /// Creates a new builder-pattern struct instance to construct [`Adjustment`] objects.
137    ///
138    /// This method returns an instance of [`AdjustmentBuilder`](crate::builders::AdjustmentBuilder) which can be used to create [`Adjustment`] objects.
139    pub fn builder() -> AdjustmentBuilder {
140        AdjustmentBuilder::new()
141    }
142}
143
144impl Default for Adjustment {
145    fn default() -> Self {
146        glib::object::Object::new::<Self>()
147    }
148}
149
150// rustdoc-stripper-ignore-next
151/// A [builder-pattern] type to construct [`Adjustment`] objects.
152///
153/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
154#[must_use = "The builder must be built to be used"]
155pub struct AdjustmentBuilder {
156    builder: glib::object::ObjectBuilder<'static, Adjustment>,
157}
158
159impl AdjustmentBuilder {
160    fn new() -> Self {
161        Self {
162            builder: glib::object::Object::builder(),
163        }
164    }
165
166    /// The minimum value of the adjustment.
167    pub fn lower(self, lower: f64) -> Self {
168        Self {
169            builder: self.builder.property("lower", lower),
170        }
171    }
172
173    /// The page increment of the adjustment.
174    pub fn page_increment(self, page_increment: f64) -> Self {
175        Self {
176            builder: self.builder.property("page-increment", page_increment),
177        }
178    }
179
180    /// The page size of the adjustment.
181    /// Note that the page-size is irrelevant and should be set to zero
182    /// if the adjustment is used for a simple scalar value, e.g. in a
183    /// [`SpinButton`][crate::SpinButton].
184    pub fn page_size(self, page_size: f64) -> Self {
185        Self {
186            builder: self.builder.property("page-size", page_size),
187        }
188    }
189
190    /// The step increment of the adjustment.
191    pub fn step_increment(self, step_increment: f64) -> Self {
192        Self {
193            builder: self.builder.property("step-increment", step_increment),
194        }
195    }
196
197    /// The maximum value of the adjustment.
198    /// Note that values will be restricted by
199    /// `upper - page-size` if the page-size
200    /// property is nonzero.
201    pub fn upper(self, upper: f64) -> Self {
202        Self {
203            builder: self.builder.property("upper", upper),
204        }
205    }
206
207    /// The value of the adjustment.
208    pub fn value(self, value: f64) -> Self {
209        Self {
210            builder: self.builder.property("value", value),
211        }
212    }
213
214    // rustdoc-stripper-ignore-next
215    /// Build the [`Adjustment`].
216    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
217    pub fn build(self) -> Adjustment {
218        assert_initialized_main_thread!();
219        self.builder.build()
220    }
221}
222
223/// Trait containing all [`struct@Adjustment`] methods.
224///
225/// # Implementors
226///
227/// [`Adjustment`][struct@crate::Adjustment]
228pub trait AdjustmentExt: IsA<Adjustment> + 'static {
229    /// Updates the [`value`][struct@crate::Adjustment#value] property to ensure that the range
230    /// between `lower` and `upper` is in the current page (i.e. between
231    /// [`value`][struct@crate::Adjustment#value] and [`value`][struct@crate::Adjustment#value] + [`page-size`][struct@crate::Adjustment#page-size]).
232    /// If the range is larger than the page size, then only the start of it will
233    /// be in the current page.
234    ///
235    /// A [`value-changed`][struct@crate::Adjustment#value-changed] signal will be emitted if the value is changed.
236    /// ## `lower`
237    /// the lower value
238    /// ## `upper`
239    /// the upper value
240    #[doc(alias = "gtk_adjustment_clamp_page")]
241    fn clamp_page(&self, lower: f64, upper: f64) {
242        unsafe {
243            ffi::gtk_adjustment_clamp_page(self.as_ref().to_glib_none().0, lower, upper);
244        }
245    }
246
247    /// Sets all properties of the adjustment at once.
248    ///
249    /// Use this function to avoid multiple emissions of the
250    /// [`changed`][struct@crate::Adjustment#changed] signal. See [`set_lower()`][Self::set_lower()]
251    /// for an alternative way of compressing multiple emissions of
252    /// [`changed`][struct@crate::Adjustment#changed] into one.
253    /// ## `value`
254    /// the new value
255    /// ## `lower`
256    /// the new minimum value
257    /// ## `upper`
258    /// the new maximum value
259    /// ## `step_increment`
260    /// the new step increment
261    /// ## `page_increment`
262    /// the new page increment
263    /// ## `page_size`
264    /// the new page size
265    #[doc(alias = "gtk_adjustment_configure")]
266    fn configure(
267        &self,
268        value: f64,
269        lower: f64,
270        upper: f64,
271        step_increment: f64,
272        page_increment: f64,
273        page_size: f64,
274    ) {
275        unsafe {
276            ffi::gtk_adjustment_configure(
277                self.as_ref().to_glib_none().0,
278                value,
279                lower,
280                upper,
281                step_increment,
282                page_increment,
283                page_size,
284            );
285        }
286    }
287
288    /// Retrieves the minimum value of the adjustment.
289    ///
290    /// # Returns
291    ///
292    /// The current minimum value of the adjustment
293    #[doc(alias = "gtk_adjustment_get_lower")]
294    #[doc(alias = "get_lower")]
295    fn lower(&self) -> f64 {
296        unsafe { ffi::gtk_adjustment_get_lower(self.as_ref().to_glib_none().0) }
297    }
298
299    /// Gets the smaller of step increment and page increment.
300    ///
301    /// # Returns
302    ///
303    /// the minimum increment of `self`
304    #[doc(alias = "gtk_adjustment_get_minimum_increment")]
305    #[doc(alias = "get_minimum_increment")]
306    fn minimum_increment(&self) -> f64 {
307        unsafe { ffi::gtk_adjustment_get_minimum_increment(self.as_ref().to_glib_none().0) }
308    }
309
310    /// Retrieves the page increment of the adjustment.
311    ///
312    /// # Returns
313    ///
314    /// The current page increment of the adjustment
315    #[doc(alias = "gtk_adjustment_get_page_increment")]
316    #[doc(alias = "get_page_increment")]
317    #[doc(alias = "page-increment")]
318    fn page_increment(&self) -> f64 {
319        unsafe { ffi::gtk_adjustment_get_page_increment(self.as_ref().to_glib_none().0) }
320    }
321
322    /// Retrieves the page size of the adjustment.
323    ///
324    /// # Returns
325    ///
326    /// The current page size of the adjustment
327    #[doc(alias = "gtk_adjustment_get_page_size")]
328    #[doc(alias = "get_page_size")]
329    #[doc(alias = "page-size")]
330    fn page_size(&self) -> f64 {
331        unsafe { ffi::gtk_adjustment_get_page_size(self.as_ref().to_glib_none().0) }
332    }
333
334    /// Retrieves the step increment of the adjustment.
335    ///
336    /// # Returns
337    ///
338    /// The current step increment of the adjustment.
339    #[doc(alias = "gtk_adjustment_get_step_increment")]
340    #[doc(alias = "get_step_increment")]
341    #[doc(alias = "step-increment")]
342    fn step_increment(&self) -> f64 {
343        unsafe { ffi::gtk_adjustment_get_step_increment(self.as_ref().to_glib_none().0) }
344    }
345
346    /// Retrieves the maximum value of the adjustment.
347    ///
348    /// # Returns
349    ///
350    /// The current maximum value of the adjustment
351    #[doc(alias = "gtk_adjustment_get_upper")]
352    #[doc(alias = "get_upper")]
353    fn upper(&self) -> f64 {
354        unsafe { ffi::gtk_adjustment_get_upper(self.as_ref().to_glib_none().0) }
355    }
356
357    /// Gets the current value of the adjustment.
358    /// See [`set_value()`][Self::set_value()].
359    ///
360    /// # Returns
361    ///
362    /// The current value of the adjustment
363    #[doc(alias = "gtk_adjustment_get_value")]
364    #[doc(alias = "get_value")]
365    fn value(&self) -> f64 {
366        unsafe { ffi::gtk_adjustment_get_value(self.as_ref().to_glib_none().0) }
367    }
368
369    /// Sets the minimum value of the adjustment.
370    ///
371    /// When setting multiple adjustment properties via their individual
372    /// setters, multiple [`changed`][struct@crate::Adjustment#changed] signals will be emitted.
373    /// However, since the emission of the [`changed`][struct@crate::Adjustment#changed] signal
374    /// is tied to the emission of the [`notify`][struct@crate::glib::Object#notify] signals of the changed
375    /// properties, it’s possible to compress the [`changed`][struct@crate::Adjustment#changed]
376    /// signals into one by calling [`ObjectExt::freeze_notify()`][crate::glib::prelude::ObjectExt::freeze_notify()] and
377    /// [`ObjectExt::thaw_notify()`][crate::glib::prelude::ObjectExt::thaw_notify()] around the calls to the individual setters.
378    ///
379    /// Alternatively, using a single [`ObjectExt::set()`][crate::glib::prelude::ObjectExt::set()] for all the properties
380    /// to change, or using [`configure()`][Self::configure()] has the same effect
381    /// of compressing [`changed`][struct@crate::Adjustment#changed] emissions.
382    /// ## `lower`
383    /// the new minimum value
384    #[doc(alias = "gtk_adjustment_set_lower")]
385    #[doc(alias = "lower")]
386    fn set_lower(&self, lower: f64) {
387        unsafe {
388            ffi::gtk_adjustment_set_lower(self.as_ref().to_glib_none().0, lower);
389        }
390    }
391
392    /// Sets the page increment of the adjustment.
393    ///
394    /// See [`set_lower()`][Self::set_lower()] about how to compress multiple
395    /// emissions of the [`changed`][struct@crate::Adjustment#changed] signal when setting
396    /// multiple adjustment properties.
397    /// ## `page_increment`
398    /// the new page increment
399    #[doc(alias = "gtk_adjustment_set_page_increment")]
400    #[doc(alias = "page-increment")]
401    fn set_page_increment(&self, page_increment: f64) {
402        unsafe {
403            ffi::gtk_adjustment_set_page_increment(self.as_ref().to_glib_none().0, page_increment);
404        }
405    }
406
407    /// Sets the page size of the adjustment.
408    ///
409    /// See [`set_lower()`][Self::set_lower()] about how to compress multiple
410    /// emissions of the GtkAdjustment::changed signal when setting
411    /// multiple adjustment properties.
412    /// ## `page_size`
413    /// the new page size
414    #[doc(alias = "gtk_adjustment_set_page_size")]
415    #[doc(alias = "page-size")]
416    fn set_page_size(&self, page_size: f64) {
417        unsafe {
418            ffi::gtk_adjustment_set_page_size(self.as_ref().to_glib_none().0, page_size);
419        }
420    }
421
422    /// Sets the step increment of the adjustment.
423    ///
424    /// See [`set_lower()`][Self::set_lower()] about how to compress multiple
425    /// emissions of the [`changed`][struct@crate::Adjustment#changed] signal when setting
426    /// multiple adjustment properties.
427    /// ## `step_increment`
428    /// the new step increment
429    #[doc(alias = "gtk_adjustment_set_step_increment")]
430    #[doc(alias = "step-increment")]
431    fn set_step_increment(&self, step_increment: f64) {
432        unsafe {
433            ffi::gtk_adjustment_set_step_increment(self.as_ref().to_glib_none().0, step_increment);
434        }
435    }
436
437    /// Sets the maximum value of the adjustment.
438    ///
439    /// Note that values will be restricted by `upper - page-size`
440    /// if the page-size property is nonzero.
441    ///
442    /// See [`set_lower()`][Self::set_lower()] about how to compress multiple
443    /// emissions of the [`changed`][struct@crate::Adjustment#changed] signal when setting
444    /// multiple adjustment properties.
445    /// ## `upper`
446    /// the new maximum value
447    #[doc(alias = "gtk_adjustment_set_upper")]
448    #[doc(alias = "upper")]
449    fn set_upper(&self, upper: f64) {
450        unsafe {
451            ffi::gtk_adjustment_set_upper(self.as_ref().to_glib_none().0, upper);
452        }
453    }
454
455    /// Sets the [`Adjustment`][crate::Adjustment] value. The value is clamped to lie between
456    /// [`lower`][struct@crate::Adjustment#lower] and [`upper`][struct@crate::Adjustment#upper].
457    ///
458    /// Note that for adjustments which are used in a [`Scrollbar`][crate::Scrollbar], the
459    /// effective range of allowed values goes from [`lower`][struct@crate::Adjustment#lower] to
460    /// [`upper`][struct@crate::Adjustment#upper] - [`page-size`][struct@crate::Adjustment#page-size].
461    /// ## `value`
462    /// the new value
463    #[doc(alias = "gtk_adjustment_set_value")]
464    #[doc(alias = "value")]
465    fn set_value(&self, value: f64) {
466        unsafe {
467            ffi::gtk_adjustment_set_value(self.as_ref().to_glib_none().0, value);
468        }
469    }
470
471    /// Emitted when one or more of the [`Adjustment`][crate::Adjustment] properties have been
472    /// changed, other than the [`value`][struct@crate::Adjustment#value] property.
473    #[doc(alias = "changed")]
474    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
475        unsafe extern "C" fn changed_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
476            this: *mut ffi::GtkAdjustment,
477            f: glib::ffi::gpointer,
478        ) {
479            unsafe {
480                let f: &F = &*(f as *const F);
481                f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
482            }
483        }
484        unsafe {
485            let f: Box_<F> = Box_::new(f);
486            connect_raw(
487                self.as_ptr() as *mut _,
488                c"changed".as_ptr(),
489                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
490                    changed_trampoline::<Self, F> as *const (),
491                )),
492                Box_::into_raw(f),
493            )
494        }
495    }
496
497    /// Emitted when the [`value`][struct@crate::Adjustment#value] property has been changed.
498    #[doc(alias = "value-changed")]
499    fn connect_value_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
500        unsafe extern "C" fn value_changed_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
501            this: *mut ffi::GtkAdjustment,
502            f: glib::ffi::gpointer,
503        ) {
504            unsafe {
505                let f: &F = &*(f as *const F);
506                f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
507            }
508        }
509        unsafe {
510            let f: Box_<F> = Box_::new(f);
511            connect_raw(
512                self.as_ptr() as *mut _,
513                c"value-changed".as_ptr(),
514                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
515                    value_changed_trampoline::<Self, F> as *const (),
516                )),
517                Box_::into_raw(f),
518            )
519        }
520    }
521
522    #[doc(alias = "lower")]
523    fn connect_lower_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
524        unsafe extern "C" fn notify_lower_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
525            this: *mut ffi::GtkAdjustment,
526            _param_spec: glib::ffi::gpointer,
527            f: glib::ffi::gpointer,
528        ) {
529            unsafe {
530                let f: &F = &*(f as *const F);
531                f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
532            }
533        }
534        unsafe {
535            let f: Box_<F> = Box_::new(f);
536            connect_raw(
537                self.as_ptr() as *mut _,
538                c"notify::lower".as_ptr(),
539                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
540                    notify_lower_trampoline::<Self, F> as *const (),
541                )),
542                Box_::into_raw(f),
543            )
544        }
545    }
546
547    #[doc(alias = "page-increment")]
548    fn connect_page_increment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
549        unsafe extern "C" fn notify_page_increment_trampoline<
550            P: IsA<Adjustment>,
551            F: Fn(&P) + 'static,
552        >(
553            this: *mut ffi::GtkAdjustment,
554            _param_spec: glib::ffi::gpointer,
555            f: glib::ffi::gpointer,
556        ) {
557            unsafe {
558                let f: &F = &*(f as *const F);
559                f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
560            }
561        }
562        unsafe {
563            let f: Box_<F> = Box_::new(f);
564            connect_raw(
565                self.as_ptr() as *mut _,
566                c"notify::page-increment".as_ptr(),
567                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
568                    notify_page_increment_trampoline::<Self, F> as *const (),
569                )),
570                Box_::into_raw(f),
571            )
572        }
573    }
574
575    #[doc(alias = "page-size")]
576    fn connect_page_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
577        unsafe extern "C" fn notify_page_size_trampoline<
578            P: IsA<Adjustment>,
579            F: Fn(&P) + 'static,
580        >(
581            this: *mut ffi::GtkAdjustment,
582            _param_spec: glib::ffi::gpointer,
583            f: glib::ffi::gpointer,
584        ) {
585            unsafe {
586                let f: &F = &*(f as *const F);
587                f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
588            }
589        }
590        unsafe {
591            let f: Box_<F> = Box_::new(f);
592            connect_raw(
593                self.as_ptr() as *mut _,
594                c"notify::page-size".as_ptr(),
595                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
596                    notify_page_size_trampoline::<Self, F> as *const (),
597                )),
598                Box_::into_raw(f),
599            )
600        }
601    }
602
603    #[doc(alias = "step-increment")]
604    fn connect_step_increment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
605        unsafe extern "C" fn notify_step_increment_trampoline<
606            P: IsA<Adjustment>,
607            F: Fn(&P) + 'static,
608        >(
609            this: *mut ffi::GtkAdjustment,
610            _param_spec: glib::ffi::gpointer,
611            f: glib::ffi::gpointer,
612        ) {
613            unsafe {
614                let f: &F = &*(f as *const F);
615                f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
616            }
617        }
618        unsafe {
619            let f: Box_<F> = Box_::new(f);
620            connect_raw(
621                self.as_ptr() as *mut _,
622                c"notify::step-increment".as_ptr(),
623                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
624                    notify_step_increment_trampoline::<Self, F> as *const (),
625                )),
626                Box_::into_raw(f),
627            )
628        }
629    }
630
631    #[doc(alias = "upper")]
632    fn connect_upper_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
633        unsafe extern "C" fn notify_upper_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
634            this: *mut ffi::GtkAdjustment,
635            _param_spec: glib::ffi::gpointer,
636            f: glib::ffi::gpointer,
637        ) {
638            unsafe {
639                let f: &F = &*(f as *const F);
640                f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
641            }
642        }
643        unsafe {
644            let f: Box_<F> = Box_::new(f);
645            connect_raw(
646                self.as_ptr() as *mut _,
647                c"notify::upper".as_ptr(),
648                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
649                    notify_upper_trampoline::<Self, F> as *const (),
650                )),
651                Box_::into_raw(f),
652            )
653        }
654    }
655
656    #[doc(alias = "value")]
657    fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
658        unsafe extern "C" fn notify_value_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
659            this: *mut ffi::GtkAdjustment,
660            _param_spec: glib::ffi::gpointer,
661            f: glib::ffi::gpointer,
662        ) {
663            unsafe {
664                let f: &F = &*(f as *const F);
665                f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
666            }
667        }
668        unsafe {
669            let f: Box_<F> = Box_::new(f);
670            connect_raw(
671                self.as_ptr() as *mut _,
672                c"notify::value".as_ptr(),
673                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
674                    notify_value_trampoline::<Self, F> as *const (),
675                )),
676                Box_::into_raw(f),
677            )
678        }
679    }
680}
681
682impl<O: IsA<Adjustment>> AdjustmentExt for O {}