Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
imgui_internal.h
Go to the documentation of this file.
1 // dear imgui, v1.52 WIP
2 // (internals)
3 
4 // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
5 // Implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)
6 // #define IMGUI_DEFINE_MATH_OPERATORS
7 // Define IM_PLACEMENT_NEW() macro helper.
8 // #define IMGUI_DEFINE_PLACEMENT_NEW
9 
10 #pragma once
11 
12 #ifndef IMGUI_VERSION
13 #error Must include imgui.h before imgui_internal.h
14 #endif
15 
16 #include <stdio.h> // FILE*
17 #include <math.h> // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf
18 
19 #ifdef _MSC_VER
20 #pragma warning (push)
21 #pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport)
22 #endif
23 
24 #ifdef __clang__
25 #pragma clang diagnostic push
26 #pragma clang diagnostic ignored "-Wunused-function" // for stb_textedit.h
27 #pragma clang diagnostic ignored "-Wmissing-prototypes" // for stb_textedit.h
28 #pragma clang diagnostic ignored "-Wold-style-cast"
29 #endif
30 
31 //-----------------------------------------------------------------------------
32 // Forward Declarations
33 //-----------------------------------------------------------------------------
34 
35 struct ImRect;
36 struct ImGuiColMod;
37 struct ImGuiStyleMod;
38 struct ImGuiGroupData;
39 struct ImGuiSimpleColumns;
40 struct ImGuiDrawContext;
41 struct ImGuiTextEditState;
42 struct ImGuiIniData;
44 struct ImGuiPopupRef;
45 struct ImGuiWindow;
46 
47 typedef int ImGuiLayoutType; // enum ImGuiLayoutType_
48 typedef int ImGuiButtonFlags; // enum ImGuiButtonFlags_
49 typedef int ImGuiTreeNodeFlags; // enum ImGuiTreeNodeFlags_
50 typedef int ImGuiSliderFlags; // enum ImGuiSliderFlags_
51 typedef int ImGuiSeparatorFlags; // enum ImGuiSeparatorFlags_
52 typedef int ImGuiItemFlags; // enum ImGuiItemFlags_
53 
54 //-------------------------------------------------------------------------
55 // STB libraries
56 //-------------------------------------------------------------------------
57 
58 namespace ImGuiStb
59 {
60 
61 #undef STB_TEXTEDIT_STRING
62 #undef STB_TEXTEDIT_CHARTYPE
63 #define STB_TEXTEDIT_STRING ImGuiTextEditState
64 #define STB_TEXTEDIT_CHARTYPE ImWchar
65 #define STB_TEXTEDIT_GETWIDTH_NEWLINE -1.0f
66 #include "stb_textedit.h"
67 
68 } // namespace ImGuiStb
69 
70 //-----------------------------------------------------------------------------
71 // Context
72 //-----------------------------------------------------------------------------
73 
74 #ifndef GImGui
75 extern IMGUI_API ImGuiContext* GImGui; // Current implicit ImGui context pointer
76 #endif
77 
78 //-----------------------------------------------------------------------------
79 // Helpers
80 //-----------------------------------------------------------------------------
81 
82 #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR)))
83 #define IM_PI 3.14159265358979323846f
84 #define IM_OFFSETOF(_TYPE,_ELM) ((size_t)&(((_TYPE*)0)->_ELM))
85 
86 // Helpers: UTF-8 <> wchar
87 IMGUI_API int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count
88 IMGUI_API int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end); // return input UTF-8 bytes count
89 IMGUI_API int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_remaining = NULL); // return input UTF-8 bytes count
90 IMGUI_API int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end); // return number of UTF-8 code-points (NOT bytes count)
91 IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end); // return number of bytes to express string as UTF-8 code-points
92 
93 // Helpers: Misc
94 IMGUI_API ImU32 ImHash(const void* data, int data_size, ImU32 seed = 0); // Pass data_size==0 for zero-terminated strings
95 IMGUI_API void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, int* out_file_size = NULL, int padding_bytes = 0);
96 IMGUI_API FILE* ImFileOpen(const char* filename, const char* file_open_mode);
97 static inline bool ImCharIsSpace(int c) { return c == ' ' || c == '\t' || c == 0x3000; }
98 static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }
99 static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
100 
101 // Helpers: Geometry
102 IMGUI_API ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p);
103 IMGUI_API bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);
104 IMGUI_API ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);
105 IMGUI_API void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w);
106 
107 // Helpers: String
108 IMGUI_API int ImStricmp(const char* str1, const char* str2);
109 IMGUI_API int ImStrnicmp(const char* str1, const char* str2, int count);
110 IMGUI_API char* ImStrdup(const char* str);
111 IMGUI_API int ImStrlenW(const ImWchar* str);
112 IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin); // Find beginning-of-line
113 IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);
114 IMGUI_API int ImFormatString(char* buf, int buf_size, const char* fmt, ...) IM_FMTARGS(3);
115 IMGUI_API int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args) IM_FMTLIST(3);
116 
117 // Helpers: Math
118 // We are keeping those not leaking to the user by default, in the case the user has implicit cast operators between ImVec2 and its own types (when IM_VEC2_CLASS_EXTRA is defined)
119 #ifdef IMGUI_DEFINE_MATH_OPERATORS
120 static inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x*rhs, lhs.y*rhs); }
121 static inline ImVec2 operator/(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x/rhs, lhs.y/rhs); }
122 static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x+rhs.x, lhs.y+rhs.y); }
123 static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x-rhs.x, lhs.y-rhs.y); }
124 static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x*rhs.x, lhs.y*rhs.y); }
125 static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x/rhs.x, lhs.y/rhs.y); }
126 static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; }
127 static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; }
128 static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; }
129 static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; }
130 static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-rhs.w); }
131 #endif
132 
133 static inline int ImMin(int lhs, int rhs) { return lhs < rhs ? lhs : rhs; }
134 static inline int ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; }
135 static inline float ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; }
136 static inline float ImMax(float lhs, float rhs) { return lhs >= rhs ? lhs : rhs; }
137 static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(ImMin(lhs.x,rhs.x), ImMin(lhs.y,rhs.y)); }
138 static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(ImMax(lhs.x,rhs.x), ImMax(lhs.y,rhs.y)); }
139 static inline int ImClamp(int v, int mn, int mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
140 static inline float ImClamp(float v, float mn, float mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
141 static inline ImVec2 ImClamp(const ImVec2& f, const ImVec2& mn, ImVec2 mx) { return ImVec2(ImClamp(f.x,mn.x,mx.x), ImClamp(f.y,mn.y,mx.y)); }
142 static inline float ImSaturate(float f) { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }
143 static inline void ImSwap(float& a, float& b) { float tmp = a; a = b; b = tmp; }
144 static inline int ImLerp(int a, int b, float t) { return (int)(a + (b - a) * t); }
145 static inline float ImLerp(float a, float b, float t) { return a + (b - a) * t; }
146 static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }
147 static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }
148 static inline float ImLengthSqr(const ImVec2& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y; }
149 static inline float ImLengthSqr(const ImVec4& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y + lhs.z*lhs.z + lhs.w*lhs.w; }
150 static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; }
151 static inline float ImFloor(float f) { return (float)(int)f; }
152 static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)v.x, (float)(int)v.y); }
153 static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }
154 static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
155 
156 // We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
157 // Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
158 #ifdef IMGUI_DEFINE_PLACEMENT_NEW
159 struct ImPlacementNewDummy {};
160 inline void* operator new(size_t, ImPlacementNewDummy, void* ptr) { return ptr; }
161 inline void operator delete(void*, ImPlacementNewDummy, void*) {}
162 #define IM_PLACEMENT_NEW(_PTR) new(ImPlacementNewDummy(), _PTR)
163 #endif
164 
165 //-----------------------------------------------------------------------------
166 // Types
167 //-----------------------------------------------------------------------------
168 
170 {
171  ImGuiButtonFlags_Repeat = 1 << 0, // hold to repeat
172  ImGuiButtonFlags_PressedOnClickRelease = 1 << 1, // return true on click + release on same item [DEFAULT if no PressedOn* flag is set]
173  ImGuiButtonFlags_PressedOnClick = 1 << 2, // return true on click (default requires click+release)
174  ImGuiButtonFlags_PressedOnRelease = 1 << 3, // return true on release (default requires click+release)
175  ImGuiButtonFlags_PressedOnDoubleClick = 1 << 4, // return true on double-click (default requires click+release)
176  ImGuiButtonFlags_FlattenChilds = 1 << 5, // allow interactions even if a child window is overlapping
177  ImGuiButtonFlags_DontClosePopups = 1 << 6, // disable automatically closing parent popup on press // [UNUSED]
178  ImGuiButtonFlags_Disabled = 1 << 7, // disable interactions
179  ImGuiButtonFlags_AlignTextBaseLine = 1 << 8, // vertically align button to match text baseline - ButtonEx() only
180  ImGuiButtonFlags_NoKeyModifiers = 1 << 9, // disable interaction if a key modifier is held
181  ImGuiButtonFlags_AllowOverlapMode = 1 << 10 // require previous frame HoveredId to either match id or be null before being usable
182 };
183 
185 {
187 };
188 
190 {
191  // Default: 0
192  ImGuiColumnsFlags_NoBorder = 1 << 0, // Disable column dividers
193  ImGuiColumnsFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers
194  ImGuiColumnsFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns
195  ImGuiColumnsFlags_NoForceWithinWindow = 1 << 3 // Disable forcing columns to fit within window
196 };
197 
199 {
200  // NB: need to be in sync with last value of ImGuiSelectableFlags_
205 };
206 
208 {
209  ImGuiSeparatorFlags_Horizontal = 1 << 0, // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar
211 };
212 
213 // FIXME: this is in development, not exposed/functional as a generic feature yet.
215 {
218 };
219 
221 {
224 };
225 
227 {
231 };
232 
234 {
240 };
241 
243 {
244  ImGuiCorner_TopLeft = 1 << 0, // 1
245  ImGuiCorner_TopRight = 1 << 1, // 2
246  ImGuiCorner_BotRight = 1 << 2, // 4
247  ImGuiCorner_BotLeft = 1 << 3, // 8
249 };
250 
251 // 2D axis aligned bounding-box
252 // NB: we can't rely on ImVec2 math operators being available here
254 {
255  ImVec2 Min; // Upper-left
256  ImVec2 Max; // Lower-right
257 
258  ImRect() : Min(FLT_MAX,FLT_MAX), Max(-FLT_MAX,-FLT_MAX) {}
259  ImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {}
260  ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {}
261  ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {}
262 
263  ImVec2 GetCenter() const { return ImVec2((Min.x+Max.x)*0.5f, (Min.y+Max.y)*0.5f); }
264  ImVec2 GetSize() const { return ImVec2(Max.x-Min.x, Max.y-Min.y); }
265  float GetWidth() const { return Max.x-Min.x; }
266  float GetHeight() const { return Max.y-Min.y; }
267  ImVec2 GetTL() const { return Min; } // Top-left
268  ImVec2 GetTR() const { return ImVec2(Max.x, Min.y); } // Top-right
269  ImVec2 GetBL() const { return ImVec2(Min.x, Max.y); } // Bottom-left
270  ImVec2 GetBR() const { return Max; } // Bottom-right
271  bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; }
272  bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x < Max.x && r.Max.y < Max.y; }
273  bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; }
274  void Add(const ImVec2& rhs) { if (Min.x > rhs.x) Min.x = rhs.x; if (Min.y > rhs.y) Min.y = rhs.y; if (Max.x < rhs.x) Max.x = rhs.x; if (Max.y < rhs.y) Max.y = rhs.y; }
275  void Add(const ImRect& rhs) { if (Min.x > rhs.Min.x) Min.x = rhs.Min.x; if (Min.y > rhs.Min.y) Min.y = rhs.Min.y; if (Max.x < rhs.Max.x) Max.x = rhs.Max.x; if (Max.y < rhs.Max.y) Max.y = rhs.Max.y; }
276  void Expand(const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; }
277  void Expand(const ImVec2& amount) { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; }
278  void Translate(const ImVec2& v) { Min.x += v.x; Min.y += v.y; Max.x += v.x; Max.y += v.y; }
279  void ClipWith(const ImRect& clip) { if (Min.x < clip.Min.x) Min.x = clip.Min.x; if (Min.y < clip.Min.y) Min.y = clip.Min.y; if (Max.x > clip.Max.x) Max.x = clip.Max.x; if (Max.y > clip.Max.y) Max.y = clip.Max.y; }
280  void Floor() { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; }
281  ImVec2 GetClosestPoint(ImVec2 p, bool on_edge) const
282  {
283  if (!on_edge && Contains(p))
284  return p;
285  if (p.x > Max.x) p.x = Max.x;
286  else if (p.x < Min.x) p.x = Min.x;
287  if (p.y > Max.y) p.y = Max.y;
288  else if (p.y < Min.y) p.y = Min.y;
289  return p;
290  }
291 };
292 
293 // Stacked color modifier, backup of modified data so we can restore it
295 {
298 };
299 
300 // Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable.
302 {
304  union { int BackupInt[2]; float BackupFloat[2]; };
305  ImGuiStyleMod(ImGuiStyleVar idx, int v) { VarIdx = idx; BackupInt[0] = v; }
306  ImGuiStyleMod(ImGuiStyleVar idx, float v) { VarIdx = idx; BackupFloat[0] = v; }
307  ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; }
308 };
309 
310 // Stacked data for BeginGroup()/EndGroup()
312 {
322 };
323 
324 // Per column data for Columns()
326 {
327  float OffsetNorm; // Column start offset, normalized 0.0 (far left) -> 1.0 (far right)
329  //float IndentX;
330 };
331 
332 // Simple column measurement currently used for MenuItem() only. This is very short-sighted/throw-away code and NOT a generic helper.
334 {
335  int Count;
336  float Spacing;
337  float Width, NextWidth;
338  float Pos[8], NextWidths[8];
339 
341  void Update(int count, float spacing, bool clear);
342  float DeclColumns(float w0, float w1, float w2);
343  float CalcExtraSpace(float avail_w);
344 };
345 
346 // Internal state of the currently focused/edited text input box
348 {
349  ImGuiID Id; // widget id owning the text state
350  ImVector<ImWchar> Text; // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer.
351  ImVector<char> InitialText; // backup of end-user buffer at the time of focus (in UTF-8, unaltered)
353  int CurLenA, CurLenW; // we need to maintain our buffer length in both UTF-8 and wchar format.
354  int BufSizeA; // end-user buffer size
355  float ScrollX;
356  ImGuiStb::STB_TexteditState StbState;
357  float CursorAnim;
360 
361  ImGuiTextEditState() { memset(this, 0, sizeof(*this)); }
362  void CursorAnimReset() { CursorAnim = -0.30f; } // After a user-input the cursor stays on for a while without blinking
363  void CursorClamp() { StbState.cursor = ImMin(StbState.cursor, CurLenW); StbState.select_start = ImMin(StbState.select_start, CurLenW); StbState.select_end = ImMin(StbState.select_end, CurLenW); }
364  bool HasSelection() const { return StbState.select_start != StbState.select_end; }
365  void ClearSelection() { StbState.select_start = StbState.select_end = StbState.cursor; }
366  void SelectAll() { StbState.select_start = 0; StbState.select_end = CurLenW; StbState.cursor = StbState.select_end; StbState.has_preferred_x = false; }
367  void OnKeyPressed(int key);
368 };
369 
370 // Data saved in imgui.ini file
372 {
373  char* Name;
377  bool Collapsed;
378 };
379 
380 // Mouse cursor data (used when io.MouseDrawCursor is set)
382 {
386  ImVec2 TexUvMin[2];
387  ImVec2 TexUvMax[2];
388 };
389 
390 // Storage for current popup stack
392 {
393  ImGuiID PopupId; // Set on OpenPopup()
394  ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
395  ImGuiWindow* ParentWindow; // Set on OpenPopup()
396  ImGuiID ParentMenuSet; // Set on OpenPopup()
397  ImVec2 MousePosOnOpen; // Copy of mouse position at the time of opening popup
398 
399  ImGuiPopupRef(ImGuiID id, ImGuiWindow* parent_window, ImGuiID parent_menu_set, const ImVec2& mouse_pos) { PopupId = id; Window = NULL; ParentWindow = parent_window; ParentMenuSet = parent_menu_set; MousePosOnOpen = mouse_pos; }
400 };
401 
402 // Main state for ImGui
404 {
408  ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()
409  float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.
410  float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.
411  ImVec2 FontTexUvWhitePixel; // (Shortcut) == Font->TexUvWhitePixel
412 
413  float Time;
420  ImGuiWindow* CurrentWindow; // Being drawn into
421  ImGuiWindow* NavWindow; // Nav/focused window for navigation
422  ImGuiWindow* HoveredWindow; // Will catch mouse inputs
423  ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only)
424  ImGuiID HoveredId; // Hovered widget
427  ImGuiID ActiveId; // Active widget
429  bool ActiveIdIsAlive; // Active widget has been seen this frame
430  bool ActiveIdIsJustActivated; // Set at the time of activation for one frame
431  bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
432 
433  ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
435  ImGuiWindow* MovedWindow; // Track the child window we clicked on to move a window.
436  ImGuiID MovedWindowMoveId; // == MovedWindow->RootWindow->MoveId
438  float SettingsDirtyTimer; // Save .ini Settings on disk when time reaches zero
439  ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
440  ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
441  ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont()
442  ImVector<ImGuiPopupRef> OpenPopupStack; // Which popups are open (persistent)
443  ImVector<ImGuiPopupRef> CurrentPopupStack; // Which level of BeginPopup() we are in (reset every frame)
444 
445  // Storage for SetNexWindow** and SetNextTreeNode*** functions
455  ImRect SetNextWindowSizeConstraintRect; // Valid if 'SetNextWindowSizeConstraint' is true
462 
463  // Render
464  ImDrawData RenderDrawData; // Main ImDrawData instance to pass render information to the user
465  ImVector<ImDrawList*> RenderDrawLists[3];
467  ImDrawList OverlayDrawList; // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays
470 
471  // Widget state
474  ImGuiID ScalarAsInputTextId; // Temporary text input when CTRL+clicking on a slider, etc.
475  ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
477  float DragCurrentValue; // Currently dragged value, always float, not rounded by end-user precision settings
479  float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
482  ImVec2 ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
484  ImVector<char> PrivateClipboard; // If no custom clipboard handler is defined
485  ImVec2 OsImePosRequest, OsImePosSet; // Cursor position request & last passed to the OS Input Method Editor
486 
487  // Logging
489  FILE* LogFile; // If != NULL log to stdout/ file
490  ImGuiTextBuffer* LogClipboard; // Else log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
493 
494  // Misc
495  float FramerateSecPerFrame[120]; // calculate estimate of framerate for user
498  int WantCaptureMouseNextFrame; // explicit capture via CaptureInputs() sets those flags
501  char TempBuffer[1024*3+1]; // temporary text buffer
502 
504  {
505  Initialized = false;
506  Font = NULL;
507  FontSize = FontBaseSize = 0.0f;
508  FontTexUvWhitePixel = ImVec2(0.0f, 0.0f);
509 
510  Time = 0.0f;
511  FrameCount = 0;
512  FrameCountEnded = FrameCountRendered = -1;
513  CurrentWindow = NULL;
514  NavWindow = NULL;
515  HoveredWindow = NULL;
516  HoveredRootWindow = NULL;
517  HoveredId = 0;
518  HoveredIdAllowOverlap = false;
519  HoveredIdPreviousFrame = 0;
520  ActiveId = 0;
521  ActiveIdPreviousFrame = 0;
522  ActiveIdIsAlive = false;
523  ActiveIdIsJustActivated = false;
524  ActiveIdAllowOverlap = false;
525  ActiveIdClickOffset = ImVec2(-1,-1);
526  ActiveIdWindow = NULL;
527  MovedWindow = NULL;
528  MovedWindowMoveId = 0;
529  SettingsDirtyTimer = 0.0f;
530 
531  SetNextWindowPosVal = ImVec2(0.0f, 0.0f);
532  SetNextWindowSizeVal = ImVec2(0.0f, 0.0f);
533  SetNextWindowCollapsedVal = false;
534  SetNextWindowPosCond = 0;
535  SetNextWindowSizeCond = 0;
536  SetNextWindowContentSizeCond = 0;
537  SetNextWindowCollapsedCond = 0;
538  SetNextWindowSizeConstraintRect = ImRect();
539  SetNextWindowSizeConstraintCallback = NULL;
540  SetNextWindowSizeConstraintCallbackUserData = NULL;
541  SetNextWindowSizeConstraint = false;
542  SetNextWindowFocus = false;
543  SetNextTreeNodeOpenVal = false;
544  SetNextTreeNodeOpenCond = 0;
545 
546  ScalarAsInputTextId = 0;
547  ColorEditOptions = ImGuiColorEditFlags__OptionsDefault;
548  DragCurrentValue = 0.0f;
549  DragLastMouseDelta = ImVec2(0.0f, 0.0f);
550  DragSpeedDefaultRatio = 1.0f / 100.0f;
551  DragSpeedScaleSlow = 1.0f / 100.0f;
552  DragSpeedScaleFast = 10.0f;
553  ScrollbarClickDeltaToGrabCenter = ImVec2(0.0f, 0.0f);
554  TooltipOverrideCount = 0;
555  OsImePosRequest = OsImePosSet = ImVec2(-1.0f, -1.0f);
556 
557  ModalWindowDarkeningRatio = 0.0f;
558  OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
559  MouseCursor = ImGuiMouseCursor_Arrow;
560  memset(MouseCursorData, 0, sizeof(MouseCursorData));
561 
562  LogEnabled = false;
563  LogFile = NULL;
564  LogClipboard = NULL;
565  LogStartDepth = 0;
566  LogAutoExpandMaxDepth = 2;
567 
568  memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
569  FramerateSecPerFrameIdx = 0;
570  FramerateSecPerFrameAccum = 0.0f;
571  WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1;
572  memset(TempBuffer, 0, sizeof(TempBuffer));
573  }
574 };
575 
576 // Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().
578 {
580  ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
581  //ImGuiItemFlags_Disabled = 1 << 2, // false // All widgets appears are disabled
582  //ImGuiItemFlags_AllowNavDefaultFocus = 1 << 3, // true
583  ImGuiItemFlags_SelectableDontClosePopup = 1 << 4, // false // MenuItem/Selectable() automatically closes current Popup window
585 };
586 
587 // Transient per-window data, reset at the beginning of the frame
588 // FIXME: That's theory, in practice the delimitation between ImGuiWindow and ImGuiDrawContext is quite tenuous and could be reconsidered.
590 {
594  ImVec2 CursorMaxPos; // Implicitly calculate the size of our contents, always extending. Saved into window->SizeContents at the end of the frame
599  float LogLinePosY;
609 
610  // We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
611  ImGuiItemFlags ItemFlags; // == ItemFlagsStack.back() [empty == ImGuiItemFlags_Default]
612  float ItemWidth; // == ItemWidthStack.back(). 0.0: default, >0.0: width in pixels, <0.0: align xx pixels to the right of window
613  float TextWrapPos; // == TextWrapPosStack.back() [empty == -1.0f]
618  int StackSizesBackup[6]; // Store size of various stacks for asserting
619 
620  float IndentX; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
622  float ColumnsOffsetX; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
625  float ColumnsMinX;
626  float ColumnsMaxX;
628  float ColumnsStartMaxPosX; // Backup of CursorMaxPos
634 
636  {
637  CursorPos = CursorPosPrevLine = CursorStartPos = CursorMaxPos = ImVec2(0.0f, 0.0f);
638  CurrentLineHeight = PrevLineHeight = 0.0f;
639  CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;
640  LogLinePosY = -1.0f;
641  TreeDepth = 0;
642  LastItemId = 0;
643  LastItemRect = ImRect();
644  LastItemRectHoveredRect = false;
645  MenuBarAppending = false;
646  MenuBarOffsetX = 0.0f;
647  StateStorage = NULL;
648  LayoutType = ImGuiLayoutType_Vertical;
649  ItemWidth = 0.0f;
650  ItemFlags = ImGuiItemFlags_Default_;
651  TextWrapPos = -1.0f;
652  memset(StackSizesBackup, 0, sizeof(StackSizesBackup));
653 
654  IndentX = 0.0f;
655  GroupOffsetX = 0.0f;
656  ColumnsOffsetX = 0.0f;
657  ColumnsCurrent = 0;
658  ColumnsCount = 1;
659  ColumnsMinX = ColumnsMaxX = 0.0f;
660  ColumnsStartPosY = 0.0f;
661  ColumnsStartMaxPosX = 0.0f;
662  ColumnsCellMinY = ColumnsCellMaxY = 0.0f;
663  ColumnsFlags = 0;
664  ColumnsSetId = 0;
665  }
666 };
667 
668 // Windows data
670 {
671  char* Name;
672  ImGuiID ID; // == ImHash(Name)
673  ImGuiWindowFlags Flags; // See enum ImGuiWindowFlags_
674  int OrderWithinParent; // Order within immediate parent window, if we are a child window. Otherwise 0.
676  ImVec2 Pos; // Position rounded-up to nearest pixel
677  ImVec2 Size; // Current size (==SizeFull or collapsed title bar size)
678  ImVec2 SizeFull; // Size when non collapsed
679  ImVec2 SizeContents; // Size of contents (== extents reach of the drawing cursor) from previous frame
680  ImVec2 SizeContentsExplicit; // Size of contents explicitly set by the user via SetNextWindowContentSize()
681  ImRect ContentsRegionRect; // Maximum visible content position in window coordinates. ~~ (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis
682  ImVec2 WindowPadding; // Window padding at the time of begin. We need to lock it, in particular manipulation of the ShowBorder would have an effect
683  ImGuiID MoveId; // == window->GetID("#MOVE")
685  ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
686  ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
687  bool ScrollbarX, ScrollbarY;
689  float BorderSize;
690  bool Active; // Set to true on Begin()
691  bool WasActive;
692  bool Accessed; // Set to true when any widget access the current window
693  bool Collapsed; // Set when collapsing window to become only title-bar
694  bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed)
695  bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
696  int BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
697  ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)
698  int AutoFitFramesX, AutoFitFramesY;
703  ImGuiCond SetWindowPosAllowFlags; // store condition flags for next SetWindowPos() call.
704  ImGuiCond SetWindowSizeAllowFlags; // store condition flags for next SetWindowSize() call.
705  ImGuiCond SetWindowCollapsedAllowFlags; // store condition flags for next SetWindowCollapsed() call.
706  ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
707  ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right.
708 
709  ImGuiDrawContext DC; // Temporary per-window data, reset at the beginning of the frame
710  ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
711  ImRect ClipRect; // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
712  ImRect WindowRectClipped; // = WindowRect just after setup in Begin(). == window->Rect() for root window.
715  ImGuiSimpleColumns MenuColumns; // Simplified columns storage for menu items
717  float FontWindowScale; // Scale multiplier per-window
719  ImGuiWindow* ParentWindow; // Immediate parent in the window stack *regardless* of whether this window is a child window or not)
720  ImGuiWindow* RootWindow; // Generally point to ourself. If we are a child window, this is pointing to the first non-child parent window.
721  ImGuiWindow* RootNonPopupWindow; // Generally point to ourself. Used to display TitleBgActive color and for selecting which window to use for NavWindowing
722 
723  // Navigation / Focus
724  int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister()
725  int FocusIdxTabCounter; // (same, but only count widgets which you can Tab through)
726  int FocusIdxAllRequestCurrent; // Item being requested for focus
727  int FocusIdxTabRequestCurrent; // Tab-able item being requested for focus
728  int FocusIdxAllRequestNext; // Item being requested for focus, for next update (relies on layout to be stable between the frame pressing TAB and the next frame)
730 
731 public:
732  ImGuiWindow(const char* name);
733  ~ImGuiWindow();
734 
735  ImGuiID GetID(const char* str, const char* str_end = NULL);
736  ImGuiID GetID(const void* ptr);
737  ImGuiID GetIDNoKeepAlive(const char* str, const char* str_end = NULL);
738 
739  ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x+Size.x, Pos.y+Size.y); }
740  float CalcFontSize() const { return GImGui->FontBaseSize * FontWindowScale; }
741  float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f; }
742  ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); }
743  float MenuBarHeight() const { return (Flags & ImGuiWindowFlags_MenuBar) ? CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f : 0.0f; }
744  ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }
745 };
746 
747 //-----------------------------------------------------------------------------
748 // Internal API
749 // No guarantee of forward compatibility here.
750 //-----------------------------------------------------------------------------
751 
752 namespace ImGui
753 {
754  // We should always have a CurrentWindow in the stack (there is an implicit "Debug" window)
755  // If this ever crash because g.CurrentWindow is NULL it means that either
756  // - ImGui::NewFrame() has never been called, which is illegal.
757  // - You are calling ImGui functions after ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
761  IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
762  IMGUI_API void FocusWindow(ImGuiWindow* window);
763 
764  IMGUI_API void Initialize();
765  IMGUI_API void EndFrame(); // Ends the ImGui frame. Automatically called by Render()! you most likely don't need to ever call that yourself directly. If you don't need to render you can call EndFrame() but you'll have wasted CPU already. If you don't need to render, don't create any windows instead!
766 
767  IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window);
768  IMGUI_API void ClearActiveID();
769  IMGUI_API void SetHoveredID(ImGuiID id);
770  IMGUI_API void KeepAliveID(ImGuiID id);
771 
772  IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);
773  IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f);
774  IMGUI_API bool ItemAdd(const ImRect& bb, const ImGuiID* id);
775  IMGUI_API bool IsClippedEx(const ImRect& bb, const ImGuiID* id, bool clip_even_when_logged);
776  IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
777  IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested
779  IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y);
780  IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
781  IMGUI_API void PushMultiItemsWidths(int components, float width_full = 0.0f);
782  IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
783  IMGUI_API void PopItemFlag();
784 
785  IMGUI_API void OpenPopupEx(ImGuiID id, bool reopen_existing);
786  IMGUI_API void ClosePopup(ImGuiID id);
787  IMGUI_API bool IsPopupOpen(ImGuiID id);
788  IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
789 
790  IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
791 
792  IMGUI_API void VerticalSeparator(); // Vertical separator, for menu bars (use current line height). not exposed because it is misleading what it doesn't have an effect on regular layout.
793 
794  // FIXME-WIP: New Columns API
795  IMGUI_API void BeginColumns(const char* id, int count, ImGuiColumnsFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().
796  IMGUI_API void EndColumns(); // close columns
797  IMGUI_API void PushColumnClipRect(int column_index = -1);
798 
799  // FIXME-WIP: New Combo API
800  IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImVec2 popup_size = ImVec2(0.0f,0.0f));
801  IMGUI_API void EndCombo();
802 
803  // NB: All position are in absolute pixels coordinates (never using window coordinates internally)
804  // AVOID USING OUTSIDE OF IMGUI.CPP! NOT FOR PUBLIC CONSUMPTION. THOSE FUNCTIONS ARE A MESS. THEIR SIGNATURE AND BEHAVIOR WILL CHANGE, THEY NEED TO BE REFACTORED INTO SOMETHING DECENT.
805  IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true);
806  IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);
807  IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0,0), const ImRect* clip_rect = NULL);
808  IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
809  IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding = 0.0f);
810  IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, int rounding_corners_flags = ~0);
811  IMGUI_API void RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale = 1.0f);
812  IMGUI_API void RenderBullet(ImVec2 pos);
813  IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col);
814  IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
815  IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.
816 
817  IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
818  IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
819  IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
820 
821  IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags = 0);
822  IMGUI_API bool SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power);
823  IMGUI_API bool SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* display_format);
824 
825  IMGUI_API bool DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power);
826  IMGUI_API bool DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* display_format, float power);
827  IMGUI_API bool DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* display_format);
828 
829  IMGUI_API bool InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
830  IMGUI_API bool InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags);
831  IMGUI_API bool InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags);
832  IMGUI_API bool InputScalarEx(const char* label, ImGuiDataType data_type, void* data_ptr, void* step_ptr, void* step_fast_ptr, const char* scalar_format, ImGuiInputTextFlags extra_flags);
833  IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiDataType data_type, void* data_ptr, ImGuiID id, int decimal_precision);
834 
835  IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);
836  IMGUI_API void ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags);
837 
838  IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
839  IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0); // Consume previous SetNextTreeNodeOpened() data, if any. May return true when logging
841 
842  IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size);
843 
844  IMGUI_API int ParseFormatPrecision(const char* fmt, int default_value);
845  IMGUI_API float RoundScalar(float value, int decimal_precision);
846 
847 } // namespace ImGui
848 
849 // ImFontAtlas internals
852 IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent);
855 IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor);
856 IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride);
857 
858 #ifdef __clang__
859 #pragma clang diagnostic pop
860 #endif
861 
862 #ifdef _MSC_VER
863 #pragma warning (pop)
864 #endif
IMGUI_API bool BeginCombo(const char *label, const char *preview_value, ImVec2 popup_size=ImVec2(0.0f, 0.0f))
Definition: imgui.cpp:8622
ImGuiCol Col
void Add(const ImVec2 &rhs)
ImRect SetNextWindowSizeConstraintRect
ImVec2 BackupCursorPos
IMGUI_API bool SliderBehavior(const ImRect &frame_bb, ImGuiID id, float *v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags=0)
Definition: imgui.cpp:6629
ImGuiWindow * RootNonPopupWindow
int FocusIdxTabRequestNext
ImGuiCond SetNextWindowCollapsedCond
int FocusIdxTabCounter
bool HasSelection() const
unsigned int ImU32
Definition: imgui.h:66
IMGUI_API void RenderText(ImVec2 pos, const char *text, const char *text_end=NULL, bool hide_text_after_hash=true)
Definition: imgui.cpp:2923
ImRect WindowRectClipped
ImGuiSeparatorFlags_
ImGuiCond SetWindowPosAllowFlags
ImVec2 GetCenter() const
bool ActiveIdIsJustActivated
bool Contains(const ImRect &r) const
ImVec2 GetBR() const
ImRect TitleBarRect() const
ImGuiCond SetNextTreeNodeOpenCond
float ModalWindowDarkeningRatio
IMGUI_API int ImFormatStringV(char *buf, int buf_size, const char *fmt, va_list args) IM_FMTLIST(3)
Definition: imgui.cpp:973
ImGuiWindow * ParentWindow
IMGUI_API void PushColumnClipRect(int column_index=-1)
Definition: imgui.cpp:10226
ImVec2 ActiveIdClickOffset
IMGUI_API void ColorEditOptionsPopup(const float *col, ImGuiColorEditFlags flags)
Definition: imgui.cpp:9285
IMGUI_API float RoundScalar(float value, int decimal_precision)
Definition: imgui.cpp:6586
IMGUI_API bool IsPopupOpen(ImGuiID id)
Definition: imgui.cpp:3621
ImVector< ImWchar > Text
ImGuiStyleMod(ImGuiStyleVar idx, int v)
IMGUI_API const char * FindRenderedTextEnd(const char *text, const char *text_end=NULL)
Definition: imgui.cpp:2838
int WantCaptureMouseNextFrame
#define IM_FMTLIST(FMT)
Definition: imgui.h:39
IMGUI_API void PopItemFlag()
Definition: imgui.cpp:4785
ImGuiLayoutType LayoutType
ImVec2 SetNextWindowContentSizeVal
float FontWindowScale
Definition: imgui.h:96
ImVec2 MousePosOnOpen
bool SetNextWindowCollapsedVal
ImGuiMouseCursor Type
int TooltipOverrideCount
IMGUI_API void PushMultiItemsWidths(int components, float width_full=0.0f)
Definition: imgui.cpp:4705
IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding=0.0f)
Definition: imgui.cpp:3021
bool ActiveIdAllowOverlap
IMGUI_API void Initialize()
Definition: imgui.cpp:2402
ImVec2 ScrollbarClickDeltaToGrabCenter
int FramerateSecPerFrameIdx
IMGUI_API void SetHoveredID(ImGuiID id)
Definition: imgui.cpp:1887
ImGuiID HoveredId
#define IM_FMTARGS(FMT)
Definition: imgui.h:38
ImDrawList OverlayDrawList
int FocusIdxAllRequestCurrent
bool BackupActiveIdIsAlive
int ImGuiTreeNodeFlags
Definition: imgui.h:83
IMGUI_API int ImStrnicmp(const char *str1, const char *str2, int count)
Definition: imgui.cpp:889
IMGUI_API bool FocusableItemRegister(ImGuiWindow *window, ImGuiID id, bool tab_stop=true)
Definition: imgui.cpp:2022
ImVector< ImGuiIniData > Settings
int ImGuiColorEditFlags
Definition: imgui.h:76
ImGuiID MovedWindowMoveId
float TitleBarHeight() const
int ImGuiLayoutType
int(* ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data)
Definition: imgui.h:84
float FramerateSecPerFrameAccum
ImVector< ImGuiItemFlags > ItemFlagsStack
IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char *pixels, int x, int y, int w, int h, int stride)
IMGUI_API int ImTextStrToUtf8(char *buf, int buf_size, const ImWchar *in_text, const ImWchar *in_text_end)
Definition: imgui.cpp:1173
ImGuiID MoveId
ImVec2 SetNextWindowSizeVal
ImGuiButtonFlags_
ImGuiColumnsFlags ColumnsFlags
float BackupCurrentLineTextBaseOffset
ImVec2 SetWindowPosVal
ImVec2 SetNextWindowPosVal
ImGuiStorage StateStorage
ImGuiItemFlags ItemFlags
bool SetNextWindowFocus
ImGuiPlotType
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char *label, const char *label_end=NULL)
Definition: imgui.cpp:6075
IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas *atlas, ImFont *font, ImFontConfig *font_config, float ascent, float descent)
IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor)
int ImGuiItemFlags
IMGUI_API int ImStrlenW(const ImWchar *str)
Definition: imgui.cpp:910
IMGUI_API ImVec2 ImTriangleClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
Definition: imgui.cpp:866
ImGuiPopupRef(ImGuiID id, ImGuiWindow *parent_window, ImGuiID parent_menu_set, const ImVec2 &mouse_pos)
ImGuiColorEditFlags ColorEditOptions
IMGUI_API void ClosePopup(ImGuiID id)
Definition: imgui.cpp:3554
ImVector< ImGuiWindow * > CurrentWindowStack
ImVector< ImFont * > FontStack
IMGUI_API bool DragBehavior(const ImRect &frame_bb, ImGuiID id, float *v, float v_speed, float v_min, float v_max, int decimal_precision, float power)
Definition: imgui.cpp:6961
IMGUI_API void BeginColumns(const char *id, int count, ImGuiColumnsFlags flags=0)
Definition: imgui.cpp:10235
ImDrawList * DrawList
ImVec2 SetWindowPosPivot
ImGuiDrawContext DC
ImRect Rect() const
ImGuiTextBuffer * LogClipboard
unsigned short ImWchar
Definition: imgui.h:71
IMGUI_API void ItemSize(const ImRect &bb, float text_offset_y=0.0f)
Definition: imgui.cpp:1941
int ImGuiCond
Definition: imgui.h:79
IMGUI_API bool IsClippedEx(const ImRect &bb, const ImGuiID *id, bool clip_even_when_logged)
Definition: imgui.cpp:2011
int ImGuiInputTextFlags
Definition: imgui.h:81
ImGuiID ActiveId
ImDrawData RenderDrawData
ImRect MenuBarRect() const
ImGuiCond SetNextWindowSizeCond
ImGuiSimpleColumns MenuColumns
IMGUI_API void RenderRectFilledRangeH(ImDrawList *draw_list, const ImRect &rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding)
bool SetNextTreeNodeOpenVal
IMGUI_API FILE * ImFileOpen(const char *filename, const char *file_open_mode)
Definition: imgui.cpp:1306
float CurrentLineTextBaseOffset
float DragSpeedDefaultRatio
IMGUI_API ImU32 ImHash(const void *data, int data_size, ImU32 seed=0)
Definition: imgui.cpp:985
IMGUI_API bool ItemAdd(const ImRect &bb, const ImGuiID *id)
Definition: imgui.cpp:1949
ImVector< ImGuiWindow * > Windows
int WantTextInputNextFrame
int ImGuiWindowFlags
Definition: imgui.h:78
#define IMGUI_API
Definition: imgui.h:24
ImRect(const ImVec4 &v)
ImVec2 SizeContentsExplicit
ImGuiStb::STB_TexteditState StbState
IMGUI_API void KeepAliveID(ImGuiID id)
Definition: imgui.cpp:1894
void Expand(const float amount)
IMGUI_API void * ImFileLoadToMemory(const char *filename, const char *file_open_mode, int *out_file_size=NULL, int padding_bytes=0)
Definition: imgui.cpp:1324
ImVector< char > TempTextBuffer
float w
Definition: imgui.h:108
ImFont InputTextPasswordFont
IMGUI_API bool SliderIntN(const char *label, int *v, int components, int v_min, int v_max, const char *display_format)
Definition: imgui.cpp:6919
ImGuiTextEditState InputTextState
IMGUI_API void ColorTooltip(const char *text, const float *col, ImGuiColorEditFlags flags)
Definition: imgui.cpp:9145
IMGUI_API void TreePushRawID(ImGuiID id)
Definition: imgui.cpp:10402
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled)
Definition: imgui.cpp:4775
ImGuiWindow * RootWindow
ImVector< ImGuiColMod > ColorModifiers
ImGuiWindow * MovedWindow
IMGUI_API int ImStricmp(const char *str1, const char *str2)
Definition: imgui.cpp:882
ImVec2 Max
const char * _OwnerName
Definition: imgui.h:1235
void ClipWith(const ImRect &clip)
IMGUI_API bool InputIntN(const char *label, int *v, int components, ImGuiInputTextFlags extra_flags)
Definition: imgui.cpp:8530
float ItemWidthDefault
IMGUI_API void FocusWindow(ImGuiWindow *window)
Definition: imgui.cpp:4666
ImGuiWindow * ActiveIdWindow
IMGUI_API bool ImTriangleContainsPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
Definition: imgui.cpp:847
bool AutoFitOnlyGrows
ImVector< ImGuiStyleMod > StyleModifiers
bool Contains(const ImVec2 &p) const
ImRect ContentsRegionRect
int ImGuiStyleVar
Definition: imgui.h:74
ImGuiID HoveredIdPreviousFrame
void(* ImGuiSizeConstraintCallback)(ImGuiSizeConstraintCallbackData *data)
Definition: imgui.h:85
void Translate(const ImVec2 &v)
IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect &aabb, const char *label, ImGuiDataType data_type, void *data_ptr, ImGuiID id, int decimal_precision)
Definition: imgui.cpp:6532
float GetWidth() const
ImVec2 OsImePosSet
float z
Definition: imgui.h:108
IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas *atlas)
ImVec2 WindowPadding
ImGuiID ActiveIdPreviousFrame
IMGUI_API void VerticalSeparator()
Definition: imgui.cpp:9932
ImGuiCond SetNextWindowContentSizeCond
IMGUI_API void EndCombo()
Definition: imgui.cpp:8698
float GetHeight() const
unsigned int ImGuiID
Definition: imgui.h:70
float CalcFontSize() const
IMGUI_API void ImTriangleBarycentricCoords(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p, float &out_u, float &out_v, float &out_w)
Definition: imgui.cpp:855
ImVec2 ScrollTargetCenterRatio
ImGuiWindow * HoveredRootWindow
int FocusIdxTabRequestCurrent
IMGUI_API ImGuiWindow * GetParentWindow()
Definition: imgui.cpp:1865
IMGUI_API int ImTextStrFromUtf8(ImWchar *buf, int buf_size, const char *in_text, const char *in_text_end, const char **in_remaining=NULL)
Definition: imgui.cpp:1092
IMGUI_API void FocusableItemUnregister(ImGuiWindow *window)
Definition: imgui.cpp:2046
ImRect(float x1, float y1, float x2, float y2)
Definition: imgui.h:106
ImVec4 BackupValue
ImGuiDir
ImVector< ImGuiColumnData > ColumnsData
float DragSpeedScaleSlow
int ImGuiSliderFlags
IMGUI_API void RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale=1.0f)
Definition: imgui.cpp:3032
ImVec2 GetTL() const
ImGuiID ScalarAsInputTextId
int ImGuiMouseCursor
Definition: imgui.h:77
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding=0.0f, int rounding_corners_flags=~0)
Definition: imgui.cpp:9180
float PrevLineTextBaseOffset
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col)
Definition: imgui.cpp:3065
ImGuiCorner
ImGuiWindow * ParentWindow
ImGuiSelectableFlagsPrivate_
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char *text, const char *text_end, float wrap_width)
Definition: imgui.cpp:2950
IMGUI_API void RenderBullet(ImVec2 pos)
Definition: imgui.cpp:3059
float x
Definition: imgui.h:108
ImRect(const ImVec2 &min, const ImVec2 &max)
ImGuiItemFlags_
ImVector< ImGuiPopupRef > OpenPopupStack
IMGUI_API bool ButtonEx(const char *label, const ImVec2 &size_arg=ImVec2(0, 0), ImGuiButtonFlags flags=0)
Definition: imgui.cpp:5761
ImVector< char > PrivateClipboard
IMGUI_API int ImFormatString(char *buf, int buf_size, const char *fmt,...) IM_FMTARGS(3)
Definition: imgui.cpp:960
ImGuiCond SetWindowCollapsedAllowFlags
IMGUI_API bool SliderFloatN(const char *label, float *v, int components, float v_min, float v_max, const char *display_format, float power)
Definition: imgui.cpp:6877
float BackupGroupOffsetX
float SettingsDirtyTimer
ImGuiWindow * CurrentWindow
float y
Definition: imgui.h:98
ImGuiStyle Style
IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar *in_text, const ImWchar *in_text_end)
Definition: imgui.cpp:1189
ImGuiSizeConstraintCallback SetNextWindowSizeConstraintCallback
ImVec2 FramePadding
Definition: imgui.h:753
int ImGuiSeparatorFlags
ImGuiCond SetNextWindowPosCond
int LogAutoExpandMaxDepth
IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas *atlas, void *spc)
bool SetNextWindowSizeConstraint
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border=true, float rounding=0.0f)
Definition: imgui.cpp:3009
ImGuiWindowFlags Flags
ImVec2 GetTR() const
ImGuiColumnsFlags_
IMGUI_API const ImWchar * ImStrbolW(const ImWchar *buf_mid_line, const ImWchar *buf_begin)
Definition: imgui.cpp:917
ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v)
IMGUI_API ImGuiWindow * FindWindowByName(const char *name)
Definition: imgui.cpp:3834
ImVec2 SetNextWindowPosPivot
int ImGuiTreeNodeFlags
IMGUI_API char * ImStrdup(const char *str)
Definition: imgui.cpp:903
IMGUI_API bool DragIntN(const char *label, int *v, int components, float v_speed, int v_min, int v_max, const char *display_format)
Definition: imgui.cpp:7178
IMGUI_API const char * ImStristr(const char *haystack, const char *haystack_end, const char *needle, const char *needle_end)
Definition: imgui.cpp:924
int FocusIdxAllCounter
ImVec4 ColorPickerRef
IMGUI_API ImVec2 ImLineClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &p)
Definition: imgui.cpp:833
ImVector< ImGuiWindow * > WindowsSortBuffer
ImVec2 GetBL() const
IMGUI_API bool DragFloatN(const char *label, float *v, int components, float v_speed, float v_min, float v_max, const char *display_format, float power)
Definition: imgui.cpp:7100
ImGuiSliderFlags_
Definition: imgui.h:118
IMGUI_API void EndColumns()
Definition: imgui.cpp:10291
int FocusIdxAllRequestNext
IMGUI_API bool InputScalarEx(const char *label, ImGuiDataType data_type, void *data_ptr, void *step_ptr, void *step_fast_ptr, const char *scalar_format, ImGuiInputTextFlags extra_flags)
Definition: imgui.cpp:8414
ImVec2 ScrollbarSizes
IMGUI_API bool ButtonBehavior(const ImRect &bb, ImGuiID id, bool *out_hovered, bool *out_held, ImGuiButtonFlags flags=0)
Definition: imgui.cpp:5673
int AutoFitChildAxises
ImVector< float > TextWrapPosStack
Definition: imgui.h:1462
IMGUI_API void EndFrame()
Definition: imgui.cpp:2705
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate)
Definition: imgui.cpp:3203
IMGUI_API bool ItemHoverable(const ImRect &bb, ImGuiID id)
Definition: imgui.cpp:1991
float DragSpeedScaleFast
IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char *label, float(*values_getter)(void *data, int idx), void *data, int values_count, int values_offset, const char *overlay_text, float scale_min, float scale_max, ImVec2 graph_size)
Definition: imgui.cpp:7245
ImGuiStyleMod(ImGuiStyleVar idx, float v)
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow *window)
Definition: imgui.cpp:1872
ImGuiWindow * NavWindow
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2 &pos, float radius)
Definition: imgui.cpp:5836
bool HoveredIdAllowOverlap
int WantCaptureKeyboardNextFrame
ImGuiID PopupId
ImVec2 GetClosestPoint(ImVec2 p, bool on_edge) const
Definition: imgui.h:777
IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags=0)
Definition: imgui.cpp:6028
IMGUI_API bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas *atlas)
IMGUI_API float CalcWrapWidthForPos(const ImVec2 &pos, float wrap_pos_x)
Definition: imgui.cpp:2065
IMGUI_API bool InputFloatN(const char *label, float *v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags)
Definition: imgui.cpp:8487
float MenuBarHeight() const
IMGUI_API void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas *atlas)
IMGUI_API int ImTextCharFromUtf8(unsigned int *out_char, const char *in_text, const char *in_text_end)
Definition: imgui.cpp:1034
ImVector< ImGuiGroupData > GroupStack
ImGuiLayoutType_
IMGUI_API ImGuiID GetID(const char *str_id)
Definition: imgui.cpp:6353
void Expand(const ImVec2 &amount)
IMGUI_API bool InputTextEx(const char *label, char *buf, int buf_size, const ImVec2 &size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
Definition: imgui.cpp:7812
ImVector< ImGuiID > IDStack
ImGuiMouseCursor MouseCursor
int ImGuiColumnsFlags
Definition: imgui.h:80
IMGUI_API void RenderTextClipped(const ImVec2 &pos_min, const ImVec2 &pos_max, const char *text, const char *text_end, const ImVec2 *text_size_if_known, const ImVec2 &align=ImVec2(0, 0), const ImRect *clip_rect=NULL)
Definition: imgui.cpp:2969
IMGUI_API int ImTextCountCharsFromUtf8(const char *in_text, const char *in_text_end)
Definition: imgui.cpp:1111
ImGuiWindow * GetCurrentWindow()
void Floor()
int ImGuiCol
Definition: imgui.h:73
void * SetNextWindowSizeConstraintCallbackUserData
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y)
Definition: imgui.cpp:2052
ImGuiDataType
ImVector< char > InitialText
IMGUI_API ImGuiContext * GImGui
Definition: imgui.cpp:661
ImVec2 DragLastMouseDelta
ImGuiWindow * Window
ImVec2 BackupCursorMaxPos
ImVec2 SizeContents
int AutoPosLastDirection
IMGUI_API void OpenPopupEx(ImGuiID id, bool reopen_existing)
Definition: imgui.cpp:3482
IMGUI_API void ClearActiveID()
Definition: imgui.cpp:1882
ImGuiStorage * StateStorage
ImVec2 Min
void Add(const ImRect &rhs)
ImVec2 FontTexUvWhitePixel
ImGuiWindow * HoveredWindow
bool Overlaps(const ImRect &r) const
float BackupCurrentLineHeight
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
Definition: imgui.cpp:3582
ImVec2 GetSize() const
int ImGuiButtonFlags
IMGUI_API int ParseFormatPrecision(const char *fmt, int default_value)
Definition: imgui.cpp:6558
ImGuiStyleVar VarIdx
ImGuiWindow * GetCurrentWindowRead()
ImVector< ImGuiPopupRef > CurrentPopupStack
ImVec2 ScrollTarget
float y
Definition: imgui.h:108
ImVector< float > ItemWidthStack
float x
Definition: imgui.h:98
ImGuiCond SetWindowSizeAllowFlags
ImVector< ImGuiWindow * > ChildWindows
float DragCurrentValue
ImGuiID ParentMenuSet