1 /*
2  * Copyright (c) 2016 Derelict Developers
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  *   notice, this list of conditions and the following disclaimer in the
14  *   documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the names 'Derelict', 'DerelictLibui', nor the names of its contributors
17  *   may be used to endorse or promote products derived from this software
18  *   without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 module derelict.libui.types;
33 
34 align(1):
35 
36 alias cstring = const(char)*;
37 
38 alias uintptr_t = uint*;
39 alias uint32_t = uint;
40 
41 alias uintmax_t = size_t;
42 alias intmax_t = ptrdiff_t;
43 
44 struct uiInitOptions {
45     size_t Size;
46 }
47 
48 struct uiWindow {}
49 struct uiControl {}
50 struct uiColorButton {}
51 struct uiMenu {}
52 struct uiMenuItem {}
53 struct uiButton {}
54 struct uiBox {}
55 struct uiEntry {}
56 struct uiCheckbox {}
57 struct uiLabel {}
58 struct uiTab {}
59 struct uiGroup {}
60 struct uiSpinbox {}
61 struct uiProgressBar {}
62 struct uiSlider {}
63 struct uiSeparator {}
64 struct uiCombobox {}
65 struct uiRadioButtons {}
66 struct uiDateTimePicker {}
67 struct uiMultilineEntry {}
68 
69 struct uiArea {}
70 struct uiAreaHandler {}
71 struct uiAreaDrawParams {}
72 struct uiAreaMouseEvent {}
73 struct uiAreaKeyEvent {}
74 
75 struct uiDrawContext {}
76 struct uiDrawPath {}
77 struct uiDrawBrush {}
78 struct uiDrawStrokeParams {}
79 struct uiDrawMatrix {}
80 struct uiDrawBrushGradientStop {}
81 struct uiDrawFontFamilies {}
82 struct uiDrawTextLayout {}
83 struct uiDrawTextFont {}
84 struct uiDrawTextFontDescriptor {}
85 struct uiDrawTextFontMetrics {}
86 struct uiFontButton {}
87 
88 alias uiDrawBrushType = int;
89 enum {
90     uiDrawBrushTypeSolid,
91     uiDrawBrushTypeLinearGradient,
92     uiDrawBrushTypeRadialGradient,
93     uiDrawBrushTypeImage,
94 }
95 
96 alias uiDrawLineCap = int;
97 enum {
98     uiDrawLineCapFlat,
99     uiDrawLineCapRound,
100     uiDrawLineCapSquare,
101 }
102 
103 alias uiDrawLineJoin = int;
104 enum {
105     uiDrawLineJoinMiter,
106     uiDrawLineJoinRound,
107     uiDrawLineJoinBevel,
108 }
109 
110 alias uiDrawFillMode = int;
111 enum {
112     uiDrawFillModeWinding,
113     uiDrawFillModeAlternate,
114 }
115 
116 alias uiDrawTextWeight = int;
117 enum {
118     uiDrawTextWeightThin,
119     uiDrawTextWeightUltraLight,
120     uiDrawTextWeightLight,
121     uiDrawTextWeightBook,
122     uiDrawTextWeightNormal,
123     uiDrawTextWeightMedium,
124     uiDrawTextWeightSemiBold,
125     uiDrawTextWeightBold,
126     uiDrawTextWeightUtraBold,
127     uiDrawTextWeightHeavy,
128     uiDrawTextWeightUltraHeavy,
129 }
130 
131 alias uiDrawTextItalic = int;
132 enum {
133     uiDrawTextItalicNormal,
134     uiDrawTextItalicOblique,
135     uiDrawTextItalicItalic,
136 }
137 
138 alias uiDrawTextStretch = int;
139 enum {
140     uiDrawTextStretchUltraCondensed,
141     uiDrawTextStretchExtraCondensed,
142     uiDrawTextStretchCondensed,
143     uiDrawTextStretchSemiCondensed,
144     uiDrawTextStretchNormal,
145     uiDrawTextStretchSemiExpanded,
146     uiDrawTextStretchExpanded,
147     uiDrawTextStretchExtraExpanded,
148     uiDrawTextStretchUltraExpanded,
149 }
150 
151 alias uiModifiers = int;
152 enum {
153     uiModifierCtrl = 1 << 0,
154     uiModifierAlt = 1 << 1,
155     uiModifierShift = 1 << 2,
156     uiModifierSuper = 1 << 3,
157 }
158 
159 alias uiExtKey = int;
160 enum {
161     uiExtKeyEscape = 1,
162     uiExtKeyInsert,         // equivalent to "Help" on Apple keyboards
163     uiExtKeyDelete,
164     uiExtKeyHome,
165     uiExtKeyEnd,
166     uiExtKeyPageUp,
167     uiExtKeyPageDown,
168     uiExtKeyUp,
169     uiExtKeyDown,
170     uiExtKeyLeft,
171     uiExtKeyRight,
172     uiExtKeyF1,         // F1..F12 are guaranteed to be consecutive
173     uiExtKeyF2,
174     uiExtKeyF3,
175     uiExtKeyF4,
176     uiExtKeyF5,
177     uiExtKeyF6,
178     uiExtKeyF7,
179     uiExtKeyF8,
180     uiExtKeyF9,
181     uiExtKeyF10,
182     uiExtKeyF11,
183     uiExtKeyF12,
184     uiExtKeyN0,         // numpad keys; independent of Num Lock state
185     uiExtKeyN1,         // N0..N9 are guaranteed to be consecutive
186     uiExtKeyN2,
187     uiExtKeyN3,
188     uiExtKeyN4,
189     uiExtKeyN5,
190     uiExtKeyN6,
191     uiExtKeyN7,
192     uiExtKeyN8,
193     uiExtKeyN9,
194     uiExtKeyNDot,
195     uiExtKeyNEnter,
196     uiExtKeyNAdd,
197     uiExtKeyNSubtract,
198     uiExtKeyNMultiply,
199     uiExtKeyNDivide,
200 }
201 
202 static immutable uiDrawDefaultMiterLimit = 10.0;