Skip to main content

dear_imgui_rs/layout/
metrics.rs

1use crate::Ui;
2use crate::sys;
3
4impl Ui {
5    /// Return ~ FontSize.
6    #[doc(alias = "GetTextLineHeight")]
7    pub fn text_line_height(&self) -> f32 {
8        self.run_with_bound_context(|| unsafe { sys::igGetTextLineHeight() })
9    }
10
11    /// Return ~ FontSize + style.ItemSpacing.y.
12    #[doc(alias = "GetTextLineHeightWithSpacing")]
13    pub fn text_line_height_with_spacing(&self) -> f32 {
14        self.run_with_bound_context(|| unsafe { sys::igGetTextLineHeightWithSpacing() })
15    }
16
17    /// Return ~ FontSize + style.FramePadding.y * 2.
18    #[doc(alias = "GetFrameHeight")]
19    pub fn frame_height(&self) -> f32 {
20        self.run_with_bound_context(|| unsafe { sys::igGetFrameHeight() })
21    }
22
23    /// Return ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y.
24    #[doc(alias = "GetFrameHeightWithSpacing")]
25    pub fn frame_height_with_spacing(&self) -> f32 {
26        self.run_with_bound_context(|| unsafe { sys::igGetFrameHeightWithSpacing() })
27    }
28}