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
use crate::sys;
use crate::Ui;

/// # Window scrolling
impl<'ui> Ui<'ui> {
    /// Returns the horizontal scrolling position.
    ///
    /// Value is between 0.0 and self.scroll_max_x().
    pub fn scroll_x(&self) -> f32 {
        unsafe { sys::igGetScrollX() }
    }
    /// Returns the vertical scrolling position.
    ///
    /// Value is between 0.0 and self.scroll_max_y().
    pub fn scroll_y(&self) -> f32 {
        unsafe { sys::igGetScrollY() }
    }
    /// Returns the maximum horizontal scrolling position.
    ///
    /// Roughly equal to content size X - window size X.
    pub fn scroll_max_x(&self) -> f32 {
        unsafe { sys::igGetScrollMaxX() }
    }
    /// Returns the maximum vertical scrolling position.
    ///
    /// Roughly equal to content size Y - window size Y.
    pub fn scroll_max_y(&self) -> f32 {
        unsafe { sys::igGetScrollMaxY() }
    }
    /// Sets the horizontal scrolling position
    pub fn set_scroll_x(&self, scroll_x: f32) {
        unsafe { sys::igSetScrollX(scroll_x) };
    }
    /// Sets the vertical scroll position
    pub fn set_scroll_y(&self, scroll_y: f32) {
        unsafe { sys::igSetScrollY(scroll_y) };
    }
    /// Adjusts the horizontal scroll position to make the current cursor position visible
    pub fn set_scroll_here_x(&self) {
        unsafe { sys::igSetScrollHereX(0.5) };
    }
    /// Adjusts the horizontal scroll position to make the current cursor position visible.
    ///
    /// center_x_ratio:
    ///
    /// - `0.0`: left
    /// - `0.5`: center
    /// - `1.0`: right
    pub fn set_scroll_here_x_with_ratio(&self, center_x_ratio: f32) {
        unsafe { sys::igSetScrollHereX(center_x_ratio) };
    }
    /// Adjusts the vertical scroll position to make the current cursor position visible
    pub fn set_scroll_here_y(&self) {
        unsafe { sys::igSetScrollHereY(0.5) };
    }
    /// Adjusts the vertical scroll position to make the current cursor position visible.
    ///
    /// center_y_ratio:
    ///
    /// - `0.0`: top
    /// - `0.5`: center
    /// - `1.0`: bottom
    pub fn set_scroll_here_y_with_ratio(&self, center_y_ratio: f32) {
        unsafe { sys::igSetScrollHereY(center_y_ratio) };
    }
    /// Adjusts the horizontal scroll position to make the given position visible
    pub fn set_scroll_from_pos_x(&self, local_x: f32) {
        unsafe { sys::igSetScrollFromPosX(local_x, 0.5) };
    }
    /// Adjusts the horizontal scroll position to make the given position visible.
    ///
    /// center_x_ratio:
    ///
    /// - `0.0`: left
    /// - `0.5`: center
    /// - `1.0`: right
    pub fn set_scroll_from_pos_x_with_ratio(&self, local_x: f32, center_x_ratio: f32) {
        unsafe { sys::igSetScrollFromPosX(local_x, center_x_ratio) };
    }
    /// Adjusts the vertical scroll position to make the given position visible
    pub fn set_scroll_from_pos_y(&self, local_y: f32) {
        unsafe { sys::igSetScrollFromPosY(local_y, 0.5) };
    }
    /// Adjusts the vertical scroll position to make the given position visible.
    ///
    /// center_y_ratio:
    ///
    /// - `0.0`: top
    /// - `0.5`: center
    /// - `1.0`: bottom
    pub fn set_scroll_from_pos_y_with_ratio(&self, local_y: f32, center_y_ratio: f32) {
        unsafe { sys::igSetScrollFromPosY(local_y, center_y_ratio) };
    }
}