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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
/// A color identifier for styling
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ImGuiCol {
    Text,
    TextDisabled,
    /// Background of normal windows
    WindowBg,
    /// Background of child windows
    ChildBg,
    /// Background of popups, menus, tooltips windows
    PopupBg,
    Border,
    BorderShadow,
    /// Background of checkbox, radio button, plot, slider, text input
    FrameBg,
    FrameBgHovered,
    FrameBgActive,
    TitleBg,
    TitleBgActive,
    TitleBgCollapsed,
    MenuBarBg,
    ScrollbarBg,
    ScrollbarGrab,
    ScrollbarGrabHovered,
    ScrollbarGrabActive,
    CheckMark,
    SliderGrab,
    SliderGrabActive,
    Button,
    ButtonHovered,
    ButtonActive,
    Header,
    HeaderHovered,
    HeaderActive,
    Separator,
    SeparatorHovered,
    SeparatorActive,
    ResizeGrip,
    ResizeGripHovered,
    ResizeGripActive,
    PlotLines,
    PlotLinesHovered,
    PlotHistogram,
    PlotHistogramHovered,
    TextSelectedBg,
    DragDropTarget,
    /// Gamepad/keyboard: current highlighted item
    NavHighlight,
    /// Highlight window when using CTRL+TAB
    NavWindowingHighlight,
    /// Darken/colorize entire screen behind the CTRL+TAB window list, when active
    NavWindowingDimBg,
    /// Darken/colorize entire screen behind a modal window, when one is active
    ModalWindowDimBg,
}
impl ImGuiCol {
    /// All possible `ImGuiCol` variants
    pub const VARIANTS: [ImGuiCol; 43] = [
        ImGuiCol::Text,
        ImGuiCol::TextDisabled,
        ImGuiCol::WindowBg,
        ImGuiCol::ChildBg,
        ImGuiCol::PopupBg,
        ImGuiCol::Border,
        ImGuiCol::BorderShadow,
        ImGuiCol::FrameBg,
        ImGuiCol::FrameBgHovered,
        ImGuiCol::FrameBgActive,
        ImGuiCol::TitleBg,
        ImGuiCol::TitleBgActive,
        ImGuiCol::TitleBgCollapsed,
        ImGuiCol::MenuBarBg,
        ImGuiCol::ScrollbarBg,
        ImGuiCol::ScrollbarGrab,
        ImGuiCol::ScrollbarGrabHovered,
        ImGuiCol::ScrollbarGrabActive,
        ImGuiCol::CheckMark,
        ImGuiCol::SliderGrab,
        ImGuiCol::SliderGrabActive,
        ImGuiCol::Button,
        ImGuiCol::ButtonHovered,
        ImGuiCol::ButtonActive,
        ImGuiCol::Header,
        ImGuiCol::HeaderHovered,
        ImGuiCol::HeaderActive,
        ImGuiCol::Separator,
        ImGuiCol::SeparatorHovered,
        ImGuiCol::SeparatorActive,
        ImGuiCol::ResizeGrip,
        ImGuiCol::ResizeGripHovered,
        ImGuiCol::ResizeGripActive,
        ImGuiCol::PlotLines,
        ImGuiCol::PlotLinesHovered,
        ImGuiCol::PlotHistogram,
        ImGuiCol::PlotHistogramHovered,
        ImGuiCol::TextSelectedBg,
        ImGuiCol::DragDropTarget,
        ImGuiCol::NavHighlight,
        ImGuiCol::NavWindowingHighlight,
        ImGuiCol::NavWindowingDimBg,
        ImGuiCol::ModalWindowDimBg,
    ];
    pub const COUNT: usize = 43;
}

/// A primary data type
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ImGuiDataType {
    /// `i32` (C data type `int`)
    S32,
    /// `u32` (C data type `unsigned int`)
    U32,
    /// `i64` (C data type `long long`, `__int64`)
    S64,
    /// `u64` (C data type `unsigned long long`, `unsigned __int64`)
    U64,
    /// `f32` (C data type `float`)
    Float,
    /// `f64` (C data type `double`)
    Double,
}
impl ImGuiDataType {
    /// All possible `ImGuiDataType` variants
    pub const VARIANTS: [ImGuiDataType; 6] = [
        ImGuiDataType::S32,
        ImGuiDataType::U32,
        ImGuiDataType::S64,
        ImGuiDataType::U64,
        ImGuiDataType::Float,
        ImGuiDataType::Double,
    ];
}

/// A cardinal direction
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ImGuiDir {
    None = -1,
    Left = 0,
    Right,
    Up,
    Down,
}
impl ImGuiDir {
    /// All possible `ImGuiDir` variants, except None
    pub const VARIANTS: [ImGuiDir; 4] = [
        // None variant intentionally skipped
        ImGuiDir::Left,
        ImGuiDir::Right,
        ImGuiDir::Up,
        ImGuiDir::Down,
    ];
}

/// A key identifier (ImGui-side enum)
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ImGuiKey {
    Tab,
    LeftArrow,
    RightArrow,
    UpArrow,
    DownArrow,
    PageUp,
    PageDown,
    Home,
    End,
    Insert,
    Delete,
    Backspace,
    Space,
    Enter,
    Escape,
    /// for text edit CTRL+A: select all
    A,
    /// for text edit CTRL+C: copy
    C,
    /// for text edit CTRL+V: paste
    V,
    /// for text edit CTRL+X: cut
    X,
    /// for text edit CTRL+Y: redo
    Y,
    /// for text edit CTRL+Z: undo
    Z,
}
impl ImGuiKey {
    /// All possible `ImGuiKey` variants
    pub const VARIANTS: [ImGuiKey; 21] = [
        ImGuiKey::Tab,
        ImGuiKey::LeftArrow,
        ImGuiKey::RightArrow,
        ImGuiKey::UpArrow,
        ImGuiKey::DownArrow,
        ImGuiKey::PageUp,
        ImGuiKey::PageDown,
        ImGuiKey::Home,
        ImGuiKey::End,
        ImGuiKey::Insert,
        ImGuiKey::Delete,
        ImGuiKey::Backspace,
        ImGuiKey::Space,
        ImGuiKey::Enter,
        ImGuiKey::Escape,
        ImGuiKey::A,
        ImGuiKey::C,
        ImGuiKey::V,
        ImGuiKey::X,
        ImGuiKey::Y,
        ImGuiKey::Z,
    ];
    pub const COUNT: usize = 21;
}

/// A mouse cursor identifier
///
/// User code may request binding to display given cursor, which is why we have some cursors that
/// are marked unused here
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ImGuiMouseCursor {
    None = -1,
    Arrow = 0,
    /// When hovering over InputText, etc.
    TextInput,
    /// (Unused by imgui functions)
    ResizeAll,
    /// When hovering over an horizontal border
    ResizeNS,
    /// When hovering over a vertical border or a column
    ResizeEW,
    /// When hovering over the bottom-left corner of a window
    ResizeNESW,
    /// When hovering over the bottom-right corner of a window
    ResizeNWSE,
    /// (Unused by imgui functions. Use for e.g. hyperlinks)
    Hand,
}
impl ImGuiMouseCursor {
    /// All possible `ImGuiMouseCursor` variants, except None
    pub const VARIANTS: [ImGuiMouseCursor; 8] = [
        // None variant intentionally skipped
        ImGuiMouseCursor::Arrow,
        ImGuiMouseCursor::TextInput,
        ImGuiMouseCursor::ResizeAll,
        ImGuiMouseCursor::ResizeNS,
        ImGuiMouseCursor::ResizeEW,
        ImGuiMouseCursor::ResizeNESW,
        ImGuiMouseCursor::ResizeNWSE,
        ImGuiMouseCursor::Hand,
    ];
}

/// An input identifier for navigation
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ImGuiNavInput {
    /// activate / open / toggle / tweak value
    ///
    /// e.g. Cross  (PS4), A (Xbox), A (Switch), Space (Keyboard)
    Activate,
    /// cancel / close / exit
    ///
    /// e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard)
    Cancel,
    /// text input / on-screen keyboard
    ///
    /// e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)
    Input,
    /// tap: toggle menu / hold: focus, move, resize
    ///
    /// e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)
    Menu,
    /// move / tweak / resize window (w/ PadMenu)
    ///
    /// e.g. D-pad Left (Gamepads), Left arrow (Keyboard)
    DpadLeft,
    /// move / tweak / resize window (w/ PadMenu)
    ///
    /// e.g. D-pad Right (Gamepads), Right arrow (Keyboard)
    DpadRight,
    /// move / tweak / resize window (w/ PadMenu)
    ///
    /// e.g. D-pad Up (Gamepads), Up arrow (Keyboard)
    DpadUp,
    /// move / tweak / resize window (w/ PadMenu)
    ///
    /// e.g. D-pad Down (Gamepads), Down arrow (Keyboard)
    DpadDown,
    /// scroll / move window (w/ PadMenu)
    ///
    /// e.g. Left Analog Stick Left
    LStickLeft,
    /// scroll / move window (w/ PadMenu)
    ///
    /// e.g. Left Analog Stick Right
    LStickRight,
    /// scroll / move window (w/ PadMenu)
    ///
    /// e.g. Left Analog Stick Up
    LStickUp,
    /// scroll / move window (w/ PadMenu)
    ///
    /// e.g. Left Analog Stick Down
    LStickDown,
    /// next window (w/ PadMenu)
    ///
    /// e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
    FocusPrev,
    /// prev window (w/ PadMenu)
    ///
    /// e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
    FocusNext,
    /// slower tweaks
    ///
    /// e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
    TweakSlow,
    /// faster tweaks
    ///
    /// e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
    TweakFast,
}
impl ImGuiNavInput {
    /// All possible `ImGuiNavInput` variants
    pub const VARIANTS: [ImGuiNavInput; 16] = [
        ImGuiNavInput::Activate,
        ImGuiNavInput::Cancel,
        ImGuiNavInput::Input,
        ImGuiNavInput::Menu,
        ImGuiNavInput::DpadLeft,
        ImGuiNavInput::DpadRight,
        ImGuiNavInput::DpadUp,
        ImGuiNavInput::DpadDown,
        ImGuiNavInput::LStickLeft,
        ImGuiNavInput::LStickRight,
        ImGuiNavInput::LStickUp,
        ImGuiNavInput::LStickDown,
        ImGuiNavInput::FocusPrev,
        ImGuiNavInput::FocusNext,
        ImGuiNavInput::TweakSlow,
        ImGuiNavInput::TweakFast,
    ];
    pub const COUNT: usize = 16;
    pub(crate) const COUNT_INTERNAL: usize = 21;
}

/// A variable identifier for styling
#[repr(C)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ImGuiStyleVar {
    Alpha,
    WindowPadding,
    WindowRounding,
    WindowBorderSize,
    WindowMinSize,
    WindowTitleAlign,
    ChildRounding,
    ChildBorderSize,
    PopupRounding,
    PopupBorderSize,
    FramePadding,
    FrameRounding,
    FrameBorderSize,
    ItemSpacing,
    ItemInnerSpacing,
    IndentSpacing,
    ScrollbarSize,
    ScrollbarRounding,
    GrabMinSize,
    GrabRounding,
    ButtonTextAlign,
}
impl ImGuiStyleVar {
    pub const VARIANTS: [ImGuiStyleVar; 21] = [
        ImGuiStyleVar::Alpha,
        ImGuiStyleVar::WindowPadding,
        ImGuiStyleVar::WindowRounding,
        ImGuiStyleVar::WindowBorderSize,
        ImGuiStyleVar::WindowMinSize,
        ImGuiStyleVar::WindowTitleAlign,
        ImGuiStyleVar::ChildRounding,
        ImGuiStyleVar::ChildBorderSize,
        ImGuiStyleVar::PopupRounding,
        ImGuiStyleVar::PopupBorderSize,
        ImGuiStyleVar::FramePadding,
        ImGuiStyleVar::FrameRounding,
        ImGuiStyleVar::FrameBorderSize,
        ImGuiStyleVar::ItemSpacing,
        ImGuiStyleVar::ItemInnerSpacing,
        ImGuiStyleVar::IndentSpacing,
        ImGuiStyleVar::ScrollbarSize,
        ImGuiStyleVar::ScrollbarRounding,
        ImGuiStyleVar::GrabMinSize,
        ImGuiStyleVar::GrabRounding,
        ImGuiStyleVar::ButtonTextAlign,
    ];
}