#if (defined __SSE__ || defined __x86_64__ || defined _M_X64 || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))) && !defined(IMGUI_DISABLE_SSE)
62
#defineIMGUI_ENABLE_SSE
63
#include<immintrin.h>
64
#endif
65
66
// Visual Studio warnings
67
#ifdef _MSC_VER
68
#pragma warning (push)
69
#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)
70
#pragma warning (disable: 26812) // The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). [MSVC Static Analyzer)
71
#pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).
72
#ifdefined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later
73
#pragma warning (disable: 5054) // operator '|': deprecated between enumerations of different types
#pragma clang diagnostic ignored "-Wfloat-equal" // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants ok, for ImFloor()
85
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast
86
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning: zero as null pointer constant
87
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
88
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
89
#pragma clang diagnostic ignored "-Wmissing-noreturn" // warning: function 'xxx' could be declared with attribute 'noreturn'
90
#pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion"// warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
91
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access
92
#pragma clang diagnostic ignored "-Wnontrivial-memaccess" // warning: first argument in call to 'memset' is a pointer to non-trivially copyable type
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
97
#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
98
#endif
99
100
// In 1.89.4, we moved the implementation of "courtesy maths operators" from imgui_internal.h in imgui.h
101
// As they are frequently requested, we do not want to encourage to many people using imgui_internal.h
structImRect;// An axis-aligned rectangle (2 points)
126
structImDrawDataBuilder;// Helper to build a ImDrawData instance
127
structImDrawListSharedData;// Data shared between all ImDrawList instances
128
structImGuiBoxSelectState;// Box-selection state (currently used by multi-selection, could potentially be used by others)
129
structImGuiColorMod;// Stacked color modifier, backup of modified data so we can restore it
130
structImGuiContext;// Main Dear ImGui context
131
structImGuiContextHook;// Hook for extensions like ImGuiTestEngine
132
structImGuiDataVarInfo;// Variable information (e.g. to access style variables from an enum)
133
structImGuiDataTypeInfo;// Type information associated to a ImGuiDataType enum
134
structImGuiDockContext;// Docking system context
135
structImGuiDockRequest;// Docking system dock/undock queued request
136
structImGuiDockNode;// Docking system node (hold a list of Windows OR two child dock nodes)
137
structImGuiDockNodeSettings;// Storage for a dock node in .ini file (we preserve those even if the associated dock node isn't active during the session)
138
structImGuiErrorRecoveryState;// Storage of stack sizes for error handling and recovery
139
structImGuiGroupData;// Stacked storage data for BeginGroup()/EndGroup()
140
structImGuiInputTextState;// Internal state of the currently focused/edited text input box
141
structImGuiInputTextDeactivateData;// Short term storage to backup text of a deactivating InputText() while another is stealing active id
142
structImGuiLastItemData;// Status storage for last submitted items
143
structImGuiLocEntry;// A localization entry.
144
structImGuiMenuColumns;// Simple column measurement, currently used for MenuItem() only
145
structImGuiMultiSelectState;// Multi-selection persistent state (for focused selection).
146
structImGuiMultiSelectTempData;// Multi-selection temporary state (while traversing).
147
structImGuiNavItemData;// Result of a keyboard/gamepad directional navigation move query result
148
structImGuiMetricsConfig;// Storage for ShowMetricsWindow() and DebugNodeXXX() functions
149
structImGuiNextWindowData;// Storage for SetNextWindow** functions
150
structImGuiNextItemData;// Storage for SetNextItem** functions
151
structImGuiOldColumnData;// Storage data for a single column for legacy Columns() api
152
structImGuiOldColumns;// Storage data for a columns set for legacy Columns() api
153
structImGuiPopupData;// Storage for current popup stack
154
structImGuiSettingsHandler;// Storage for one type registered in the .ini file
155
structImGuiStyleMod;// Stacked style modifier, backup of modified data so we can restore it
156
structImGuiTabBar;// Storage for a tab bar
157
structImGuiTabItem;// Storage for a tab item (within a tab bar)
158
structImGuiTable;// Storage for a table
159
structImGuiTableHeaderData;// Storage for TableAngledHeadersRow()
160
structImGuiTableColumn;// Storage for one column of a table
161
structImGuiTableInstanceData;// Storage for one instance of a same table
162
structImGuiTableTempData;// Temporary storage for one table (one per table in the stack), shared between tables.
163
structImGuiTableSettings;// Storage for a table .ini settings
164
structImGuiTableColumnsSettings;// Storage for a column .ini settings
165
structImGuiTreeNodeStackData;// Temporary storage for TreeNode().
166
structImGuiTypingSelectState;// Storage for GetTypingSelectRequest()
167
structImGuiTypingSelectRequest;// Storage for GetTypingSelectRequest() (aimed to be public)
168
structImGuiWindow;// Storage for one window
169
structImGuiWindowDockStyle;// Storage for window-style data which needs to be stored for docking purpose
170
structImGuiWindowTempData;// Temporary storage for one window (that's the data which in theory we could ditch at the end of the frame, in practice we currently keep it for each window)
171
structImGuiWindowSettings;// Storage for a window .ini settings (we keep one of those even if the actual window wasn't instanced during this session)
172
173
// Enumerations
174
// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists.
175
enumImGuiLocKey : int;// -> enum ImGuiLocKey // Enum: a localization entry for translation.
176
typedefintImGuiDataAuthority;// -> enum ImGuiDataAuthority_ // Enum: for storing the source authority (dock node vs window) of a field
177
typedefintImGuiLayoutType;// -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
178
179
// Flags
180
typedefintImGuiActivateFlags;// -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
181
typedefintImGuiDebugLogFlags;// -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
182
typedefintImGuiFocusRequestFlags;// -> enum ImGuiFocusRequestFlags_ // Flags: for FocusWindow()
183
typedefintImGuiItemStatusFlags;// -> enum ImGuiItemStatusFlags_ // Flags: for g.LastItemData.StatusFlags
184
typedefintImGuiOldColumnFlags;// -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
185
typedefintImGuiLogFlags;// -> enum ImGuiLogFlags_ // Flags: for LogBegin() text capturing function
186
typedefintImGuiNavRenderCursorFlags;// -> enum ImGuiNavRenderCursorFlags_//Flags: for RenderNavCursor()
187
typedefintImGuiNavMoveFlags;// -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
188
typedefintImGuiNextItemDataFlags;// -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
189
typedefintImGuiNextWindowDataFlags;// -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
190
typedefintImGuiScrollFlags;// -> enum ImGuiScrollFlags_ // Flags: for ScrollToItem() and navigation requests
191
typedefintImGuiSeparatorFlags;// -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
192
typedefintImGuiTextFlags;// -> enum ImGuiTextFlags_ // Flags: for TextEx()
193
typedefintImGuiTooltipFlags;// -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
194
typedefintImGuiTypingSelectFlags;// -> enum ImGuiTypingSelectFlags_ // Flags: for GetTypingSelectRequest()
195
typedefintImGuiWindowRefreshFlags;// -> enum ImGuiWindowRefreshFlags_ // Flags: for SetNextWindowRefreshPolicy()
// (since IMGUI_VERSION_NUM >= 18729: IMGUI_DEBUG_LOG was reworked into IMGUI_DEBUG_PRINTF (and removed framecount from it). If you were using a #define IMGUI_DEBUG_LOG please rename)
// Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall
IMGUI_API intImTextCountLines(constchar*in_text,constchar*in_text_end);// return number of lines taken by text. trailing carriage return doesn't count as an extra line.
// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double
466
// (Exceptionally using templates here but we could also redefine them for those types)
467
template<typename T>staticinline T ImMin(T lhs, T rhs){return lhs < rhs ? lhs : rhs;}
468
template<typename T>staticinline T ImMax(T lhs, T rhs){return lhs >= rhs ? lhs : rhs;}
469
template<typename T>staticinline T ImClamp(T v, T mn, T mx){return(v < mn)? mn :(v > mx)? mx : v;}
470
template<typename T>staticinline T ImLerp(T a, T b,float t){return(T)(a +(b - a)* t);}
471
template<typename T>staticinlinevoidImSwap(T& a, T& b){ T tmp = a; a = b; b = tmp;}
472
template<typename T>staticinline T ImAddClampOverflow(T a, T b, T mn, T mx){if(b <0&&(a < mn - b))return mn;if(b >0&&(a > mx - b))return mx;return a + b;}
473
template<typename T>staticinline T ImSubClampOverflow(T a, T b, T mn, T mx){if(b >0&&(a < mn + b))return mn;if(b <0&&(a > mx + b))return mx;return a - b;}
IMGUI_API ImVec2 ImBezierCubicClosestPoint(const ImVec2&p1,const ImVec2&p2,const ImVec2&p3,const ImVec2&p4,const ImVec2&p,intnum_segments);// For curves with explicit number of segments
502
IMGUI_API ImVec2 ImBezierCubicClosestPointCasteljau(const ImVec2&p1,const ImVec2&p2,const ImVec2&p3,const ImVec2&p4,const ImVec2&p,floattess_tol);// For auto-tessellated curves you can use tess_tol = style.CurveTessellationTol
voidClipWith(const ImRect& r){ Min =ImMax(Min, r.Min); Max =ImMin(Max, r.Max);}// Simple version, may lead to an inverted rectangle, which is fine for Contains/Overlaps test but not for display.
563
voidClipWithFull(const ImRect& r){ Min =ImClamp(Min, r.Min, r.Max); Max =ImClamp(Max, r.Min, r.Max);}// Full version, ensure both points are fully clipped.
#defineIM_BITARRAY_TESTBIT(_ARRAY,_N)((_ARRAY[(_N)>>5]&((ImU32)1<<((_N)&31)))!=0)// Macro version of ImBitArrayTestBit(): ensure args have side-effect or are costly!
571
#defineIM_BITARRAY_CLEARBIT(_ARRAY,_N)((_ARRAY[(_N)>>5]&=~((ImU32)1<<((_N)&31))))// Macro version of ImBitArrayClearBit(): ensure args have side-effect or are costly!
boolTestBit(int n)const{ n += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT);returnIM_BITARRAY_TESTBIT(Storage, n);}
602
voidSetBit(int n){ n += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT);ImBitArraySetBit(Storage, n);}
603
voidClearBit(int n){ n += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT);ImBitArrayClearBit(Storage, n);}
604
voidSetBitRange(int n,int n2){ n += OFFSET; n2 += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT && n2 > n && n2 <= BITCOUNT);ImBitArraySetBitRange(Storage, n, n2);}// Works on range [n..n2)
605
bool operator[](int n)const{ n += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT);returnIM_BITARRAY_TESTBIT(Storage, n);}
inline T& operator[](int i){ T* p = Data + i;IM_ASSERT(p >= Data && p < DataEnd);return*p;}
639
inlineconst T& operator[](int i)const{const T* p = Data + i;IM_ASSERT(p >= Data && p < DataEnd);return*p;}
640
641
inline T*begin(){return Data;}
642
inlineconst T*begin()const{return Data;}
643
inline T*end(){return DataEnd;}
644
inlineconst T*end()const{return DataEnd;}
645
646
// Utilities
647
inlineintindex_from_ptr(const T* it)const{IM_ASSERT(it >= Data && it < DataEnd);constptrdiff_t off = it - Data;return(int)off;}
648
};
649
650
// Helper: ImSpanAllocator<>
651
// Facilitate storing multiple chunks into a single large block (the "arena")
652
// - Usage: call Reserve() N times, allocate GetArenaSizeInBytes() worth, pass it to SetArenaBasePtr(), call GetSpan() N times to retrieve the aligned ranges.
// ImDrawList: Lookup table size for adaptive arc drawing, cover full circle.
768
#ifndef IM_DRAWLIST_ARCFAST_TABLE_SIZE
769
#defineIM_DRAWLIST_ARCFAST_TABLE_SIZE48// Number of samples in lookup table.
770
#endif
771
#defineIM_DRAWLIST_ARCFAST_SAMPLE_MAX IM_DRAWLIST_ARCFAST_TABLE_SIZE // Sample index _PathArcToFastEx() for 360 angle.
772
773
// Data shared between all ImDrawList instances
774
// You may want to create your own instance of this if you want to use ImDrawList completely without ImGui. In that case, watch out for future changes to this structure.
775
struct IMGUI_API ImDrawListSharedData
776
{
777
ImVec2 TexUvWhitePixel;// UV of white pixel in the atlas
778
ImFont* Font;// Current/default font (optional, for simplified AddText overload)
779
float FontSize;// Current/default font size (optional, for simplified AddText overload)
780
float FontScale;// Current/default font scale (== FontSize / Font->FontSize)
781
float CurveTessellationTol;// Tessellation tolerance when using PathBezierCurveTo()
782
float CircleSegmentMaxError;// Number of circle segments to use per pixel of radius for AddCircle() etc
783
ImVec4 ClipRectFullscreen;// Value for PushClipRectFullscreen()
784
ImDrawListFlags InitialFlags;// Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
785
786
// [Internal] Temp write buffer
787
ImVector<ImVec2> TempBuffer;
788
789
// [Internal] Lookup tables
790
ImVec2 ArcFastVtx[IM_DRAWLIST_ARCFAST_TABLE_SIZE];// Sample points on the quarter of the circle.
791
float ArcFastRadiusCutoff;// Cutoff radius after which arc drawing will fallback to slower PathArcTo()
792
ImU8 CircleSegmentCounts[64];// Precomputed segment count for given radius before we calculate it dynamically (to avoid calculation overhead)
793
const ImVec4* TexUvLines;// UV of anti-aliased lines in the atlas
// - input: PushItemFlag() manipulates g.CurrentItemFlags, g.NextItemData.ItemFlags, ItemAdd() calls may add extra flags too.
847
// - output: stored in g.LastItemData.ItemFlags
848
enumImGuiItemFlagsPrivate_
849
{
850
// Controlled by user
851
ImGuiItemFlags_Disabled =1<<10,// false // Disable interactions (DOES NOT affect visuals. DO NOT mix direct use of this with BeginDisabled(). See BeginDisabled()/EndDisabled() for full disable feature, and github #211).
852
ImGuiItemFlags_ReadOnly =1<<11,// false // [ALPHA] Allow hovering interactions but underlying value is not changed.
853
ImGuiItemFlags_MixedValue =1<<12,// false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
854
ImGuiItemFlags_NoWindowHoverableCheck =1<<13,// false // Disable hoverable check in ItemHoverable()
855
ImGuiItemFlags_AllowOverlap =1<<14,// false // Allow being overlapped by another widget. Not-hovered to Hovered transition deferred by a frame.
856
ImGuiItemFlags_NoNavDisableMouseHover =1<<15,// false // Nav keyboard/gamepad mode doesn't disable hover highlight (behave as if NavHighlightItemUnderNav==false).
ImGuiItemFlags_Inputable =1<<20,// false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
861
ImGuiItemFlags_HasSelectionUserData =1<<21,// false // Set by SetNextItemSelectionUserData()
862
ImGuiItemFlags_IsMultiSelect =1<<22,// false // Set by SetNextItemSelectionUserData()
863
864
ImGuiItemFlags_Default_ = ImGuiItemFlags_AutoClosePopups,// Please don't change, use PushItemFlag() instead.
865
866
// Obsolete
867
//ImGuiItemFlags_SelectableDontClosePopup = !ImGuiItemFlags_AutoClosePopups, // Can't have a redirect as we inverted the behavior
868
};
869
870
// Status flags for an already submitted item
871
// - output: stored in g.LastItemData.StatusFlags
872
enumImGuiItemStatusFlags_
873
{
874
ImGuiItemStatusFlags_None =0,
875
ImGuiItemStatusFlags_HoveredRect =1<<0,// Mouse position is within item rectangle (does NOT mean that the window is in correct z-order and can be hovered!, this is only one part of the most-common IsItemHovered test)
876
ImGuiItemStatusFlags_HasDisplayRect =1<<1,// g.LastItemData.DisplayRect is valid
877
ImGuiItemStatusFlags_Edited =1<<2,// Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
878
ImGuiItemStatusFlags_ToggledSelection =1<<3,// Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected", only state changes, in order to easily handle clipping with less issues.
879
ImGuiItemStatusFlags_ToggledOpen =1<<4,// Set when TreeNode() reports toggling their open state.
880
ImGuiItemStatusFlags_HasDeactivated =1<<5,// Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
881
ImGuiItemStatusFlags_Deactivated =1<<6,// Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
882
ImGuiItemStatusFlags_HoveredWindow =1<<7,// Override the HoveredWindow test to allow cross-window hover testing.
883
ImGuiItemStatusFlags_Visible =1<<8,// [WIP] Set when item is overlapping the current clipping rectangle (Used internally. Please don't use yet: API/system will change as we refactor Itemadd()).
884
ImGuiItemStatusFlags_HasClipRect =1<<9,// g.LastItemData.ClipRect is valid.
885
ImGuiItemStatusFlags_HasShortcut =1<<10,// g.LastItemData.Shortcut valid. Set by SetNextItemShortcut() -> ItemAdd().
886
887
// Additional status + semantic for ImGuiTestEngine
888
#ifdef IMGUI_ENABLE_TEST_ENGINE
889
ImGuiItemStatusFlags_Openable =1<<20,// Item is an openable (e.g. TreeNode)
890
ImGuiItemStatusFlags_Opened =1<<21,// Opened status
891
ImGuiItemStatusFlags_Checkable =1<<22,// Item is a checkable (e.g. CheckBox, MenuItem)
892
ImGuiItemStatusFlags_Checked =1<<23,// Checked status
893
ImGuiItemStatusFlags_Inputable =1<<24,// Item is a text-inputable (e.g. InputText, SliderXXX, DragXXX)
ImGuiInputTextFlags_Multiline =1<<26,// For internal use by InputTextMultiline()
910
ImGuiInputTextFlags_MergedItem =1<<27,// For internal use by TempInputText(), will skip calling ItemAdd(). Require bounding-box to strictly match.
911
ImGuiInputTextFlags_LocalizeDecimalPoint=1<<28,// For internal use by InputScalar() and TempInputScalar()
912
};
913
914
// Extend ImGuiButtonFlags_
915
enumImGuiButtonFlagsPrivate_
916
{
917
ImGuiButtonFlags_PressedOnClick =1<<4,// return true on click (mouse down event)
918
ImGuiButtonFlags_PressedOnClickRelease =1<<5,// [Default] return true on click + release on same item <-- this is what the majority of Button are using
919
ImGuiButtonFlags_PressedOnClickReleaseAnywhere =1<<6,// return true on click + release even if the release event is not done while hovering the item
920
ImGuiButtonFlags_PressedOnRelease =1<<7,// return true on release (default requires click+release)
921
ImGuiButtonFlags_PressedOnDoubleClick =1<<8,// return true on double-click (default requires click+release)
922
ImGuiButtonFlags_PressedOnDragDropHold =1<<9,// return true when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
923
//ImGuiButtonFlags_Repeat = 1 << 10, // hold to repeat
924
ImGuiButtonFlags_FlattenChildren =1<<11,// allow interactions even if a child window is overlapping
925
ImGuiButtonFlags_AllowOverlap =1<<12,// require previous frame HoveredId to either match id or be null before being usable.
//ImGuiButtonFlags_Disabled = 1 << 14, // disable interactions -> use BeginDisabled() or ImGuiItemFlags_Disabled
928
ImGuiButtonFlags_AlignTextBaseLine =1<<15,// vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
929
ImGuiButtonFlags_NoKeyModsAllowed =1<<16,// disable mouse interaction if a key modifier is held
930
ImGuiButtonFlags_NoHoldingActiveId =1<<17,// don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
931
ImGuiButtonFlags_NoNavFocus =1<<18,// don't override navigation focus when activated (FIXME: this is essentially used every time an item uses ImGuiItemFlags_NoNav, but because legacy specs don't requires LastItemData to be set ButtonBehavior(), we can't poll g.LastItemData.ItemFlags)
932
ImGuiButtonFlags_NoHoveredOnFocus =1<<19,// don't report as hovered when nav focus is on this item
933
ImGuiButtonFlags_NoSetKeyOwner =1<<20,// don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
934
ImGuiButtonFlags_NoTestKeyOwner =1<<21,// don't test key/input owner when polling the key (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
ImGuiSliderFlags_Vertical =1<<20,// Should this slider be orientated vertically?
949
ImGuiSliderFlags_ReadOnly =1<<21,// Consider using g.NextItemData.ItemFlags |= ImGuiItemFlags_ReadOnly instead.
950
};
951
952
// Extend ImGuiSelectableFlags_
953
enumImGuiSelectableFlagsPrivate_
954
{
955
// NB: need to be in sync with last value of ImGuiSelectableFlags_
956
ImGuiSelectableFlags_NoHoldingActiveID =1<<20,
957
ImGuiSelectableFlags_SelectOnNav =1<<21,// (WIP) Auto-select when moved into. This is not exposed in public API as to handle multi-select and modifiers we will need user to explicitly control focus scope. May be replaced with a BeginSelection() API.
958
ImGuiSelectableFlags_SelectOnClick =1<<22,// Override button behavior to react on Click (default is Click+Release)
959
ImGuiSelectableFlags_SelectOnRelease =1<<23,// Override button behavior to react on Release (default is Click+Release)
960
ImGuiSelectableFlags_SpanAvailWidth =1<<24,// Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus)
961
ImGuiSelectableFlags_SetNavIdOnHover =1<<25,// Set Nav/Focus ID on mouse hover (used by MenuItem)
962
ImGuiSelectableFlags_NoPadWithHalfSpacing =1<<26,// Disable padding each side with ItemSpacing * 0.5f
963
ImGuiSelectableFlags_NoSetKeyOwner =1<<27,// Don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!)
964
};
965
966
// Extend ImGuiTreeNodeFlags_
967
enumImGuiTreeNodeFlagsPrivate_
968
{
969
ImGuiTreeNodeFlags_ClipLabelForTrailingButton =1<<28,// FIXME-WIP: Hard-coded for CollapsingHeader()
970
ImGuiTreeNodeFlags_UpsideDownArrow =1<<29,// FIXME-WIP: Turn Down arrow into an Up arrow, for reversed trees (#6517)
voidOnKeyPressed(int key);// Cannot be inline because we call in code in stb_textedit.h implementation
1152
voidOnCharPressed(unsignedint c);
1153
1154
// Cursor & Selection
1155
voidCursorAnimReset();
1156
voidCursorClamp();
1157
boolHasSelection()const;
1158
voidClearSelection();
1159
intGetCursorPos()const;
1160
intGetSelectionStart()const;
1161
intGetSelectionEnd()const;
1162
voidSelectAll();
1163
1164
// Reload user buf (WIP #2890)
1165
// If you modify underlying user-passed const char* while active you need to call this (InputText V2 may lift this)
1166
// strcpy(my_buf, "hello");
1167
// if (ImGuiInputTextState* state = ImGui::GetInputTextState(id)) // id may be ImGui::GetItemID() is last item
1168
// state->ReloadUserBufAndSelectAll();
1169
voidReloadUserBufAndSelectAll();
1170
voidReloadUserBufAndKeepSelection();
1171
voidReloadUserBufAndMoveToEnd();
1172
};
1173
1174
enumImGuiWindowRefreshFlags_
1175
{
1176
ImGuiWindowRefreshFlags_None =0,
1177
ImGuiWindowRefreshFlags_TryToAvoidRefresh =1<<0,// [EXPERIMENTAL] Try to keep existing contents, USER MUST NOT HONOR BEGIN() RETURNING FALSE AND NOT APPEND.
1178
ImGuiWindowRefreshFlags_RefreshOnHover =1<<1,// [EXPERIMENTAL] Always refresh on hover
1179
ImGuiWindowRefreshFlags_RefreshOnFocus =1<<2,// [EXPERIMENTAL] Always refresh on focus
1180
// Refresh policy/frequency, Load Balancing etc.
1181
};
1182
1183
enumImGuiNextWindowDataFlags_
1184
{
1185
ImGuiNextWindowDataFlags_None =0,
1186
ImGuiNextWindowDataFlags_HasPos =1<<0,
1187
ImGuiNextWindowDataFlags_HasSize =1<<1,
1188
ImGuiNextWindowDataFlags_HasContentSize =1<<2,
1189
ImGuiNextWindowDataFlags_HasCollapsed =1<<3,
1190
ImGuiNextWindowDataFlags_HasSizeConstraint =1<<4,
1191
ImGuiNextWindowDataFlags_HasFocus =1<<5,
1192
ImGuiNextWindowDataFlags_HasBgAlpha =1<<6,
1193
ImGuiNextWindowDataFlags_HasScroll =1<<7,
1194
ImGuiNextWindowDataFlags_HasChildFlags =1<<8,
1195
ImGuiNextWindowDataFlags_HasRefreshPolicy =1<<9,
1196
ImGuiNextWindowDataFlags_HasViewport =1<<10,
1197
ImGuiNextWindowDataFlags_HasDock =1<<11,
1198
ImGuiNextWindowDataFlags_HasWindowClass =1<<12,
1199
};
1200
1201
// Storage for SetNexWindow** functions
1202
structImGuiNextWindowData
1203
{
1204
ImGuiNextWindowDataFlags Flags;
1205
ImGuiCond PosCond;
1206
ImGuiCond SizeCond;
1207
ImGuiCond CollapsedCond;
1208
ImGuiCond DockCond;
1209
ImVec2 PosVal;
1210
ImVec2 PosPivotVal;
1211
ImVec2 SizeVal;
1212
ImVec2 ContentSizeVal;
1213
ImVec2 ScrollVal;
1214
ImGuiChildFlags ChildFlags;
1215
bool PosUndock;
1216
bool CollapsedVal;
1217
ImRect SizeConstraintRect;
1218
ImGuiSizeCallback SizeCallback;
1219
void* SizeCallbackUserData;
1220
float BgAlphaVal;// Override background alpha
1221
ImGuiID ViewportId;
1222
ImGuiID DockId;
1223
ImGuiWindowClass WindowClass;
1224
ImVec2 MenuBarOffsetMinVal;// (Always on) This is not exposed publicly, so we don't clear it and it doesn't have a corresponding flag (could we? for consistency?)
ImGuiNextItemDataFlags HasFlags;// Called HasFlags instead of Flags to avoid mistaking this
1244
ImGuiItemFlags ItemFlags;// Currently only tested/used for ImGuiItemFlags_AllowOverlap and ImGuiItemFlags_HasSelectionUserData.
1245
// Non-flags members are NOT cleared by ItemAdd() meaning they are still valid during NavProcessItem()
1246
ImGuiID FocusScopeId;// Set by SetNextItemSelectionUserData()
1247
ImGuiSelectionUserData SelectionUserData;// Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values)
1248
float Width;// Set by SetNextItemWidth()
1249
ImGuiKeyChord Shortcut;// Set by SetNextItemShortcut()
1250
ImGuiInputFlags ShortcutFlags;// Set by SetNextItemShortcut()
1251
bool OpenVal;// Set by SetNextItemOpen()
1252
ImU8 OpenCond;// Set by SetNextItemOpen()
1253
ImGuiDataTypeStorage RefVal;// Not exposed yet, for ImGuiInputTextFlags_ParseEmptyAsRefVal
1254
ImGuiID StorageId;// Set by SetNextItemStorageID()
// Storage for popup stacks (g.OpenPopupStack and g.BeginPopupStack)
1343
structImGuiPopupData
1344
{
1345
ImGuiID PopupId;// Set on OpenPopup()
1346
ImGuiWindow* Window;// Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
1347
ImGuiWindow* RestoreNavWindow;// Set on OpenPopup(), a NavWindow that will be restored on popup close
1348
int ParentNavLayer;// Resolved on BeginPopup(). Actually a ImGuiNavLayer type (declared down below), initialized to -1 which is not part of an enum, but serves well-enough as "not any of layers" value
1349
int OpenFrameCount;// Set on OpenPopup()
1350
ImGuiID OpenParentId;// Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)
1351
ImVec2 OpenPopupPos;// Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse)
1352
ImVec2 OpenMousePos;// Set on OpenPopup(), copy of mouse position at the time of opening popup
ImU32 EventId;// Unique, sequential increasing integer to identify an event (if you need to correlate them to other data).
1423
union
1424
{
1425
ImGuiInputEventMousePos MousePos;// if Type == ImGuiInputEventType_MousePos
1426
ImGuiInputEventMouseWheel MouseWheel;// if Type == ImGuiInputEventType_MouseWheel
1427
ImGuiInputEventMouseButton MouseButton;// if Type == ImGuiInputEventType_MouseButton
1428
ImGuiInputEventMouseViewport MouseViewport;// if Type == ImGuiInputEventType_MouseViewport
1429
ImGuiInputEventKey Key;// if Type == ImGuiInputEventType_Key
1430
ImGuiInputEventText Text;// if Type == ImGuiInputEventType_Text
1431
ImGuiInputEventAppFocused AppFocused;// if Type == ImGuiInputEventType_Focus
1432
};
1433
bool AddedByTestEngine;
1434
1435
ImGuiInputEvent(){memset(this,0,sizeof(*this));}
1436
};
1437
1438
// Input function taking an 'ImGuiID owner_id' argument defaults to (ImGuiKeyOwner_Any == 0) aka don't test ownership, which matches legacy behavior.
1439
#defineImGuiKeyOwner_Any((ImGuiID)0)// Accept key that have an owner, UNLESS a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease.
1440
#defineImGuiKeyOwner_NoOwner((ImGuiID)-1)// Require key to have no owner.
1441
//#define ImGuiKeyOwner_None ImGuiKeyOwner_NoOwner // We previously called this 'ImGuiKeyOwner_None' but it was inconsistent with our pattern that _None values == 0 and quite dangerous. Also using _NoOwner makes the IsKeyPressed() calls more explicit.
1442
1443
typedef ImS16 ImGuiKeyRoutingIndex;
1444
1445
// Routing table entry (sizeof() == 16 bytes)
1446
structImGuiKeyRoutingData
1447
{
1448
ImGuiKeyRoutingIndex NextEntryIndex;
1449
ImU16 Mods;// Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits.
1450
ImU8 RoutingCurrScore;// [DEBUG] For debug display
1451
ImU8 RoutingNextScore;// Lower is better (0: perfect score)
// Routing table: maintain a desired owner for each possible key-chord (key + mods), and setup owner in NewFrame() when mods are matching.
1459
// Stored in main context (1 instance)
1460
structImGuiKeyRoutingTable
1461
{
1462
ImGuiKeyRoutingIndex Index[ImGuiKey_NamedKey_COUNT];// Index of first entry in Entries[]
1463
ImVector<ImGuiKeyRoutingData> Entries;
1464
ImVector<ImGuiKeyRoutingData> EntriesNext;// Double-buffer to avoid reallocation (could use a shared buffer)
1465
1466
ImGuiKeyRoutingTable(){Clear();}
1467
voidClear(){for(int n =0; n <IM_ARRAYSIZE(Index); n++) Index[n]=-1; Entries.clear(); EntriesNext.clear();}
1468
};
1469
1470
// This extends ImGuiKeyData but only for named keys (legacy keys don't support the new features)
1471
// Stored in main context (1 per named key). In the future it might be merged into ImGuiKeyData.
1472
structImGuiKeyOwnerData
1473
{
1474
ImGuiID OwnerCurr;
1475
ImGuiID OwnerNext;
1476
bool LockThisFrame;// Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags_LockThisFrame.
1477
bool LockUntilRelease;// Reading this key requires explicit owner id (until key is released). Set by ImGuiInputFlags_LockUntilRelease. When this is true LockThisFrame is always true as well.
// - Repeat mode: Specify when repeating key pressed can be interrupted.
1493
// - In theory ImGuiInputFlags_RepeatUntilOtherKeyPress may be a desirable default, but it would break too many behavior so everything is opt-in.
1494
ImGuiInputFlags_RepeatUntilRelease =1<<4,// Stop repeating when released (default for all functions except Shortcut). This only exists to allow overriding Shortcut() default behavior.
1495
ImGuiInputFlags_RepeatUntilKeyModsChange =1<<5,// Stop repeating when released OR if keyboard mods are changed (default for Shortcut)
1496
ImGuiInputFlags_RepeatUntilKeyModsChangeFromNone =1<<6,// Stop repeating when released OR if keyboard mods are leaving the None state. Allows going from Mod+Key to Key by releasing Mod.
1497
ImGuiInputFlags_RepeatUntilOtherKeyPress =1<<7,// Stop repeating when released OR if any other keyboard key is pressed during the repeat
1498
1499
// Flags for SetKeyOwner(), SetItemKeyOwner()
1500
// - Locking key away from non-input aware code. Locking is useful to make input-owner-aware code steal keys from non-input-owner-aware code. If all code is input-owner-aware locking would never be necessary.
1501
ImGuiInputFlags_LockThisFrame =1<<20,// Further accesses to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared at end of frame.
1502
ImGuiInputFlags_LockUntilRelease =1<<21,// Further accesses to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared when the key is released or at end of each frame if key is released.
1503
1504
// - Condition for SetItemKeyOwner()
1505
ImGuiInputFlags_CondHovered =1<<22,// Only set if item is hovered (default to both)
1506
ImGuiInputFlags_CondActive =1<<23,// Only set if item is active (default to both)
ImGuiActivateFlags_PreferInput =1<<0,// Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default for Enter key.
1562
ImGuiActivateFlags_PreferTweak =1<<1,// Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default for Space key and if keyboard is not used.
1563
ImGuiActivateFlags_TryToPreserveState =1<<2,// Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
1564
ImGuiActivateFlags_FromTabbing =1<<3,// Activation requested by a tabbing request
1565
ImGuiActivateFlags_FromShortcut =1<<4,// Activation requested by an item shortcut via SetNextItemShortcut() function.
1566
};
1567
1568
// Early work-in-progress API for ScrollToItem()
1569
enumImGuiScrollFlags_
1570
{
1571
ImGuiScrollFlags_None =0,
1572
ImGuiScrollFlags_KeepVisibleEdgeX =1<<0,// If item is not visible: scroll as little as possible on X axis to bring item back into view [default for X axis]
1573
ImGuiScrollFlags_KeepVisibleEdgeY =1<<1,// If item is not visible: scroll as little as possible on Y axis to bring item back into view [default for Y axis for windows that are already visible]
1574
ImGuiScrollFlags_KeepVisibleCenterX =1<<2,// If item is not visible: scroll to make the item centered on X axis [rarely used]
1575
ImGuiScrollFlags_KeepVisibleCenterY =1<<3,// If item is not visible: scroll to make the item centered on Y axis
1576
ImGuiScrollFlags_AlwaysCenterX =1<<4,// Always center the result item on X axis [rarely used]
1577
ImGuiScrollFlags_AlwaysCenterY =1<<5,// Always center the result item on Y axis [default for Y axis for appearing window)
1578
ImGuiScrollFlags_NoScrollParent =1<<6,// Disable forwarding scrolling to parent window if required to keep item/rect visible (only scroll window the function was applied to).
ImGuiNavRenderCursorFlags_Compact =1<<1,// Compact highlight, no padding/distance from focused item
1587
ImGuiNavRenderCursorFlags_AlwaysDraw =1<<2,// Draw rectangular highlight if (g.NavId == id) even when g.NavCursorVisible == false, aka even when using the mouse.
1588
ImGuiNavRenderCursorFlags_NoRounding =1<<3,
1589
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1590
ImGuiNavHighlightFlags_None = ImGuiNavRenderCursorFlags_None,// Renamed in 1.91.4
1591
ImGuiNavHighlightFlags_Compact = ImGuiNavRenderCursorFlags_Compact,// Renamed in 1.91.4
1592
ImGuiNavHighlightFlags_AlwaysDraw = ImGuiNavRenderCursorFlags_AlwaysDraw,// Renamed in 1.91.4
1593
ImGuiNavHighlightFlags_NoRounding = ImGuiNavRenderCursorFlags_NoRounding,// Renamed in 1.91.4
1594
#endif
1595
};
1596
1597
enumImGuiNavMoveFlags_
1598
{
1599
ImGuiNavMoveFlags_None =0,
1600
ImGuiNavMoveFlags_LoopX =1<<0,// On failed request, restart from opposite side
1601
ImGuiNavMoveFlags_LoopY =1<<1,
1602
ImGuiNavMoveFlags_WrapX =1<<2,// On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)
1603
ImGuiNavMoveFlags_WrapY =1<<3,// This is not super useful but provided for completeness
ImGuiNavMoveFlags_AllowCurrentNavId =1<<4,// Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)
1606
ImGuiNavMoveFlags_AlsoScoreVisibleSet =1<<5,// Store alternate result in NavMoveResultLocalVisible that only comprise elements that are already fully visible (used by PageUp/PageDown)
1607
ImGuiNavMoveFlags_ScrollToEdgeY =1<<6,// Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword, probably unnecessary
1608
ImGuiNavMoveFlags_Forwarded =1<<7,
1609
ImGuiNavMoveFlags_DebugNoResult =1<<8,// Dummy scoring for debug purpose, don't apply result
1610
ImGuiNavMoveFlags_FocusApi =1<<9,// Requests from focus API can land/focus/activate items even if they are marked with _NoTabStop (see NavProcessItemForTabbingRequest() for details)
1611
ImGuiNavMoveFlags_IsTabbing =1<<10,// == Focus + Activate if item is Inputable + DontChangeNavHighlight
1612
ImGuiNavMoveFlags_IsPageMove =1<<11,// Identify a PageDown/PageUp request.
ImGuiTypingSelectFlags_AllowBackspace =1<<0,// Backspace to delete character inputs. If using: ensure GetTypingSelectRequest() is not called more than once per frame (filter by e.g. focus state)
1659
ImGuiTypingSelectFlags_AllowSingleCharMode =1<<1,// Allow "single char" search mode which is activated when pressing the same character multiple times.
1660
};
1661
1662
// Returned by GetTypingSelectRequest(), designed to eventually be public.
1663
struct IMGUI_API ImGuiTypingSelectRequest
1664
{
1665
ImGuiTypingSelectFlags Flags;// Flags passed to GetTypingSelectRequest()
1666
int SearchBufferLen;
1667
constchar* SearchBuffer;// Search buffer contents (use full string. unless SingleCharMode is set, in which case use SingleCharSize).
1668
bool SelectRequest;// Set when buffer was modified this frame, requesting a selection.
1669
bool SingleCharMode;// Notify when buffer contains same character repeated, to implement special mode. In this situation it preferred to not display any on-screen search indication.
1670
ImS8 SingleCharSize;// Length in bytes of first letter codepoint (1 for ascii, 2-4 for UTF-8). If (SearchBufferLen==RepeatCharSize) only 1 letter has been input.
1671
};
1672
1673
// Storage for GetTypingSelectRequest()
1674
struct IMGUI_API ImGuiTypingSelectState
1675
{
1676
ImGuiTypingSelectRequest Request;// User-facing data
1677
char SearchBuffer[64];// Search buffer: no need to make dynamic as this search is very transient.
1678
ImGuiID FocusScope;
1679
int LastRequestFrame =0;
1680
float LastRequestTime =0.0f;
1681
bool SingleCharModeLock =false;// After a certain single char repeat count we lock into SingleCharMode. Two benefits: 1) buffer never fill, 2) we can provide an immediate SingleChar mode without timer elapsing.
ImGuiOldColumnFlags_NoResize =1<<1,// Disable resizing columns when clicking on the dividers
1697
ImGuiOldColumnFlags_NoPreserveWidths =1<<2,// Disable column width preservation when adjusting columns
1698
ImGuiOldColumnFlags_NoForceWithinWindow =1<<3,// Disable forcing columns to fit within window
1699
ImGuiOldColumnFlags_GrowParentContentsSize =1<<4,// Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.
ImGuiMultiSelectIO IO;// MUST BE FIRST FIELD. Requests are set and returned by BeginMultiSelect()/EndMultiSelect() + written to by user during the loop.
1782
ImGuiMultiSelectState* Storage;
1783
ImGuiID FocusScopeId;// Copied from g.CurrentFocusScopeId (unless another selection scope was pushed manually)
1784
ImGuiMultiSelectFlags Flags;
1785
ImVec2 ScopeRectMin;
1786
ImVec2 BackupCursorMaxPos;
1787
ImGuiSelectionUserData LastSubmittedItem;// Copy of last submitted item data, used to merge output ranges.
1788
ImGuiID BoxSelectId;
1789
ImGuiKeyChord KeyMods;
1790
ImS8 LoopRequestSetAll;// -1: no operation, 0: clear all, 1: select all.
1791
bool IsEndIO;// Set when switching IO from BeginMultiSelect() to EndMultiSelect() state.
1792
bool IsFocused;// Set if currently focusing the selection scope (any item of the selection). May be used if you have custom shortcut associated to selection.
1793
bool IsKeyboardSetRange;// Set by BeginMultiSelect() when using Shift+Navigation. Because scrolling may be affected we can't afford a frame of lag with Shift+Navigation.
1794
bool NavIdPassedBy;
1795
bool RangeSrcPassedBy;// Set by the item that matches RangeSrcItem.
1796
bool RangeDstPassedBy;// Set by the item that matches NavJustMovedToId when IsSetRange is set.
1797
1798
ImGuiMultiSelectTempData(){Clear();}
1799
voidClear(){size_t io_sz =sizeof(IO);ClearIO();memset((void*)(&IO +1),0,sizeof(*this)- io_sz);}// Zero-clear except IO as we preserve IO.Requests[] buffer allocation.
#defineDOCKING_HOST_DRAW_CHANNEL_BG0// Dock host: background fill
1823
#defineDOCKING_HOST_DRAW_CHANNEL_FG1// Dock host: decorations and contents
1824
1825
#ifdef IMGUI_HAS_DOCK
1826
1827
// Extend ImGuiDockNodeFlags_
1828
enumImGuiDockNodeFlagsPrivate_
1829
{
1830
// [Internal]
1831
ImGuiDockNodeFlags_DockSpace =1<<10,// Saved // A dockspace is a node that occupy space within an existing user window. Otherwise the node is floating and create its own window.
1832
ImGuiDockNodeFlags_CentralNode =1<<11,// Saved // The central node has 2 main properties: stay visible when empty, only use "remaining" spaces from its neighbor.
1833
ImGuiDockNodeFlags_NoTabBar =1<<12,// Saved // Tab bar is completely unavailable. No triangle in the corner to enable it back.
1834
ImGuiDockNodeFlags_HiddenTabBar =1<<13,// Saved // Tab bar is hidden, with a triangle in the corner to show it again (NB: actual tab-bar instance may be destroyed as this is only used for single-window tab bar)
1835
ImGuiDockNodeFlags_NoWindowMenuButton =1<<14,// Saved // Disable window/docking menu (that one that appears instead of the collapse button)
1836
ImGuiDockNodeFlags_NoCloseButton =1<<15,// Saved // Disable close button
1837
ImGuiDockNodeFlags_NoResizeX =1<<16,// //
1838
ImGuiDockNodeFlags_NoResizeY =1<<17,// //
1839
ImGuiDockNodeFlags_DockedWindowsInFocusRoute=1<<18,// // Any docked window will be automatically be focus-route chained (window->ParentWindowForFocusRoute set to this) so Shortcut() in this window can run when any docked window is focused.
1840
// Disable docking/undocking actions in this dockspace or individual node (existing docked nodes will be preserved)
1841
// Those are not exposed in public because the desirable sharing/inheriting/copy-flag-on-split behaviors are quite difficult to design and understand.
1842
// The two public flags ImGuiDockNodeFlags_NoDockingOverCentralNode/ImGuiDockNodeFlags_NoDockingSplit don't have those issues.
1843
ImGuiDockNodeFlags_NoDockingSplitOther =1<<19,// // Disable this node from splitting other windows/nodes.
1844
ImGuiDockNodeFlags_NoDockingOverMe =1<<20,// // Disable other windows/nodes from being docked over this node.
1845
ImGuiDockNodeFlags_NoDockingOverOther =1<<21,// // Disable this node from being docked over another window or non-empty node.
1846
ImGuiDockNodeFlags_NoDockingOverEmpty =1<<22,// // Disable this node from being docked over an empty node (e.g. DockSpace with no other windows)
ImGuiDockNode* ChildNodes[2];// [Split node only] Child nodes (left/right or top/bottom). Consider switching to an array.
1884
ImVector<ImGuiWindow*> Windows;// Note: unordered list! Iterate TabBar->Tabs for user-order.
1885
ImGuiTabBar* TabBar;
1886
ImVec2 Pos;// Current position
1887
ImVec2 Size;// Current size
1888
ImVec2 SizeRef;// [Split node only] Last explicitly written-to size (overridden when using a splitter affecting the node), used to calculate Size.
1889
ImGuiAxis SplitAxis;// [Split node only] Split axis (X or Y)
1890
ImGuiWindowClass WindowClass;// [Root node only]
1891
ImU32 LastBgColor;
1892
1893
ImGuiWindow* HostWindow;
1894
ImGuiWindow* VisibleWindow;// Generally point to window which is ID is == SelectedTabID, but when CTRL+Tabbing this can be a different window.
1895
ImGuiDockNode* CentralNode;// [Root node only] Pointer to central node.
1896
ImGuiDockNode* OnlyNodeWithWindows;// [Root node only] Set when there is a single visible node within the hierarchy.
1897
int CountNodeWithWindows;// [Root node only]
1898
int LastFrameAlive;// Last frame number the node was updated or kept alive explicitly with DockSpace() + ImGuiDockNodeFlags_KeepAliveOnly
1899
int LastFrameActive;// Last frame number the node was updated.
1900
int LastFrameFocused;// Last frame number the node was focused.
1901
ImGuiID LastFocusedNodeId;// [Root node only] Which of our child docking node (any ancestor in the hierarchy) was last focused.
1902
ImGuiID SelectedTabId;// [Leaf node only] Which of our tab/window is selected.
1903
ImGuiID WantCloseTabId;// [Leaf node only] Set when closing a specific tab/window.
1904
ImGuiID RefViewportId;// Reference viewport ID from visible window when HostWindow == NULL.
1905
ImGuiDataAuthority AuthorityForPos :3;
1906
ImGuiDataAuthority AuthorityForSize :3;
1907
ImGuiDataAuthority AuthorityForViewport :3;
1908
bool IsVisible :1;// Set to false when the node is hidden (usually disabled as it has no active window)
1909
bool IsFocused :1;
1910
bool IsBgDrawnThisFrame :1;
1911
bool HasCloseButton :1;// Provide space for a close button (if any of the docked window has one). Note that button may be hidden on window without one.
1912
bool HasWindowMenuButton :1;
1913
bool HasCentralNodeChild :1;
1914
bool WantCloseAll :1;// Set when closing all tabs at once.
1915
bool WantLockSizeOnce :1;
1916
bool WantMouseMove :1;// After a node extraction we need to transition toward moving the newly created host window
// We don't store style.Alpha: dock_node->LastBgColor embeds it and otherwise it would only affect the docking tab, which intuitively I would say we don't want to.
1955
structImGuiWindowDockStyle
1956
{
1957
ImU32 Colors[ImGuiWindowDockStyleCol_COUNT];
1958
};
1959
1960
structImGuiDockContext
1961
{
1962
ImGuiStorage Nodes;// Map ID -> ImGuiDockNode*: Active nodes
// ImGuiViewport Private/Internals fields (cardinal sin: we are using inheritance!)
1976
// Every instance of ImGuiViewport is in fact a ImGuiViewportP.
1977
structImGuiViewportP : publicImGuiViewport
1978
{
1979
ImGuiWindow* Window;// Set when the viewport is owned by a window (and ImGuiViewportFlags_CanHostOtherWindows is NOT set)
1980
int Idx;
1981
int LastFrameActive;// Last frame number this viewport was activated by a window
1982
int LastFocusedStampCount;// Last stamp number from when a window hosted by this viewport was focused (by comparing this value between two viewport we have an implicit viewport z-order we use as fallback)
1983
ImGuiID LastNameHash;
1984
ImVec2 LastPos;
1985
ImVec2 LastSize;
1986
float Alpha;// Window opacity (when dragging dockable windows/viewports we make them transparent)
1987
float LastAlpha;
1988
bool LastFocusedHadNavWindow;// Instead of maintaining a LastFocusedWindow (which may harder to correctly maintain), we merely store weither NavWindow != NULL last time the viewport was focused.
1989
short PlatformMonitor;
1990
int BgFgDrawListsLastFrame[2];// Last frame number the background (0) and foreground (1) draw lists were used
1991
ImDrawList* BgFgDrawLists[2];// Convenience background (0) and foreground (1) draw lists. We use them to draw software mouser cursor when io.MouseDrawCursor is set and to draw most debug overlays.
1992
ImDrawData DrawDataP;
1993
ImDrawDataBuilder DrawDataBuilder;// Temporary data while building final ImDrawData
1994
ImVec2 LastPlatformPos;
1995
ImVec2 LastPlatformSize;
1996
ImVec2 LastRendererSize;
1997
1998
// Per-viewport work area
1999
// - Insets are >= 0.0f values, distance from viewport corners to work area.
2000
// - BeginMainMenuBar() and DockspaceOverViewport() tend to use work area to avoid stepping over existing contents.
2001
// - Generally 'safeAreaInsets' in iOS land, 'DisplayCutout' in Android land.
2002
ImVec2 WorkInsetMin;// Work Area inset locked for the frame. GetWorkRect() always fits within GetMainRect().
2003
ImVec2 WorkInsetMax;// "
2004
ImVec2 BuildWorkInsetMin;// Work Area inset accumulator for current frame, to become next frame's WorkInset
// Calculate work rect pos/size given a set of offset (we have 1 pair of offset for rect locked from last frame data, and 1 pair for currently building rect)
// Because we never destroy or rename ImGuiWindowSettings, we can store the names in a separate buffer easily.
2028
// (this is designed to be stored in a ImChunkStream buffer, with the variable-length Name following our structure)
2029
structImGuiWindowSettings
2030
{
2031
ImGuiID ID;
2032
ImVec2ih Pos;// NB: Settings position are stored RELATIVE to the viewport! Whereas runtime ones are absolute positions.
2033
ImVec2ih Size;
2034
ImVec2ih ViewportPos;
2035
ImGuiID ViewportId;
2036
ImGuiID DockId;// ID of last known DockNode (even if the DockNode is invisible because it has only 1 active window), or 0 if none.
2037
ImGuiID ClassId;// ID of window class if specified
2038
short DockOrder;// Order of the last time the window was visible within its DockNode. This is used to reorder windows that are reappearing on the same frame. Same value between windows that were active and windows that were none are possible.
2039
bool Collapsed;
2040
bool IsChild;
2041
bool WantApply;// Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)
2042
bool WantDelete;// Set to invalidate/delete the settings entry
constchar* TypeName;// Short description stored in .ini file. Disallowed characters: '[' ']'
2051
ImGuiID TypeHash;// == ImHashStr(TypeName)
2052
void(*ClearAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);// Clear all settings data
2053
void(*ReadInitFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);// Read: Called before reading (in registration order)
2054
void*(*ReadOpenFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler,constchar* name);// Read: Called when entering into a new ini entry e.g. "[Window][Name]"
2055
void(*ReadLineFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler,void* entry,constchar* line);// Read: Called for every line of text within an ini entry
2056
void(*ApplyAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);// Read: Called after reading (in registration order)
2057
void(*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf);// Write: Output every entries into 'out_buf'
bool QuerySuccess;// Obtained result from DebugHookIdInfo()
2173
ImGuiDataType DataType :8;
2174
char Desc[57];// Arbitrarily sized buffer to hold a result (FIXME: could replace Results[] with a chunk stream?) FIXME: Now that we added CTRL+C this should be fixed.
float FontSize;// (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.
2225
float FontBaseSize;// (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.
2226
float FontScale;// == FontSize / Font->FontSize
2227
float CurrentDpiScale;// Current window/viewport DpiScale == CurrentViewport->DpiScale
2228
ImDrawListSharedData DrawListSharedData;
2229
double Time;
2230
int FrameCount;
2231
int FrameCountEnded;
2232
int FrameCountPlatformEnded;
2233
int FrameCountRendered;
2234
bool WithinFrameScope;// Set by NewFrame(), cleared by EndFrame()
2235
bool WithinFrameScopeWithImplicitWindow;// Set by NewFrame(), cleared by EndFrame() when the implicit debug window has been pushed
2236
bool WithinEndChild;// Set within EndChild()
2237
bool GcCompactAll;// Request full GC
2238
bool TestEngineHookItems;// Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
2239
void* TestEngine;// Test engine user data
2240
char ContextName[16];// Storage for a context name (to facilitate debugging multi-context setups)
2241
2242
// Inputs
2243
ImVector<ImGuiInputEvent> InputEventsQueue;// Input events which will be trickled/written into IO structure.
2244
ImVector<ImGuiInputEvent> InputEventsTrail;// Past input events processed in NewFrame(). This is to allow domain-specific application to access e.g mouse/pen trail.
2245
ImGuiMouseSource InputEventsNextMouseSource;
2246
ImU32 InputEventsNextEventId;
2247
2248
// Windows state
2249
ImVector<ImGuiWindow*> Windows;// Windows, sorted in display order, back to front
2250
ImVector<ImGuiWindow*> WindowsFocusOrder;// Root windows, sorted in focus order, back to front.
2251
ImVector<ImGuiWindow*> WindowsTempSortBuffer;// Temporary buffer used in EndFrame() to reorder windows so parents are kept before their child
ImGuiStorage WindowsById;// Map window's ImGuiID to ImGuiWindow*
2254
int WindowsActiveCount;// Number of unique windows submitted by frame
2255
ImVec2 WindowsHoverPadding;// Padding around resizable windows for which hovering on counts as hovering the window == ImMax(style.TouchExtraPadding, WINDOWS_HOVER_PADDING).
2256
ImGuiID DebugBreakInWindow;// Set to break in Begin() call.
2257
ImGuiWindow* CurrentWindow;// Window being drawn into
2258
ImGuiWindow* HoveredWindow;// Window the mouse is hovering. Will typically catch mouse inputs.
2259
ImGuiWindow* HoveredWindowUnderMovingWindow;// Hovered window ignoring MovingWindow. Only set if MovingWindow is set.
2260
ImGuiWindow* HoveredWindowBeforeClear;// Window the mouse is hovering. Filled even with _NoMouse. This is currently useful for multi-context compositors.
2261
ImGuiWindow* MovingWindow;// Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindowDockTree.
2262
ImGuiWindow* WheelingWindow;// Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window.
2263
ImVec2 WheelingWindowRefMousePos;
2264
int WheelingWindowStartFrame;// This may be set one frame before WheelingWindow is != NULL
2265
int WheelingWindowScrolledFrame;
2266
float WheelingWindowReleaseTimer;
2267
ImVec2 WheelingWindowWheelRemainder;
2268
ImVec2 WheelingAxisAvg;
2269
2270
// Item/widgets state and tracking information
2271
ImGuiID DebugDrawIdConflicts;// Set when we detect multiple items with the same identifier
2272
ImGuiID DebugHookIdInfo;// Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
2273
ImGuiID HoveredId;// Hovered widget, filled during the frame
2274
ImGuiID HoveredIdPreviousFrame;
2275
int HoveredIdPreviousFrameItemCount;// Count numbers of items using the same ID as last frame's hovered id
2276
float HoveredIdTimer;// Measure contiguous hovering time
2277
float HoveredIdNotActiveTimer;// Measure contiguous hovering time where the item has not been active
2278
bool HoveredIdAllowOverlap;
2279
bool HoveredIdIsDisabled;// At least one widget passed the rect test, but has been discarded by disabled flag or popup inhibit. May be true even if HoveredId == 0.
2280
bool ItemUnclipByLog;// Disable ItemAdd() clipping, essentially a memory-locality friendly copy of LogEnabled
2281
ImGuiID ActiveId;// Active widget
2282
ImGuiID ActiveIdIsAlive;// Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
2283
float ActiveIdTimer;
2284
bool ActiveIdIsJustActivated;// Set at the time of activation for one frame
2285
bool ActiveIdAllowOverlap;// Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
2286
bool ActiveIdNoClearOnFocusLoss;// Disable losing active id if the active id window gets unfocused.
2287
bool ActiveIdHasBeenPressedBefore;// Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch.
2288
bool ActiveIdHasBeenEditedBefore;// Was the value associated to the widget Edited over the course of the Active state.
2289
bool ActiveIdHasBeenEditedThisFrame;
2290
bool ActiveIdFromShortcut;
2291
int ActiveIdMouseButton :8;
2292
ImVec2 ActiveIdClickOffset;// Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
2293
ImGuiWindow* ActiveIdWindow;
2294
ImGuiInputSource ActiveIdSource;// Activating source: ImGuiInputSource_Mouse OR ImGuiInputSource_Keyboard OR ImGuiInputSource_Gamepad
2295
ImGuiID ActiveIdPreviousFrame;
2296
bool ActiveIdPreviousFrameIsAlive;
2297
bool ActiveIdPreviousFrameHasBeenEditedBefore;
2298
ImGuiWindow* ActiveIdPreviousFrameWindow;
2299
ImGuiID LastActiveId;// Store the last non-zero ActiveId, useful for animation.
2300
float LastActiveIdTimer;// Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
2301
2302
// Key/Input Ownership + Shortcut Routing system
2303
// - The idea is that instead of "eating" a given key, we can link to an owner.
2304
// - Input query can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_NoOwner (== -1) or a custom ID.
2305
// - Routing is requested ahead of time for a given chord (Key + Mods) and granted in NewFrame().
2306
double LastKeyModsChangeTime;// Record the last time key mods changed (affect repeat delay when using shortcut logic)
2307
double LastKeyModsChangeFromNoneTime;// Record the last time key mods changed away from being 0 (affect repeat delay when using shortcut logic)
2308
double LastKeyboardKeyPressTime;// Record the last time a keyboard key (ignore mouse/gamepad ones) was pressed.
2309
ImBitArrayForNamedKeys KeysMayBeCharInput;// Lookup to tell if a key can emit char input, see IsKeyChordPotentiallyCharInput(). sizeof() = 20 bytes
ImU32 ActiveIdUsingNavDirMask;// Active widget will want to read those nav move requests (e.g. can activate a button and move away from it)
2313
bool ActiveIdUsingAllKeyboardKeys;// Active widget will want to read all keyboard keys inputs. (this is a shortcut for not taking ownership of 100+ keys, frequently used by drag operations)
2314
ImGuiKeyChord DebugBreakInShortcutRouting;// Set to break in SetShortcutRouting()/Shortcut() calls.
ImGuiID CurrentFocusScopeId;// Value for currently appending items == g.FocusScopeStack.back(). Not to be mistaken with g.NavFocusScopeId.
2319
ImGuiItemFlags CurrentItemFlags;// Value for currently appending items == g.ItemFlagsStack.back()
2320
ImGuiID DebugLocateId;// Storage for DebugLocateItemOnHover() feature: this is read by ItemAdd() so we keep it in a hot/cached location
2321
ImGuiNextItemData NextItemData;// Storage for SetNextItem** functions
2322
ImGuiLastItemData LastItemData;// Storage for last submitted item (setup by ItemAdd)
2323
ImGuiNextWindowData NextWindowData;// Storage for SetNextWindow** functions
2324
bool DebugShowGroupRects;
2325
2326
// Shared stacks
2327
ImGuiCol DebugFlashStyleColorIdx;// (Keep close to ColorStack to share cache line)
2328
ImVector<ImGuiColorMod> ColorStack;// Stack for PushStyleColor()/PopStyleColor() - inherited by Begin()
2329
ImVector<ImGuiStyleMod> StyleVarStack;// Stack for PushStyleVar()/PopStyleVar() - inherited by Begin()
2330
ImVector<ImFont*> FontStack;// Stack for PushFont()/PopFont() - inherited by Begin()
2331
ImVector<ImGuiFocusScopeData> FocusScopeStack;// Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin()
2332
ImVector<ImGuiItemFlags> ItemFlagsStack;// Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()
2333
ImVector<ImGuiGroupData> GroupStack;// Stack for BeginGroup()/EndGroup() - not inherited by Begin()
2334
ImVector<ImGuiPopupData> OpenPopupStack;// Which popups are open (persistent)
2335
ImVector<ImGuiPopupData> BeginPopupStack;// Which level of BeginPopup() we are in (reset every frame)
2336
ImVector<ImGuiTreeNodeStackData>TreeNodeStack;// Stack for TreeNode()
2337
2338
// Viewports
2339
ImVector<ImGuiViewportP*> Viewports;// Active viewports (always 1+, and generally 1 unless multi-viewports are enabled). Each viewports hold their copy of ImDrawData.
2340
ImGuiViewportP* CurrentViewport;// We track changes of viewport (happening in Begin) so we can call Platform_OnChangedViewport()
2341
ImGuiViewportP* MouseViewport;
2342
ImGuiViewportP* MouseLastHoveredViewport;// Last known viewport that was hovered by mouse (even if we are not hovering any viewport any more) + honoring the _NoInputs flag.
2343
ImGuiID PlatformLastFocusedViewportId;
2344
ImGuiPlatformMonitor FallbackMonitor;// Virtual monitor used as fallback if backend doesn't provide monitor information.
2345
ImRect PlatformMonitorsFullWorkRect;// Bounding box of all platform monitors
2346
int ViewportCreatedCount;// Unique sequential creation counter (mostly for testing/debugging)
2347
int PlatformWindowsCreatedCount;// Unique sequential creation counter (mostly for testing/debugging)
2348
int ViewportFocusedStampCount;// Every time the front-most window changes, we stamp its viewport with an incrementing counter
2349
2350
// Keyboard/Gamepad Navigation
2351
bool NavCursorVisible;// Nav focus cursor/rectangle is visible? We hide it after a mouse click. We show it after a nav move.
//bool NavDisableHighlight; // Old name for !g.NavCursorVisible before 1.91.4 (2024/10/18). OPPOSITE VALUE (g.NavDisableHighlight == !g.NavCursorVisible)
2354
//bool NavDisableMouseHover; // Old name for g.NavHighlightItemUnderNav before 1.91.1 (2024/10/18) this was called When user starts using keyboard/gamepad, we hide mouse hovering highlight until mouse is touched again.
2355
bool NavMousePosDirty;// When set we will update mouse position if io.ConfigNavMoveSetMousePos is set (not enabled by default)
2356
bool NavIdIsAlive;// Nav widget has been seen this frame ~~ NavRectRel is valid
2357
ImGuiID NavId;// Focused item for navigation
2358
ImGuiWindow* NavWindow;// Focused window for navigation. Could be called 'FocusedWindow'
2359
ImGuiID NavFocusScopeId;// Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
2360
ImGuiNavLayer NavLayer;// Focused layer (main scrolling layer, or menu/title bar layer)
2361
ImGuiID NavActivateId;// ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem()
ImVector<ImGuiFocusScopeData> NavFocusRoute;// Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
2366
ImGuiID NavHighlightActivatedId;
2367
float NavHighlightActivatedTimer;
2368
ImGuiID NavNextActivateId;// Set by ActivateItem(), queued until next frame.
2369
ImGuiActivateFlags NavNextActivateFlags;
2370
ImGuiInputSource NavInputSource;// Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Mouse
2371
ImGuiSelectionUserData NavLastValidSelectionUserData;// Last valid data passed to SetNextItemSelectionUser(), or -1. For current window. Not reset when focusing an item that doesn't have selection data.
2372
ImS8 NavCursorHideFrames;
2373
2374
// Navigation: Init & Move Requests
2375
bool NavAnyRequest;// ~~ NavMoveRequest || NavInitRequest this is to perform early out in ItemAdd()
2376
bool NavInitRequest;// Init request for appearing window to select first item
2377
bool NavInitRequestFromMove;
2378
ImGuiNavItemData NavInitResult;// Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)
2379
bool NavMoveSubmitted;// Move request submitted, will process result on next NewFrame()
2380
bool NavMoveScoringItems;// Move request submitted, still scoring incoming items
2381
bool NavMoveForwardToNextFrame;
2382
ImGuiNavMoveFlags NavMoveFlags;
2383
ImGuiScrollFlags NavMoveScrollFlags;
2384
ImGuiKeyChord NavMoveKeyMods;
2385
ImGuiDir NavMoveDir;// Direction of the move request (left/right/up/down)
2386
ImGuiDir NavMoveDirForDebug;
2387
ImGuiDir NavMoveClipDir;// FIXME-NAV: Describe the purpose of this better. Might want to rename?
2388
ImRect NavScoringRect;// Rectangle used for scoring, in screen space. Based of window->NavRectRel[], modified for directional navigation scoring.
2389
ImRect NavScoringNoClipRect;// Some nav operations (such as PageUp/PageDown) enforce a region which clipper will attempt to always keep submitted
2390
int NavScoringDebugCount;// Metrics for debugging
2391
int NavTabbingDir;// Generally -1 or +1, 0 when tabbing without a nav id
2392
int NavTabbingCounter;// >0 when counting items for tabbing
2393
ImGuiNavItemData NavMoveResultLocal;// Best move request candidate within NavWindow
2394
ImGuiNavItemData NavMoveResultLocalVisible;// Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
2395
ImGuiNavItemData NavMoveResultOther;// Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
2396
ImGuiNavItemData NavTabbingResultFirst;// First tabbing request candidate within NavWindow and flattened hierarchy
2397
2398
// Navigation: record of last move request
2399
ImGuiID NavJustMovedFromFocusScopeId;// Just navigated from this focus scope id (result of a successfully MoveRequest).
2400
ImGuiID NavJustMovedToId;// Just navigated to this id (result of a successfully MoveRequest).
2401
ImGuiID NavJustMovedToFocusScopeId;// Just navigated to this focus scope id (result of a successfully MoveRequest).
2402
ImGuiKeyChord NavJustMovedToKeyMods;
2403
bool NavJustMovedToIsTabbing;// Copy of ImGuiNavMoveFlags_IsTabbing. Maybe we should store whole flags.
2404
bool NavJustMovedToHasSelectionData;// Copy of move result's ItemFlags & ImGuiItemFlags_HasSelectionUserData). Maybe we should just store ImGuiNavItemData.
2405
2406
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
2407
ImGuiKeyChord ConfigNavWindowingKeyNext;// = ImGuiMod_Ctrl | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiKey_Tab on OS X). For reconfiguration (see #4828)
2408
ImGuiKeyChord ConfigNavWindowingKeyPrev;// = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey_Tab on OS X)
2409
ImGuiWindow* NavWindowingTarget;// Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
2410
ImGuiWindow* NavWindowingTargetAnim;// Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it.
2411
ImGuiWindow* NavWindowingListWindow;// Internal window actually listing the CTRL+Tab contents
2412
float NavWindowingTimer;
2413
float NavWindowingHighlightAlpha;
2414
bool NavWindowingToggleLayer;
2415
ImGuiKey NavWindowingToggleKey;
2416
ImVec2 NavWindowingAccumDeltaPos;
2417
ImVec2 NavWindowingAccumDeltaSize;
2418
2419
// Render
2420
float DimBgRatio;// 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
2421
2422
// Drag and Drop
2423
bool DragDropActive;
2424
bool DragDropWithinSource;// Set when within a BeginDragDropXXX/EndDragDropXXX block for a drag source.
2425
bool DragDropWithinTarget;// Set when within a BeginDragDropXXX/EndDragDropXXX block for a drag target.
2426
ImGuiDragDropFlags DragDropSourceFlags;
2427
int DragDropSourceFrameCount;
2428
int DragDropMouseButton;
2429
ImGuiPayload DragDropPayload;
2430
ImRect DragDropTargetRect;// Store rectangle of current target candidate (we favor small targets when overlapping)
2431
ImRect DragDropTargetClipRect;// Store ClipRect at the time of item's drawing
2432
ImGuiID DragDropTargetId;
2433
ImGuiDragDropFlags DragDropAcceptFlags;
2434
float DragDropAcceptIdCurrRectSurface;// Target item surface (we resolve overlapping targets by prioritizing the smaller surface)
2435
ImGuiID DragDropAcceptIdCurr;// Target item id (set at the time of accepting the payload)
2436
ImGuiID DragDropAcceptIdPrev;// Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)
2437
int DragDropAcceptFrameCount;// Last time a target expressed a desire to accept the source
2438
ImGuiID DragDropHoldJustPressedId;// Set when holding a payload just made ButtonBehavior() return a press.
2439
ImVector<unsignedchar> DragDropPayloadBufHeap;// We don't expose the ImVector<> directly, ImGuiPayload only holds pointer+size
2440
unsignedchar DragDropPayloadBufLocal[16];// Local buffer for small payloads
2441
2442
// Clipper
2443
int ClipperTempDataStacked;
2444
ImVector<ImGuiListClipperData> ClipperTempData;
2445
2446
// Tables
2447
ImGuiTable* CurrentTable;
2448
ImGuiID DebugBreakInTable;// Set to break in BeginTable() call.
2449
int TablesTempDataStacked;// Temporary table data size (because we leave previous instances undestructed, we generally don't use TablesTempData.Size)
2450
ImVector<ImGuiTableTempData> TablesTempData;// Temporary table data (buffers reused/shared across instances, support nesting)
2451
ImPool<ImGuiTable> Tables;// Persistent table data
2452
ImVector<float> TablesLastTimeActive;// Last used timestamp of each tables (SOA, for efficient GC)
int MultiSelectTempDataStacked;// Temporary multi-select data size (because we leave previous instances undestructed, we generally don't use MultiSelectTempData.Size)
// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.
2603
// (That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered..)
2604
// (This doesn't need a constructor because we zero-clear it as part of ImGuiWindow and all frame-temporary data are setup on Begin)
2605
struct IMGUI_API ImGuiWindowTempData
2606
{
2607
// Layout
2608
ImVec2 CursorPos;// Current emitting position, in absolute coordinates.
2609
ImVec2 CursorPosPrevLine;
2610
ImVec2 CursorStartPos;// Initial position after Begin(), generally ~ window position + WindowPadding.
2611
ImVec2 CursorMaxPos;// Used to implicitly calculate ContentSize at the beginning of next frame, for scrolling range and auto-resize. Always growing during the frame.
2612
ImVec2 IdealMaxPos;// Used to implicitly calculate ContentSizeIdeal at the beginning of next frame, for auto-resize only. Always growing during the frame.
2613
ImVec2 CurrLineSize;
2614
ImVec2 PrevLineSize;
2615
float CurrLineTextBaseOffset;// Baseline offset (0.0f by default on a new line, generally == style.FramePadding.y when a framed item has been added).
2616
float PrevLineTextBaseOffset;
2617
bool IsSameLine;
2618
bool IsSetPos;
2619
ImVec1 Indent;// Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
2620
ImVec1 ColumnsOffset;// 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.
2621
ImVec1 GroupOffset;
2622
ImVec2 CursorStartPosLossyness;// Record the loss of precision of CursorStartPos due to really large scrolling amount. This is used by clipper to compensate and fix the most common use case of large scroll area.
2623
2624
// Keyboard/Gamepad navigation
2625
ImGuiNavLayer NavLayerCurrent;// Current layer, 0..31 (we currently only use 0..1)
2626
short NavLayersActiveMask;// Which layers have been written to (result from previous frame)
2627
short NavLayersActiveMaskNext;// Which layers have been written to (accumulator for current frame)
2628
bool NavIsScrollPushableX;// Set when current work location may be scrolled horizontally when moving left / right. This is generally always true UNLESS within a column.
2629
bool NavHideHighlightOneFrame;
2630
bool NavWindowHasScrollY;// Set per window when scrolling can be used (== ScrollMax.y > 0.0f)
2631
2632
// Miscellaneous
2633
bool MenuBarAppending;// FIXME: Remove this
2634
ImVec2 MenuBarOffset;// MenuBarOffset.x is sort of equivalent of a per-layer CursorPos.x, saved/restored as we switch to the menu bar. The only situation when MenuBarOffset.y is > 0 if when (SafeAreaPadding.y > FramePadding.y), often used on TVs.
2635
ImGuiMenuColumns MenuColumns;// Simplified columns storage for menu items measurement
2636
int TreeDepth;// Current tree depth.
2637
ImU32 TreeHasStackDataDepthMask;// Store whether given depth has ImGuiTreeNodeStackData data. Could be turned into a ImU64 if necessary.
2638
ImVector<ImGuiWindow*> ChildWindows;
2639
ImGuiStorage* StateStorage;// Current persistent per-window storage (store e.g. tree node open/close state)
2640
ImGuiOldColumns* CurrentColumns;// Current columns set
2641
int CurrentTableIdx;// Current table index (into g.Tables)
2642
ImGuiLayoutType LayoutType;
2643
ImGuiLayoutType ParentLayoutType;// Layout type of parent window at the time of Begin()
2644
ImU32 ModalDimBgColor;
2645
2646
// Local parameters stacks
2647
// 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.
2648
float ItemWidth;// Current item width (>0.0: width in pixels, <0.0: align xx pixels to the right of window).
2649
float TextWrapPos;// Current text wrap pos.
2650
ImVector<float> ItemWidthStack;// Store item widths to restore (attention: .back() is not == ItemWidth)
2651
ImVector<float> TextWrapPosStack;// Store text wrap pos to restore (attention: .back() is not == TextWrapPos)
2652
};
2653
2654
// Storage for one window
2655
struct IMGUI_API ImGuiWindow
2656
{
2657
ImGuiContext* Ctx;// Parent UI context (needs to be set explicitly by parent).
2658
char* Name;// Window name, owned by the window.
2659
ImGuiID ID;// == ImHashStr(Name)
2660
ImGuiWindowFlags Flags, FlagsPreviousFrame;// See enum ImGuiWindowFlags_
2661
ImGuiChildFlags ChildFlags;// Set when window is a child window. See enum ImGuiChildFlags_
2662
ImGuiWindowClass WindowClass;// Advanced users only. Set with SetNextWindowClass()
2663
ImGuiViewportP* Viewport;// Always set in Begin(). Inactive windows may have a NULL value here if their viewport was discarded.
2664
ImGuiID ViewportId;// We backup the viewport id (since the viewport may disappear or never be created if the window is inactive)
2665
ImVec2 ViewportPos;// We backup the viewport position (since the viewport may disappear or never be created if the window is inactive)
2666
int ViewportAllowPlatformMonitorExtend;// Reset to -1 every frame (index is guaranteed to be valid between NewFrame..EndFrame), only used in the Appearing frame of a tooltip/popup to enforce clamping to a given monitor
2667
ImVec2 Pos;// Position (always rounded-up to nearest pixel)
2668
ImVec2 Size;// Current size (==SizeFull or collapsed title bar size)
2669
ImVec2 SizeFull;// Size when non collapsed
2670
ImVec2 ContentSize;// Size of contents/scrollable client area (calculated from the extents reach of the cursor) from previous frame. Does not include window decoration or window padding.
2671
ImVec2 ContentSizeIdeal;
2672
ImVec2 ContentSizeExplicit;// Size of contents/scrollable client area explicitly request by the user via SetNextWindowContentSize().
2673
ImVec2 WindowPadding;// Window padding at the time of Begin().
2674
float WindowRounding;// Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc.
2675
float WindowBorderSize;// Window border size at the time of Begin().
2676
float TitleBarHeight, MenuBarHeight;// Note that those used to be function before 2024/05/28. If you have old code calling TitleBarHeight() you can change it to TitleBarHeight.
2677
float DecoOuterSizeX1, DecoOuterSizeY1;// Left/Up offsets. Sum of non-scrolling outer decorations (X1 generally == 0.0f. Y1 generally = TitleBarHeight + MenuBarHeight). Locked during Begin().
float DecoInnerSizeX1, DecoInnerSizeY1;// Applied AFTER/OVER InnerRect. Specialized for Tables as they use specialized form of clipping and frozen rows/columns are inside InnerRect (and not part of regular decoration sizes).
2680
int NameBufLen;// Size of buffer storing Name. May be larger than strlen(Name)!
2681
ImGuiID MoveId;// == window->GetID("#MOVE")
2682
ImGuiID TabId;// == window->GetID("#TAB")
2683
ImGuiID ChildId;// ID of corresponding item in parent window (for navigation to return from child window to parent window)
2684
ImGuiID PopupId;// ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)
2685
ImVec2 Scroll;
2686
ImVec2 ScrollMax;
2687
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)
2688
ImVec2 ScrollTargetCenterRatio;// 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
2689
ImVec2 ScrollTargetEdgeSnapDist;// 0.0f = no snapping, >0.0f snapping threshold
2690
ImVec2 ScrollbarSizes;// Size taken by each scrollbars on their smaller axis. Pay attention! ScrollbarSizes.x == width of the vertical scrollbar, ScrollbarSizes.y = height of the horizontal scrollbar.
2691
bool ScrollbarX, ScrollbarY;// Are scrollbars visible?
2692
bool ViewportOwned;
2693
bool Active;// Set to true on Begin(), unless Collapsed
2694
bool WasActive;
2695
bool WriteAccessed;// Set to true when any widget access the current window
2696
bool Collapsed;// Set when collapsing window to become only title-bar
2697
bool WantCollapseToggle;
2698
bool SkipItems;// Set when items can safely be all clipped (e.g. window not visible or collapsed)
bool Appearing;// Set during the frame where the window is appearing (or re-appearing)
2701
bool Hidden;// Do not display (== HiddenFrames*** > 0)
2702
bool IsFallbackWindow;// Set on the "Debug##Default" window.
2703
bool IsExplicitChild;// Set when passed _ChildWindow, left to false by BeginDocked()
2704
bool HasCloseButton;// Set when the window has a close button (p_open != NULL)
2705
signedchar ResizeBorderHovered;// Current border being hovered for resize (-1: none, otherwise 0-3)
2706
signedchar ResizeBorderHeld;// Current border being held for resize (-1: none, otherwise 0-3)
2707
short BeginCount;// Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
2708
short BeginCountPreviousFrame;// Number of Begin() during the previous frame
2709
short BeginOrderWithinParent;// Begin() order within immediate parent window, if we are a child window. Otherwise 0.
2710
short BeginOrderWithinContext;// Begin() order within entire imgui context. This is mostly used for debugging submission order related issues.
2711
short FocusOrder;// Order within WindowsFocusOrder[], altered when windows are focused.
2712
ImS8 AutoFitFramesX, AutoFitFramesY;
2713
bool AutoFitOnlyGrows;
2714
ImGuiDir AutoPosLastDirection;
2715
ImS8 HiddenFramesCanSkipItems;// Hide the window for N frames
2716
ImS8 HiddenFramesCannotSkipItems;// Hide the window for N frames while allowing items to be submitted so we can measure their size
2717
ImS8 HiddenFramesForRenderOnly;// Hide the window until frame N at Render() time only
2718
ImS8 DisableInputsFrames;// Disable window interactions for N frames
2719
ImGuiCond SetWindowPosAllowFlags :8;// store acceptable condition flags for SetNextWindowPos() use.
2720
ImGuiCond SetWindowSizeAllowFlags :8;// store acceptable condition flags for SetNextWindowSize() use.
2721
ImGuiCond SetWindowCollapsedAllowFlags :8;// store acceptable condition flags for SetNextWindowCollapsed() use.
2722
ImGuiCond SetWindowDockAllowFlags :8;// store acceptable condition flags for SetNextWindowDock() use.
2723
ImVec2 SetWindowPosVal;// store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
2724
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.
2725
2726
ImVector<ImGuiID> IDStack;// ID stack. ID are hashes seeded with the value at the top of the stack. (In theory this should be in the TempData structure)
2727
ImGuiWindowTempData DC;// Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
2728
2729
// The best way to understand what those rectangles are is to use the 'Metrics->Tools->Show Windows Rectangles' viewer.
2730
// The main 'OuterRect', omitted as a field, is window->Rect().
2731
ImRect OuterRectClipped;// == Window->Rect() just after setup in Begin(). == window->Rect() for root window.
2732
ImRect InnerRect;// Inner rectangle (omit title bar, menu bar, scroll bar)
2733
ImRect InnerClipRect;// == InnerRect shrunk by WindowPadding*0.5f on each side, clipped within viewport or parent clip rect.
2734
ImRect WorkRect;// Initially covers the whole scrolling region. Reduced by containers e.g columns/tables when active. Shrunk by WindowPadding*1.0f on each side. This is meant to replace ContentRegionRect over time (from 1.71+ onward).
2735
ImRect ParentWorkRect;// Backup of WorkRect before entering a container such as columns/tables. Used by e.g. SpanAllColumns functions to easily access. Stacked containers are responsible for maintaining this. // FIXME-WORKRECT: Could be a stack?
2736
ImRect ClipRect;// Current clipping/scissoring rectangle, evolve as we are using PushClipRect(), etc. == DrawList->clip_rect_stack.back().
2737
ImRect ContentRegionRect;// FIXME: This is currently confusing/misleading. It is essentially WorkRect but not handling of scrolling. We currently rely on it as right/bottom aligned sizing operation need some size to rely on.
2738
ImVec2ih HitTestHoleSize;// Define an optional rectangular hole where mouse will pass-through the window.
2739
ImVec2ih HitTestHoleOffset;
2740
2741
int LastFrameActive;// Last frame number the window was Active.
2742
int LastFrameJustFocused;// Last frame number the window was made Focused.
2743
float LastTimeActive;// Last timestamp the window was Active (using float as we don't need high precision there)
2744
float ItemWidthDefault;
2745
ImGuiStorage StateStorage;
2746
ImVector<ImGuiOldColumns> ColumnsStorage;
2747
float FontWindowScale;// User scale multiplier per-window, via SetWindowFontScale()
2748
float FontDpiScale;
2749
int SettingsOffset;// Offset into SettingsWindows[] (offsets are always valid as we only grow the array from the back)
2750
2751
ImDrawList* DrawList;// == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
2752
ImDrawList DrawListInst;
2753
ImGuiWindow* ParentWindow;// If we are a child _or_ popup _or_ docked window, this is pointing to our parent. Otherwise NULL.
2754
ImGuiWindow* ParentWindowInBeginStack;
2755
ImGuiWindow* RootWindow;// Point to ourself or first ancestor that is not a child window. Doesn't cross through popups/dock nodes.
2756
ImGuiWindow* RootWindowPopupTree;// Point to ourself or first ancestor that is not a child window. Cross through popups parent<>child.
2757
ImGuiWindow* RootWindowDockTree;// Point to ourself or first ancestor that is not a child window. Cross through dock nodes.
2758
ImGuiWindow* RootWindowForTitleBarHighlight;// Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
2759
ImGuiWindow* RootWindowForNav;// Point to ourself or first ancestor which doesn't have the NavFlattened flag.
2760
ImGuiWindow* ParentWindowForFocusRoute;// Set to manual link a window to its logical parent so that Shortcut() chain are honoerd (e.g. Tool linked to Document)
2761
2762
ImGuiWindow* NavLastChildNavWindow;// When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.)
2763
ImGuiID NavLastIds[ImGuiNavLayer_COUNT];// Last known NavId for this window, per layer (0/1)
2764
ImRect NavRectRel[ImGuiNavLayer_COUNT];// Reference rectangle, in window relative space
2765
ImVec2 NavPreferredScoringPosRel[ImGuiNavLayer_COUNT];// Preferred X/Y position updated when moving on a given axis, reset to FLT_MAX.
2766
ImGuiID NavRootFocusScopeId;// Focus Scope ID at the time of Begin()
2767
2768
int MemoryDrawListIdxCapacity;// Backup of last idx/vtx count, so when waking up the window we can preallocate and avoid iterative alloc/copy
2769
int MemoryDrawListVtxCapacity;
2770
bool MemoryCompacted;// Set when window extraneous data have been garbage collected
2771
2772
// Docking
2773
bool DockIsActive :1;// When docking artifacts are actually visible. When this is set, DockNode is guaranteed to be != NULL. ~~ (DockNode != NULL) && (DockNode->Windows.Size > 1).
2774
bool DockNodeIsVisible :1;
2775
bool DockTabIsVisible :1;// Is our window visible this frame? ~~ is the corresponding tab selected?
2776
bool DockTabWantClose :1;
2777
short DockOrder;// Order of the last time the window was visible within its DockNode. This is used to reorder windows that are reappearing on the same frame. Same value between windows that were active and windows that were none are possible.
2778
ImGuiWindowDockStyle DockStyle;
2779
ImGuiDockNode* DockNode;// Which node are we docked into. Important: Prefer testing DockIsActive in many cases as this will still be set when the dock node is hidden.
2780
ImGuiDockNode* DockNodeAsHost;// Which node are we owning (for parent windows)
2781
ImGuiID DockId;// Backup of last valid DockNode->ID, so single window remember their dock node id even when they are not bound any more
ImGuiTabBarFlags_DockNode =1<<20,// Part of a dock node [we don't use this in the master branch but it facilitate branch syncing to keep this around]
2810
ImGuiTabBarFlags_IsFocused =1<<21,
2811
ImGuiTabBarFlags_SaveSettings =1<<22,// FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs
ImGuiTabItemFlags_NoCloseButton =1<<20,// Track whether p_open was set or not (we'll need this info on the next frame to recompute ContentWidth during layout)
2819
ImGuiTabItemFlags_Button =1<<21,// Used by TabItemButton, change the tab item behavior to mimic a button
2820
ImGuiTabItemFlags_Unsorted =1<<22,// [Docking] Trailing tabs with the _Unsorted flag will be sorted based on the DockOrder of their Window.
2821
};
2822
2823
// Storage for one active tab item (sizeof() 48 bytes)
2824
structImGuiTabItem
2825
{
2826
ImGuiID ID;
2827
ImGuiTabItemFlags Flags;
2828
ImGuiWindow* Window;// When TabItem is part of a DockNode's TabBar, we hold on to a window.
2829
int LastFrameVisible;
2830
int LastFrameSelected;// This allows us to infer an ordered list of the last activated tabs with little maintenance
2831
float Offset;// Position relative to beginning of tab
2832
float Width;// Width currently displayed
2833
float ContentWidth;// Width of label, stored during BeginTabItem() call
2834
float RequestedWidth;// Width optionally requested by caller, -1.0f is unused
2835
ImS32 NameOffset;// When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames
2836
ImS16 BeginOrder;// BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable
2837
ImS16 IndexDuringLayout;// Index only used during TabBarLayout(). Tabs gets reordered so 'Tabs[n].IndexDuringLayout == n' but may mismatch during additions.
2838
bool WantClose;// Marked as closed by SetTabItemClosed()
#defineIM_COL32_DISABLEIM_COL32(0,0,0,1)// Special sentinel code which cannot be used as a regular color.
2889
#defineIMGUI_TABLE_MAX_COLUMNS512// May be further lifted
2890
2891
// Our current column maximum is 64 but we may raise that in the future.
2892
typedef ImS16 ImGuiTableColumnIdx;
2893
typedef ImU16 ImGuiTableDrawChannelIdx;
2894
2895
// [Internal] sizeof() ~ 112
2896
// We use the terminology "Enabled" to refer to a column that is not Hidden by user/api.
2897
// We use the terminology "Clipped" to refer to a column that is out of sight because of scrolling/clipping.
2898
// This is in contrast with some user-facing api such as IsItemVisible() / IsRectVisible() which use "Visible" to mean "not clipped".
2899
structImGuiTableColumn
2900
{
2901
ImGuiTableColumnFlags Flags;// Flags after some patching (not directly same as provided by user). See ImGuiTableColumnFlags_
2902
float WidthGiven;// Final/actual width visible == (MaxX - MinX), locked in TableUpdateLayout(). May be > WidthRequest to honor minimum width, may be < WidthRequest to honor shrinking columns down in tight space.
2903
float MinX;// Absolute positions
2904
float MaxX;
2905
float WidthRequest;// Master width absolute value when !(Flags & _WidthStretch). When Stretch this is derived every frame from StretchWeight in TableUpdateLayout()
2906
float WidthAuto;// Automatic width
2907
float WidthMax;// Maximum width (FIXME: overwritten by each instance)
2908
float StretchWeight;// Master width weight when (Flags & _WidthStretch). Often around ~1.0f initially.
2909
float InitStretchWeightOrWidth;// Value passed to TableSetupColumn(). For Width it is a content width (_without padding_).
2910
ImRect ClipRect;// Clipping rectangle for the column
2911
ImGuiID UserID;// Optional, value passed to TableSetupColumn()
2912
float WorkMinX;// Contents region min ~(MinX + CellPaddingX + CellSpacingX1) == cursor start position when entering column
2913
float WorkMaxX;// Contents region max ~(MaxX - CellPaddingX - CellSpacingX2)
2914
float ItemWidth;// Current item width for the column, preserved across rows
2915
float ContentMaxXFrozen;// Contents maximum position for frozen rows (apart from headers), from which we can infer content width.
2916
float ContentMaxXUnfrozen;
2917
float ContentMaxXHeadersUsed;// Contents maximum position for headers rows (regardless of freezing). TableHeader() automatically softclip itself + report ideal desired size, to avoid creating extraneous draw calls
2918
float ContentMaxXHeadersIdeal;
2919
ImS16 NameOffset;// Offset into parent ColumnsNames[]
2920
ImGuiTableColumnIdx DisplayOrder;// Index within Table's IndexToDisplayOrder[] (column may be reordered by users)
2921
ImGuiTableColumnIdx IndexWithinEnabledSet;// Index within enabled/visible set (<= IndexToDisplayOrder)
2922
ImGuiTableColumnIdx PrevEnabledColumn;// Index of prev enabled/visible column within Columns[], -1 if first enabled/visible column
2923
ImGuiTableColumnIdx NextEnabledColumn;// Index of next enabled/visible column within Columns[], -1 if last enabled/visible column
2924
ImGuiTableColumnIdx SortOrder;// Index of this column within sort specs, -1 if not sorting on this column, 0 for single-sort, may be >0 on multi-sort
2925
ImGuiTableDrawChannelIdx DrawChannelCurrent;// Index within DrawSplitter.Channels[]
2926
ImGuiTableDrawChannelIdx DrawChannelFrozen;// Draw channels for frozen rows (often headers)
2927
ImGuiTableDrawChannelIdx DrawChannelUnfrozen;// Draw channels for unfrozen rows
// This may end up being refactored for more general purpose.
2967
// sizeof() ~ 12 bytes
2968
structImGuiTableHeaderData
2969
{
2970
ImGuiTableColumnIdx Index;// Column index
2971
ImU32 TextColor;
2972
ImU32 BgColor0;
2973
ImU32 BgColor1;
2974
};
2975
2976
// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs. Does that means they could be moved to ImGuiTableTempData?)
2977
// sizeof() ~ 24 bytes
2978
structImGuiTableInstanceData
2979
{
2980
ImGuiID TableInstanceID;
2981
float LastOuterHeight;// Outer height from last frame
2982
float LastTopHeadersRowHeight;// Height of first consecutive header rows from last frame (FIXME: this is used assuming consecutive headers are in same frozen set)
2983
float LastFrozenHeight;// Height of frozen section from last frame
2984
int HoveredRowLast;// Index of row which was hovered last frame.
2985
int HoveredRowNext;// Index of row hovered this frame, set after encountering it.
// sizeof() ~ 592 bytes + heap allocs described in TableBeginInitMemory()
2991
struct IMGUI_API ImGuiTable
2992
{
2993
ImGuiID ID;
2994
ImGuiTableFlags Flags;
2995
void* RawData;// Single allocation to hold Columns[], DisplayOrderToIndex[] and RowCellData[]
2996
ImGuiTableTempData* TempData;// Transient data while table is active. Point within g.CurrentTableStack[]
2997
ImSpan<ImGuiTableColumn> Columns;// Point within RawData[]
2998
ImSpan<ImGuiTableColumnIdx> DisplayOrderToIndex;// Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)
2999
ImSpan<ImGuiTableCellData> RowCellData;// Point within RawData[]. Store cells background requests for current row.
ImBitArrayPtr EnabledMaskByIndex;// Column Index -> IsEnabled map (== not hidden by user/api) in a format adequate for iterating column without touching cold data
3002
ImBitArrayPtr VisibleMaskByIndex;// Column Index -> IsVisibleX|IsVisibleY map (== not hidden by user/api && not hidden by scrolling/cliprect)
3003
ImGuiTableFlags SettingsLoadedFlags;// Which data were loaded from the .ini file (e.g. when order is not altered we won't save order)
3004
int SettingsOffset;// Offset in g.SettingsTables
3005
int LastFrameActive;
3006
int ColumnsCount;// Number of columns declared in BeginTable()
3007
int CurrentRow;
3008
int CurrentColumn;
3009
ImS16 InstanceCurrent;// Count of BeginTable() calls with same ID in the same frame (generally 0). This is a little bit similar to BeginCount for a window, but multiple table with same ID look are multiple tables, they are just synched.
3010
ImS16 InstanceInteracted;// Mark which instance (generally 0) of the same ID is being interacted with
3011
float RowPosY1;
3012
float RowPosY2;
3013
float RowMinHeight;// Height submitted to TableNextRow()
3014
float RowCellPaddingY;// Top and bottom padding. Reloaded during row change.
3015
float RowTextBaseline;
3016
float RowIndentOffsetX;
3017
ImGuiTableRowFlags RowFlags :16;// Current row flags, see ImGuiTableRowFlags_
3018
ImGuiTableRowFlags LastRowFlags :16;
3019
int RowBgColorCounter;// Counter for alternating background colors (can be fast-forwarded by e.g clipper), not same as CurrentRow because header rows typically don't increase this.
3020
ImU32 RowBgColor[2];// Background color override for current row.
3021
ImU32 BorderColorStrong;
3022
ImU32 BorderColorLight;
3023
float BorderX1;
3024
float BorderX2;
3025
float HostIndentX;
3026
float MinColumnWidth;
3027
float OuterPaddingX;
3028
float CellPaddingX;// Padding from each borders. Locked in BeginTable()/Layout.
3029
float CellSpacingX1;// Spacing between non-bordered cells. Locked in BeginTable()/Layout.
3030
float CellSpacingX2;
3031
float InnerWidth;// User value passed to BeginTable(), see comments at the top of BeginTable() for details.
3032
float ColumnsGivenWidth;// Sum of current column width
3033
float ColumnsAutoFitWidth;// Sum of ideal column width in order nothing to be clipped, used for auto-fitting and content width submission in outer window
3034
float ColumnsStretchSumWeights;// Sum of weight of all enabled stretching columns
3035
float ResizedColumnNextWidth;
3036
float ResizeLockMinContentsX2;// Lock minimum contents width while resizing down in order to not create feedback loops. But we allow growing the table.
3037
float RefScale;// Reference scale to be able to rescale columns on font/dpi changes.
3038
float AngledHeadersHeight;// Set by TableAngledHeadersRow(), used in TableUpdateLayout()
3039
float AngledHeadersSlope;// Set by TableAngledHeadersRow(), used in TableUpdateLayout()
3040
ImRect OuterRect;// Note: for non-scrolling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
3041
ImRect InnerRect;// InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is
3042
ImRect WorkRect;
3043
ImRect InnerClipRect;
3044
ImRect BgClipRect;// We use this to cpu-clip cell background color fill, evolve during the frame as we cross frozen rows boundaries
3045
ImRect Bg0ClipRectForDrawCmd;// Actual ImDrawCmd clip rect for BG0/1 channel. This tends to be == OuterWindow->ClipRect at BeginTable() because output in BG0/BG1 is cpu-clipped
3046
ImRect Bg2ClipRectForDrawCmd;// Actual ImDrawCmd clip rect for BG2 channel. This tends to be a correct, tight-fit, because output to BG2 are done by widgets relying on regular ClipRect.
3047
ImRect HostClipRect;// This is used to check if we can eventually merge our columns draw calls into the current draw call of the current window.
3048
ImRect HostBackupInnerClipRect;// Backup of InnerWindow->ClipRect during PushTableBackground()/PopTableBackground()
3049
ImGuiWindow* OuterWindow;// Parent window for the table
3050
ImGuiWindow* InnerWindow;// Window holding the table data (== OuterWindow or a child window)
ImDrawListSplitter* DrawSplitter;// Shortcut to TempData->DrawSplitter while in table. Isolate draw commands per columns to avoid switching clip rect constantly
3053
ImGuiTableInstanceData InstanceDataFirst;
3054
ImVector<ImGuiTableInstanceData> InstanceDataExtra;// FIXME-OPT: Using a small-vector pattern would be good.
3055
ImGuiTableColumnSortSpecs SortSpecsSingle;
3056
ImVector<ImGuiTableColumnSortSpecs> SortSpecsMulti;// FIXME-OPT: Using a small-vector pattern would be good.
3057
ImGuiTableSortSpecs SortSpecs;// Public facing sorts specs, this is what we return in TableGetSortSpecs()
3058
ImGuiTableColumnIdx SortSpecsCount;
3059
ImGuiTableColumnIdx ColumnsEnabledCount;// Number of enabled columns (<= ColumnsCount)
3060
ImGuiTableColumnIdx ColumnsEnabledFixedCount;// Number of enabled columns using fixed width (<= ColumnsCount)
3061
ImGuiTableColumnIdx DeclColumnsCount;// Count calls to TableSetupColumn()
3062
ImGuiTableColumnIdx AngledHeadersCount;// Count columns with angled headers
3063
ImGuiTableColumnIdx HoveredColumnBody;// Index of column whose visible region is being hovered. Important: == ColumnsCount when hovering empty region after the right-most column!
3064
ImGuiTableColumnIdx HoveredColumnBorder;// Index of column whose right-border is being hovered (for resizing).
3065
ImGuiTableColumnIdx HighlightColumnHeader;// Index of column which should be highlighted.
3066
ImGuiTableColumnIdx AutoFitSingleColumn;// Index of single column requesting auto-fit.
3067
ImGuiTableColumnIdx ResizedColumn;// Index of column being resized. Reset when InstanceCurrent==0.
3068
ImGuiTableColumnIdx LastResizedColumn;// Index of column being resized from previous frame.
3069
ImGuiTableColumnIdx HeldHeaderColumn;// Index of column header being held.
3070
ImGuiTableColumnIdx ReorderColumn;// Index of column being reordered. (not cleared)
3071
ImGuiTableColumnIdx ReorderColumnDir;// -1 or +1
3072
ImGuiTableColumnIdx LeftMostEnabledColumn;// Index of left-most non-hidden column.
3073
ImGuiTableColumnIdx RightMostEnabledColumn;// Index of right-most non-hidden column.
3074
ImGuiTableColumnIdx LeftMostStretchedColumn;// Index of left-most stretched column.
3075
ImGuiTableColumnIdx RightMostStretchedColumn;// Index of right-most stretched column.
3076
ImGuiTableColumnIdx ContextPopupColumn;// Column right-clicked on, of -1 if opening context menu from a neutral/empty spot
ImGuiTableDrawChannelIdx Bg2DrawChannelCurrent;// For Selectable() and other widgets drawing across columns after the freezing line. Index within DrawSplitter.Channels[]
3084
ImGuiTableDrawChannelIdx Bg2DrawChannelUnfrozen;
3085
bool IsLayoutLocked;// Set by TableUpdateLayout() which is called when beginning the first row.
3086
bool IsInsideRow;// Set when inside TableBeginRow()/TableEndRow().
3087
bool IsInitializing;
3088
bool IsSortSpecsDirty;
3089
bool IsUsingHeaders;// Set when the first row had the ImGuiTableRowFlags_Headers flag.
3090
bool IsContextPopupOpen;// Set when default context menu is open (also see: ContextPopupColumn, InstanceInteracted).
3091
bool DisableDefaultContextMenu;// Disable default context menu contents. You may submit your own using TableBeginContextMenuPopup()/EndPopup()
3092
bool IsSettingsRequestLoad;
3093
bool IsSettingsDirty;// Set when table settings have changed and needs to be reported into ImGuiTableSetttings data.
3094
bool IsDefaultDisplayOrder;// Set when display order is unchanged from default (DisplayOrder contains 0...Count-1)
3095
bool IsResetAllRequest;
3096
bool IsResetDisplayOrderRequest;
3097
bool IsUnfrozenRows;// Set when we got past the frozen row.
3098
bool IsDefaultSizingPolicy;// Set if user didn't explicitly set a sizing policy in BeginTable()
3099
bool IsActiveIdAliveBeforeTable;
3100
bool IsActiveIdInTable;
3101
bool HasScrollbarYCurr;// Whether ANY instance of this table had a vertical scrollbar during the current frame.
3102
bool HasScrollbarYPrev;// Whether ANY instance of this table had a vertical scrollbar during the previous.
3103
bool MemoryCompacted;
3104
bool HostSkipItems;// Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
// This is designed to be stored in a single ImChunkStream (1 header followed by N ImGuiTableColumnSettings, etc.)
3162
structImGuiTableSettings
3163
{
3164
ImGuiID ID;// Set to 0 to invalidate/delete the setting
3165
ImGuiTableFlags SaveFlags;// Indicate data we want to save using the Resizable/Reorderable/Sortable/Hideable flags (could be using its own flags..)
3166
float RefScale;// Reference scale to be able to rescale columns on font/dpi changes.
3167
ImGuiTableColumnIdx ColumnsCount;
3168
ImGuiTableColumnIdx ColumnsCountMax;// Maximum number of columns this settings instance can store, we can recycle a settings instance with lower number of columns but not higher
3169
bool WantApply;// Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)
inlinevoidSetWindowParentWindowForFocusRoute(ImGuiWindow* window, ImGuiWindow* parent_window){ window->ParentWindowForFocusRoute = parent_window;}// You may also use SetNextWindowClass()'s FocusRouteParentWindowId field.
inlinevoidItemSize(const ImRect& bb,float text_baseline_y =-1.0f){ItemSize(bb.GetSize(), text_baseline_y);}// FIXME: This is a misleading API since we expect CursorPos to be bb.Min.
IMGUI_API voidLogBegin(ImGuiLogFlags flags,int auto_open_depth);// -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.
3324
IMGUI_API voidLogToBuffer(int auto_open_depth =-1);// Start logging/capturing to internal buffer
// This should be part of a larger set of API: FocusItem(offset = -1), FocusItemByID(id), ActivateItem(offset = -1), ActivateItemByID(id) etc. which are
3380
// much harder to design and implement than expected. I have a couple of private branches on this matter but it's not simple. For now implementing the easy ones.
3381
IMGUI_API voidFocusItem();// Focus last item (no selection/activation).
3382
IMGUI_API voidActivateItemByID(ImGuiID id);// Activate an item by ID (button, checkbox, tree node etc.). Activation is queued and processed on the next frame when the item is encountered again.
3383
3384
// Inputs
3385
// FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions.
inlineboolIsActiveIdUsingNavDir(ImGuiDir dir){ ImGuiContext& g =*GImGui;return(g.ActiveIdUsingNavDirMask&(1<< dir))!=0;}
3416
3417
// [EXPERIMENTAL] Low-Level: Key/Input Ownership
3418
// - The idea is that instead of "eating" a given input, we can link to an owner id.
3419
// - Ownership is most often claimed as a result of reacting to a press/down event (but occasionally may be claimed ahead).
3420
// - Input queries can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_NoOwner (== -1) or a custom ID.
3421
// - Legacy input queries (without specifying an owner or _Any or _None) are equivalent to using ImGuiKeyOwner_Any (== 0).
3422
// - Input ownership is automatically released on the frame after a key is released. Therefore:
3423
// - for ownership registration happening as a result of a down/press event, the SetKeyOwner() call may be done once (common case).
3424
// - for ownership registration happening ahead of a down/press event, the SetKeyOwner() call needs to be made every frame (happens if e.g. claiming ownership on hover).
3425
// - SetItemKeyOwner() is a shortcut for common simple case. A custom widget will probably want to call SetKeyOwner() multiple times directly based on its interaction state.
3426
// - This is marked experimental because not all widgets are fully honoring the Set/Test idioms. We will need to move forward step by step.
3427
// Please open a GitHub Issue to submit your usage scenario or if there's a use case you need solved.
IMGUI_API voidSetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags);// Set key owner to last item if it is hovered or active. Equivalent to 'if (IsItemHovered() || IsItemActive()) { SetKeyOwner(key, GetItemID());'.
3432
IMGUI_API boolTestKeyOwner(ImGuiKey key, ImGuiID owner_id);// Test that key is either not owned, either owned by 'owner_id'
// [EXPERIMENTAL] High-Level: Input Access functions w/ support for Key/Input Ownership
3436
// - Important: legacy IsKeyPressed(ImGuiKey, bool repeat=true) _DEFAULTS_ to repeat, new IsKeyPressed() requires _EXPLICIT_ ImGuiInputFlags_Repeat flag.
3437
// - Expected to be later promoted to public API, the prototypes are designed to replace existing ones (since owner_id can default to Any == 0)
3438
// - Specifying a value for 'ImGuiID owner' will test that EITHER the key is NOT owned (UNLESS locked), EITHER the key is owned by 'owner'.
3439
// Legacy functions use ImGuiKeyOwner_Any meaning that they typically ignore ownership, unless a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease.
3440
// - Binding generators may want to ignore those for now, or suffix them with Ex() until we decide if this gets moved into public API.
IMGUI_API boolIsKeyPressed(ImGuiKey key, ImGuiInputFlags flags, ImGuiID owner_id =0);// Important: when transitioning from old to new IsKeyPressed(): old API has "bool repeat = true", so would default to repeat. New API requiress explicit ImGuiInputFlags_Repeat.
// - Set Shortcut() and SetNextItemShortcut() in imgui.h
3452
// - When a policy (except for ImGuiInputFlags_RouteAlways *) is set, Shortcut() will register itself with SetShortcutRouting(),
3453
// allowing the system to decide where to route the input among other route-aware calls.
3454
// (* using ImGuiInputFlags_RouteAlways is roughly equivalent to calling IsKeyChordPressed(key) and bypassing route registration and check)
3455
// - When using one of the routing option:
3456
// - The default route is ImGuiInputFlags_RouteFocused (accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window.)
3457
// - Routes are requested given a chord (key + modifiers) and a routing policy.
3458
// - Routes are resolved during NewFrame(): if keyboard modifiers are matching current ones: SetKeyOwner() is called + route is granted for the frame.
3459
// - Each route may be granted to a single owner. When multiple requests are made we have policies to select the winning route (e.g. deep most window).
3460
// - Multiple read sites may use the same owner id can all access the granted route.
3461
// - When owner_id is 0 we use the current Focus Scope ID as a owner ID in order to identify our location.
3462
// - You can chain two unrelated windows in the focus stack using SetWindowParentWindowForFocusRoute()
3463
// e.g. if you have a tool window associated to a document, and you want document shortcuts to run when the tool is focused.
IMGUI_API voidDockBuilderRemoveNodeChildNodes(ImGuiID node_id);// Remove all split/hierarchy. All remaining docked windows will be re-docked to the remaining root node (node_id).
// This is generally used to identify a unique input location (for e.g. a selection set)
3526
// There is one per window (automatically set in Begin), but:
3527
// - Selection patterns generally need to react (e.g. clear a selection) when landing on one item of the set.
3528
// So in order to identify a set multiple lists in same window may each need a focus scope.
3529
// If you imagine an hypothetical BeginSelectionGroup()/EndSelectionGroup() api, it would likely call PushFocusScope()/EndFocusScope()
3530
// - Shortcut routing also use focus scope as a default location identifier if an owner is not provided.
3531
// We don't use the ID Stack for this as it is common to want them separate.
3532
IMGUI_API voidPushFocusScope(ImGuiID id);
3533
IMGUI_API voidPopFocusScope();
3534
inline ImGuiID GetCurrentFocusScope(){ ImGuiContext& g =*GImGui;return g.CurrentFocusScopeId;}// Focus scope we are outputting into, set by PushFocusScope()
// (provide Windows Explorer style "select items by typing partial name" + "cycle through items by typing same letter" feature)
3545
// (this is currently not documented nor used by main library, but should work. See "widgets_typingselect" in imgui_test_suite for usage code. Please let us know if you use this!)
IMGUI_API voidBeginColumns(constchar* str_id,int count, ImGuiOldColumnFlags flags =0);// setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().
IMGUI_API intTableGetHoveredRow();// Retrieve *PREVIOUS FRAME* hovered row. This difference with TableGetHoveredColumn() is the reason why this is not public yet.
// 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.
3656
// NB: All position are in absolute pixels coordinates (we are never using window coordinates internally)
IMGUI_API boolTreeNodeUpdateNextOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags);// Return open state. Consume previous SetNextItemOpen() data, if any. May return true when logging.
3714
3715
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
3716
// To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036).
3717
// e.g. " extern template IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDataType data_type, float v); "
3718
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API floatScaleRatioFromValueT(ImGuiDataType data_type, T v, T v_min, T v_max,bool is_logarithmic,float logarithmic_zero_epsilon,float zero_deadzone_size);
3719
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API T ScaleValueFromRatioT(ImGuiDataType data_type,float t, T v_min, T v_max,bool is_logarithmic,float logarithmic_zero_epsilon,float zero_deadzone_size);
3720
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API boolDragBehaviorT(ImGuiDataType data_type, T* v,float v_speed, T v_min, T v_max,constchar* format, ImGuiSliderFlags flags);
3721
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API boolSliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, T v_min, T v_max,constchar* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
3722
template<typename T> IMGUI_API T RoundScalarWithFormatT(constchar* format, ImGuiDataType data_type, T v);
3723
template<typename T> IMGUI_API boolCheckboxFlagsT(constchar* label, T* flags, T flags_value);
inlineboolTempInputIsActive(ImGuiID id){ ImGuiContext& g =*GImGui;return(g.ActiveId==id && g.TempInputId==id);}
3740
inline ImGuiInputTextState*GetInputTextState(ImGuiID id){ ImGuiContext& g =*GImGui;return(id !=0&& g.InputTextState.ID==id)?&g.InputTextState:NULL;}// Get input text state if active