dear_imgui/
style.rs

1#![allow(
2    clippy::cast_possible_truncation,
3    clippy::cast_sign_loss,
4    clippy::as_conversions
5)]
6use crate::internal::RawWrapper;
7use crate::sys;
8use crate::utils::HoveredFlags;
9use crate::widget::TreeNodeFlags;
10
11/// User interface style/colors
12///
13/// Note: This is a transparent wrapper over `sys::ImGuiStyle` (v1.92+ layout).
14/// Do not assume field layout here; use accessors or `raw()/raw_mut()` if needed.
15#[repr(transparent)]
16#[derive(Debug, Copy, Clone, PartialEq)]
17pub struct Style(pub(crate) sys::ImGuiStyle);
18
19impl Style {
20    /// Get a color by style color identifier
21    pub fn color(&self, color: StyleColor) -> [f32; 4] {
22        let c = self.0.Colors[color as usize];
23        [c.x, c.y, c.z, c.w]
24    }
25
26    /// Set a color by style color identifier
27    pub fn set_color(&mut self, color: StyleColor, value: [f32; 4]) {
28        self.0.Colors[color as usize] = sys::ImVec4 {
29            x: value[0],
30            y: value[1],
31            z: value[2],
32            w: value[3],
33        };
34    }
35
36    /// Get main font scale (formerly io.FontGlobalScale)
37    pub fn font_scale_main(&self) -> f32 {
38        self.0.FontScaleMain
39    }
40
41    /// Set main font scale (formerly io.FontGlobalScale)
42    pub fn set_font_scale_main(&mut self, scale: f32) {
43        self.0.FontScaleMain = scale;
44    }
45
46    /// Get DPI font scale (auto-overwritten if ConfigDpiScaleFonts=true)
47    pub fn font_scale_dpi(&self) -> f32 {
48        self.0.FontScaleDpi
49    }
50
51    /// Set DPI font scale
52    pub fn set_font_scale_dpi(&mut self, scale: f32) {
53        self.0.FontScaleDpi = scale;
54    }
55
56    /// Base size used by style for font sizing
57    pub fn font_size_base(&self) -> f32 {
58        self.0.FontSizeBase
59    }
60
61    pub fn set_font_size_base(&mut self, sz: f32) {
62        self.0.FontSizeBase = sz;
63    }
64
65    // Common style accessors (typed, convenient)
66
67    pub fn alpha(&self) -> f32 {
68        self.0.Alpha
69    }
70    pub fn set_alpha(&mut self, v: f32) {
71        self.0.Alpha = v;
72    }
73
74    pub fn disabled_alpha(&self) -> f32 {
75        self.0.DisabledAlpha
76    }
77    pub fn set_disabled_alpha(&mut self, v: f32) {
78        self.0.DisabledAlpha = v;
79    }
80
81    pub fn window_padding(&self) -> [f32; 2] {
82        [self.0.WindowPadding.x, self.0.WindowPadding.y]
83    }
84    pub fn set_window_padding(&mut self, v: [f32; 2]) {
85        self.0.WindowPadding = sys::ImVec2 { x: v[0], y: v[1] };
86    }
87
88    pub fn window_rounding(&self) -> f32 {
89        self.0.WindowRounding
90    }
91    pub fn set_window_rounding(&mut self, v: f32) {
92        self.0.WindowRounding = v;
93    }
94
95    pub fn window_border_size(&self) -> f32 {
96        self.0.WindowBorderSize
97    }
98    pub fn set_window_border_size(&mut self, v: f32) {
99        self.0.WindowBorderSize = v;
100    }
101
102    pub fn window_min_size(&self) -> [f32; 2] {
103        [self.0.WindowMinSize.x, self.0.WindowMinSize.y]
104    }
105    pub fn set_window_min_size(&mut self, v: [f32; 2]) {
106        self.0.WindowMinSize = sys::ImVec2 { x: v[0], y: v[1] };
107    }
108
109    pub fn window_title_align(&self) -> [f32; 2] {
110        [self.0.WindowTitleAlign.x, self.0.WindowTitleAlign.y]
111    }
112    pub fn set_window_title_align(&mut self, v: [f32; 2]) {
113        self.0.WindowTitleAlign = sys::ImVec2 { x: v[0], y: v[1] };
114    }
115
116    pub fn window_menu_button_position(&self) -> Direction {
117        Direction::from(self.0.WindowMenuButtonPosition)
118    }
119    pub fn set_window_menu_button_position(&mut self, d: Direction) {
120        self.0.WindowMenuButtonPosition = d.into();
121    }
122
123    pub fn child_rounding(&self) -> f32 {
124        self.0.ChildRounding
125    }
126    pub fn set_child_rounding(&mut self, v: f32) {
127        self.0.ChildRounding = v;
128    }
129
130    pub fn child_border_size(&self) -> f32 {
131        self.0.ChildBorderSize
132    }
133    pub fn set_child_border_size(&mut self, v: f32) {
134        self.0.ChildBorderSize = v;
135    }
136
137    pub fn popup_rounding(&self) -> f32 {
138        self.0.PopupRounding
139    }
140    pub fn set_popup_rounding(&mut self, v: f32) {
141        self.0.PopupRounding = v;
142    }
143
144    pub fn popup_border_size(&self) -> f32 {
145        self.0.PopupBorderSize
146    }
147    pub fn set_popup_border_size(&mut self, v: f32) {
148        self.0.PopupBorderSize = v;
149    }
150
151    pub fn frame_padding(&self) -> [f32; 2] {
152        [self.0.FramePadding.x, self.0.FramePadding.y]
153    }
154    pub fn set_frame_padding(&mut self, v: [f32; 2]) {
155        self.0.FramePadding = sys::ImVec2 { x: v[0], y: v[1] };
156    }
157
158    pub fn frame_rounding(&self) -> f32 {
159        self.0.FrameRounding
160    }
161    pub fn set_frame_rounding(&mut self, v: f32) {
162        self.0.FrameRounding = v;
163    }
164
165    pub fn frame_border_size(&self) -> f32 {
166        self.0.FrameBorderSize
167    }
168    pub fn set_frame_border_size(&mut self, v: f32) {
169        self.0.FrameBorderSize = v;
170    }
171
172    pub fn item_spacing(&self) -> [f32; 2] {
173        [self.0.ItemSpacing.x, self.0.ItemSpacing.y]
174    }
175    pub fn set_item_spacing(&mut self, v: [f32; 2]) {
176        self.0.ItemSpacing = sys::ImVec2 { x: v[0], y: v[1] };
177    }
178
179    pub fn item_inner_spacing(&self) -> [f32; 2] {
180        [self.0.ItemInnerSpacing.x, self.0.ItemInnerSpacing.y]
181    }
182    pub fn set_item_inner_spacing(&mut self, v: [f32; 2]) {
183        self.0.ItemInnerSpacing = sys::ImVec2 { x: v[0], y: v[1] };
184    }
185
186    pub fn cell_padding(&self) -> [f32; 2] {
187        [self.0.CellPadding.x, self.0.CellPadding.y]
188    }
189    pub fn set_cell_padding(&mut self, v: [f32; 2]) {
190        self.0.CellPadding = sys::ImVec2 { x: v[0], y: v[1] };
191    }
192
193    pub fn touch_extra_padding(&self) -> [f32; 2] {
194        [self.0.TouchExtraPadding.x, self.0.TouchExtraPadding.y]
195    }
196    pub fn set_touch_extra_padding(&mut self, v: [f32; 2]) {
197        self.0.TouchExtraPadding = sys::ImVec2 { x: v[0], y: v[1] };
198    }
199
200    pub fn indent_spacing(&self) -> f32 {
201        self.0.IndentSpacing
202    }
203    pub fn set_indent_spacing(&mut self, v: f32) {
204        self.0.IndentSpacing = v;
205    }
206
207    pub fn columns_min_spacing(&self) -> f32 {
208        self.0.ColumnsMinSpacing
209    }
210    pub fn set_columns_min_spacing(&mut self, v: f32) {
211        self.0.ColumnsMinSpacing = v;
212    }
213
214    pub fn scrollbar_size(&self) -> f32 {
215        self.0.ScrollbarSize
216    }
217    pub fn set_scrollbar_size(&mut self, v: f32) {
218        self.0.ScrollbarSize = v;
219    }
220
221    pub fn scrollbar_rounding(&self) -> f32 {
222        self.0.ScrollbarRounding
223    }
224    pub fn set_scrollbar_rounding(&mut self, v: f32) {
225        self.0.ScrollbarRounding = v;
226    }
227
228    pub fn grab_min_size(&self) -> f32 {
229        self.0.GrabMinSize
230    }
231    pub fn set_grab_min_size(&mut self, v: f32) {
232        self.0.GrabMinSize = v;
233    }
234
235    pub fn grab_rounding(&self) -> f32 {
236        self.0.GrabRounding
237    }
238    pub fn set_grab_rounding(&mut self, v: f32) {
239        self.0.GrabRounding = v;
240    }
241
242    pub fn log_slider_deadzone(&self) -> f32 {
243        self.0.LogSliderDeadzone
244    }
245    pub fn set_log_slider_deadzone(&mut self, v: f32) {
246        self.0.LogSliderDeadzone = v;
247    }
248
249    pub fn tab_rounding(&self) -> f32 {
250        self.0.TabRounding
251    }
252    pub fn set_tab_rounding(&mut self, v: f32) {
253        self.0.TabRounding = v;
254    }
255
256    pub fn tab_border_size(&self) -> f32 {
257        self.0.TabBorderSize
258    }
259    pub fn set_tab_border_size(&mut self, v: f32) {
260        self.0.TabBorderSize = v;
261    }
262
263    pub fn color_button_position(&self) -> Direction {
264        Direction::from(self.0.ColorButtonPosition)
265    }
266    pub fn set_color_button_position(&mut self, d: Direction) {
267        self.0.ColorButtonPosition = d.into();
268    }
269
270    pub fn button_text_align(&self) -> [f32; 2] {
271        [self.0.ButtonTextAlign.x, self.0.ButtonTextAlign.y]
272    }
273    pub fn set_button_text_align(&mut self, v: [f32; 2]) {
274        self.0.ButtonTextAlign = sys::ImVec2 { x: v[0], y: v[1] };
275    }
276
277    pub fn selectable_text_align(&self) -> [f32; 2] {
278        [self.0.SelectableTextAlign.x, self.0.SelectableTextAlign.y]
279    }
280    pub fn set_selectable_text_align(&mut self, v: [f32; 2]) {
281        self.0.SelectableTextAlign = sys::ImVec2 { x: v[0], y: v[1] };
282    }
283
284    pub fn display_window_padding(&self) -> [f32; 2] {
285        [self.0.DisplayWindowPadding.x, self.0.DisplayWindowPadding.y]
286    }
287    pub fn set_display_window_padding(&mut self, v: [f32; 2]) {
288        self.0.DisplayWindowPadding = sys::ImVec2 { x: v[0], y: v[1] };
289    }
290
291    pub fn display_safe_area_padding(&self) -> [f32; 2] {
292        [
293            self.0.DisplaySafeAreaPadding.x,
294            self.0.DisplaySafeAreaPadding.y,
295        ]
296    }
297    pub fn set_display_safe_area_padding(&mut self, v: [f32; 2]) {
298        self.0.DisplaySafeAreaPadding = sys::ImVec2 { x: v[0], y: v[1] };
299    }
300
301    pub fn mouse_cursor_scale(&self) -> f32 {
302        self.0.MouseCursorScale
303    }
304    pub fn set_mouse_cursor_scale(&mut self, v: f32) {
305        self.0.MouseCursorScale = v;
306    }
307
308    pub fn anti_aliased_lines(&self) -> bool {
309        self.0.AntiAliasedLines
310    }
311    pub fn set_anti_aliased_lines(&mut self, v: bool) {
312        self.0.AntiAliasedLines = v;
313    }
314
315    pub fn anti_aliased_lines_use_tex(&self) -> bool {
316        self.0.AntiAliasedLinesUseTex
317    }
318    pub fn set_anti_aliased_lines_use_tex(&mut self, v: bool) {
319        self.0.AntiAliasedLinesUseTex = v;
320    }
321
322    pub fn anti_aliased_fill(&self) -> bool {
323        self.0.AntiAliasedFill
324    }
325    pub fn set_anti_aliased_fill(&mut self, v: bool) {
326        self.0.AntiAliasedFill = v;
327    }
328
329    pub fn curve_tessellation_tol(&self) -> f32 {
330        self.0.CurveTessellationTol
331    }
332    pub fn set_curve_tessellation_tol(&mut self, v: f32) {
333        self.0.CurveTessellationTol = v;
334    }
335
336    pub fn circle_tessellation_max_error(&self) -> f32 {
337        self.0.CircleTessellationMaxError
338    }
339    pub fn set_circle_tessellation_max_error(&mut self, v: f32) {
340        self.0.CircleTessellationMaxError = v;
341    }
342
343    // Newly exposed 1.92+ or less-common fields
344
345    pub fn window_border_hover_padding(&self) -> f32 {
346        self.0.WindowBorderHoverPadding
347    }
348    pub fn set_window_border_hover_padding(&mut self, v: f32) {
349        self.0.WindowBorderHoverPadding = v;
350    }
351
352    pub fn scrollbar_padding(&self) -> f32 {
353        self.0.ScrollbarPadding
354    }
355    pub fn set_scrollbar_padding(&mut self, v: f32) {
356        self.0.ScrollbarPadding = v;
357    }
358
359    pub fn image_border_size(&self) -> f32 {
360        self.0.ImageBorderSize
361    }
362    pub fn set_image_border_size(&mut self, v: f32) {
363        self.0.ImageBorderSize = v;
364    }
365
366    pub fn tab_min_width_base(&self) -> f32 {
367        self.0.TabMinWidthBase
368    }
369    pub fn set_tab_min_width_base(&mut self, v: f32) {
370        self.0.TabMinWidthBase = v;
371    }
372
373    pub fn tab_min_width_shrink(&self) -> f32 {
374        self.0.TabMinWidthShrink
375    }
376    pub fn set_tab_min_width_shrink(&mut self, v: f32) {
377        self.0.TabMinWidthShrink = v;
378    }
379
380    pub fn tab_close_button_min_width_selected(&self) -> f32 {
381        self.0.TabCloseButtonMinWidthSelected
382    }
383    pub fn set_tab_close_button_min_width_selected(&mut self, v: f32) {
384        self.0.TabCloseButtonMinWidthSelected = v;
385    }
386
387    pub fn tab_close_button_min_width_unselected(&self) -> f32 {
388        self.0.TabCloseButtonMinWidthUnselected
389    }
390    pub fn set_tab_close_button_min_width_unselected(&mut self, v: f32) {
391        self.0.TabCloseButtonMinWidthUnselected = v;
392    }
393
394    pub fn tab_bar_border_size(&self) -> f32 {
395        self.0.TabBarBorderSize
396    }
397    pub fn set_tab_bar_border_size(&mut self, v: f32) {
398        self.0.TabBarBorderSize = v;
399    }
400
401    pub fn tab_bar_overline_size(&self) -> f32 {
402        self.0.TabBarOverlineSize
403    }
404    pub fn set_tab_bar_overline_size(&mut self, v: f32) {
405        self.0.TabBarOverlineSize = v;
406    }
407
408    pub fn table_angled_headers_angle(&self) -> f32 {
409        self.0.TableAngledHeadersAngle
410    }
411    pub fn set_table_angled_headers_angle(&mut self, v: f32) {
412        self.0.TableAngledHeadersAngle = v;
413    }
414
415    pub fn table_angled_headers_text_align(&self) -> [f32; 2] {
416        [
417            self.0.TableAngledHeadersTextAlign.x,
418            self.0.TableAngledHeadersTextAlign.y,
419        ]
420    }
421    pub fn set_table_angled_headers_text_align(&mut self, v: [f32; 2]) {
422        self.0.TableAngledHeadersTextAlign = sys::ImVec2 { x: v[0], y: v[1] };
423    }
424
425    pub fn tree_lines_flags(&self) -> TreeNodeFlags {
426        TreeNodeFlags::from_bits_truncate(self.0.TreeLinesFlags as i32)
427    }
428    pub fn set_tree_lines_flags(&mut self, flags: TreeNodeFlags) {
429        self.0.TreeLinesFlags = flags.bits() as sys::ImGuiTreeNodeFlags;
430    }
431
432    pub fn tree_lines_size(&self) -> f32 {
433        self.0.TreeLinesSize
434    }
435    pub fn set_tree_lines_size(&mut self, v: f32) {
436        self.0.TreeLinesSize = v;
437    }
438
439    pub fn tree_lines_rounding(&self) -> f32 {
440        self.0.TreeLinesRounding
441    }
442    pub fn set_tree_lines_rounding(&mut self, v: f32) {
443        self.0.TreeLinesRounding = v;
444    }
445
446    pub fn separator_text_border_size(&self) -> f32 {
447        self.0.SeparatorTextBorderSize
448    }
449    pub fn set_separator_text_border_size(&mut self, v: f32) {
450        self.0.SeparatorTextBorderSize = v;
451    }
452
453    pub fn separator_text_align(&self) -> [f32; 2] {
454        [self.0.SeparatorTextAlign.x, self.0.SeparatorTextAlign.y]
455    }
456    pub fn set_separator_text_align(&mut self, v: [f32; 2]) {
457        self.0.SeparatorTextAlign = sys::ImVec2 { x: v[0], y: v[1] };
458    }
459
460    pub fn separator_text_padding(&self) -> [f32; 2] {
461        [self.0.SeparatorTextPadding.x, self.0.SeparatorTextPadding.y]
462    }
463    pub fn set_separator_text_padding(&mut self, v: [f32; 2]) {
464        self.0.SeparatorTextPadding = sys::ImVec2 { x: v[0], y: v[1] };
465    }
466
467    pub fn docking_node_has_close_button(&self) -> bool {
468        self.0.DockingNodeHasCloseButton
469    }
470    pub fn set_docking_node_has_close_button(&mut self, v: bool) {
471        self.0.DockingNodeHasCloseButton = v;
472    }
473
474    pub fn docking_separator_size(&self) -> f32 {
475        self.0.DockingSeparatorSize
476    }
477    pub fn set_docking_separator_size(&mut self, v: f32) {
478        self.0.DockingSeparatorSize = v;
479    }
480
481    pub fn hover_stationary_delay(&self) -> f32 {
482        self.0.HoverStationaryDelay
483    }
484    pub fn set_hover_stationary_delay(&mut self, v: f32) {
485        self.0.HoverStationaryDelay = v;
486    }
487
488    pub fn hover_delay_short(&self) -> f32 {
489        self.0.HoverDelayShort
490    }
491    pub fn set_hover_delay_short(&mut self, v: f32) {
492        self.0.HoverDelayShort = v;
493    }
494
495    pub fn hover_delay_normal(&self) -> f32 {
496        self.0.HoverDelayNormal
497    }
498    pub fn set_hover_delay_normal(&mut self, v: f32) {
499        self.0.HoverDelayNormal = v;
500    }
501
502    pub fn hover_flags_for_tooltip_mouse(&self) -> HoveredFlags {
503        HoveredFlags::from_bits_truncate(self.0.HoverFlagsForTooltipMouse as i32)
504    }
505    pub fn set_hover_flags_for_tooltip_mouse(&mut self, flags: HoveredFlags) {
506        self.0.HoverFlagsForTooltipMouse = flags.bits() as sys::ImGuiHoveredFlags;
507    }
508
509    pub fn hover_flags_for_tooltip_nav(&self) -> HoveredFlags {
510        HoveredFlags::from_bits_truncate(self.0.HoverFlagsForTooltipNav as i32)
511    }
512    pub fn set_hover_flags_for_tooltip_nav(&mut self, flags: HoveredFlags) {
513        self.0.HoverFlagsForTooltipNav = flags.bits() as sys::ImGuiHoveredFlags;
514    }
515}
516
517// HoveredFlags are defined in utils.rs and re-exported at crate root.
518
519/// A cardinal direction
520#[repr(i32)]
521#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
522pub enum Direction {
523    None = sys::ImGuiDir_None as i32,
524    Left = sys::ImGuiDir_Left as i32,
525    Right = sys::ImGuiDir_Right as i32,
526    Up = sys::ImGuiDir_Up as i32,
527    Down = sys::ImGuiDir_Down as i32,
528}
529
530impl From<sys::ImGuiDir> for Direction {
531    fn from(d: sys::ImGuiDir) -> Self {
532        match d as i32 {
533            x if x == sys::ImGuiDir_Left as i32 => Direction::Left,
534            x if x == sys::ImGuiDir_Right as i32 => Direction::Right,
535            x if x == sys::ImGuiDir_Up as i32 => Direction::Up,
536            x if x == sys::ImGuiDir_Down as i32 => Direction::Down,
537            _ => Direction::None,
538        }
539    }
540}
541
542impl From<Direction> for sys::ImGuiDir {
543    fn from(d: Direction) -> Self {
544        match d {
545            Direction::None => sys::ImGuiDir_None,
546            Direction::Left => sys::ImGuiDir_Left,
547            Direction::Right => sys::ImGuiDir_Right,
548            Direction::Up => sys::ImGuiDir_Up,
549            Direction::Down => sys::ImGuiDir_Down,
550        }
551    }
552}
553
554/// Style color identifier
555#[repr(i32)]
556#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
557pub enum StyleColor {
558    Text = sys::ImGuiCol_Text as i32,
559    TextDisabled = sys::ImGuiCol_TextDisabled as i32,
560    WindowBg = sys::ImGuiCol_WindowBg as i32,
561    ChildBg = sys::ImGuiCol_ChildBg as i32,
562    PopupBg = sys::ImGuiCol_PopupBg as i32,
563    Border = sys::ImGuiCol_Border as i32,
564    BorderShadow = sys::ImGuiCol_BorderShadow as i32,
565    FrameBg = sys::ImGuiCol_FrameBg as i32,
566    FrameBgHovered = sys::ImGuiCol_FrameBgHovered as i32,
567    FrameBgActive = sys::ImGuiCol_FrameBgActive as i32,
568    TitleBg = sys::ImGuiCol_TitleBg as i32,
569    TitleBgActive = sys::ImGuiCol_TitleBgActive as i32,
570    TitleBgCollapsed = sys::ImGuiCol_TitleBgCollapsed as i32,
571    MenuBarBg = sys::ImGuiCol_MenuBarBg as i32,
572    ScrollbarBg = sys::ImGuiCol_ScrollbarBg as i32,
573    ScrollbarGrab = sys::ImGuiCol_ScrollbarGrab as i32,
574    ScrollbarGrabHovered = sys::ImGuiCol_ScrollbarGrabHovered as i32,
575    ScrollbarGrabActive = sys::ImGuiCol_ScrollbarGrabActive as i32,
576    CheckMark = sys::ImGuiCol_CheckMark as i32,
577    SliderGrab = sys::ImGuiCol_SliderGrab as i32,
578    SliderGrabActive = sys::ImGuiCol_SliderGrabActive as i32,
579    Button = sys::ImGuiCol_Button as i32,
580    ButtonHovered = sys::ImGuiCol_ButtonHovered as i32,
581    ButtonActive = sys::ImGuiCol_ButtonActive as i32,
582    Header = sys::ImGuiCol_Header as i32,
583    HeaderHovered = sys::ImGuiCol_HeaderHovered as i32,
584    HeaderActive = sys::ImGuiCol_HeaderActive as i32,
585    Separator = sys::ImGuiCol_Separator as i32,
586    SeparatorHovered = sys::ImGuiCol_SeparatorHovered as i32,
587    SeparatorActive = sys::ImGuiCol_SeparatorActive as i32,
588    ResizeGrip = sys::ImGuiCol_ResizeGrip as i32,
589    ResizeGripHovered = sys::ImGuiCol_ResizeGripHovered as i32,
590    ResizeGripActive = sys::ImGuiCol_ResizeGripActive as i32,
591    Tab = sys::ImGuiCol_Tab as i32,
592    TabHovered = sys::ImGuiCol_TabHovered as i32,
593    // Newly added tab colors in docking branch
594    TabSelected = sys::ImGuiCol_TabSelected as i32,
595    TabSelectedOverline = sys::ImGuiCol_TabSelectedOverline as i32,
596    TabDimmed = sys::ImGuiCol_TabDimmed as i32,
597    TabDimmedSelected = sys::ImGuiCol_TabDimmedSelected as i32,
598    TabDimmedSelectedOverline = sys::ImGuiCol_TabDimmedSelectedOverline as i32,
599    DockingPreview = sys::ImGuiCol_DockingPreview as i32,
600    DockingEmptyBg = sys::ImGuiCol_DockingEmptyBg as i32,
601    PlotLines = sys::ImGuiCol_PlotLines as i32,
602    PlotLinesHovered = sys::ImGuiCol_PlotLinesHovered as i32,
603    PlotHistogram = sys::ImGuiCol_PlotHistogram as i32,
604    PlotHistogramHovered = sys::ImGuiCol_PlotHistogramHovered as i32,
605    TableHeaderBg = sys::ImGuiCol_TableHeaderBg as i32,
606    TableBorderStrong = sys::ImGuiCol_TableBorderStrong as i32,
607    TableBorderLight = sys::ImGuiCol_TableBorderLight as i32,
608    TableRowBg = sys::ImGuiCol_TableRowBg as i32,
609    TableRowBgAlt = sys::ImGuiCol_TableRowBgAlt as i32,
610    TextSelectedBg = sys::ImGuiCol_TextSelectedBg as i32,
611    TextLink = sys::ImGuiCol_TextLink as i32,
612    TreeLines = sys::ImGuiCol_TreeLines as i32,
613    InputTextCursor = sys::ImGuiCol_InputTextCursor as i32,
614    DragDropTarget = sys::ImGuiCol_DragDropTarget as i32,
615    NavCursor = sys::ImGuiCol_NavCursor as i32,
616    NavWindowingHighlight = sys::ImGuiCol_NavWindowingHighlight as i32,
617    NavWindowingDimBg = sys::ImGuiCol_NavWindowingDimBg as i32,
618    ModalWindowDimBg = sys::ImGuiCol_ModalWindowDimBg as i32,
619}
620
621impl StyleColor {
622    pub const COUNT: usize = sys::ImGuiCol_COUNT as usize;
623}
624
625impl RawWrapper for Style {
626    type Raw = sys::ImGuiStyle;
627
628    unsafe fn raw(&self) -> &Self::Raw {
629        &self.0
630    }
631
632    unsafe fn raw_mut(&mut self) -> &mut Self::Raw {
633        &mut self.0
634    }
635}
636
637/// A temporary change in user interface style
638#[derive(Copy, Clone, Debug, PartialEq)]
639#[non_exhaustive]
640pub enum StyleVar {
641    /// Global alpha applies to everything
642    Alpha(f32),
643    /// Additional alpha multiplier applied to disabled elements
644    DisabledAlpha(f32),
645    /// Padding within a window
646    WindowPadding([f32; 2]),
647    /// Rounding radius of window corners
648    WindowRounding(f32),
649    /// Thickness of border around windows
650    WindowBorderSize(f32),
651    /// Minimum window size
652    WindowMinSize([f32; 2]),
653    /// Alignment for title bar text
654    WindowTitleAlign([f32; 2]),
655    /// Rounding radius of child window corners
656    ChildRounding(f32),
657    /// Thickness of border around child windows
658    ChildBorderSize(f32),
659    /// Rounding radius of popup window corners
660    PopupRounding(f32),
661    /// Thickness of border around popup/tooltip windows
662    PopupBorderSize(f32),
663    /// Padding within a framed rectangle (used by most widgets)
664    FramePadding([f32; 2]),
665    /// Rounding radius of frame corners (used by most widgets)
666    FrameRounding(f32),
667    /// Thickness of border around frames
668    FrameBorderSize(f32),
669    /// Horizontal and vertical spacing between widgets/lines
670    ItemSpacing([f32; 2]),
671    /// Horizontal and vertical spacing between within elements of a composed widget
672    ItemInnerSpacing([f32; 2]),
673    /// Horizontal indentation when e.g. entering a tree node
674    IndentSpacing(f32),
675    /// Padding within a table cell
676    CellPadding([f32; 2]),
677    /// Width of the vertical scrollbar, height of the horizontal scrollbar
678    ScrollbarSize(f32),
679    /// Rounding radius of scrollbar corners
680    ScrollbarRounding(f32),
681    /// Minimum width/height of a grab box for slider/scrollbar
682    GrabMinSize(f32),
683    /// Rounding radius of grabs corners
684    GrabRounding(f32),
685    /// Rounding radius of upper corners of tabs
686    TabRounding(f32),
687    /// Alignment of button text when button is larger than text
688    ButtonTextAlign([f32; 2]),
689    /// Alignment of selectable text when selectable is larger than text
690    SelectableTextAlign([f32; 2]),
691}