dear_imgui/window/
content_region.rs

1use crate::Ui;
2use crate::sys;
3
4impl Ui {
5    /// Returns the size of the content region available for widgets
6    ///
7    /// This is the size of the window minus decorations (title bar, scrollbars, etc.)
8    #[doc(alias = "GetContentRegionAvail")]
9    pub fn content_region_avail(&self) -> [f32; 2] {
10        unsafe {
11            let mut size = sys::ImVec2 { x: 0.0, y: 0.0 };
12            sys::igGetContentRegionAvail(&mut size);
13            [size.x, size.y]
14        }
15    }
16
17    /// Returns the width of the content region available for widgets
18    ///
19    /// This is equivalent to `content_region_avail()[0]`
20    pub fn content_region_avail_width(&self) -> f32 {
21        self.content_region_avail()[0]
22    }
23
24    /// Returns the height of the content region available for widgets
25    ///
26    /// This is equivalent to `content_region_avail()[1]`
27    pub fn content_region_avail_height(&self) -> f32 {
28        self.content_region_avail()[1]
29    }
30}