gtk4/auto/
adjustment.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    /// [`Adjustment`][crate::Adjustment] is a model for a numeric value.
    ///
    /// The [`Adjustment`][crate::Adjustment] has an associated lower and upper bound.
    /// It also contains step and page increments, and a page size.
    ///
    /// Adjustments are used within several GTK widgets, including
    /// [`SpinButton`][crate::SpinButton], [`Viewport`][crate::Viewport], [`Scrollbar`][crate::Scrollbar]
    /// and [`Scale`][crate::Scale].
    ///
    /// The [`Adjustment`][crate::Adjustment] object does not update the value itself. Instead
    /// it is left up to the owner of the [`Adjustment`][crate::Adjustment] to control the value.
    ///
    /// ## Properties
    ///
    ///
    /// #### `lower`
    ///  The minimum value of the adjustment.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `page-increment`
    ///  The page increment of the adjustment.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `page-size`
    ///  The page size of the adjustment.
    ///
    /// Note that the page-size is irrelevant and should be set to zero
    /// if the adjustment is used for a simple scalar value, e.g. in a
    /// [`SpinButton`][crate::SpinButton].
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `step-increment`
    ///  The step increment of the adjustment.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `upper`
    ///  The maximum value of the adjustment.
    ///
    /// Note that values will be restricted by `upper - page-size` if the page-size
    /// property is nonzero.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `value`
    ///  The value of the adjustment.
    ///
    /// Readable | Writeable
    ///
    /// ## Signals
    ///
    ///
    /// #### `changed`
    ///  Emitted when one or more of the [`Adjustment`][crate::Adjustment] properties have been
    /// changed.
    ///
    /// Note that the [`value`][struct@crate::Adjustment#value] property is
    /// covered by the [`value-changed`][struct@crate::Adjustment#value-changed] signal.
    ///
    ///
    ///
    ///
    /// #### `value-changed`
    ///  Emitted when the value has been changed.
    ///
    ///
    ///
    /// # Implements
    ///
    /// [`AdjustmentExt`][trait@crate::prelude::AdjustmentExt], [`trait@glib::ObjectExt`]
    #[doc(alias = "GtkAdjustment")]
    pub struct Adjustment(Object<ffi::GtkAdjustment, ffi::GtkAdjustmentClass>);

    match fn {
        type_ => || ffi::gtk_adjustment_get_type(),
    }
}

impl Adjustment {
    pub const NONE: Option<&'static Adjustment> = None;

    /// Creates a new [`Adjustment`][crate::Adjustment].
    /// ## `value`
    /// the initial value
    /// ## `lower`
    /// the minimum value
    /// ## `upper`
    /// the maximum value
    /// ## `step_increment`
    /// the step increment
    /// ## `page_increment`
    /// the page increment
    /// ## `page_size`
    /// the page size
    ///
    /// # Returns
    ///
    /// a new [`Adjustment`][crate::Adjustment]
    #[doc(alias = "gtk_adjustment_new")]
    pub fn new(
        value: f64,
        lower: f64,
        upper: f64,
        step_increment: f64,
        page_increment: f64,
        page_size: f64,
    ) -> Adjustment {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_none(ffi::gtk_adjustment_new(
                value,
                lower,
                upper,
                step_increment,
                page_increment,
                page_size,
            ))
        }
    }

    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`Adjustment`] objects.
    ///
    /// This method returns an instance of [`AdjustmentBuilder`](crate::builders::AdjustmentBuilder) which can be used to create [`Adjustment`] objects.
    pub fn builder() -> AdjustmentBuilder {
        AdjustmentBuilder::new()
    }
}

impl Default for Adjustment {
    fn default() -> Self {
        glib::object::Object::new::<Self>()
    }
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`Adjustment`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct AdjustmentBuilder {
    builder: glib::object::ObjectBuilder<'static, Adjustment>,
}

impl AdjustmentBuilder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    /// The minimum value of the adjustment.
    pub fn lower(self, lower: f64) -> Self {
        Self {
            builder: self.builder.property("lower", lower),
        }
    }

    /// The page increment of the adjustment.
    pub fn page_increment(self, page_increment: f64) -> Self {
        Self {
            builder: self.builder.property("page-increment", page_increment),
        }
    }

    /// The page size of the adjustment.
    ///
    /// Note that the page-size is irrelevant and should be set to zero
    /// if the adjustment is used for a simple scalar value, e.g. in a
    /// [`SpinButton`][crate::SpinButton].
    pub fn page_size(self, page_size: f64) -> Self {
        Self {
            builder: self.builder.property("page-size", page_size),
        }
    }

    /// The step increment of the adjustment.
    pub fn step_increment(self, step_increment: f64) -> Self {
        Self {
            builder: self.builder.property("step-increment", step_increment),
        }
    }

    /// The maximum value of the adjustment.
    ///
    /// Note that values will be restricted by `upper - page-size` if the page-size
    /// property is nonzero.
    pub fn upper(self, upper: f64) -> Self {
        Self {
            builder: self.builder.property("upper", upper),
        }
    }

    /// The value of the adjustment.
    pub fn value(self, value: f64) -> Self {
        Self {
            builder: self.builder.property("value", value),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`Adjustment`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> Adjustment {
        assert_initialized_main_thread!();
        self.builder.build()
    }
}

/// Trait containing all [`struct@Adjustment`] methods.
///
/// # Implementors
///
/// [`Adjustment`][struct@crate::Adjustment]
pub trait AdjustmentExt: IsA<Adjustment> + 'static {
    /// Updates the value property to ensure that the range
    /// between @lower and @upper is in the current page.
    ///
    /// The current page goes from `value` to `value` + `page-size`.
    /// If the range is larger than the page size, then only the
    /// start of it will be in the current page.
    ///
    /// A [`value-changed`][struct@crate::Adjustment#value-changed] signal will be emitted
    /// if the value is changed.
    /// ## `lower`
    /// the lower value
    /// ## `upper`
    /// the upper value
    #[doc(alias = "gtk_adjustment_clamp_page")]
    fn clamp_page(&self, lower: f64, upper: f64) {
        unsafe {
            ffi::gtk_adjustment_clamp_page(self.as_ref().to_glib_none().0, lower, upper);
        }
    }

    /// Sets all properties of the adjustment at once.
    ///
    /// Use this function to avoid multiple emissions of the
    /// [`changed`][struct@crate::Adjustment#changed] signal. See
    /// [`set_lower()`][Self::set_lower()] for an alternative
    /// way of compressing multiple emissions of
    /// [`changed`][struct@crate::Adjustment#changed] into one.
    /// ## `value`
    /// the new value
    /// ## `lower`
    /// the new minimum value
    /// ## `upper`
    /// the new maximum value
    /// ## `step_increment`
    /// the new step increment
    /// ## `page_increment`
    /// the new page increment
    /// ## `page_size`
    /// the new page size
    #[doc(alias = "gtk_adjustment_configure")]
    fn configure(
        &self,
        value: f64,
        lower: f64,
        upper: f64,
        step_increment: f64,
        page_increment: f64,
        page_size: f64,
    ) {
        unsafe {
            ffi::gtk_adjustment_configure(
                self.as_ref().to_glib_none().0,
                value,
                lower,
                upper,
                step_increment,
                page_increment,
                page_size,
            );
        }
    }

    /// Retrieves the minimum value of the adjustment.
    ///
    /// # Returns
    ///
    /// The current minimum value of the adjustment
    #[doc(alias = "gtk_adjustment_get_lower")]
    #[doc(alias = "get_lower")]
    fn lower(&self) -> f64 {
        unsafe { ffi::gtk_adjustment_get_lower(self.as_ref().to_glib_none().0) }
    }

    /// Gets the smaller of step increment and page increment.
    ///
    /// # Returns
    ///
    /// the minimum increment of @self
    #[doc(alias = "gtk_adjustment_get_minimum_increment")]
    #[doc(alias = "get_minimum_increment")]
    fn minimum_increment(&self) -> f64 {
        unsafe { ffi::gtk_adjustment_get_minimum_increment(self.as_ref().to_glib_none().0) }
    }

    /// Retrieves the page increment of the adjustment.
    ///
    /// # Returns
    ///
    /// The current page increment of the adjustment
    #[doc(alias = "gtk_adjustment_get_page_increment")]
    #[doc(alias = "get_page_increment")]
    #[doc(alias = "page-increment")]
    fn page_increment(&self) -> f64 {
        unsafe { ffi::gtk_adjustment_get_page_increment(self.as_ref().to_glib_none().0) }
    }

    /// Retrieves the page size of the adjustment.
    ///
    /// # Returns
    ///
    /// The current page size of the adjustment
    #[doc(alias = "gtk_adjustment_get_page_size")]
    #[doc(alias = "get_page_size")]
    #[doc(alias = "page-size")]
    fn page_size(&self) -> f64 {
        unsafe { ffi::gtk_adjustment_get_page_size(self.as_ref().to_glib_none().0) }
    }

    /// Retrieves the step increment of the adjustment.
    ///
    /// # Returns
    ///
    /// The current step increment of the adjustment.
    #[doc(alias = "gtk_adjustment_get_step_increment")]
    #[doc(alias = "get_step_increment")]
    #[doc(alias = "step-increment")]
    fn step_increment(&self) -> f64 {
        unsafe { ffi::gtk_adjustment_get_step_increment(self.as_ref().to_glib_none().0) }
    }

    /// Retrieves the maximum value of the adjustment.
    ///
    /// # Returns
    ///
    /// The current maximum value of the adjustment
    #[doc(alias = "gtk_adjustment_get_upper")]
    #[doc(alias = "get_upper")]
    fn upper(&self) -> f64 {
        unsafe { ffi::gtk_adjustment_get_upper(self.as_ref().to_glib_none().0) }
    }

    /// Gets the current value of the adjustment.
    ///
    /// # Returns
    ///
    /// The current value of the adjustment
    #[doc(alias = "gtk_adjustment_get_value")]
    #[doc(alias = "get_value")]
    fn value(&self) -> f64 {
        unsafe { ffi::gtk_adjustment_get_value(self.as_ref().to_glib_none().0) }
    }

    /// Sets the minimum value of the adjustment.
    ///
    /// When setting multiple adjustment properties via their individual
    /// setters, multiple [`changed`][struct@crate::Adjustment#changed] signals will
    /// be emitted. However, since the emission of the
    /// [`changed`][struct@crate::Adjustment#changed] signal is tied to the emission
    /// of the ::notify signals of the changed properties, it’s possible
    /// to compress the [`changed`][struct@crate::Adjustment#changed] signals into one
    /// by calling g_object_freeze_notify() and g_object_thaw_notify()
    /// around the calls to the individual setters.
    ///
    /// Alternatively, using a single g_object_set() for all the properties
    /// to change, or using [`configure()`][Self::configure()] has the same effect.
    /// ## `lower`
    /// the new minimum value
    #[doc(alias = "gtk_adjustment_set_lower")]
    #[doc(alias = "lower")]
    fn set_lower(&self, lower: f64) {
        unsafe {
            ffi::gtk_adjustment_set_lower(self.as_ref().to_glib_none().0, lower);
        }
    }

    /// Sets the page increment of the adjustment.
    ///
    /// See [`set_lower()`][Self::set_lower()] about how to compress
    /// multiple emissions of the [`changed`][struct@crate::Adjustment#changed]
    /// signal when setting multiple adjustment properties.
    /// ## `page_increment`
    /// the new page increment
    #[doc(alias = "gtk_adjustment_set_page_increment")]
    #[doc(alias = "page-increment")]
    fn set_page_increment(&self, page_increment: f64) {
        unsafe {
            ffi::gtk_adjustment_set_page_increment(self.as_ref().to_glib_none().0, page_increment);
        }
    }

    /// Sets the page size of the adjustment.
    ///
    /// See [`set_lower()`][Self::set_lower()] about how to compress
    /// multiple emissions of the [`changed`][struct@crate::Adjustment#changed]
    /// signal when setting multiple adjustment properties.
    /// ## `page_size`
    /// the new page size
    #[doc(alias = "gtk_adjustment_set_page_size")]
    #[doc(alias = "page-size")]
    fn set_page_size(&self, page_size: f64) {
        unsafe {
            ffi::gtk_adjustment_set_page_size(self.as_ref().to_glib_none().0, page_size);
        }
    }

    /// Sets the step increment of the adjustment.
    ///
    /// See [`set_lower()`][Self::set_lower()] about how to compress
    /// multiple emissions of the [`changed`][struct@crate::Adjustment#changed]
    /// signal when setting multiple adjustment properties.
    /// ## `step_increment`
    /// the new step increment
    #[doc(alias = "gtk_adjustment_set_step_increment")]
    #[doc(alias = "step-increment")]
    fn set_step_increment(&self, step_increment: f64) {
        unsafe {
            ffi::gtk_adjustment_set_step_increment(self.as_ref().to_glib_none().0, step_increment);
        }
    }

    /// Sets the maximum value of the adjustment.
    ///
    /// Note that values will be restricted by `upper - page-size`
    /// if the page-size property is nonzero.
    ///
    /// See [`set_lower()`][Self::set_lower()] about how to compress
    /// multiple emissions of the [`changed`][struct@crate::Adjustment#changed]
    /// signal when setting multiple adjustment properties.
    /// ## `upper`
    /// the new maximum value
    #[doc(alias = "gtk_adjustment_set_upper")]
    #[doc(alias = "upper")]
    fn set_upper(&self, upper: f64) {
        unsafe {
            ffi::gtk_adjustment_set_upper(self.as_ref().to_glib_none().0, upper);
        }
    }

    /// Sets the [`Adjustment`][crate::Adjustment] value.
    ///
    /// The value is clamped to lie between [`lower`][struct@crate::Adjustment#lower]
    /// and [`upper`][struct@crate::Adjustment#upper].
    ///
    /// Note that for adjustments which are used in a [`Scrollbar`][crate::Scrollbar],
    /// the effective range of allowed values goes from
    /// [`lower`][struct@crate::Adjustment#lower] to
    /// [`upper`][struct@crate::Adjustment#upper] - [`page-size`][struct@crate::Adjustment#page-size].
    /// ## `value`
    /// the new value
    #[doc(alias = "gtk_adjustment_set_value")]
    #[doc(alias = "value")]
    fn set_value(&self, value: f64) {
        unsafe {
            ffi::gtk_adjustment_set_value(self.as_ref().to_glib_none().0, value);
        }
    }

    /// Emitted when one or more of the [`Adjustment`][crate::Adjustment] properties have been
    /// changed.
    ///
    /// Note that the [`value`][struct@crate::Adjustment#value] property is
    /// covered by the [`value-changed`][struct@crate::Adjustment#value-changed] signal.
    #[doc(alias = "changed")]
    fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn changed_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
            this: *mut ffi::GtkAdjustment,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"changed\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    changed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    /// Emitted when the value has been changed.
    #[doc(alias = "value-changed")]
    fn connect_value_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn value_changed_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
            this: *mut ffi::GtkAdjustment,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"value-changed\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    value_changed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "lower")]
    fn connect_lower_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_lower_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
            this: *mut ffi::GtkAdjustment,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::lower\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_lower_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "page-increment")]
    fn connect_page_increment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_page_increment_trampoline<
            P: IsA<Adjustment>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GtkAdjustment,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::page-increment\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_page_increment_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "page-size")]
    fn connect_page_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_page_size_trampoline<
            P: IsA<Adjustment>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GtkAdjustment,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::page-size\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_page_size_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "step-increment")]
    fn connect_step_increment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_step_increment_trampoline<
            P: IsA<Adjustment>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GtkAdjustment,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::step-increment\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_step_increment_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "upper")]
    fn connect_upper_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_upper_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
            this: *mut ffi::GtkAdjustment,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::upper\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_upper_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "value")]
    fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_value_trampoline<P: IsA<Adjustment>, F: Fn(&P) + 'static>(
            this: *mut ffi::GtkAdjustment,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Adjustment::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::value\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_value_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<Adjustment>> AdjustmentExt for O {}