dear_imgui_rs/style/var.rs
1/// A temporary change in user interface style
2#[derive(Copy, Clone, Debug, PartialEq)]
3#[non_exhaustive]
4pub enum StyleVar {
5 /// Global alpha applies to everything
6 Alpha(f32),
7 /// Additional alpha multiplier applied to disabled elements
8 DisabledAlpha(f32),
9 /// Padding within a window
10 WindowPadding([f32; 2]),
11 /// Rounding radius of window corners
12 WindowRounding(f32),
13 /// Thickness of border around windows
14 WindowBorderSize(f32),
15 /// Minimum window size
16 WindowMinSize([f32; 2]),
17 /// Alignment for title bar text
18 WindowTitleAlign([f32; 2]),
19 /// Rounding radius of child window corners
20 ChildRounding(f32),
21 /// Thickness of border around child windows
22 ChildBorderSize(f32),
23 /// Rounding radius of popup window corners
24 PopupRounding(f32),
25 /// Thickness of border around popup/tooltip windows
26 PopupBorderSize(f32),
27 /// Padding within a framed rectangle (used by most widgets)
28 FramePadding([f32; 2]),
29 /// Rounding radius of frame corners (used by most widgets)
30 FrameRounding(f32),
31 /// Rounding radius of image corners (used by Image() and ImageButton() widgets)
32 ImageRounding(f32),
33 /// Thickness of border around images
34 ImageBorderSize(f32),
35 /// Thickness of border around frames
36 FrameBorderSize(f32),
37 /// Horizontal and vertical spacing between widgets/lines
38 ItemSpacing([f32; 2]),
39 /// Horizontal and vertical spacing between within elements of a composed widget
40 ItemInnerSpacing([f32; 2]),
41 /// Horizontal indentation when e.g. entering a tree node
42 IndentSpacing(f32),
43 /// Padding within a table cell
44 CellPadding([f32; 2]),
45 /// Width of the vertical scrollbar, height of the horizontal scrollbar
46 ScrollbarSize(f32),
47 /// Rounding radius of scrollbar corners
48 ScrollbarRounding(f32),
49 /// Padding of scrollbar grab within its frame
50 ScrollbarPadding(f32),
51 /// Minimum width/height of a grab box for slider/scrollbar
52 GrabMinSize(f32),
53 /// Rounding radius of grabs corners
54 GrabRounding(f32),
55 /// Rounding radius of upper corners of tabs
56 TabRounding(f32),
57 /// Thickness of border around tabs
58 TabBorderSize(f32),
59 /// Minimum tab width before fitting policy shrink is applied
60 TabMinWidthBase(f32),
61 /// Minimum tab width after shrinking with the mixed fitting policy
62 TabMinWidthShrink(f32),
63 /// Thickness of the tab-bar separator
64 TabBarBorderSize(f32),
65 /// Thickness of the selected tab-bar overline
66 TabBarOverlineSize(f32),
67 /// Angle of angled table headers, in radians
68 TableAngledHeadersAngle(f32),
69 /// Alignment of angled table headers within the cell
70 TableAngledHeadersTextAlign([f32; 2]),
71 /// Thickness of tree hierarchy outlines
72 TreeLinesSize(f32),
73 /// Rounding radius of tree hierarchy outlines
74 TreeLinesRounding(f32),
75 /// Rounding radius of menu items and menus
76 MenuItemRounding(f32),
77 /// Rounding radius of selectable items
78 SelectableRounding(f32),
79 /// Rounding radius of drag and drop target highlights; negative values use frame rounding
80 DragDropTargetRounding(f32),
81 /// Alignment of button text when button is larger than text
82 ButtonTextAlign([f32; 2]),
83 /// Alignment of selectable text when selectable is larger than text
84 SelectableTextAlign([f32; 2]),
85 /// Thickness of border in `Separator()`
86 SeparatorSize(f32),
87 /// Thickness of border in `SeparatorText()`
88 SeparatorTextBorderSize(f32),
89 /// Alignment of text within the separator
90 SeparatorTextAlign([f32; 2]),
91 /// Padding around text in `SeparatorText()`
92 SeparatorTextPadding([f32; 2]),
93 /// Thickness of resizing border between docked windows
94 DockingSeparatorSize(f32),
95}
96
97/// A two-component style variable whose X or Y component can be overridden.
98///
99/// Use this with [`Ui::push_style_var_x`](crate::Ui::push_style_var_x) or
100/// [`Ui::push_style_var_y`](crate::Ui::push_style_var_y). Scalar style
101/// variables are intentionally not representable by this type.
102#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
103#[non_exhaustive]
104pub enum StyleVarVec2 {
105 /// Padding within a window.
106 WindowPadding,
107 /// Minimum window size.
108 WindowMinSize,
109 /// Alignment for title bar text.
110 WindowTitleAlign,
111 /// Padding within a framed rectangle.
112 FramePadding,
113 /// Horizontal and vertical spacing between widgets or lines.
114 ItemSpacing,
115 /// Spacing between elements of a composed widget.
116 ItemInnerSpacing,
117 /// Padding within a table cell.
118 CellPadding,
119 /// Alignment of angled table headers within the cell.
120 TableAngledHeadersTextAlign,
121 /// Alignment of button text when the button is larger than its text.
122 ButtonTextAlign,
123 /// Alignment of selectable text when the selectable is larger than its text.
124 SelectableTextAlign,
125 /// Alignment of text within a separator.
126 SeparatorTextAlign,
127 /// Padding around text in a separator.
128 SeparatorTextPadding,
129}
130
131impl StyleVarVec2 {
132 pub(crate) const fn raw(self) -> i32 {
133 match self {
134 Self::WindowPadding => crate::sys::ImGuiStyleVar_WindowPadding as i32,
135 Self::WindowMinSize => crate::sys::ImGuiStyleVar_WindowMinSize as i32,
136 Self::WindowTitleAlign => crate::sys::ImGuiStyleVar_WindowTitleAlign as i32,
137 Self::FramePadding => crate::sys::ImGuiStyleVar_FramePadding as i32,
138 Self::ItemSpacing => crate::sys::ImGuiStyleVar_ItemSpacing as i32,
139 Self::ItemInnerSpacing => crate::sys::ImGuiStyleVar_ItemInnerSpacing as i32,
140 Self::CellPadding => crate::sys::ImGuiStyleVar_CellPadding as i32,
141 Self::TableAngledHeadersTextAlign => {
142 crate::sys::ImGuiStyleVar_TableAngledHeadersTextAlign as i32
143 }
144 Self::ButtonTextAlign => crate::sys::ImGuiStyleVar_ButtonTextAlign as i32,
145 Self::SelectableTextAlign => crate::sys::ImGuiStyleVar_SelectableTextAlign as i32,
146 Self::SeparatorTextAlign => crate::sys::ImGuiStyleVar_SeparatorTextAlign as i32,
147 Self::SeparatorTextPadding => crate::sys::ImGuiStyleVar_SeparatorTextPadding as i32,
148 }
149 }
150}