Skip to main content

dear_imgui_rs/layout/
separator.rs

1use crate::Ui;
2use crate::sys;
3
4impl Ui {
5    /// Renders a separator (generally horizontal).
6    ///
7    /// This becomes a vertical separator inside a menu bar or in horizontal layout mode.
8    #[doc(alias = "Separator")]
9    pub fn separator(&self) {
10        self.run_with_bound_context(|| unsafe { sys::igSeparator() });
11    }
12
13    /// Renders a separator with text.
14    #[doc(alias = "SeparatorText")]
15    pub fn separator_with_text(&self, text: impl AsRef<str>) {
16        let text = self.scratch_txt(text);
17        self.run_with_bound_context(|| unsafe { sys::igSeparatorText(text) });
18    }
19
20    /// Creates a vertical separator
21    #[doc(alias = "SeparatorEx")]
22    pub fn separator_vertical(&self) {
23        self.run_with_bound_context(|| unsafe {
24            sys::igSeparatorEx(sys::ImGuiSeparatorFlags_Vertical as i32, 1.0)
25        });
26    }
27
28    /// Creates a horizontal separator
29    #[doc(alias = "SeparatorEx")]
30    pub fn separator_horizontal(&self) {
31        self.run_with_bound_context(|| unsafe {
32            sys::igSeparatorEx(sys::ImGuiSeparatorFlags_Horizontal as i32, 1.0)
33        });
34    }
35}