forked from inkyblackness/imgui-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStyle.go
142 lines (132 loc) · 4.19 KB
/
Style.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package imgui
// #include "StyleWrapper.h"
import "C"
// StyleVarID identifies a style variable in the UI style.
type StyleVarID int
const (
// StyleVarAlpha is a float
StyleVarAlpha StyleVarID = iota
// StyleVarWindowPadding is a Vec2
StyleVarWindowPadding
// StyleVarWindowRounding is a float
StyleVarWindowRounding
// StyleVarWindowBorderSize is a float
StyleVarWindowBorderSize
// StyleVarWindowMinSize is a Vec2
StyleVarWindowMinSize
// StyleVarWindowTitleAlign is a Vec2
StyleVarWindowTitleAlign
// StyleVarChildRounding is a float
StyleVarChildRounding
// StyleVarChildBorderSize is a float
StyleVarChildBorderSize
// StyleVarPopupRounding is a float
StyleVarPopupRounding
// StyleVarPopupBorderSize is a float
StyleVarPopupBorderSize
// StyleVarFramePadding is a Vec2
StyleVarFramePadding
// StyleVarFrameRounding is a float
StyleVarFrameRounding
// StyleVarFrameBorderSize is a float
StyleVarFrameBorderSize
// StyleVarItemSpacing is a Vec2
StyleVarItemSpacing
// StyleVarItemInnerSpacing is a Vec2
StyleVarItemInnerSpacing
// StyleVarIndentSpacing is a float
StyleVarIndentSpacing
// StyleVarScrollbarSize is a float
StyleVarScrollbarSize
// StyleVarScrollbarRounding is a float
StyleVarScrollbarRounding
// StyleVarGrabMinSize is a float
StyleVarGrabMinSize
// StyleVarGrabRounding is a float
StyleVarGrabRounding
// StyleVarTabRounding is a float
StyleVarTabRounding
// StyleVarButtonTextAlign is a Vec2
StyleVarButtonTextAlign
)
// StyleColorID identifies a color in the UI style.
type StyleColorID int
// StyleColor identifier
const (
StyleColorText StyleColorID = iota
StyleColorTextDisabled
StyleColorWindowBg
StyleColorChildBg
StyleColorPopupBg
StyleColorBorder
StyleColorBorderShadow
StyleColorFrameBg
StyleColorFrameBgHovered
StyleColorFrameBgActive
StyleColorTitleBg
StyleColorTitleBgActive
StyleColorTitleBgCollapsed
StyleColorMenuBarBg
StyleColorScrollbarBg
StyleColorScrollbarGrab
StyleColorScrollbarGrabHovered
StyleColorScrollbarGrabActive
StyleColorCheckMark
StyleColorSliderGrab
StyleColorSliderGrabActive
StyleColorButton
StyleColorButtonHovered
StyleColorButtonActive
StyleColorHeader
StyleColorHeaderHovered
StyleColorHeaderActive
StyleColorSeparator
StyleColorSeparatorHovered
StyleColorSeparatorActive
StyleColorResizeGrip
StyleColorResizeGripHovered
StyleColorResizeGripActive
StyleColorTab
StyleColorTabHovered
StyleColorTabActive
StyleColorTabUnfocused
StyleColorTabUnfocusedActive
StyleColorPlotLines
StyleColorPlotLinesHovered
StyleColorPlotHistogram
StyleColorPlotHistogramHovered
StyleColorTextSelectedBg
StyleColorDragDropTarget
StyleColorNavHighlight // Gamepad/keyboard: current highlighted item
StyleColorNavWindowingHighlight // Highlight window when using CTRL+TAB
StyleColorNavWindowingDarkening // Darken/colorize entire screen behind the CTRL+TAB window list, when active
StyleColorModalWindowDarkening // Darken/colorize entire screen behind a modal window, when one is active
)
// Style describes the overall graphical representation of the user interface.
type Style uintptr
func (style Style) handle() C.IggGuiStyle {
return C.IggGuiStyle(style)
}
// ItemInnerSpacing is the horizontal and vertical spacing between elements of
// a composed widget (e.g. a slider and its label).
func (style Style) ItemInnerSpacing() Vec2 {
var value Vec2
valueArg, valueFin := value.wrapped()
C.iggStyleGetItemInnerSpacing(style.handle(), valueArg)
valueFin()
return value
}
// SetColor sets a color value of the UI style.
func (style Style) SetColor(id StyleColorID, value Vec4) {
valueArg, _ := value.wrapped()
C.iggStyleSetColor(style.handle(), C.int(id), valueArg)
}
// ScaleAllSizes applies a scaling factor to all sizes.
// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function.
// Scaling the fonts is done separately and is up to you.
//
// Important: This operation is lossy because all sizes are rounded to integer.
// If you need to change your scale multiples, call this over a freshly initialized style rather than scaling multiple times.
func (style Style) ScaleAllSizes(scale float32) {
C.iggStyleScaleAllSizes(style.handle(), C.float(scale))
}