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
// This file was generated by gir (9e3f4cc) from gir-files (71d73f0)
// DO NOT EDIT

use Adjustment;
use ScrollablePolicy;
use ffi;
use glib::object::IsA;
use glib::translate::*;

glib_wrapper! {
    pub struct Scrollable(Object<ffi::GtkScrollable>);

    match fn {
        get_type => || ffi::gtk_scrollable_get_type(),
    }
}

pub trait ScrollableExt {
    //#[cfg(feature = "v3_16")]
    //fn get_border(&self, border: /*Ignored*/Border) -> bool;

    fn get_hadjustment(&self) -> Option<Adjustment>;

    fn get_hscroll_policy(&self) -> ScrollablePolicy;

    fn get_vadjustment(&self) -> Option<Adjustment>;

    fn get_vscroll_policy(&self) -> ScrollablePolicy;

    fn set_hadjustment<'a, P: Into<Option<&'a Adjustment>>>(&self, hadjustment: P);

    fn set_hscroll_policy(&self, policy: ScrollablePolicy);

    fn set_vadjustment<'a, P: Into<Option<&'a Adjustment>>>(&self, vadjustment: P);

    fn set_vscroll_policy(&self, policy: ScrollablePolicy);
}

impl<O: IsA<Scrollable>> ScrollableExt for O {
    //#[cfg(feature = "v3_16")]
    //fn get_border(&self, border: /*Ignored*/Border) -> bool {
    //    unsafe { TODO: call ffi::gtk_scrollable_get_border() }
    //}

    fn get_hadjustment(&self) -> Option<Adjustment> {
        unsafe {
            from_glib_none(ffi::gtk_scrollable_get_hadjustment(self.to_glib_none().0))
        }
    }

    fn get_hscroll_policy(&self) -> ScrollablePolicy {
        unsafe {
            from_glib(ffi::gtk_scrollable_get_hscroll_policy(self.to_glib_none().0))
        }
    }

    fn get_vadjustment(&self) -> Option<Adjustment> {
        unsafe {
            from_glib_none(ffi::gtk_scrollable_get_vadjustment(self.to_glib_none().0))
        }
    }

    fn get_vscroll_policy(&self) -> ScrollablePolicy {
        unsafe {
            from_glib(ffi::gtk_scrollable_get_vscroll_policy(self.to_glib_none().0))
        }
    }

    fn set_hadjustment<'a, P: Into<Option<&'a Adjustment>>>(&self, hadjustment: P) {
        let hadjustment = hadjustment.into();
        let hadjustment = hadjustment.to_glib_none();
        unsafe {
            ffi::gtk_scrollable_set_hadjustment(self.to_glib_none().0, hadjustment.0);
        }
    }

    fn set_hscroll_policy(&self, policy: ScrollablePolicy) {
        unsafe {
            ffi::gtk_scrollable_set_hscroll_policy(self.to_glib_none().0, policy.to_glib());
        }
    }

    fn set_vadjustment<'a, P: Into<Option<&'a Adjustment>>>(&self, vadjustment: P) {
        let vadjustment = vadjustment.into();
        let vadjustment = vadjustment.to_glib_none();
        unsafe {
            ffi::gtk_scrollable_set_vadjustment(self.to_glib_none().0, vadjustment.0);
        }
    }

    fn set_vscroll_policy(&self, policy: ScrollablePolicy) {
        unsafe {
            ffi::gtk_scrollable_set_vscroll_policy(self.to_glib_none().0, policy.to_glib());
        }
    }
}