dear_imgui_rs/ui/
style.rs1use super::*;
2
3impl Ui {
4 #[doc(alias = "ShowStyleEditor")]
6 pub fn show_style_editor(&self, style: &mut crate::style::Style) {
7 self.run_with_bound_context(|| unsafe {
8 crate::sys::igShowStyleEditor(style.raw_mut());
9 });
10 }
11
12 #[doc(alias = "ShowStyleEditor")]
14 pub fn show_default_style_editor(&self) {
15 self.run_with_bound_context(|| unsafe {
16 crate::sys::igShowStyleEditor(std::ptr::null_mut());
17 });
18 }
19
20 #[doc(alias = "GetStyle")]
36 pub unsafe fn style(&self) -> &crate::Style {
37 self.run_with_bound_context(|| unsafe {
38 &*(sys::igGetStyle() as *const crate::Style)
40 })
41 }
42
43 #[doc(alias = "GetStyle")]
47 pub fn clone_style(&self) -> crate::Style {
48 unsafe { self.style().clone() }
49 }
50
51 #[doc(alias = "StyleColorsDark")]
53 pub fn style_colors_dark(&self) {
54 self.run_with_bound_context(|| unsafe { sys::igStyleColorsDark(std::ptr::null_mut()) });
55 }
56
57 #[doc(alias = "StyleColorsLight")]
59 pub fn style_colors_light(&self) {
60 self.run_with_bound_context(|| unsafe { sys::igStyleColorsLight(std::ptr::null_mut()) });
61 }
62
63 #[doc(alias = "StyleColorsClassic")]
65 pub fn style_colors_classic(&self) {
66 self.run_with_bound_context(|| unsafe { sys::igStyleColorsClassic(std::ptr::null_mut()) });
67 }
68
69 #[doc(alias = "StyleColorsDark")]
71 pub fn style_colors_dark_into(&self, dst: &mut crate::Style) {
72 self.run_with_bound_context(|| unsafe {
73 sys::igStyleColorsDark(dst.raw_mut() as *mut sys::ImGuiStyle)
74 });
75 }
76
77 #[doc(alias = "StyleColorsLight")]
79 pub fn style_colors_light_into(&self, dst: &mut crate::Style) {
80 self.run_with_bound_context(|| unsafe {
81 sys::igStyleColorsLight(dst.raw_mut() as *mut sys::ImGuiStyle)
82 });
83 }
84
85 #[doc(alias = "StyleColorsClassic")]
87 pub fn style_colors_classic_into(&self, dst: &mut crate::Style) {
88 self.run_with_bound_context(|| unsafe {
89 sys::igStyleColorsClassic(dst.raw_mut() as *mut sys::ImGuiStyle)
90 });
91 }
92
93 #[doc(alias = "ShowStyleSelector")]
97 pub fn show_style_selector(&self, label: impl AsRef<str>) -> bool {
98 self.run_with_bound_context(|| unsafe { sys::igShowStyleSelector(self.scratch_txt(label)) })
99 }
100
101 #[doc(alias = "ShowFontSelector")]
103 pub fn show_font_selector(&self, label: impl AsRef<str>) {
104 self.run_with_bound_context(|| unsafe {
105 sys::igShowFontSelector(self.scratch_txt(label));
106 });
107 }
108}