1 /*
2  * Copyright (c) 2015 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', 'DerelictImgui', 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.imgui.types;
33 
34 import derelict.util.system;
35 import core.vararg;
36 
37 // opaque pointer
38 struct ImGuiTextFilter;
39 struct ImGuiTextBuffer;
40 struct ImGuiStorage;
41 struct ImDrawChannel;
42 struct ImDrawList;
43 struct ImFont;
44 struct ImFontAtlas;
45 struct ImGuiContext;
46 
47 // Typedefs and Enumerations (declared as int for compatibility and to not pollute the top of this file)
48 alias uint ImU32;                 // 32-bit unsigned integer (typically used to store packed colors)
49 alias uint ImGuiID;               // unique ID used by widgets (typically hashed from a stack of string)
50 alias ushort ImWchar;             // character for keyboard input/display
51 alias void* ImTextureID;          // user data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp)
52 alias int ImGuiCol;               // a color identifier for styling       // enum ImGuiCol_
53 alias int ImGuiStyleVar;          // a variable identifier for styling    // enum ImGuiStyleVar_
54 alias int ImGuiKey;               // a key identifier (ImGui-side enum)   // enum ImGuiKey_
55 alias int ImGuiColorEditFlags;    // color edit flags for Color*()        // enum ImGuiColorEditFlags_
56 alias int ImGuiMouseCursor;       // a mouse cursor identifier            // enum ImGuiMouseCursor_
57 alias int ImGuiWindowFlags;       // window flags for Begin()             // enum ImGuiWindowFlags_
58 alias int ImGuiFocusedFlags;      // focus flags for IsWindowFocused()    // enum ImGuiFocusedFlags_
59 alias int ImGuiHoveredFlags;      // flags: for IsItemHovered() etc.      // enum ImGuiHoveredFlags_
60 alias int ImGuiCond;              // condition flags for Set*()           // enum ImGuiCond_
61 alias int ImGuiColumnsFlags;      // flags for *Columns*()                // enum ImGuiColumnsFlags_
62 alias int ImGuiInputTextFlags;    // flags for InputText*()               // enum ImGuiInputTextFlags_
63 alias int ImGuiSelectableFlags;   // flags for Selectable()               // enum ImGuiSelectableFlags_
64 alias int ImGuiTreeNodeFlags;     // flags for TreeNode*(), Collapsing*() // enum ImGuiTreeNodeFlags_
65 
66 extern(C) nothrow {
67     alias ImGuiTextEditCallback = int function(ImGuiTextEditCallbackData *data);
68     alias ImGuiSizeConstraintCallback = void function(ImGuiSizeConstraintCallbackData *data);
69 }
70 
71 alias ulong ImU64;                // 64-bit unsigned integer
72 
73 struct ImVec2
74 {
75     float x=0;
76     float y=0;
77 }
78 
79 struct ImVec4
80 {
81     float x=0;
82     float y=0;
83     float z=0;
84     float w=0;
85 }
86 
87 enum
88 {
89     // Default: 0
90     ImGuiWindowFlags_NoTitleBar             = 1 << 0,   // Disable title-bar
91     ImGuiWindowFlags_NoResize               = 1 << 1,   // Disable user resizing with the lower-right grip
92     ImGuiWindowFlags_NoMove                 = 1 << 2,   // Disable user moving the window
93     ImGuiWindowFlags_NoScrollbar            = 1 << 3,   // Disable scrollbar (window can still scroll with mouse or programatically)
94     ImGuiWindowFlags_NoScrollWithMouse      = 1 << 4,   // Disable user scrolling with mouse wheel
95     ImGuiWindowFlags_NoCollapse             = 1 << 5,   // Disable user collapsing window by double-clicking on it
96     ImGuiWindowFlags_AlwaysAutoResize       = 1 << 6,   // Resize every window to its content every frame
97     ImGuiWindowFlags_ShowBorders            = 1 << 7,   // Show borders around windows and items
98     ImGuiWindowFlags_NoSavedSettings        = 1 << 8,   // Never load/save settings in .ini file
99     ImGuiWindowFlags_NoInputs               = 1 << 9,   // Disable catching mouse or keyboard inputs
100     ImGuiWindowFlags_MenuBar                = 1 << 10,   // Has a menubar
101     ImGuiWindowFlags_HorizontalScrollbar    = 1 << 11,  // Enable horizontal scrollbar (off by default). You need to use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section.
102     ImGuiWindowFlags_NoFocusOnAppearing     = 1 << 12,  // Disable taking focus when transitioning from hidden to visible state
103     ImGuiWindowFlags_NoBringToFrontOnFocus  = 1 << 13,  // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus)
104     ImGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14,  // Always show vertical scrollbar (even if ContentSize.y < Size.y)
105     ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15,  // Always show horizontal scrollbar (even if ContentSize.x < Size.x)
106     ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16,  // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)
107     // [Internal]
108     ImGuiWindowFlags_ChildWindow            = 1 << 22,  // Don't use! For internal use by BeginChild()
109     ImGuiWindowFlags_ComboBox               = 1 << 23,  // Don't use! For internal use by ComboBox()
110     ImGuiWindowFlags_Tooltip                = 1 << 24,  // Don't use! For internal use by BeginTooltip()
111     ImGuiWindowFlags_Popup                  = 1 << 25,  // Don't use! For internal use by BeginPopup()
112     ImGuiWindowFlags_Modal                  = 1 << 26,  // Don't use! For internal use by BeginPopupModal()
113     ImGuiWindowFlags_ChildMenu              = 1 << 27   // Don't use! For internal use by BeginMenu()
114 }
115 
116 enum
117 {
118     ImGuiFocusedFlags_ChildWindows                  = 1 << 0,   // IsWindowFocused(): Return true if any children of the window is focused
119     ImGuiFocusedFlags_RootWindow                    = 1 << 1,   // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)
120     ImGuiFocusedFlags_RootAndChildWindows           = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
121 }
122 
123 enum
124 {
125     ImGuiHoveredFlags_Default                       = 0,        // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.
126     ImGuiHoveredFlags_ChildWindows                  = 1 << 0,   // IsWindowHovered() only: Return true if any children of the window is hovered
127     ImGuiHoveredFlags_RootWindow                    = 1 << 1,   // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
128     ImGuiHoveredFlags_AllowWhenBlockedByPopup       = 1 << 2,   // Return true even if a popup window is normally blocking access to this item/window
129     //ImGuiHoveredFlags_AllowWhenBlockedByModal     = 1 << 3,   // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
130     ImGuiHoveredFlags_AllowWhenBlockedByActiveItem  = 1 << 4,   // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
131     ImGuiHoveredFlags_AllowWhenOverlapped           = 1 << 5,   // Return true even if the position is overlapped by another window
132     ImGuiHoveredFlags_RectOnly                      = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
133     ImGuiHoveredFlags_RootAndChildWindows           = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
134 }
135 
136 enum
137 {
138     // Default: 0
139     ImGuiInputTextFlags_CharsDecimal        = 1 << 0,   // Allow 0123456789.+-*/
140     ImGuiInputTextFlags_CharsHexadecimal    = 1 << 1,   // Allow 0123456789ABCDEFabcdef
141     ImGuiInputTextFlags_CharsUppercase      = 1 << 2,   // Turn a..z into A..Z
142     ImGuiInputTextFlags_CharsNoBlank        = 1 << 3,   // Filter out spaces, tabs
143     ImGuiInputTextFlags_AutoSelectAll       = 1 << 4,   // Select entire text when first taking mouse focus
144     ImGuiInputTextFlags_EnterReturnsTrue    = 1 << 5,   // Return 'true' when Enter is pressed (as opposed to when the value was modified)
145     ImGuiInputTextFlags_CallbackCompletion  = 1 << 6,   // Call user function on pressing TAB (for completion handling)
146     ImGuiInputTextFlags_CallbackHistory     = 1 << 7,   // Call user function on pressing Up/Down arrows (for history handling)
147     ImGuiInputTextFlags_CallbackAlways      = 1 << 8,   // Call user function every time
148     ImGuiInputTextFlags_CallbackCharFilter  = 1 << 9,   // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character.
149     ImGuiInputTextFlags_AllowTabInput       = 1 << 10,  // Pressing TAB input a '\t' character into the text field
150     ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11,  // In multi-line mode, allow exiting edition by pressing Enter. Ctrl+Enter to add new line (by default adds new lines with Enter).
151     ImGuiInputTextFlags_NoHorizontalScroll  = 1 << 12,  // Disable following the cursor horizontally
152     ImGuiInputTextFlags_AlwaysInsertMode    = 1 << 13,  // Insert mode
153     ImGuiInputTextFlags_ReadOnly            = 1 << 14,  // Read-only mode
154     ImGuiInputTextFlags_Password            = 1 << 15,  // Password mode, display all characters as '*'
155     // [Internal]
156     ImGuiInputTextFlags_Multiline           = 1 << 20   // For internal use by InputTextMultiline()
157 }
158 
159 enum
160 {
161     ImGuiTreeNodeFlags_Selected             = 1 << 0,   // Draw as selected
162     ImGuiTreeNodeFlags_Framed               = 1 << 1,   // Full colored frame (e.g. for CollapsingHeader)
163     ImGuiTreeNodeFlags_AllowItemOverlap     = 1 << 2,   // Hit testing to allow subsequent widgets to overlap this one
164     ImGuiTreeNodeFlags_NoTreePushOnOpen     = 1 << 3,   // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack
165     ImGuiTreeNodeFlags_NoAutoOpenOnLog      = 1 << 4,   // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes)
166     ImGuiTreeNodeFlags_DefaultOpen          = 1 << 5,   // Default node to be open
167     ImGuiTreeNodeFlags_OpenOnDoubleClick    = 1 << 6,   // Need double-click to open node
168     ImGuiTreeNodeFlags_OpenOnArrow          = 1 << 7,   // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open.
169     ImGuiTreeNodeFlags_Leaf                 = 1 << 8,   // No collapsing, no arrow (use as a convenience for leaf nodes). 
170     ImGuiTreeNodeFlags_Bullet               = 1 << 9,   // Display a bullet instead of arrow
171     //ImGuITreeNodeFlags_SpanAllAvailWidth  = 1 << 10,  // FIXME: TODO: Extend hit box horizontally even if not framed
172     //ImGuiTreeNodeFlags_NoScrollOnOpen     = 1 << 11,  // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
173     ImGuiTreeNodeFlags_CollapsingHeader     = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoAutoOpenOnLog
174 }
175 
176 enum
177 {
178     // Default: 0
179     ImGuiSelectableFlags_DontClosePopups    = 1 << 0,   // Clicking this don't close parent popup window
180     ImGuiSelectableFlags_SpanAllColumns     = 1 << 1,    // Selectable frame can span all columns (text will still fit in current column)
181     ImGuiSelectableFlags_AllowDoubleClick   = 1 << 2    // Generate press events on double clicks too
182 }
183 
184 enum
185 {
186     ImGuiKey_Tab,       // for tabbing through fields
187     ImGuiKey_LeftArrow, // for text edit
188     ImGuiKey_RightArrow,// for text edit
189     ImGuiKey_UpArrow,   // for text edit
190     ImGuiKey_DownArrow, // for text edit
191     ImGuiKey_PageUp,
192     ImGuiKey_PageDown,
193     ImGuiKey_Home,      // for text edit
194     ImGuiKey_End,       // for text edit
195     ImGuiKey_Delete,    // for text edit
196     ImGuiKey_Backspace, // for text edit
197     ImGuiKey_Enter,     // for text edit
198     ImGuiKey_Escape,    // for text edit
199     ImGuiKey_A,         // for text edit CTRL+A: select all
200     ImGuiKey_C,         // for text edit CTRL+C: copy
201     ImGuiKey_V,         // for text edit CTRL+V: paste
202     ImGuiKey_X,         // for text edit CTRL+X: cut
203     ImGuiKey_Y,         // for text edit CTRL+Y: redo
204     ImGuiKey_Z,         // for text edit CTRL+Z: undo
205     ImGuiKey_COUNT
206 };
207 
208 enum
209 {
210     ImGuiCol_Text,
211     ImGuiCol_TextDisabled,
212     ImGuiCol_WindowBg,              // Background of normal windows
213     ImGuiCol_ChildBg,               // Background of child windows
214     ImGuiCol_PopupBg,               // Background of popups, menus, tooltips windows
215     ImGuiCol_Border,
216     ImGuiCol_BorderShadow,
217     ImGuiCol_FrameBg,               // Background of checkbox, radio button, plot, slider, text input
218     ImGuiCol_FrameBgHovered,
219     ImGuiCol_FrameBgActive,
220     ImGuiCol_TitleBg,
221     ImGuiCol_TitleBgActive,
222     ImGuiCol_TitleBgCollapsed,
223     ImGuiCol_MenuBarBg,
224     ImGuiCol_ScrollbarBg,
225     ImGuiCol_ScrollbarGrab,
226     ImGuiCol_ScrollbarGrabHovered,
227     ImGuiCol_ScrollbarGrabActive,
228     ImGuiCol_CheckMark,
229     ImGuiCol_SliderGrab,
230     ImGuiCol_SliderGrabActive,
231     ImGuiCol_Button,
232     ImGuiCol_ButtonHovered,
233     ImGuiCol_ButtonActive,
234     ImGuiCol_Header,
235     ImGuiCol_HeaderHovered,
236     ImGuiCol_HeaderActive,
237     ImGuiCol_Separator,
238     ImGuiCol_SeparatorHovered,
239     ImGuiCol_SeparatorActive,
240     ImGuiCol_ResizeGrip,
241     ImGuiCol_ResizeGripHovered,
242     ImGuiCol_ResizeGripActive,
243     ImGuiCol_CloseButton,
244     ImGuiCol_CloseButtonHovered,
245     ImGuiCol_CloseButtonActive,
246     ImGuiCol_PlotLines,
247     ImGuiCol_PlotLinesHovered,
248     ImGuiCol_PlotHistogram,
249     ImGuiCol_PlotHistogramHovered,
250     ImGuiCol_TextSelectedBg,
251     ImGuiCol_ModalWindowDarkening,  // darken entire screen when a modal window is active
252     ImGuiCol_DragDropTarget,
253     ImGuiCol_COUNT
254 }
255 
256 enum
257 {
258     ImGuiStyleVar_Alpha,               // float     Alpha
259     ImGuiStyleVar_WindowPadding,       // ImVec2    WindowPadding
260     ImGuiStyleVar_WindowRounding,      // float     WindowRounding
261     ImGuiStyleVar_WindowBorderSize,    // float     WindowBorderSize
262     ImGuiStyleVar_WindowMinSize,       // ImVec2    WindowMinSize
263     ImGuiStyleVar_ChildRounding,       // float     ChildRounding
264     ImGuiStyleVar_ChildBorderSize,     // float     ChildBorderSize
265     ImGuiStyleVar_PopupRounding,       // float     PopupRounding
266     ImGuiStyleVar_PopupBorderSize,     // float     PopupBorderSize
267     ImGuiStyleVar_FramePadding,        // ImVec2    FramePadding
268     ImGuiStyleVar_FrameRounding,       // float     FrameRounding
269     ImGuiStyleVar_FrameBorderSize,     // float     FrameBorderSize
270     ImGuiStyleVar_ItemSpacing,         // ImVec2    ItemSpacing
271     ImGuiStyleVar_ItemInnerSpacing,    // ImVec2    ItemInnerSpacing
272     ImGuiStyleVar_IndentSpacing,       // float     IndentSpacing
273     ImGuiStyleVar_GrabMinSize,         // float     GrabMinSize
274     ImGuiStyleVar_ButtonTextAlign,     // ImVec2    ButtonTextAlign
275     ImGuiStyleVar_Count_
276 }
277 
278 enum
279 {
280     ImGuiColorEditFlags_NoAlpha         = 1 << 1,   //              // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (read 3 components from the input pointer).
281     ImGuiColorEditFlags_NoPicker        = 1 << 2,   //              // ColorEdit: disable picker when clicking on colored square.
282     ImGuiColorEditFlags_NoOptions       = 1 << 3,   //              // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.
283     ImGuiColorEditFlags_NoSmallPreview  = 1 << 4,   //              // ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs)
284     ImGuiColorEditFlags_NoInputs        = 1 << 5,   //              // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview colored square).
285     ImGuiColorEditFlags_NoTooltip       = 1 << 6,   //              // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.
286     ImGuiColorEditFlags_NoLabel         = 1 << 7,   //              // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).
287     ImGuiColorEditFlags_NoSidePreview   = 1 << 8,   //              // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead.
288     // User Options (right-click on widget to change some of them). You can set application defaults using SetColorEditOptions(). The idea is that you probably don't want to override them in most of your calls, let the user choose and/or call SetColorEditOptions() during startup.
289     ImGuiColorEditFlags_AlphaBar        = 1 << 9,   //              // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.
290     ImGuiColorEditFlags_AlphaPreview    = 1 << 10,  //              // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.
291     ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 11,  //              // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque.
292     ImGuiColorEditFlags_HDR             = 1 << 12,  //              // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well).
293     ImGuiColorEditFlags_RGB             = 1 << 13,  // [Inputs]     // ColorEdit: choose one among RGB/HSV/HEX. ColorPicker: choose any combination using RGB/HSV/HEX.
294     ImGuiColorEditFlags_HSV             = 1 << 14,  // [Inputs]     // "
295     ImGuiColorEditFlags_HEX             = 1 << 15,  // [Inputs]     // "
296     ImGuiColorEditFlags_Uint8           = 1 << 16,  // [DataType]   // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. 
297     ImGuiColorEditFlags_Float           = 1 << 17,  // [DataType]   // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.
298     ImGuiColorEditFlags_PickerHueBar    = 1 << 18,  // [PickerMode] // ColorPicker: bar for Hue, rectangle for Sat/Value.
299     ImGuiColorEditFlags_PickerHueWheel  = 1 << 19,  // [PickerMode] // ColorPicker: wheel for Hue, triangle for Sat/Value.
300     // Internals/Masks
301     ImGuiColorEditFlags__InputsMask     = ImGuiColorEditFlags_RGB|ImGuiColorEditFlags_HSV|ImGuiColorEditFlags_HEX,
302     ImGuiColorEditFlags__DataTypeMask   = ImGuiColorEditFlags_Uint8|ImGuiColorEditFlags_Float,
303     ImGuiColorEditFlags__PickerMask     = ImGuiColorEditFlags_PickerHueWheel|ImGuiColorEditFlags_PickerHueBar,
304     ImGuiColorEditFlags__OptionsDefault = ImGuiColorEditFlags_Uint8|ImGuiColorEditFlags_RGB|ImGuiColorEditFlags_PickerHueBar    // Change application default using SetColorEditOptions()
305 }
306 
307 enum
308 {
309     ImGuiMouseCursor_None = -1,
310     ImGuiMouseCursor_Arrow = 0,
311     ImGuiMouseCursor_TextInput,         // When hovering over InputText, etc.
312     ImGuiMouseCursor_Move,              // Unused
313     ImGuiMouseCursor_ResizeNS,          // Unused
314     ImGuiMouseCursor_ResizeEW,          // When hovering over a column
315     ImGuiMouseCursor_ResizeNESW,        // Unused
316     ImGuiMouseCursor_ResizeNWSE,        // When hovering over the bottom-right corner of a window
317     ImGuiMouseCursor_Count_
318 }
319 
320 enum
321 {
322     ImGuiCond_Always        = 1 << 0, // Set the variable
323     ImGuiCond_Once          = 1 << 1, // Set the variable once per runtime session (only the first call with succeed)
324     ImGuiCond_FirstUseEver  = 1 << 2, // Set the variable if the window has no saved data (if doesn't exist in the .ini file)
325     ImGuiCond_Appearing     = 1 << 3  // Set the variable if the window is appearing after being hidden/inactive (or the first time)
326 }
327 
328 struct ImGuiStyle
329 {
330     float       Alpha = 1.0f;                         // Global alpha applies to everything in ImGui
331     ImVec2      WindowPadding = ImVec2(8,8);          // Padding within a window
332     float       WindowRounding = 7.0f;                // Radius of window corners rounding. Set to 0.0f to have rectangular windows
333     float       WindowBorderSize = 0.0f;              // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)
334     ImVec2      WindowMinSize = ImVec2(32,32);        // Minimum window size
335     ImVec2      WindowTitleAlign = ImVec2(0.0f,0.5f); // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
336     float       ChildRounding = 0.0f;                 // Radius of child window corners rounding. Set to 0.0f to have rectangular windows
337     float       ChildBorderSize = 1.0f;               // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.
338     float       PopupRounding = 0.0f;                 // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows
339     float       PopupBorderSize = 1.0f;               // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.
340     ImVec2      FramePadding = ImVec2(4,3);           // Padding within a framed rectangle (used by most widgets)
341     float       FrameRounding = 0.0f;                 // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
342     float       FrameBorderSize = 0.0f;               // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
343     ImVec2      ItemSpacing = ImVec2(8,4);            // Horizontal and vertical spacing between widgets/lines
344     ImVec2      ItemInnerSpacing = ImVec2(4,4);       // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
345     ImVec2      TouchExtraPadding = ImVec2(0,0);      // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
346     float       IndentSpacing = 21.0f;                // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
347     float       ColumnsMinSpacing = 6.0f;             // Minimum horizontal spacing between two columns
348     float       ScrollbarSize = 16.0f;                // Width of the vertical scrollbar, Height of the horizontal scrollbar
349     float       ScrollbarRounding = 9.0f;             // Radius of grab corners for scrollbar
350     float       GrabMinSize = 10.0f;                  // Minimum width/height of a grab box for slider/scrollbar.
351     float       GrabRounding = 0.0f;                  // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
352     ImVec2      ButtonTextAlign = ImVec2(0.5f,0.5f);  // Alignment of button text when button is larger than text. Defaults to (0.5f,0.5f) for horizontally+vertically centered.
353     ImVec2      DisplayWindowPadding = ImVec2(22,22); // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
354     ImVec2      DisplaySafeAreaPadding = ImVec2(4,4); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
355     bool        AntiAliasedLines = true;              // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU.
356     bool        AntiAliasedFill = true;             // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
357     float       CurveTessellationTol = 1.25f;         // Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
358     ImVec4[ImGuiCol_COUNT] Colors = [
359         ImVec4(0.90f, 0.90f, 0.90f, 1.00f),
360         ImVec4(0.60f, 0.60f, 0.60f, 1.00f),
361         ImVec4(0.00f, 0.00f, 0.00f, 0.70f),
362         ImVec4(0.00f, 0.00f, 0.00f, 0.00f),
363         ImVec4(0.05f, 0.05f, 0.10f, 0.90f),
364         ImVec4(0.70f, 0.70f, 0.70f, 0.40f),
365         ImVec4(0.00f, 0.00f, 0.00f, 0.00f),
366         ImVec4(0.80f, 0.80f, 0.80f, 0.30f),   // Background of checkbox, radio button, plot, slider, text input
367         ImVec4(0.90f, 0.80f, 0.80f, 0.40f),
368         ImVec4(0.90f, 0.65f, 0.65f, 0.45f),
369         ImVec4(0.27f, 0.27f, 0.54f, 0.83f),
370         ImVec4(0.40f, 0.40f, 0.80f, 0.20f),
371         ImVec4(0.32f, 0.32f, 0.63f, 0.87f),
372         ImVec4(0.40f, 0.40f, 0.55f, 0.80f),
373         ImVec4(0.20f, 0.25f, 0.30f, 0.60f),
374         ImVec4(0.40f, 0.40f, 0.80f, 0.30f),
375         ImVec4(0.40f, 0.40f, 0.80f, 0.40f),
376         ImVec4(0.80f, 0.50f, 0.50f, 0.40f),
377         ImVec4(0.20f, 0.20f, 0.20f, 0.99f),
378         ImVec4(0.90f, 0.90f, 0.90f, 0.50f),
379         ImVec4(1.00f, 1.00f, 1.00f, 0.30f),
380         ImVec4(0.80f, 0.50f, 0.50f, 1.00f),
381         ImVec4(0.67f, 0.40f, 0.40f, 0.60f),
382         ImVec4(0.67f, 0.40f, 0.40f, 1.00f),
383         ImVec4(0.80f, 0.50f, 0.50f, 1.00f),
384         ImVec4(0.40f, 0.40f, 0.90f, 0.45f),
385         ImVec4(0.45f, 0.45f, 0.90f, 0.80f),
386         ImVec4(0.53f, 0.53f, 0.87f, 0.80f),
387         ImVec4(0.50f, 0.50f, 0.50f, 1.00f),
388         ImVec4(0.60f, 0.60f, 0.70f, 1.00f),
389         ImVec4(0.70f, 0.70f, 0.90f, 1.00f),
390         ImVec4(1.00f, 1.00f, 1.00f, 0.30f),
391         ImVec4(1.00f, 1.00f, 1.00f, 0.60f),
392         ImVec4(1.00f, 1.00f, 1.00f, 0.90f),
393         ImVec4(0.50f, 0.50f, 0.90f, 0.50f),
394         ImVec4(0.70f, 0.70f, 0.90f, 0.60f),
395         ImVec4(0.70f, 0.70f, 0.70f, 1.00f),
396         ImVec4(1.00f, 1.00f, 1.00f, 1.00f),
397         ImVec4(0.90f, 0.70f, 0.00f, 1.00f),
398         ImVec4(0.90f, 0.70f, 0.00f, 1.00f),
399         ImVec4(1.00f, 0.60f, 0.00f, 1.00f),
400         ImVec4(0.00f, 0.00f, 1.00f, 0.35f),
401         ImVec4(0.20f, 0.20f, 0.20f, 0.35f),
402     ];
403 }
404 
405 extern(C) nothrow {
406     alias RenderDrawListFunc = void function(ImDrawData* data);
407     alias GetClipboardTextFunc = const(char)* function(void* user_data);
408     alias SetClipboardTextFunc = void function(void* user_data, const(char)* text);
409     alias MemAllocFunc = void* function(size_t);
410     alias MemFreeFunc = void function(void*);
411     alias ImeSetInputScreenPosFunc = void function(int,int);
412 }
413 
414 struct ImGuiIO
415 {
416     ImVec2        DisplaySize;              // <unset>              // Display size, in pixels. For clamping windows positions.
417     float         DeltaTime;                // = 1.0f/60.0f         // Time elapsed since last frame, in seconds.
418     float         IniSavingRate;            // = 5.0f               // Maximum time between saving positions/sizes to .ini file, in seconds.
419     const(char)*  IniFilename;              // = "imgui.ini"        // Path to .ini file. NULL to disable .ini saving.
420     const(char)*  LogFilename;              // = "imgui_log.txt"    // Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
421     float         MouseDoubleClickTime;     // = 0.30f              // Time for a double-click, in seconds.
422     float         MouseDoubleClickMaxDist;  // = 6.0f               // Distance threshold to stay in to validate a double-click, in pixels.
423     float         MouseDragThreshold;       // = 6.0f               // Distance threshold before considering we are dragging
424     int[ImGuiKey_COUNT]           KeyMap;   // <unset>              // Map of indices into the KeysDown[512] entries array
425     float         KeyRepeatDelay;           // = 0.250f             // When holding a key/button, time before it starts repeating, in seconds. (for actions where 'repeat' is active)
426     float         KeyRepeatRate;            // = 0.020f             // When holding a key/button, rate at which it repeats, in seconds.
427     void*         UserData;                 // = NULL               // Store your own data for retrieval by callbacks.
428 
429     ImFontAtlas*  Fonts;                    // <auto>               // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.
430     float         FontGlobalScale;          // = 1.0f               // Global scale all fonts
431     bool          FontAllowUserScaling;     // = false              // Allow user scaling text of individual window with CTRL+Wheel.
432     ImFont*       FontDefault;              // = NULL               // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0].
433     ImVec2        DisplayFramebufferScale;  // = (1.0f,1.0f)        // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
434     ImVec2        DisplayVisibleMin;        // <unset> (0.0f,0.0f)  // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area.
435     ImVec2        DisplayVisibleMax;        // <unset> (0.0f,0.0f)  // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
436 
437     // Advanced/subtle behaviors
438     bool          OSXBehaviors;             // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl
439 
440     //------------------------------------------------------------------
441     // User Functions
442     //------------------------------------------------------------------
443 
444     // Rendering function, will be called in Render().
445     // Alternatively you can keep this to NULL and call GetDrawData() after Render() to get the same pointer.
446     // See example applications if you are unsure of how to implement this.
447     RenderDrawListFunc RenderDrawListsFn;
448 
449     // Optional: access OS clipboard
450     // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
451     GetClipboardTextFunc GetClipboardTextFn;
452     SetClipboardTextFunc SetClipboardTextFn;
453     void*       ClipboardUserData;
454 
455     // Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer.
456     // (default to posix malloc/free)
457     MemAllocFunc MemAllocFn;
458     MemFreeFunc MemFreeFn;
459 
460     // Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows)
461     // (default to use native imm32 api on Windows)
462     ImeSetInputScreenPosFunc ImeSetInputScreenPosFn;
463     void*       ImeWindowHandle;            // (Windows) Set this to your HWND to get automatic IME cursor positioning.
464 
465     //------------------------------------------------------------------
466     // Input - Fill before calling NewFrame()
467     //------------------------------------------------------------------
468 
469     ImVec2          MousePos;                   // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
470     bool[5]         MouseDown;                  // Mouse buttons. ImGui itself only uses button 0 (left button). Others buttons allows to track if mouse is being used by your application + available to user as a convenience via IsMouse** API.
471     float           MouseWheel;                 // Mouse wheel: 1 unit scrolls about 5 lines text.
472     bool            MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
473     bool            KeyCtrl;                    // Keyboard modifier pressed: Control
474     bool            KeyShift;                   // Keyboard modifier pressed: Shift
475     bool            KeyAlt;                     // Keyboard modifier pressed: Alt
476     bool            KeySuper;                   // Keyboard modifier pressed: Cmd/Super/Windows
477     bool[512]       KeysDown;              // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
478     ImWchar[16+1]   InputCharacters;      // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
479 
480     //------------------------------------------------------------------
481     // Output - Retrieve after calling NewFrame()
482     //------------------------------------------------------------------
483 
484     bool        WantCaptureMouse;           // Mouse is hovering a window or widget is active (= ImGui will use your mouse input)
485     bool        WantCaptureKeyboard;        // Widget is active (= ImGui will use your keyboard input)
486     bool        WantTextInput;              // Some text input widget is active, which will read input characters from the InputCharacters array.
487     bool        WantMoveMouse;              // [BETA-NAV] MousePos has been altered, back-end should reposition mouse on next frame. Set only when 'NavMovesMouse=true'.
488     float       Framerate;                  // Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames
489     int         MetricsAllocs;              // Number of active memory allocations
490     int         MetricsRenderVertices;      // Vertices processed during last call to Render()
491     int         MetricsRenderIndices;       //
492     int         MetricsActiveWindows;       // Number of visible windows (exclude child windows)
493     ImVec2      MouseDelta;                 // Mouse delta. Note that this is zero if either current or previous position are negative, so a disappearing/reappearing mouse won't have a huge delta for one frame.
494 
495     //------------------------------------------------------------------
496     // [Private] ImGui will maintain those fields. Forward compatibility not guaranteed!
497     //------------------------------------------------------------------
498 
499     ImVec2      MousePosPrev;               // Previous mouse position
500     bool[5]     MouseClicked;            // Mouse button went from !Down to Down
501     ImVec2[5]   MouseClickedPos;         // Position at time of clicking
502     float[5]    MouseClickedTime;        // Time of last click (used to figure out double-click)
503     bool[5]     MouseDoubleClicked;      // Has mouse button been double-clicked?
504     bool[5]     MouseReleased;           // Mouse button went from Down to !Down
505     bool[5]     MouseDownOwned;          // Track if button was clicked inside a window. We don't request mouse capture from the application if click started outside ImGui bounds.
506     float[5]    MouseDownDuration;       // Duration the mouse button has been down (0.0f == just clicked)
507     float[5]    MouseDownDurationPrev;   // Previous time the mouse button has been down
508     float[5]    MouseDragMaxDistanceSqr; // Squared maximum distance of how much mouse has traveled from the click point
509     float[512]  KeysDownDuration;      // Duration the keyboard key has been down (0.0f == just pressed)
510     float[512]  KeysDownDurationPrev;  // Previous duration the key has been down
511 }
512 
513 //struct ImVector(T);
514 //struct ImGuiOnceUponAFrame;
515 
516 // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
517 struct ImGuiTextFilterWrapper
518 {
519 extern(C) @nogc nothrow:
520     import derelict.imgui.funcs;
521     private ImGuiTextFilter* filter = null;
522 
523     this(const(char)* default_filter) { filter = ImGuiTextFilter_Create(default_filter); }
524     this(this) { filter = ImGuiTextFilter_Create(ImGuiTextFilter_GetInputBuf(filter)); }
525     ~this() { if(filter) ImGuiTextFilter_Destroy(filter); }
526     void init() { if(!filter) filter = ImGuiTextFilter_Create(""); }
527     void Clear() { if(filter) ImGuiTextFilter_Clear(filter); else init(); }
528 
529     bool Draw(const(char)* label = "Filter (inc,-exc)", float width = 0.0f)
530     { init(); return ImGuiTextFilter_Draw(filter, label, width); }
531 
532     bool PassFilter(const(char)* text, const(char)* text_end = null) const
533     { if(!filter) return true; return ImGuiTextFilter_PassFilter(filter, text, text_end); }
534 
535     bool IsActive() const
536     { if(!filter) return false; return ImGuiTextFilter_IsActive(filter); }
537 
538     void Build()
539     { init(); ImGuiTextFilter_Build(filter); }
540 }
541 
542 // Helper: Text buffer for logging/accumulating text
543 struct ImGuiTextBufferWrapper
544 {
545 extern(C):
546     import derelict.imgui.funcs;
547     import core.stdc.stdarg: va_list, va_start, va_end;
548     private ImGuiTextBuffer* buffer = null;
549 
550     nothrow {
551         this(this) {
552             auto s = ImGuiTextBuffer_c_str(buffer);
553             buffer = ImGuiTextBuffer_Create();
554             ImGuiTextBuffer_appendf(buffer, "%s", s);
555         }
556         ~this() { if(buffer) ImGuiTextBuffer_Destroy(buffer); }
557         void init() { if(!buffer) buffer = ImGuiTextBuffer_Create(); }
558         char opIndex(int i) { if(!buffer) return 0; return ImGuiTextBuffer_index(buffer, i); }
559         const(char)* begin() const { if(!buffer) return ""; return ImGuiTextBuffer_begin(buffer); }
560         const(char)* end() const { if(!buffer) return begin(); return ImGuiTextBuffer_end(buffer); }
561         int size() const { if(!buffer) return 0; return ImGuiTextBuffer_size(buffer); }
562         bool empty() { if(!buffer) return true; return ImGuiTextBuffer_empty(buffer); }
563         void clear() { init(); return ImGuiTextBuffer_clear(buffer); }
564         void appendfv(const(char)* fmt, va_list args) {
565             init();
566             return ImGuiTextBuffer_appendfv(buffer, fmt, args);
567         }
568     }
569 
570     void appendf(const(char)* fmt, ...) {
571         va_list args;
572         va_start(args, fmt);
573         appendfv(fmt, args);
574         va_end(args);
575     }
576 }
577 
578 //struct ImGuiStorage;
579 
580 // Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used.
581 struct ImGuiTextEditCallbackData
582 {
583 extern(C) @nogc nothrow:
584     import derelict.imgui.funcs;
585     ImGuiInputTextFlags EventFlag;      // One of ImGuiInputTextFlags_Callback* // Read-only
586     ImGuiInputTextFlags Flags;          // What user passed to InputText()      // Read-only
587     void*               UserData;       // What user passed to InputText()      // Read-only
588     bool                ReadOnly;       // Read-only mode                       // Read-only
589 
590     // CharFilter event:
591     ImWchar             EventChar;      // Character input                      // Read-write (replace character or set to zero)
592 
593     // Completion,History,Always events:
594     ImGuiKey            EventKey;       // Key pressed (Up/Down/TAB)            // Read-only
595     char*               Buf;            // Current text                         // Read-write (pointed data only)
596     int                 BufTextLen;     // Current text length in bytes         // Read-write
597     size_t              BufSize;        //                                      // Read-only
598     bool                BufDirty;       // Set if you modify Buf directly       // Write
599     int                 CursorPos;      //                                      // Read-write
600     int                 SelectionStart; //                                      // Read-write (== to SelectionEnd when no selection)
601     int                 SelectionEnd;   //                                      // Read-write
602 
603     // NB: calling those function loses selection.
604     void DeleteChars(int pos, int bytes_count) { ImGuiTextEditCallbackData_DeleteChars(&this, pos, bytes_count); }
605     void InsertChars(int pos, const(char)* text, const(char)* text_end = null) { ImGuiTextEditCallbackData_InsertChars(&this, pos, text, text_end); }
606     bool HasSelection() const { return SelectionStart != SelectionEnd; }
607 }
608 
609 struct ImGuiSizeConstraintCallbackData
610 {
611     void*   UserData;       // Read-only.   What user passed to SetNextWindowSizeConstraints()
612     ImVec2  Pos;            // Read-only.   Window position, for reference.
613     ImVec2  CurrentSize;    // Read-only.   Current window size.
614     ImVec2  DesiredSize;    // Read-write.  Desired size, based on user's mouse position. Write to this field to restrain resizing.
615 }
616 
617 // Helpers macros to generate 32-bits encoded colors
618 version(IMGUI_USE_BGRA_PACKED_COLOR) {
619     enum IM_COL32_R_SHIFT    = 16;
620     enum IM_COL32_G_SHIFT    = 8;
621     enum IM_COL32_B_SHIFT    = 0;
622     enum IM_COL32_A_SHIFT    = 24;
623     enum IM_COL32_A_MASK     = 0xFF000000;
624 } else {
625     enum IM_COL32_R_SHIFT    = 0;
626     enum IM_COL32_G_SHIFT    = 8;
627     enum IM_COL32_B_SHIFT    = 16;
628     enum IM_COL32_A_SHIFT    = 24;
629     enum IM_COL32_A_MASK     = 0xFF000000;
630 }
631 uint IM_COL32(ubyte R, ubyte G, ubyte B, ubyte A) {
632     return (
633             (cast(ImU32)(A)<<IM_COL32_A_SHIFT) | 
634             (cast(ImU32)(B)<<IM_COL32_B_SHIFT) | 
635             (cast(ImU32)(G)<<IM_COL32_G_SHIFT) | 
636             (cast(ImU32)(R)<<IM_COL32_R_SHIFT)
637             );
638 }
639 @property uint IM_COL32_WHITE() {
640     return IM_COL32(255,255,255,255);   // Opaque white = 0xFFFFFFFF
641 }
642 @property uint IM_COL32_BLACK() {
643     return IM_COL32(0,0,0,255);         // Opaque black
644 }
645 @property uint IM_COL32_BLACK_TRANS() {
646     return IM_COL32(0,0,0,0);           // Transparent black = 0x00000000
647 }
648 
649 struct ImColor
650 {
651 extern(C) @nogc nothrow:
652     import derelict.imgui.funcs;
653     ImVec4 Value = ImVec4(0, 0, 0, 0);
654     alias Value this;
655 
656     this(ubyte r, ubyte g, ubyte b, ubyte a = 255)
657     {
658         float sc = 1.0f/255.0f;
659         Value.x = r * sc;
660         Value.y = g * sc;
661         Value.z = b * sc;
662         Value.w = a * sc;
663     }
664 
665     this(ImU32 rgba)
666     {
667         this(cast(ubyte)(rgba>>IM_COL32_R_SHIFT), cast(ubyte)(rgba>>IM_COL32_G_SHIFT),
668              cast(ubyte)(rgba>>IM_COL32_B_SHIFT), cast(ubyte)(rgba>>IM_COL32_A_SHIFT));
669     }
670 
671     this(float r, float g, float b, float a = 1.0f)
672     {
673         Value.x = r; 
674         Value.y = g; 
675         Value.z = b; 
676         Value.w = a; 
677     }
678 
679     this(const ImVec4 col) { Value = col; }
680 
681     ImU32 asImU32() @property
682     {
683         return igColorConvertFloat4ToU32(Value);
684     }
685 
686     ImVec4 asImVec4() @property { return Value; }
687 
688     void SetHSV(float h, float s, float v, float a = 1.0f)
689     {
690         this = HSV(h, s, v, a);
691     }
692 
693     static ImColor HSV(float h, float s, float v, float a = 1.0f)
694     {
695         import derelict.imgui.funcs;
696         float r,g,b;
697         igColorConvertHSVtoRGB(h, s, v, &r, &g, &b);
698         return ImColor(r,g,b,a);
699     }
700 }
701 
702 struct ImGuiListClipper {
703 extern(C) @nogc nothrow:
704     import derelict.imgui.funcs : ImGuiListClipper_Begin, ImGuiListClipper_End, ImGuiListClipper_Step;
705 
706     float StartPosY = 0;
707     float ItemsHeight = -1;
708     int ItemsCount = -1, StepNo = 0, DisplayStart = -1, DisplayEnd = -1;
709 
710     this(int items_count, float items_height = -1.0f)
711     {
712         ImGuiListClipper_Begin(&this, items_count, items_height);
713     }
714 
715     ~this()
716     {
717         assert(ItemsCount == -1);
718     }
719 
720     bool Step() { return ImGuiListClipper_Step(&this); }
721 
722     void Begin(int items_count, float items_height = -1.0f)
723     {
724         ImGuiListClipper_Begin(&this, items_count, items_height);
725     }
726 
727     void End() { ImGuiListClipper_End(&this); }
728 }
729 
730 extern(C) nothrow {
731     alias ImDrawCallback = void function(const ImDrawList* parent_list, const ImDrawCmd* cmd);
732 }
733 
734 struct ImDrawCmd
735 {
736     uint            ElemCount = 0;                 // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].
737     ImVec4          ClipRect = ImVec4(-8192.0f, -8192.0f, +8192.0f, +8192.0f); // Clipping rectangle (x1, y1, x2, y2)
738     ImTextureID     TextureId = null;              // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.
739     ImDrawCallback  UserCallback = null;           // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
740     void*           UserCallbackData = null;       // The draw callback code can access this.
741 }
742 
743 alias ImDrawIdx = ushort;
744 
745 struct ImDrawVert
746 {
747     ImVec2  pos;
748     ImVec2  uv;
749     ImU32   col;
750 }
751 
752 //struct ImDrawChannel;
753 //struct ImDrawList;
754 
755 struct ImDrawData
756 {
757 extern(C) @nogc nothrow:
758     import derelict.imgui.funcs;
759     bool            Valid = false;              // Only valid after Render() is called and before the next NewFrame() is called.
760     ImDrawList**    CmdLists = null;
761     int             CmdListsCount = 0;
762     int             TotalVtxCount = 0;          // For convenience, sum of all cmd_lists vtx_buffer.Size
763     int             TotalIdxCount = 0;          // For convenience, sum of all cmd_lists idx_buffer.Size
764 
765     // Functions
766     void DeIndexAllBuffers()                    // For backward compatibility or convenience: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
767     {
768         ImDrawData_DeIndexAllBuffers(&this);
769     }
770 
771     void ScaleClipRects(const ImVec2 sc)        // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than ImGui expects, or if there is a difference between your window resolution and framebuffer resolution.
772     {
773         ImDrawData_ScaleClipRects(&this, sc);
774     }
775 }
776 
777 struct ImFontConfig
778 {
779     void*           FontData = null;                         // TTF/OTF data
780     int             FontDataSize = 0;                        // TTF/OTF data size
781     bool            FontDataOwnedByAtlas = true;             // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself). Set to true
782     int             FontNo = 0;                              // Index of font within TTF/OTF file
783     float           SizePixels = 0.0f;                       // Size in pixels for rasterizer
784     int             OversampleH = 3, OversampleV = 1;        // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
785     bool            PixelSnapH = false;                      // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
786     ImVec2          GlyphExtraSpacing = ImVec2(0.0f, 0.0f);  // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
787     ImVec2          GlyphOffset = ImVec2(0.0f, 0.0f);        // Offset all glyphs from this font input
788     const ImWchar*  GlyphRanges = null;                      // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
789     bool            MergeMode = false;                       // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights.
790 
791     // [Internal]
792     char[32]        Name = 0;                                // Name (strictly to ease debugging)
793     ImFont*         DstFont = null;
794 }
795 
796 //struct ImFontAtlas;
797 
798 // Helpers to build glyph ranges from text data. Feed all your application strings/characters to it then call BuildRanges().
799 struct ImFontAtlas_GlyphRangesBuilder
800 {
801     import std.bitmanip;
802     import std.string : fromStringz;
803 	import std.array : appender;
804     BitArray UsedChars;
805 
806     void init() { if(UsedChars.length == 0) UsedChars.length = 0x10000; }
807     bool GetBit(int n) { return UsedChars[n]; }
808     void SetBit(int n) { UsedChars[n] = true; }  // Set bit 'c' in the array
809     void AddChar(ImWchar c) { init(); UsedChars[c] = true; }        // Add character
810     void AddText(const(char)* text, const(char)* text_end = null)   // Add string (each character of the UTF-8 string are added)
811     {
812         init();
813         const(char)[] s = text_end ? text[0..(text_end - text)] : text.fromStringz;
814         foreach(dchar c; s) {
815             if (c < 0x10000)
816                 UsedChars[c] = true;
817         }
818     }
819 
820     void AddRanges(const(ImWchar)* ranges)                          // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault) to force add all of ASCII/Latin+Ext
821     {
822         init();
823         for (; ranges[0]; ranges += 2)
824             for (ImWchar c = ranges[0]; c <= ranges[1]; c++)
825                 UsedChars[c] = true;
826     }
827 
828     ImWchar[] BuildRanges()                                         // Output new ranges
829     {
830         init();
831         auto r = appender!(ImWchar[]);
832         for (int n = 0; n < 0x10000; n++)
833             if (UsedChars[n])
834             {
835                 r ~= cast(ImWchar)n;
836                 while (n < 0x10000-1 && UsedChars[n + 1])
837                     n++;
838                 r ~= cast(ImWchar)n;
839             }
840         r ~= cast(ImWchar)0;
841         return r.data;
842     }
843 }
844 
845 //struct ImFont;
846 
847 struct ImFont_Glyph {
848     ImWchar                 Codepoint;
849     float                   XAdvance;
850     float                   X0, Y0, X1, Y1;
851     float                   U0, V0, U1, V1;     // Texture coordinates
852 }