#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)
80
#pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).
81
#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
82
#ifdefined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later
83
#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()
95
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast
96
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning: zero as null pointer constant
97
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
98
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
99
#pragma clang diagnostic ignored "-Wmissing-noreturn" // warning: function 'xxx' could be declared with attribute 'noreturn'
100
#pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion"// warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
101
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access
102
#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 "-Wfloat-equal" // warning: comparing floating-point with '==' or '!=' is unsafe
107
#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
108
#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
109
#pragma GCC diagnostic ignored "-Wsign-conversion" // warning: conversion to 'xxxx' from 'xxxx' may change the sign of the result
110
#endif
111
112
// In 1.89.4, we moved the implementation of "courtesy maths operators" from imgui_internal.h in imgui.h
113
// As they are frequently requested, we do not want to encourage to many people using imgui_internal.h
structImGuiBoxSelectState;// Box-selection state (currently used by multi-selection, could potentially be used by others)
151
structImGuiColorMod;// Stacked color modifier, backup of modified data so we can restore it
152
structImGuiContext;// Main Dear ImGui context
153
structImGuiContextHook;// Hook for extensions like ImGuiTestEngine
154
structImGuiDataTypeInfo;// Type information associated to a ImGuiDataType enum
155
structImGuiDeactivatedItemData;// Data for IsItemDeactivated()/IsItemDeactivatedAfterEdit() function.
156
structImGuiDockContext;// Docking system context
157
structImGuiDockRequest;// Docking system dock/undock queued request
158
structImGuiDockNode;// Docking system node (hold a list of Windows OR two child dock nodes)
159
structImGuiDockNodeSettings;// Storage for a dock node in .ini file (we preserve those even if the associated dock node isn't active during the session)
160
structImGuiErrorRecoveryState;// Storage of stack sizes for error handling and recovery
161
structImGuiGroupData;// Stacked storage data for BeginGroup()/EndGroup()
162
structImGuiInputTextState;// Internal state of the currently focused/edited text input box
163
structImGuiInputTextDeactivateData;// Short term storage to backup text of a deactivating InputText() while another is stealing active id
164
structImGuiLastItemData;// Status storage for last submitted items
165
structImGuiLocEntry;// A localization entry.
166
structImGuiMenuColumns;// Simple column measurement, currently used for MenuItem() only
167
structImGuiMultiSelectState;// Multi-selection persistent state (for focused selection).
168
structImGuiMultiSelectTempData;// Multi-selection temporary state (while traversing).
169
structImGuiNavItemData;// Result of a keyboard/gamepad directional navigation move query result
170
structImGuiMetricsConfig;// Storage for ShowMetricsWindow() and DebugNodeXXX() functions
171
structImGuiNextWindowData;// Storage for SetNextWindow** functions
172
structImGuiNextItemData;// Storage for SetNextItem** functions
173
structImGuiOldColumnData;// Storage data for a single column for legacy Columns() api
174
structImGuiOldColumns;// Storage data for a columns set for legacy Columns() api
175
structImGuiPopupData;// Storage for current popup stack
176
structImGuiSettingsHandler;// Storage for one type registered in the .ini file
177
structImGuiStyleMod;// Stacked style modifier, backup of modified data so we can restore it
178
structImGuiStyleVarInfo;// Style variable information (e.g. to access style variables from an enum)
179
structImGuiTabBar;// Storage for a tab bar
180
structImGuiTabItem;// Storage for a tab item (within a tab bar)
181
structImGuiTable;// Storage for a table
182
structImGuiTableHeaderData;// Storage for TableAngledHeadersRow()
183
structImGuiTableColumn;// Storage for one column of a table
184
structImGuiTableInstanceData;// Storage for one instance of a same table
185
structImGuiTableTempData;// Temporary storage for one table (one per table in the stack), shared between tables.
186
structImGuiTableSettings;// Storage for a table .ini settings
187
structImGuiTableColumnsSettings;// Storage for a column .ini settings
188
structImGuiTreeNodeStackData;// Temporary storage for TreeNode().
189
structImGuiTypingSelectState;// Storage for GetTypingSelectRequest()
190
structImGuiTypingSelectRequest;// Storage for GetTypingSelectRequest() (aimed to be public)
191
structImGuiWindow;// Storage for one window
192
structImGuiWindowDockStyle;// Storage for window-style data which needs to be stored for docking purpose
193
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)
194
structImGuiWindowSettings;// Storage for a window .ini settings (we keep one of those even if the actual window wasn't instanced during this session)
195
196
// Enumerations
197
// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists.
198
enumImGuiLocKey : int;// -> enum ImGuiLocKey // Enum: a localization entry for translation.
199
typedefintImGuiDataAuthority;// -> enum ImGuiDataAuthority_ // Enum: for storing the source authority (dock node vs window) of a field
200
typedefintImGuiLayoutType;// -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
201
202
// Flags
203
typedefintImDrawTextFlags;// -> enum ImDrawTextFlags_ // Flags: for ImTextCalcWordWrapPositionEx()
204
typedefintImGuiActivateFlags;// -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
205
typedefintImGuiDebugLogFlags;// -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags
206
typedefintImGuiFocusRequestFlags;// -> enum ImGuiFocusRequestFlags_ // Flags: for FocusWindow()
207
typedefintImGuiItemStatusFlags;// -> enum ImGuiItemStatusFlags_ // Flags: for g.LastItemData.StatusFlags
208
typedefintImGuiOldColumnFlags;// -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
209
typedefintImGuiLogFlags;// -> enum ImGuiLogFlags_ // Flags: for LogBegin() text capturing function
210
typedefintImGuiNavRenderCursorFlags;// -> enum ImGuiNavRenderCursorFlags_//Flags: for RenderNavCursor()
211
typedefintImGuiNavMoveFlags;// -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
212
typedefintImGuiNextItemDataFlags;// -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
213
typedefintImGuiNextWindowDataFlags;// -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
214
typedefintImGuiScrollFlags;// -> enum ImGuiScrollFlags_ // Flags: for ScrollToItem() and navigation requests
215
typedefintImGuiSeparatorFlags;// -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
216
typedefintImGuiTextFlags;// -> enum ImGuiTextFlags_ // Flags: for TextEx()
217
typedefintImGuiTooltipFlags;// -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
218
typedefintImGuiTypingSelectFlags;// -> enum ImGuiTypingSelectFlags_ // Flags: for GetTypingSelectRequest()
219
typedefintImGuiWindowBgClickFlags;// -> enum ImGuiWindowBgClickFlags_ // Flags: for overriding behavior of clicking on window background/void.
220
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)
#defineIMGUI_DEBUG_LOG_FONT(...)do{ ImGuiContext* g2 = GImGui;if(g2 && g2->DebugLogFlags & ImGuiDebugLogFlags_EventFont)IMGUI_DEBUG_LOG(__VA_ARGS__);}while(0)// Called from ImFontAtlas function which may operate without a context.
// Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall
IMGUI_API constchar*ImTextFindValidUtf8CodepointEnd(constchar*in_text_start,constchar*in_text_end,constchar*in_p);// return previous UTF-8 code-point if 'in_p' is not the end of a valid one.
446
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.
447
448
// Helpers: High-level text functions (DO NOT USE!!! THIS IS A MINIMAL SUBSET OF LARGER UPCOMING CHANGES)
449
enumImDrawTextFlags_
450
{
451
ImDrawTextFlags_None =0,
452
ImDrawTextFlags_CpuFineClip =1<<0,// Must be == 1/true for legacy with 'bool cpu_fine_clip' arg to RenderText()
IMGUI_API constchar*ImTextCalcWordWrapNextLineStart(constchar*text,constchar*text_end, ImDrawTextFlags flags =0);// trim trailing space and find beginning of next line
459
460
// Character classification for word-wrapping logic
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
562
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.
633
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!
641
#defineIM_BITARRAY_CLEARBIT(_ARRAY,_N)((_ARRAY[(_N)>>5]&=~((ImU32)1<<((_N)&31))))// Macro version of ImBitArrayClearBit(): ensure args have side-effect or are costly!
typedef ImU32*ImBitArrayPtr;// Name for use in structs
661
662
// Helper: ImBitArray class (wrapper over ImBitArray functions)
663
// Store 1-bit per value.
664
template<int BITCOUNT,int OFFSET =0>
665
structImBitArray
666
{
667
ImU32 Data[(BITCOUNT +31)>>5];
668
ImBitArray(){ClearAllBits();}
669
voidClearAllBits(){memset(Data,0,sizeof(Data));}
670
voidSetAllBits(){memset(Data,255,sizeof(Data));}
671
boolTestBit(int n)const{ n += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT);returnIM_BITARRAY_TESTBIT(Data, n);}
672
voidSetBit(int n){ n += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT);ImBitArraySetBit(Data, n);}
673
voidClearBit(int n){ n += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT);ImBitArrayClearBit(Data, n);}
674
voidSetBitRange(int n,int n2){ n += OFFSET; n2 += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT && n2 > n && n2 <= BITCOUNT);ImBitArraySetBitRange(Data, n, n2);}// Works on range [n..n2)
675
bool operator[](int n)const{ n += OFFSET;IM_ASSERT(n >=0&& n < BITCOUNT);returnIM_BITARRAY_TESTBIT(Data, n);}
inline T& operator[](int i){ T* p = Data + i;IM_ASSERT(p >= Data && p < DataEnd);return*p;}
711
inlineconst T& operator[](int i)const{const T* p = Data + i;IM_ASSERT(p >= Data && p < DataEnd);return*p;}
712
713
inline T*begin(){return Data;}
714
inlineconst T*begin()const{return Data;}
715
inline T*end(){return DataEnd;}
716
inlineconst T*end()const{return DataEnd;}
717
718
// Utilities
719
inlineintindex_from_ptr(const T* it)const{IM_ASSERT(it >= Data && it < DataEnd);constptrdiff_t off = it - Data;return(int)off;}
720
};
721
722
// Helper: ImSpanAllocator<>
723
// Facilitate storing multiple chunks into a single large block (the "arena")
724
// - 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.
874
#ifndef IM_DRAWLIST_ARCFAST_TABLE_SIZE
875
#defineIM_DRAWLIST_ARCFAST_TABLE_SIZE48// Number of samples in lookup table.
876
#endif
877
#defineIM_DRAWLIST_ARCFAST_SAMPLE_MAX IM_DRAWLIST_ARCFAST_TABLE_SIZE // Sample index _PathArcToFastEx() for 360 angle.
878
879
// Data shared between all ImDrawList instances
880
// Conceptually this could have been called e.g. ImDrawListSharedContext
881
// Typically one ImGui context would create and maintain one of this.
882
// You may want to create your own instance of you try to ImDrawList completely without ImGui. In that case, watch out for future changes to this structure.
883
struct IMGUI_API ImDrawListSharedData
884
{
885
ImVec2 TexUvWhitePixel;// UV of white pixel in the atlas (== FontAtlas->TexUvWhitePixel)
886
const ImVec4* TexUvLines;// UV of anti-aliased lines in the atlas (== FontAtlas->TexUvLines)
887
ImFontAtlas* FontAtlas;// Current font atlas
888
ImFont* Font;// Current font (used for simplified AddText overload)
889
float FontSize;// Current font size (used for for simplified AddText overload)
890
float FontScale;// Current font scale (== FontSize / Font->FontSize)
891
float CurveTessellationTol;// Tessellation tolerance when using PathBezierCurveTo()
892
float CircleTessellationMaxError;// Number of circle segments to use per pixel of radius for AddCircle() etc
893
float InitialFringeScale;// Initial scale to apply to AA fringe
894
ImDrawListFlags InitialFlags;// Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
895
ImVec4 ClipRectFullscreen;// Value for PushClipRectFullscreen()
ImVector<ImDrawList*> DrawLists;// All draw lists associated to this ImDrawListSharedData
898
ImGuiContext* Context;// [OPTIONAL] Link to Dear ImGui context. 99% of ImDrawList/ImFontAtlas can function without an ImGui context, but this facilitate handling one legacy edge case.
899
900
// Lookup tables
901
ImVec2 ArcFastVtx[IM_DRAWLIST_ARCFAST_TABLE_SIZE];// Sample points on the quarter of the circle.
902
float ArcFastRadiusCutoff;// Cutoff radius after which arc drawing will fallback to slower PathArcTo()
903
ImU8 CircleSegmentCounts[64];// Precomputed segment count for given radius before we calculate it dynamically (to avoid calculation overhead)
// - input: PushItemFlag() manipulates g.CurrentItemFlags, g.NextItemData.ItemFlags, ItemAdd() calls may add extra flags too.
985
// - output: stored in g.LastItemData.ItemFlags
986
enumImGuiItemFlagsPrivate_
987
{
988
// Controlled by user
989
ImGuiItemFlags_ReadOnly =1<<11,// false // [ALPHA] Allow hovering interactions but underlying value is not changed.
990
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)
991
ImGuiItemFlags_NoWindowHoverableCheck =1<<13,// false // Disable hoverable check in ItemHoverable()
992
ImGuiItemFlags_AllowOverlap =1<<14,// false // Allow being overlapped by another widget. Not-hovered to Hovered transition deferred by a frame.
993
ImGuiItemFlags_NoNavDisableMouseHover =1<<15,// false // Nav keyboard/gamepad mode doesn't disable hover highlight (behave as if NavHighlightItemUnderNav==false).
ImGuiItemFlags_NoFocus =1<<17,// false // [EXPERIMENTAL: Not very well specced] Clicking doesn't take focus. Automatically sets ImGuiButtonFlags_NoFocus + ImGuiButtonFlags_NoNavFocus in ButtonBehavior().
996
997
// Controlled by widget code
998
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.
999
ImGuiItemFlags_HasSelectionUserData =1<<21,// false // Set by SetNextItemSelectionUserData()
1000
ImGuiItemFlags_IsMultiSelect =1<<22,// false // Set by SetNextItemSelectionUserData()
1001
1002
ImGuiItemFlags_Default_ = ImGuiItemFlags_AutoClosePopups,// Please don't change, use PushItemFlag() instead.
1003
1004
// Obsolete
1005
//ImGuiItemFlags_SelectableDontClosePopup = !ImGuiItemFlags_AutoClosePopups, // Can't have a redirect as we inverted the behavior
1006
};
1007
1008
// Status flags for an already submitted item
1009
// - output: stored in g.LastItemData.StatusFlags
1010
enumImGuiItemStatusFlags_
1011
{
1012
ImGuiItemStatusFlags_None =0,
1013
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)
1014
ImGuiItemStatusFlags_HasDisplayRect =1<<1,// g.LastItemData.DisplayRect is valid
1015
ImGuiItemStatusFlags_Edited =1<<2,// Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
1016
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.
1017
ImGuiItemStatusFlags_ToggledOpen =1<<4,// Set when TreeNode() reports toggling their open state.
1018
ImGuiItemStatusFlags_HasDeactivated =1<<5,// Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
1019
ImGuiItemStatusFlags_Deactivated =1<<6,// Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
1020
ImGuiItemStatusFlags_HoveredWindow =1<<7,// Override the HoveredWindow test to allow cross-window hover testing.
1021
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()).
1022
ImGuiItemStatusFlags_HasClipRect =1<<9,// g.LastItemData.ClipRect is valid.
1023
ImGuiItemStatusFlags_HasShortcut =1<<10,// g.LastItemData.Shortcut valid. Set by SetNextItemShortcut() -> ItemAdd().
1024
//ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8, // Removed IN 1.90.1 (Dec 2023). The trigger is part of g.NavActivateId. See commit 54c1bdeceb.
1025
ImGuiItemStatusFlags_EditedInternal =1<<11,// Similar to ImGuiItemStatusFlags_Edited but bypassing ImGuiItemFlags_NoMarkEdited.
1026
1027
// Additional status + semantic for ImGuiTestEngine
1028
#ifdef IMGUI_ENABLE_TEST_ENGINE
1029
ImGuiItemStatusFlags_Openable =1<<20,// Item is an openable (e.g. TreeNode)
1030
ImGuiItemStatusFlags_Opened =1<<21,// Opened status
1031
ImGuiItemStatusFlags_Checkable =1<<22,// Item is a checkable (e.g. CheckBox, MenuItem)
1032
ImGuiItemStatusFlags_Checked =1<<23,// Checked status
1033
ImGuiItemStatusFlags_Inputable =1<<24,// Item is a text-inputable (e.g. InputText, SliderXXX, DragXXX)
ImGuiInputTextFlags_Multiline =1<<26,// For internal use by InputTextMultiline()
1050
ImGuiInputTextFlags_TempInput =1<<27,// For internal use by TempInputText(), will skip calling ItemAdd(). Require bounding-box to strictly match.
1051
ImGuiInputTextFlags_LocalizeDecimalPoint=1<<28,// For internal use by InputScalar() and TempInputScalar()
1052
};
1053
1054
// Extend ImGuiButtonFlags_
1055
enumImGuiButtonFlagsPrivate_
1056
{
1057
ImGuiButtonFlags_PressedOnClick =1<<4,// return true on click (mouse down event)
1058
ImGuiButtonFlags_PressedOnClickRelease =1<<5,// [Default] return true on click + release on same item <-- this is what the majority of Button are using
1059
ImGuiButtonFlags_PressedOnClickReleaseAnywhere =1<<6,// return true on click + release even if the release event is not done while hovering the item
1060
ImGuiButtonFlags_PressedOnRelease =1<<7,// return true on release (default requires click+release). Prior to 2026/03/20 this implied ImGuiButtonFlags_NoHoldingActiveId but they are separate now.
1061
ImGuiButtonFlags_PressedOnDoubleClick =1<<8,// return true on double-click (default requires click+release)
1062
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)
1063
//ImGuiButtonFlags_Repeat = 1 << 10, // hold to repeat -> use ImGuiItemFlags_ButtonRepeat instead.
1064
ImGuiButtonFlags_FlattenChildren =1<<11,// allow interactions even if a child window is overlapping
//ImGuiButtonFlags_Disabled = 1 << 14, // disable interactions -> use BeginDisabled() or ImGuiItemFlags_Disabled
1067
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
1068
ImGuiButtonFlags_NoKeyModsAllowed =1<<16,// disable mouse interaction if a key modifier is held
1069
ImGuiButtonFlags_NoHoldingActiveId =1<<17,// don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
1070
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)
1071
ImGuiButtonFlags_NoHoveredOnFocus =1<<19,// don't report as hovered when nav focus is on this item
1072
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!)
1073
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!)
1074
ImGuiButtonFlags_NoFocus =1<<22,// [EXPERIMENTAL: Not very well specced]. Don't focus parent window when clicking.
ImGuiSliderFlags_Vertical =1<<20,// Should this slider be orientated vertically?
1090
ImGuiSliderFlags_ReadOnly =1<<21,// Consider using g.NextItemData.ItemFlags |= ImGuiItemFlags_ReadOnly instead.
1091
};
1092
1093
// Extend ImGuiSelectableFlags_
1094
enumImGuiSelectableFlagsPrivate_
1095
{
1096
// NB: need to be in sync with last value of ImGuiSelectableFlags_
1097
ImGuiSelectableFlags_NoHoldingActiveID =1<<20,
1098
ImGuiSelectableFlags_SelectOnClick =1<<22,// Override button behavior to react on Click (default is Click+Release)
1099
ImGuiSelectableFlags_SelectOnRelease =1<<23,// Override button behavior to react on Release (default is Click+Release)
1100
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)
1101
ImGuiSelectableFlags_SetNavIdOnHover =1<<25,// Set Nav/Focus ID on mouse hover (used by MenuItem)
1102
ImGuiSelectableFlags_NoPadWithHalfSpacing =1<<26,// Disable padding each side with ItemSpacing * 0.5f
1103
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!)
1104
};
1105
1106
// Extend ImGuiTreeNodeFlags_
1107
enumImGuiTreeNodeFlagsPrivate_
1108
{
1109
ImGuiTreeNodeFlags_NoNavFocus =1<<27,// Don't claim nav focus when interacting with this item (#8551)
1110
ImGuiTreeNodeFlags_ClipLabelForTrailingButton =1<<28,// FIXME-WIP: Hard-coded for CollapsingHeader()
1111
ImGuiTreeNodeFlags_UpsideDownArrow =1<<29,// FIXME-WIP: Turn Down arrow into an Up arrow, for reversed trees (#6517)
// Internal state of the currently focused/edited text input box
1253
// For a given item ID, access with ImGui::GetInputTextState()
1254
struct IMGUI_API ImGuiInputTextState
1255
{
1256
ImGuiContext* Ctx;// parent UI context (needs to be set explicitly by parent).
1257
ImStbTexteditState* Stb;// State for stb_textedit.h
1258
ImGuiInputTextFlags Flags;// copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set.
1259
ImGuiID ID;// widget id owning the text state
1260
int TextLen;// UTF-8 length of the string in TextA (in bytes)
1261
constchar* TextSrc;// == TextA.Data unless read-only, in which case == buf passed to InputText(). For _ReadOnly fields, pointer will be null outside the InputText() call.
1262
ImVector<char> TextA;// main UTF8 buffer. TextA.Size is a buffer size! Should always be >= buf_size passed by user (and of course >= CurLenA + 1).
1263
ImVector<char> TextToRevertTo;// value to revert to when pressing Escape = backup of end-user buffer at the time of focus (in UTF-8, unaltered)
1264
ImVector<char> CallbackTextBackup;// temporary storage for callback to support automatic reconcile of undo-stack
1265
int BufCapacity;// end-user buffer capacity (include zero terminator)
1266
ImVec2 Scroll;// horizontal offset (managed manually) + vertical scrolling (pulled from child window's own Scroll.y)
1267
int LineCount;// last line count (solely for debugging)
1268
float WrapWidth;// word-wrapping width
1269
float CursorAnim;// timer for cursor blink, reset on every user action so the cursor reappears immediately
1270
bool CursorFollow;// set when we want scrolling to follow the current cursor position (not always!)
1271
bool CursorCenterY;// set when we want scrolling to be centered over the cursor position (while resizing a word-wrapping field)
1272
bool SelectedAllMouseLock;// after a double-click to select all, we ignore further mouse drags to update selection
1273
bool EditedBefore;// edited since activated
1274
bool EditedThisFrame;// edited this frame
1275
bool WantReloadUserBuf;// force a reload of user buf so it may be modified externally. may be automatic in future version.
1276
ImS8 LastMoveDirectionLR;// ImGuiDir_Left or ImGuiDir_Right. track last movement direction so when cursor cross over a word-wrapping boundaries we can display it on either line depending on last move.s
// If you modify underlying user-passed const char* while active you need to call this (InputText V2 may lift this)
1302
// strcpy(my_buf, "hello");
1303
// if (ImGuiInputTextState* state = ImGui::GetInputTextState(id)) // id may be ImGui::GetItemID() is last item
1304
// state->ReloadUserBufAndSelectAll();
1305
voidReloadUserBufAndSelectAll();
1306
voidReloadUserBufAndKeepSelection();
1307
voidReloadUserBufAndMoveToEnd();
1308
};
1309
1310
enumImGuiWindowRefreshFlags_
1311
{
1312
ImGuiWindowRefreshFlags_None =0,
1313
ImGuiWindowRefreshFlags_TryToAvoidRefresh =1<<0,// [EXPERIMENTAL] Try to keep existing contents, USER MUST NOT HONOR BEGIN() RETURNING FALSE AND NOT APPEND.
1314
ImGuiWindowRefreshFlags_RefreshOnHover =1<<1,// [EXPERIMENTAL] Always refresh on hover
1315
ImGuiWindowRefreshFlags_RefreshOnFocus =1<<2,// [EXPERIMENTAL] Always refresh on focus
1316
// Refresh policy/frequency, Load Balancing etc.
1317
};
1318
1319
enumImGuiWindowBgClickFlags_
1320
{
1321
ImGuiWindowBgClickFlags_None =0,
1322
ImGuiWindowBgClickFlags_Move =1<<0,// Click on bg/void + drag to move window. Cleared by default when using io.ConfigWindowsMoveFromTitleBarOnly.
1323
};
1324
1325
enumImGuiNextWindowDataFlags_
1326
{
1327
ImGuiNextWindowDataFlags_None =0,
1328
ImGuiNextWindowDataFlags_HasPos =1<<0,
1329
ImGuiNextWindowDataFlags_HasSize =1<<1,
1330
ImGuiNextWindowDataFlags_HasContentSize =1<<2,
1331
ImGuiNextWindowDataFlags_HasCollapsed =1<<3,
1332
ImGuiNextWindowDataFlags_HasSizeConstraint =1<<4,
1333
ImGuiNextWindowDataFlags_HasFocus =1<<5,
1334
ImGuiNextWindowDataFlags_HasBgAlpha =1<<6,
1335
ImGuiNextWindowDataFlags_HasScroll =1<<7,
1336
ImGuiNextWindowDataFlags_HasWindowFlags =1<<8,
1337
ImGuiNextWindowDataFlags_HasChildFlags =1<<9,
1338
ImGuiNextWindowDataFlags_HasRefreshPolicy =1<<10,
1339
ImGuiNextWindowDataFlags_HasViewport =1<<11,
1340
ImGuiNextWindowDataFlags_HasDock =1<<12,
1341
ImGuiNextWindowDataFlags_HasWindowClass =1<<13,
1342
};
1343
1344
// Storage for SetNexWindow** functions
1345
structImGuiNextWindowData
1346
{
1347
ImGuiNextWindowDataFlags HasFlags;
1348
1349
// Members below are NOT cleared. Always rely on HasFlags.
1350
ImGuiCond PosCond;
1351
ImGuiCond SizeCond;
1352
ImGuiCond CollapsedCond;
1353
ImGuiCond DockCond;
1354
ImVec2 PosVal;
1355
ImVec2 PosPivotVal;
1356
ImVec2 SizeVal;
1357
ImVec2 ContentSizeVal;
1358
ImVec2 ScrollVal;
1359
ImGuiWindowFlags WindowFlags;// Only honored by BeginTable()
1360
ImGuiChildFlags ChildFlags;
1361
bool PosUndock;
1362
bool CollapsedVal;
1363
ImRect SizeConstraintRect;
1364
ImGuiSizeCallback SizeCallback;
1365
void* SizeCallbackUserData;
1366
float BgAlphaVal;// Override background alpha
1367
ImGuiID ViewportId;
1368
ImGuiID DockId;
1369
ImGuiWindowClass WindowClass;
1370
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
1391
ImGuiItemFlags ItemFlags;// Currently only tested/used for ImGuiItemFlags_AllowOverlap and ImGuiItemFlags_HasSelectionUserData.
1392
1393
// Members below are NOT cleared by ItemAdd() meaning they are still valid during e.g. NavProcessItem(). Always rely on HasFlags.
1394
ImGuiID FocusScopeId;// Set by SetNextItemSelectionUserData()
1395
ImGuiSelectionUserData SelectionUserData;// Set by SetNextItemSelectionUserData() (note that NULL/0 is a valid value, we use -1 == ImGuiSelectionUserData_Invalid to mark invalid values)
1396
float Width;// Set by SetNextItemWidth()
1397
ImGuiKeyChord Shortcut;// Set by SetNextItemShortcut()
1398
ImGuiInputFlags ShortcutFlags;// Set by SetNextItemShortcut()
1399
bool OpenVal;// Set by SetNextItemOpen()
1400
ImU8 OpenCond;// Set by SetNextItemOpen()
1401
ImGuiDataTypeStorage RefVal;// Not exposed yet, for ImGuiInputTextFlags_ParseEmptyAsRefVal
1402
ImGuiID StorageId;// Set by SetNextItemStorageID()
1403
ImU32 ColorMarker;// Set by SetNextItemColorMarker(). Not exposed yet, supported by DragScalar,SliderScalar and for ImGuiSliderFlags_ColorMarkers.
// Storage for popup stacks (g.OpenPopupStack and g.BeginPopupStack)
1506
structImGuiPopupData
1507
{
1508
ImGuiID PopupId;// Set on OpenPopup()
1509
ImGuiWindow* Window;// Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
1510
ImGuiWindow* RestoreNavWindow;// Set on OpenPopup(), a NavWindow that will be restored on popup close
1511
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
1512
int OpenFrameCount;// Set on OpenPopup()
1513
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)
1514
ImVec2 OpenPopupPos;// Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse)
1515
ImVec2 OpenMousePos;// Set on OpenPopup(), copy of mouse position at the time of opening popup
// Input function taking an 'ImGuiID owner_id' argument defaults to (ImGuiKeyOwner_Any == 0) aka don't test ownership, which matches legacy behavior.
1602
#defineImGuiKeyOwner_Any((ImGuiID)0)// Accept key that have an owner, UNLESS a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease.
1603
#defineImGuiKeyOwner_NoOwner((ImGuiID)-1)// Require key to have no owner.
1604
//#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.
1605
1606
typedef ImS16 ImGuiKeyRoutingIndex;
1607
1608
// Routing table entry (sizeof() == 16 bytes)
1609
structImGuiKeyRoutingData
1610
{
1611
ImGuiKeyRoutingIndex NextEntryIndex;
1612
ImU16 Mods;// Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits.
1613
ImU16 RoutingCurrScore;// [DEBUG] For debug display
1614
ImU16 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.
1622
// Stored in main context (1 instance)
1623
structImGuiKeyRoutingTable
1624
{
1625
ImGuiKeyRoutingIndex Index[ImGuiKey_NamedKey_COUNT];// Index of first entry in Entries[]
1626
ImVector<ImGuiKeyRoutingData> Entries;
1627
ImVector<ImGuiKeyRoutingData> EntriesNext;// Double-buffer to avoid reallocation (could use a shared buffer)
1628
1629
ImGuiKeyRoutingTable(){Clear();}
1630
voidClear(){for(int n =0; n <IM_COUNTOF(Index); n++) Index[n]=-1; Entries.clear(); EntriesNext.clear();}
1631
};
1632
1633
// This extends ImGuiKeyData but only for named keys (legacy keys don't support the new features)
1634
// Stored in main context (1 per named key). In the future it might be merged into ImGuiKeyData.
1635
structImGuiKeyOwnerData
1636
{
1637
ImGuiID OwnerCurr;
1638
ImGuiID OwnerNext;
1639
bool LockThisFrame;// Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags_LockThisFrame.
1640
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.
1656
// - In theory ImGuiInputFlags_RepeatUntilOtherKeyPress may be a desirable default, but it would break too many behavior so everything is opt-in.
1657
ImGuiInputFlags_RepeatUntilRelease =1<<4,// Stop repeating when released (default for all functions except Shortcut). This only exists to allow overriding Shortcut() default behavior.
1658
ImGuiInputFlags_RepeatUntilKeyModsChange =1<<5,// Stop repeating when released OR if keyboard mods are changed (default for Shortcut)
1659
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.
1660
ImGuiInputFlags_RepeatUntilOtherKeyPress =1<<7,// Stop repeating when released OR if any other keyboard key is pressed during the repeat
1661
1662
// Flags for SetKeyOwner(), SetItemKeyOwner()
1663
// - 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.
1664
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.
1665
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.
1666
1667
// - Condition for SetItemKeyOwner()
1668
ImGuiInputFlags_CondHovered =1<<22,// Only set if item is hovered (default to both)
1669
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.
1725
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.
1726
ImGuiActivateFlags_TryToPreserveState =1<<2,// Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
1727
ImGuiActivateFlags_FromTabbing =1<<3,// Activation requested by a tabbing request (ImGuiNavMoveFlags_IsTabbing)
1728
ImGuiActivateFlags_FromShortcut =1<<4,// Activation requested by an item shortcut via SetNextItemShortcut() function.
1729
ImGuiActivateFlags_FromFocusApi =1<<5,// Activation requested by an api request (ImGuiNavMoveFlags_FocusApi)
1730
};
1731
1732
// Early work-in-progress API for ScrollToItem()
1733
// FIXME: Missing flags to request making both edges visible when possible.
1734
enumImGuiScrollFlags_
1735
{
1736
ImGuiScrollFlags_None =0,
1737
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]
1738
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]
1739
ImGuiScrollFlags_KeepVisibleCenterX =1<<2,// If item is not visible: scroll to make the item centered on X axis [rarely used]
1740
ImGuiScrollFlags_KeepVisibleCenterY =1<<3,// If item is not visible: scroll to make the item centered on Y axis
1741
ImGuiScrollFlags_AlwaysCenterX =1<<4,// Always center the result item on X axis [rarely used]
1742
ImGuiScrollFlags_AlwaysCenterY =1<<5,// Always center the result item on Y axis [default for Y axis for appearing window)
1743
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
1752
ImGuiNavRenderCursorFlags_AlwaysDraw =1<<2,// Draw rectangular highlight if (g.NavId == id) even when g.NavCursorVisible == false, aka even when using the mouse.
1753
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1754
ImGuiNavRenderCursorFlags_NoRounding =1<<3,
1755
ImGuiNavHighlightFlags_None = ImGuiNavRenderCursorFlags_None,// Renamed in 1.91.4
1756
ImGuiNavHighlightFlags_Compact = ImGuiNavRenderCursorFlags_Compact,// Renamed in 1.91.4
1757
ImGuiNavHighlightFlags_AlwaysDraw = ImGuiNavRenderCursorFlags_AlwaysDraw,// Renamed in 1.91.4
1758
ImGuiNavHighlightFlags_NoRounding = ImGuiNavRenderCursorFlags_NoRounding,// Renamed in 1.91.4
1759
//ImGuiNavHighlightFlags_TypeThin = ImGuiNavRenderCursorFlags_Compact, // Renamed in 1.90.2
1760
#endif
1761
};
1762
1763
enumImGuiNavMoveFlags_
1764
{
1765
ImGuiNavMoveFlags_None =0,
1766
ImGuiNavMoveFlags_LoopX =1<<0,// On failed request, restart from opposite side
1767
ImGuiNavMoveFlags_LoopY =1<<1,
1768
ImGuiNavMoveFlags_WrapX =1<<2,// On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)
1769
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)
1772
ImGuiNavMoveFlags_AlsoScoreVisibleSet =1<<5,// Store alternate result in NavMoveResultLocalVisible that only comprise elements that are already fully visible (used by PageUp/PageDown)
1773
ImGuiNavMoveFlags_ScrollToEdgeY =1<<6,// Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword as ImGuiScrollFlags
1774
ImGuiNavMoveFlags_Forwarded =1<<7,
1775
ImGuiNavMoveFlags_DebugNoResult =1<<8,// Dummy scoring for debug purpose, don't apply result
1776
ImGuiNavMoveFlags_FocusApi =1<<9,// Requests from focus API can land/focus/activate items even if they are marked with _NoTabStop (see NavProcessItemForTabbingRequest() for details)
1777
ImGuiNavMoveFlags_IsTabbing =1<<10,// == Focus + Activate if item is Inputable + DontChangeNavHighlight
1778
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)
1825
ImGuiTypingSelectFlags_AllowSingleCharMode =1<<1,// Allow "single char" search mode which is activated when pressing the same character multiple times.
1826
};
1827
1828
// Returned by GetTypingSelectRequest(), designed to eventually be public.
1829
struct IMGUI_API ImGuiTypingSelectRequest
1830
{
1831
ImGuiTypingSelectFlags Flags;// Flags passed to GetTypingSelectRequest()
1832
int SearchBufferLen;
1833
constchar* SearchBuffer;// Search buffer contents (use full string. unless SingleCharMode is set, in which case use SingleCharSize).
1834
bool SelectRequest;// Set when buffer was modified this frame, requesting a selection.
1835
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.
1836
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.
1837
};
1838
1839
// Storage for GetTypingSelectRequest()
1840
struct IMGUI_API ImGuiTypingSelectState
1841
{
1842
ImGuiTypingSelectRequest Request;// User-facing data
1843
char SearchBuffer[64];// Search buffer: no need to make dynamic as this search is very transient.
1844
ImGuiID FocusScope;
1845
int LastRequestFrame =0;
1846
float LastRequestTime =0.0f;
1847
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
1863
ImGuiOldColumnFlags_NoPreserveWidths =1<<2,// Disable column width preservation when adjusting columns
1864
ImGuiOldColumnFlags_NoForceWithinWindow =1<<3,// Disable forcing columns to fit within window
1865
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.
1949
ImGuiMultiSelectState* Storage;
1950
ImGuiID FocusScopeId;// Copied from g.CurrentFocusScopeId (unless another selection scope was pushed manually)
1951
ImGuiMultiSelectFlags Flags;
1952
ImVec2 ScopeRectMin;
1953
ImVec2 BackupCursorMaxPos;
1954
//ImGuiSelectionUserData CurrSubmittedItem; // Copy of last submitted item data, used to merge output ranges.
1955
//ImGuiSelectionUserData PrevSubmittedItem; // Copy of previous submitted item data, used to merge output ranges.
1956
ImGuiID BoxSelectId;
1957
ImGuiKeyChord KeyMods;
1958
ImS8 LoopRequestSetAll;// -1: no operation, 0: clear all, 1: select all.
1959
bool IsEndIO;// Set when switching IO from BeginMultiSelect() to EndMultiSelect() state.
1960
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.
1961
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.
1962
bool NavIdPassedBy;
1963
bool RangeSrcPassedBy;// Set by the item that matches RangeSrcItem.
1964
bool RangeDstPassedBy;// Set by the item that matches NavJustMovedToId when IsSetRange is set.
1965
1966
ImGuiMultiSelectTempData(){Clear();}
1967
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
1991
#defineDOCKING_HOST_DRAW_CHANNEL_FG1// Dock host: decorations and contents
1992
1993
#ifdef IMGUI_HAS_DOCK
1994
1995
// Extend ImGuiDockNodeFlags_
1996
enumImGuiDockNodeFlagsPrivate_
1997
{
1998
// [Internal]
1999
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.
2000
ImGuiDockNodeFlags_CentralNode =1<<11,// Saved // The central node has 2 main properties: stay visible when empty, only use "remaining" spaces from its neighbor.
2001
ImGuiDockNodeFlags_NoTabBar =1<<12,// Saved // Tab bar is completely unavailable. No triangle in the corner to enable it back.
2002
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)
2003
ImGuiDockNodeFlags_NoWindowMenuButton =1<<14,// Saved // Disable window/docking menu (that one that appears instead of the collapse button)
2004
ImGuiDockNodeFlags_NoCloseButton =1<<15,// Saved // Disable close button
2005
ImGuiDockNodeFlags_NoResizeX =1<<16,// //
2006
ImGuiDockNodeFlags_NoResizeY =1<<17,// //
2007
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.
2008
2009
// Disable docking/undocking actions in this dockspace or individual node (existing docked nodes will be preserved)
2010
// Those are not exposed in public because the desirable sharing/inheriting/copy-flag-on-split behaviors are quite difficult to design and understand.
2011
// The two public flags ImGuiDockNodeFlags_NoDockingOverCentralNode/ImGuiDockNodeFlags_NoDockingSplit don't have those issues.
2012
ImGuiDockNodeFlags_NoDockingSplitOther =1<<19,// // Disable this node from splitting other windows/nodes.
2013
ImGuiDockNodeFlags_NoDockingOverMe =1<<20,// // Disable other windows/nodes from being docked over this node.
2014
ImGuiDockNodeFlags_NoDockingOverOther =1<<21,// // Disable this node from being docked over another window or non-empty node.
2015
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.
2054
ImVector<ImGuiWindow*> Windows;// Note: unordered list! Iterate TabBar->Tabs for user-order.
2055
ImGuiTabBar* TabBar;
2056
ImVec2 Pos;// Current position
2057
ImVec2 Size;// Current size
2058
ImVec2 SizeRef;// [Split node only] Last explicitly written-to size (overridden when using a splitter affecting the node), used to calculate Size.
2059
ImGuiAxis SplitAxis;// [Split node only] Split axis (X or Y)
2060
ImU32 LastBgColor;
2061
ImGuiWindowClass WindowClass;// [Root node only]
2062
2063
ImGuiWindow* HostWindow;
2064
ImGuiWindow* VisibleWindow;// Generally point to window which is ID is == SelectedTabID, but when CTRL+Tabbing this can be a different window.
2065
ImGuiDockNode* CentralNode;// [Root node only] Pointer to central node.
2066
ImGuiDockNode* OnlyNodeWithWindows;// [Root node only] Set when there is a single visible node within the hierarchy.
2067
int CountNodeWithWindows;// [Root node only]
2068
int LastFrameAlive;// Last frame number the node was updated or kept alive explicitly with DockSpace() + ImGuiDockNodeFlags_KeepAliveOnly
2069
int LastFrameActive;// Last frame number the node was updated.
2070
int LastFrameFocused;// Last frame number the node was focused.
2071
ImGuiID LastFocusedNodeId;// [Root node only] Which of our child docking node (any ancestor in the hierarchy) was last focused.
2072
ImGuiID SelectedTabId;// [Leaf node only] Which of our tab/window is selected.
2073
ImGuiID WantCloseTabId;// [Leaf node only] Set when closing a specific tab/window.
2074
ImGuiID RefViewportId;// Reference viewport ID from visible window when HostWindow == NULL.
2075
ImGuiDataAuthority AuthorityForPos :3;
2076
ImGuiDataAuthority AuthorityForSize :3;
2077
ImGuiDataAuthority AuthorityForViewport :3;
2078
bool IsVisible :1;// Set to false when the node is hidden (usually disabled as it has no active window)
2079
bool IsFocused :1;
2080
bool IsBgDrawnThisFrame :1;
2081
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.
2082
bool HasWindowMenuButton :1;
2083
bool HasCentralNodeChild :1;
2084
bool WantCloseAll :1;// Set when closing all tabs at once.
2085
bool WantLockSizeOnce :1;
2086
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.
2126
structImGuiWindowDockStyle
2127
{
2128
ImU32 Colors[ImGuiWindowDockStyleCol_COUNT];
2129
};
2130
2131
structImGuiDockContext
2132
{
2133
ImGuiStorage Nodes;// Map ID -> ImGuiDockNode*: Active nodes
// ImGuiViewport Private/Internals fields (cardinal sin: we are using inheritance!)
2147
// Every instance of ImGuiViewport is in fact a ImGuiViewportP.
2148
structImGuiViewportP : publicImGuiViewport
2149
{
2150
ImGuiWindow* Window;// Set when the viewport is owned by a window (and ImGuiViewportFlags_CanHostOtherWindows is NOT set)
2151
int Idx;
2152
int LastFrameActive;// Last frame number this viewport was activated by a window
2153
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)
2154
ImGuiID LastNameHash;
2155
ImVec2 LastPos;
2156
ImVec2 LastSize;
2157
float Alpha;// Window opacity (when dragging dockable windows/viewports we make them transparent)
2158
float LastAlpha;
2159
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.
2160
short PlatformMonitor;
2161
float BgFgDrawListsLastTimeActive[2];// Last frame number the background (0) and foreground (1) draw lists were used
2162
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.
2163
ImDrawData DrawDataP;
2164
ImDrawDataBuilder DrawDataBuilder;// Temporary data while building final ImDrawData
2165
ImVec2 LastPlatformPos;
2166
ImVec2 LastPlatformSize;
2167
ImVec2 LastRendererSize;
2168
2169
// Per-viewport work area
2170
// - Insets are >= 0.0f values, distance from viewport corners to work area.
2171
// - BeginMainMenuBar() and DockspaceOverViewport() tend to use work area to avoid stepping over existing contents.
2172
// - Generally 'safeAreaInsets' in iOS land, 'DisplayCutout' in Android land.
2173
ImVec2 WorkInsetMin;// Work Area inset locked for the frame. GetWorkRect() always fits within GetMainRect().
2174
ImVec2 WorkInsetMax;// "
2175
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.
2199
// (this is designed to be stored in a ImChunkStream buffer, with the variable-length Name following our structure)
2200
structImGuiWindowSettings
2201
{
2202
ImGuiID ID;
2203
ImVec2ih Pos;// NB: Settings position are stored RELATIVE to the viewport! Whereas runtime ones are absolute positions.
2204
ImVec2ih Size;
2205
ImVec2ih ViewportPos;
2206
ImGuiID ViewportId;
2207
ImGuiID DockId;// ID of last known DockNode (even if the DockNode is invisible because it has only 1 active window), or 0 if none.
2208
ImGuiID ClassId;// ID of window class if specified
2209
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.
2210
bool Collapsed;
2211
bool IsChild;
2212
bool WantApply;// Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)
2213
bool WantDelete;// Set to invalidate/delete the settings entry
constchar* TypeName;// Short description stored in .ini file. Disallowed characters: '[' ']'
2222
ImGuiID TypeHash;// == ImHashStr(TypeName)
2223
void(*ClearAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);// Clear all settings data
2224
void(*ReadInitFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);// Read: Called before reading (in registration order)
2225
void*(*ReadOpenFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler,constchar* name);// Read: Called when entering into a new ini entry e.g. "[Window][Name]"
2226
void(*ReadLineFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler,void* entry,constchar* line);// Read: Called for every line of text within an ini entry
2227
void(*ApplyAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler);// Read: Called after reading (in registration order)
2228
void(*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf);// Write: Output every entries into 'out_buf'
// - Only dispatch error if _EXPR: evaluate as assert (similar to an assert macro).
2272
// - The message will always be a string literal, in order to increase likelihood of being display by an assert handler.
2273
// - See 'Demo->Configuration->Error Handling' and ImGuiIO definitions for details on error handling.
2274
// - Read https://github.com/ocornut/imgui/wiki/Error-Handling for details on error handling.
2275
#ifndef IM_ASSERT_USER_ERROR
2276
#defineIM_ASSERT_USER_ERROR(_EXPR,_MSG)do{if(!(_EXPR)){if(ImGui::ErrorLog(_MSG)){IM_ASSERT((_EXPR)&& _MSG);}}}while(0)// Recoverable User Error
2277
#defineIM_ASSERT_USER_ERROR_RET(_EXPR,_MSG)do{if(!(_EXPR)){if(ImGui::ErrorLog(_MSG)){IM_ASSERT((_EXPR)&& _MSG);}return;}}while(0)// Recoverable User Error
2278
#defineIM_ASSERT_USER_ERROR_RETV(_EXPR,_RETV,_MSG)do{if(!(_EXPR)){if(ImGui::ErrorLog(_MSG)){IM_ASSERT((_EXPR)&& _MSG);}return _RETV;}}while(0)// Recoverable User Error
2279
#endif
2280
2281
// The error callback is currently not public, as it is expected that only advanced users will rely on it.
2282
typedefvoid(*ImGuiErrorCallback)(ImGuiContext* ctx,void* user_data,constchar* msg);// Function signature for g.ErrorCallback
bool WithinFrameScope;// Set by NewFrame(), cleared by EndFrame()
2412
bool WithinFrameScopeWithImplicitWindow;// Set by NewFrame(), cleared by EndFrame() when the implicit debug window has been pushed
2413
bool TestEngineHookItems;// Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
2414
int FrameCount;
2415
int FrameCountEnded;
2416
int FrameCountPlatformEnded;
2417
int FrameCountRendered;
2418
double Time;
2419
char ContextName[16];// Storage for a context name (to facilitate debugging multi-context setups)
2420
ImGuiIO IO;
2421
ImGuiPlatformIO PlatformIO;
2422
ImGuiStyle Style;
2423
ImGuiConfigFlags ConfigFlagsCurrFrame;// = g.IO.ConfigFlags at the time of NewFrame()
2424
ImGuiConfigFlags ConfigFlagsLastFrame;
2425
ImVector<ImFontAtlas*> FontAtlases;// List of font atlases used by the context (generally only contains g.IO.Fonts aka the main font atlas)
2426
ImFont* Font;// Currently bound font. (== FontStack.back().Font)
2427
ImFontBaked* FontBaked;// Currently bound font at currently bound size. (== Font->GetFontBaked(FontSize))
2428
float FontSize;// Currently bound font size == line height (== FontSizeBase + externals scales applied in the UpdateCurrentFontSize() function).
2429
float FontSizeBase;// Font size before scaling == style.FontSizeBase == value passed to PushFont() when specified.
2430
float FontBakedScale;// == FontBaked->Size / FontSize. Scale factor over baked size. Rarely used nowadays, very often == 1.0f.
2431
float FontRasterizerDensity;// Current font density. Used by all calls to GetFontBaked().
2432
float CurrentDpiScale;// Current window/viewport DpiScale == CurrentViewport->DpiScale
2433
ImDrawListSharedData DrawListSharedData;
2434
ImGuiID WithinEndChildID;// Set within EndChild()
2435
ImGuiID WithinEndPopupID;// Set within EndPopup()
2436
void* TestEngine;// Test engine user data
2437
2438
// Inputs
2439
ImVector<ImGuiInputEvent> InputEventsQueue;// Input events which will be trickled/written into IO structure.
2440
ImVector<ImGuiInputEvent> InputEventsTrail;// Past input events processed in NewFrame(). This is to allow domain-specific application to access e.g mouse/pen trail.
2441
ImGuiMouseSource InputEventsNextMouseSource;
2442
ImU32 InputEventsNextEventId;
2443
2444
// Windows state
2445
ImVector<ImGuiWindow*> Windows;// Windows, sorted in display order, back to front
2446
ImVector<ImGuiWindow*> WindowsFocusOrder;// Root windows, sorted in focus order, back to front.
2447
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*
2450
int WindowsActiveCount;// Number of unique windows submitted by frame
2451
float WindowsBorderHoverPadding;// Padding around resizable windows for which hovering on counts as hovering the window == ImMax(style.TouchExtraPadding, style.WindowBorderHoverPadding). This isn't so multi-dpi friendly.
2452
ImGuiID DebugBreakInWindow;// Set to break in Begin() call.
2453
ImGuiWindow* CurrentWindow;// Window being drawn into
2454
ImGuiWindow* HoveredWindow;// Window the mouse is hovering. Will typically catch mouse inputs.
2455
ImGuiWindow* HoveredWindowUnderMovingWindow;// Hovered window ignoring MovingWindow. Only set if MovingWindow is set.
2456
ImGuiWindow* HoveredWindowBeforeClear;// Window the mouse is hovering. Filled even with _NoMouse. This is currently useful for multi-context compositors.
2457
ImGuiWindow* MovingWindow;// Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindowDockTree.
2458
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.
2459
ImVec2 WheelingWindowRefMousePos;
2460
int WheelingWindowStartFrame;// This may be set one frame before WheelingWindow is != NULL
2461
int WheelingWindowScrolledFrame;
2462
float WheelingWindowReleaseTimer;
2463
ImVec2 WheelingWindowWheelRemainder;
2464
ImVec2 WheelingAxisAvg;
2465
2466
// Item/widgets state and tracking information
2467
ImGuiID DebugDrawIdConflictsId;// Set when we detect multiple items with the same identifier
2468
ImGuiID DebugHookIdInfoId;// Will call core hooks: DebugHookIdInfo() from GetID functions, used by ID Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
2469
ImGuiID HoveredId;// Hovered widget, filled during the frame
2470
ImGuiID HoveredIdPreviousFrame;
2471
int HoveredIdPreviousFrameItemCount;// Count numbers of items using the same ID as last frame's hovered id
2472
float HoveredIdTimer;// Measure contiguous hovering time
2473
float HoveredIdNotActiveTimer;// Measure contiguous hovering time where the item has not been active
2474
bool HoveredIdAllowOverlap;
2475
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.
2476
bool ItemUnclipByLog;// Disable ItemAdd() clipping, essentially a memory-locality friendly copy of LogEnabled
2477
ImGuiID ActiveId;// Active widget
2478
ImGuiID ActiveIdIsAlive;// Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
2479
float ActiveIdTimer;
2480
bool ActiveIdIsJustActivated;// Set at the time of activation for one frame
2481
bool ActiveIdAllowOverlap;// Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
2482
bool ActiveIdNoClearOnFocusLoss;// Disable losing active id if the active id window gets unfocused.
2483
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.
2484
bool ActiveIdHasBeenEditedBefore;// Was the value associated to the widget Edited over the course of the Active state.
2485
bool ActiveIdHasBeenEditedThisFrame;
2486
bool ActiveIdFromShortcut;
2487
ImS8 ActiveIdMouseButton;
2488
ImGuiID ActiveIdDisabledId;// When clicking a disabled item we set ActiveId=window->MoveId to avoid interference with widget code. Actual item ID is stored here.
2489
ImVec2 ActiveIdClickOffset;// Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
2490
ImGuiInputSource ActiveIdSource;// Activating source: ImGuiInputSource_Mouse OR ImGuiInputSource_Keyboard OR ImGuiInputSource_Gamepad
2491
ImGuiWindow* ActiveIdWindow;
2492
ImGuiID ActiveIdPreviousFrame;
2493
ImGuiDeactivatedItemData DeactivatedItemData;
2494
ImGuiDataTypeStorage ActiveIdValueOnActivation;// Backup of initial value at the time of activation. ONLY SET BY SPECIFIC WIDGETS: DragXXX and SliderXXX.
2495
ImGuiID LastActiveId;// Store the last non-zero ActiveId, useful for animation.
2496
float LastActiveIdTimer;// Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
2497
2498
// Key/Input Ownership + Shortcut Routing system
2499
// - The idea is that instead of "eating" a given key, we can link to an owner.
2500
// - Input query can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_NoOwner (== -1) or a custom ID.
2501
// - Routing is requested ahead of time for a given chord (Key + Mods) and granted in NewFrame().
2502
double LastKeyModsChangeTime;// Record the last time key mods changed (affect repeat delay when using shortcut logic)
2503
double LastKeyModsChangeFromNoneTime;// Record the last time key mods changed away from being 0 (affect repeat delay when using shortcut logic)
2504
double LastKeyboardKeyPressTime;// Record the last time a keyboard key (ignore mouse/gamepad ones) was pressed.
2505
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)
2509
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)
2510
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.
2515
ImGuiItemFlags CurrentItemFlags;// Value for currently appending items == g.ItemFlagsStack.back()
2516
ImGuiID DebugLocateId;// Storage for DebugLocateItemOnHover() feature: this is read by ItemAdd() so we keep it in a hot/cached location
2517
ImGuiNextItemData NextItemData;// Storage for SetNextItem** functions
2518
ImGuiLastItemData LastItemData;// Storage for last submitted item (setup by ItemAdd)
2519
ImGuiNextWindowData NextWindowData;// Storage for SetNextWindow** functions
2520
bool DebugShowGroupRects;
2521
bool GcCompactAll;// Request full GC
2522
2523
// Shared stacks
2524
ImGuiCol DebugFlashStyleColorIdx;// (Keep close to ColorStack to share cache line)
2525
ImVector<ImGuiColorMod> ColorStack;// Stack for PushStyleColor()/PopStyleColor() - inherited by Begin()
2526
ImVector<ImGuiStyleMod> StyleVarStack;// Stack for PushStyleVar()/PopStyleVar() - inherited by Begin()
2527
ImVector<ImFontStackData> FontStack;// Stack for PushFont()/PopFont() - inherited by Begin()
2528
ImVector<ImGuiFocusScopeData> FocusScopeStack;// Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin()
2529
ImVector<ImGuiItemFlags> ItemFlagsStack;// Stack for PushItemFlag()/PopItemFlag() - inherited by Begin()
2530
ImVector<ImGuiGroupData> GroupStack;// Stack for BeginGroup()/EndGroup() - not inherited by Begin()
2531
ImVector<ImGuiPopupData> OpenPopupStack;// Which popups are open (persistent)
2532
ImVector<ImGuiPopupData> BeginPopupStack;// Which level of BeginPopup() we are in (reset every frame)
2533
ImVector<ImGuiTreeNodeStackData>TreeNodeStack;// Stack for TreeNode()
2534
2535
// Viewports
2536
ImVector<ImGuiViewportP*> Viewports;// Active viewports (always 1+, and generally 1 unless multi-viewports are enabled). Each viewports hold their copy of ImDrawData.
2537
ImGuiViewportP* CurrentViewport;// We track changes of viewport (happening in Begin) so we can call Platform_OnChangedViewport()
2538
ImGuiViewportP* MouseViewport;
2539
ImGuiViewportP* MouseLastHoveredViewport;// Last known viewport that was hovered by mouse (even if we are not hovering any viewport any more) + honoring the _NoInputs flag.
2540
ImGuiID PlatformLastFocusedViewportId;
2541
ImGuiPlatformMonitor FallbackMonitor;// Virtual monitor used as fallback if backend doesn't provide monitor information.
2542
ImRect PlatformMonitorsFullWorkRect;// Bounding box of all platform monitors
2543
int ViewportCreatedCount;// Unique sequential creation counter (mostly for testing/debugging)
2544
int PlatformWindowsCreatedCount;// Unique sequential creation counter (mostly for testing/debugging)
2545
int ViewportFocusedStampCount;// Every time the front-most window changes, we stamp its viewport with an incrementing counter
2546
2547
// Keyboard/Gamepad Navigation
2548
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)
2551
//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.
2552
bool NavMousePosDirty;// When set we will update mouse position if io.ConfigNavMoveSetMousePos is set (not enabled by default)
2553
bool NavIdIsAlive;// Nav widget has been seen this frame ~~ NavRectRel is valid
2554
ImGuiID NavId;// Focused item for navigation
2555
ImGuiWindow* NavWindow;// Focused window for navigation. Could be called 'FocusedWindow'
2556
ImGuiID NavFocusScopeId;// Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
2557
ImGuiNavLayer NavLayer;// Focused layer (main scrolling layer, or menu/title bar layer)
2558
ImGuiItemFlags NavIdItemFlags;
2559
ImGuiID NavActivateId;// ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItemByID()
ImVector<ImGuiFocusScopeData> NavFocusRoute;// Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
2564
ImGuiID NavHighlightActivatedId;
2565
float NavHighlightActivatedTimer;
2566
ImGuiID NavOpenContextMenuItemId;
2567
ImGuiID NavOpenContextMenuWindowId;
2568
ImGuiID NavNextActivateId;// Set by ActivateItemByID(), queued until next frame.
2569
ImGuiActivateFlags NavNextActivateFlags;
2570
ImGuiInputSource NavInputSource;// Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Gamepad
2571
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.
2572
ImS8 NavCursorHideFrames;
2573
//ImGuiID NavActivateInputId; // Removed in 1.89.4 (July 2023). This is now part of g.NavActivateId and sets g.NavActivateFlags |= ImGuiActivateFlags_PreferInput. See commit c9a53aa74, issue #5606.
2574
2575
// Navigation: Init & Move Requests
2576
bool NavAnyRequest;// ~~ NavMoveRequest || NavInitRequest this is to perform early out in ItemAdd()
2577
bool NavInitRequest;// Init request for appearing window to select first item
2578
bool NavInitRequestFromMove;
2579
ImGuiNavItemData NavInitResult;// Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)
2580
bool NavMoveSubmitted;// Move request submitted, will process result on next NewFrame()
2581
bool NavMoveScoringItems;// Move request submitted, still scoring incoming items
2582
bool NavMoveForwardToNextFrame;
2583
ImGuiNavMoveFlags NavMoveFlags;
2584
ImGuiScrollFlags NavMoveScrollFlags;
2585
ImGuiKeyChord NavMoveKeyMods;
2586
ImGuiDir NavMoveDir;// Direction of the move request (left/right/up/down)
2587
ImGuiDir NavMoveDirForDebug;
2588
ImGuiDir NavMoveClipDir;// FIXME-NAV: Describe the purpose of this better. Might want to rename?
2589
ImRect NavScoringRect;// Rectangle used for scoring, in screen space. Based of window->NavRectRel[], modified for directional navigation scoring.
2590
ImRect NavScoringNoClipRect;// Some nav operations (such as PageUp/PageDown) enforce a region which clipper will attempt to always keep submitted. Unset/invalid if inverted.
2591
int NavScoringDebugCount;// Metrics for debugging
2592
int NavTabbingDir;// Generally -1 or +1, 0 when tabbing without a nav id
2593
int NavTabbingCounter;// >0 when counting items for tabbing
2594
ImGuiNavItemData NavMoveResultLocal;// Best move request candidate within NavWindow
2595
ImGuiNavItemData NavMoveResultLocalVisible;// Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
2596
ImGuiNavItemData NavMoveResultOther;// Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
2597
ImGuiNavItemData NavTabbingResultFirst;// First tabbing request candidate within NavWindow and flattened hierarchy
2598
2599
// Navigation: record of last move request
2600
ImGuiID NavJustMovedFromFocusScopeId;// Just navigated from this focus scope id (result of a successfully MoveRequest).
2601
ImGuiID NavJustMovedToId;// Just navigated to this id (result of a successfully MoveRequest).
2602
ImGuiID NavJustMovedToFocusScopeId;// Just navigated to this focus scope id (result of a successfully MoveRequest).
2603
ImGuiKeyChord NavJustMovedToKeyMods;
2604
bool NavJustMovedToIsTabbing;// Copy of ImGuiNavMoveFlags_IsTabbing. Maybe we should store whole flags.
2605
bool NavJustMovedToHasSelectionData;// Copy of move result's ItemFlags & ImGuiItemFlags_HasSelectionUserData). Maybe we should just store ImGuiNavItemData.
2606
2607
// Navigation: extra config options (will be made public eventually)
2608
// - Tabbing (Tab, Shift+Tab) and Windowing (Ctrl+Tab, Ctrl+Shift+Tab) are enabled REGARDLESS of ImGuiConfigFlags_NavEnableKeyboard being set.
2609
// - Ctrl+Tab is reconfigurable because it is the only shortcut that may be polled when no window are focused. It also doesn't work e.g. Web platforms.
2610
bool ConfigNavEnableTabbing;// = true. Enable tabbing (Tab, Shift+Tab). PLEASE LET ME KNOW IF YOU USE THIS.
2611
bool ConfigNavWindowingWithGamepad;// = true. Enable Ctrl+Tab by holding ImGuiKey_GamepadFaceLeft (== ImGuiKey_NavGamepadMenu). When false, the button may still be used to toggle Menu layer.
2612
ImGuiKeyChord ConfigNavWindowingKeyNext;// = ImGuiMod_Ctrl | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiKey_Tab on OS X). Set to 0 to disable. For reconfiguration (see #4828)
2613
ImGuiKeyChord ConfigNavWindowingKeyPrev;// = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab (or ImGuiMod_Super | ImGuiMod_Shift | ImGuiKey_Tab on OS X)
2614
2615
// Navigation: Windowing (Ctrl+Tab for list, or Menu button + keys or directional pads to move/resize)
2616
ImGuiWindow* NavWindowingTarget;// Target window when doing Ctrl+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
2617
ImGuiWindow* NavWindowingTargetAnim;// Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it.
2618
ImGuiWindow* NavWindowingListWindow;// Internal window actually listing the Ctrl+Tab contents
2619
float NavWindowingTimer;
2620
float NavWindowingHighlightAlpha;
2621
ImGuiInputSource NavWindowingInputSource;
2622
bool NavWindowingToggleLayer;// Set while Alt or GamepadMenu is held, may be cleared by other operations, and processed when releasing the key.
2623
ImGuiKey NavWindowingToggleKey;// Keyboard/gamepad key used when toggling to menu layer.
2624
ImVec2 NavWindowingAccumDeltaPos;
2625
ImVec2 NavWindowingAccumDeltaSize;
2626
2627
// Render
2628
float DimBgRatio;// 0.0..1.0 animation when fading in a dimming background (for modal window and Ctrl+Tab list)
2629
2630
// Drag and Drop
2631
bool DragDropActive;
2632
bool DragDropWithinSource;// Set when within a BeginDragDropXXX/EndDragDropXXX block for a drag source.
2633
bool DragDropWithinTarget;// Set when within a BeginDragDropXXX/EndDragDropXXX block for a drag target.
2634
ImGuiDragDropFlags DragDropSourceFlags;
2635
int DragDropSourceFrameCount;
2636
int DragDropMouseButton;
2637
ImGuiPayload DragDropPayload;
2638
ImRect DragDropTargetRect;// Store rectangle of current target candidate (we favor small targets when overlapping)
2639
ImRect DragDropTargetClipRect;// Store ClipRect at the time of item's drawing
2640
ImGuiID DragDropTargetId;
2641
ImGuiID DragDropTargetFullViewport;
2642
ImGuiDragDropFlags DragDropAcceptFlagsCurr;
2643
ImGuiDragDropFlags DragDropAcceptFlagsPrev;
2644
float DragDropAcceptIdCurrRectSurface;// Target item surface (we resolve overlapping targets by prioritizing the smaller surface)
2645
ImGuiID DragDropAcceptIdCurr;// Target item id (set at the time of accepting the payload)
2646
ImGuiID DragDropAcceptIdPrev;// Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)
2647
int DragDropAcceptFrameCount;// Last time a target expressed a desire to accept the source
2648
ImGuiID DragDropHoldJustPressedId;// Set when holding a payload just made ButtonBehavior() return a press.
2649
ImVector<unsignedchar> DragDropPayloadBufHeap;// We don't expose the ImVector<> directly, ImGuiPayload only holds pointer+size
2650
unsignedchar DragDropPayloadBufLocal[16];// Local buffer for small payloads
2651
2652
// Clipper
2653
int ClipperTempDataStacked;
2654
ImVector<ImGuiListClipperData> ClipperTempData;
2655
2656
// Tables
2657
ImGuiTable* CurrentTable;
2658
ImGuiID DebugBreakInTable;// Set to break in BeginTable() call.
2659
int TablesTempDataStacked;// Temporary table data size (because we leave previous instances undestructed, we generally don't use TablesTempData.Size)
2660
ImVector<ImGuiTableTempData> TablesTempData;// Temporary table data (buffers reused/shared across instances, support nesting)
2661
ImPool<ImGuiTable> Tables;// Persistent table data
2662
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)
ImGuiID InputTextReactivateId;// ID of InputText to reactivate on next frame (for io.ConfigInputTextEnterKeepActive behavior)
2698
ImGuiID TempInputId;// Temporary text input when using Ctrl+Click on a slider, etc.
2699
ImGuiDataTypeStorage DataTypeZeroValue;// 0 for all data types
2700
int BeginMenuDepth;
2701
int BeginComboDepth;
2702
ImGuiColorEditFlags ColorEditOptions;// Store user options for color edit widgets
2703
ImGuiID ColorEditCurrentID;// Set temporarily while inside of the parent-most ColorEdit4/ColorPicker4 (because they call each others).
2704
ImGuiID ColorEditSavedID;// ID we are saving/restoring HS for
2705
float ColorEditSavedHue;// Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips
2706
float ColorEditSavedSat;// Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips
2707
ImU32 ColorEditSavedColor;// RGB value with alpha set to 0.
2708
ImVec4 ColorPickerRef;// Initial/reference color at the time of opening the color picker.
2709
ImGuiComboPreviewData ComboPreviewData;
2710
ImRect WindowResizeBorderExpectedRect;// Expected border rect, switch to relative edit if moving
2711
bool WindowResizeRelativeMode;
2712
short ScrollbarSeekMode;// 0: scroll to clicked location, -1/+1: prev/next page.
2713
float ScrollbarClickDeltaToGrabCenter;// When scrolling to mouse location: distance between mouse and center of grab box, normalized in parent space.
2714
float SliderGrabClickOffset;
2715
float SliderCurrentAccum;// Accumulated slider delta when using navigation controls.
2716
bool SliderCurrentAccumDirty;// Has the accumulated slider delta changed since last time we tried to apply it?
2717
bool DragCurrentAccumDirty;
2718
float DragCurrentAccum;// Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
2719
float DragSpeedDefaultRatio;// If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
2720
float DisabledAlphaBackup;// Backup for style.Alpha for BeginDisabled()
2721
short DisabledStackSize;
2722
short TooltipOverrideCount;
2723
ImGuiWindow* TooltipPreviousWindow;// Window of last tooltip submitted during the frame
2724
ImVector<char> ClipboardHandlerData;// If no custom clipboard handler is defined
2725
ImVector<ImGuiID> MenusIdSubmittedThisFrame;// A list of menu IDs that were rendered at least once
2726
ImGuiTypingSelectState TypingSelectState;// State for GetTypingSelectRequest()
2727
2728
// Platform support
2729
ImGuiPlatformImeData PlatformImeData;// Data updated by current frame. Will be applied at end of the frame. For some backends, this is required to have WantVisible=true in order to receive text message.
2730
ImGuiPlatformImeData PlatformImeDataPrev;// Previous frame data. When changed we call the platform_io.Platform_SetImeDataFn() handler.
2731
2732
// Extensions
2733
// FIXME: We could provide an API to register one slot in an array held in ImGuiContext?
2734
ImVector<ImTextureData*> UserTextures;// List of textures created/managed by user or third-party extension. Automatically appended into platform_io.Textures[].
float FramerateSecPerFrame[60];// Calculate estimate of framerate for user over the last 60 frames..
2807
int FramerateSecPerFrameIdx;
2808
int FramerateSecPerFrameCount;
2809
float FramerateSecPerFrameAccum;
2810
int WantCaptureMouseNextFrame;// Explicit capture override via SetNextFrameWantCaptureMouse()/SetNextFrameWantCaptureKeyboard(). Default to -1.
2811
int WantCaptureKeyboardNextFrame;// "
2812
int WantTextInputNextFrame;// Copied in EndFrame() from g.PlatformImeData.WantTextInput. Needs to be set for some backends (SDL3) to emit character inputs.
2813
ImVector<char> TempBuffer;// Temporary text buffer
// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.
2827
// (That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered..)
2828
// (This doesn't need a constructor because we zero-clear it as part of ImGuiWindow and all frame-temporary data are setup on Begin)
2829
struct IMGUI_API ImGuiWindowTempData
2830
{
2831
// Layout
2832
ImVec2 CursorPos;// Current emitting position, in absolute coordinates.
2833
ImVec2 CursorPosPrevLine;
2834
ImVec2 CursorStartPos;// Initial position after Begin(), generally ~ window position + WindowPadding.
2835
ImVec2 CursorMaxPos;// Used to implicitly calculate ContentSize at the beginning of next frame, for scrolling range and auto-resize. Always growing during the frame.
2836
ImVec2 IdealMaxPos;// Used to implicitly calculate ContentSizeIdeal at the beginning of next frame, for auto-resize only. Always growing during the frame.
2837
ImVec2 CurrLineSize;
2838
ImVec2 PrevLineSize;
2839
float CurrLineTextBaseOffset;// Baseline offset (0.0f by default on a new line, generally == style.FramePadding.y when a framed item has been added).
2840
float PrevLineTextBaseOffset;
2841
bool IsSameLine;
2842
bool IsSetPos;
2843
ImVec1 Indent;// Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
2844
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.
2845
ImVec1 GroupOffset;
2846
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.
2847
2848
// Keyboard/Gamepad navigation
2849
ImGuiNavLayer NavLayerCurrent;// Current layer, 0..31 (we currently only use 0..1)
2850
short NavLayersActiveMask;// Which layers have been written to (result from previous frame)
2851
short NavLayersActiveMaskNext;// Which layers have been written to (accumulator for current frame)
2852
bool NavIsScrollPushableX;// Set when current work location may be scrolled horizontally when moving left / right. This is generally always true UNLESS within a column.
2853
bool NavHideHighlightOneFrame;
2854
bool NavWindowHasScrollY;// Set per window when scrolling can be used (== ScrollMax.y > 0.0f)
2855
2856
// Miscellaneous
2857
bool MenuBarAppending;// FIXME: Remove this
2858
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.
2859
ImGuiMenuColumns MenuColumns;// Simplified columns storage for menu items measurement
2860
int TreeDepth;// Current tree depth.
2861
ImU32 TreeHasStackDataDepthMask;// Store whether given depth has ImGuiTreeNodeStackData data. Could be turned into a ImU64 if necessary.
2862
ImU32 TreeRecordsClippedNodesY2Mask;// Store whether we should keep recording Y2. Cleared when passing clip max. Equivalent TreeHasStackDataDepthMask value should always be set.
2863
ImVector<ImGuiWindow*> ChildWindows;
2864
ImGuiStorage* StateStorage;// Current persistent per-window storage (store e.g. tree node open/close state)
2865
ImGuiOldColumns* CurrentColumns;// Current columns set
2866
int CurrentTableIdx;// Current table index (into g.Tables)
2867
ImGuiLayoutType LayoutType;
2868
ImGuiLayoutType ParentLayoutType;// Layout type of parent window at the time of Begin()
2869
ImU32 ModalDimBgColor;
2870
2871
// Status flags
2872
ImGuiItemStatusFlags WindowItemStatusFlags;
2873
ImGuiItemStatusFlags ChildItemStatusFlags;
2874
ImGuiItemStatusFlags DockTabItemStatusFlags;
2875
ImRect DockTabItemRect;
2876
2877
// Local parameters stacks
2878
// 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.
2879
float ItemWidth;// Current item width (>0.0: width in pixels, <0.0: align xx pixels to the right of window).
2880
float ItemWidthDefault;
2881
float TextWrapPos;// Current text wrap pos.
2882
ImVector<float> ItemWidthStack;// Store item widths to restore (attention: .back() is not == ItemWidth)
2883
ImVector<float> TextWrapPosStack;// Store text wrap pos to restore (attention: .back() is not == TextWrapPos)
2884
};
2885
2886
// Storage for one window
2887
struct IMGUI_API ImGuiWindow
2888
{
2889
ImGuiContext* Ctx;// Parent UI context (needs to be set explicitly by parent).
2890
char* Name;// Window name, owned by the window.
2891
ImGuiID ID;// == ImHashStr(Name)
2892
ImGuiWindowFlags Flags, FlagsPreviousFrame;// See enum ImGuiWindowFlags_
2893
ImGuiChildFlags ChildFlags;// Set when window is a child window. See enum ImGuiChildFlags_
2894
ImGuiWindowClass WindowClass;// Advanced users only. Set with SetNextWindowClass()
2895
ImGuiViewportP* Viewport;// Always set in Begin(). Inactive windows may have a NULL value here if their viewport was discarded.
2896
ImGuiID ViewportId;// We backup the viewport id (since the viewport may disappear or never be created if the window is inactive)
2897
ImVec2 ViewportPos;// We backup the viewport position (since the viewport may disappear or never be created if the window is inactive)
2898
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
2899
ImVec2 Pos;// Position (always rounded-up to nearest pixel)
2900
ImVec2 Size;// Current size (==SizeFull or collapsed title bar size)
2901
ImVec2 SizeFull;// Size when non collapsed
2902
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.
2903
ImVec2 ContentSizeIdeal;
2904
ImVec2 ContentSizeExplicit;// Size of contents/scrollable client area explicitly request by the user via SetNextWindowContentSize().
2905
ImVec2 WindowPadding;// Window padding at the time of Begin().
2906
float WindowRounding;// Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc.
2907
float WindowBorderSize;// Window border size at the time of Begin().
2908
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.
2909
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).
2912
int NameBufLen;// Size of buffer storing Name. May be larger than strlen(Name)!
2913
ImGuiID MoveId;// == window->GetID("#MOVE")
2914
ImGuiID TabId;// == window->GetID("#TAB")
2915
ImGuiID ChildId;// ID of corresponding item in parent window (for navigation to return from child window to parent window)
2916
ImGuiID PopupId;// ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)
2917
ImVec2 Scroll;
2918
ImVec2 ScrollMax;
2919
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)
2920
ImVec2 ScrollTargetCenterRatio;// 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
2921
ImVec2 ScrollTargetEdgeSnapDist;// 0.0f = no snapping, >0.0f snapping threshold
2922
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.
2923
bool ScrollbarX, ScrollbarY;// Are scrollbars visible?
2924
bool ScrollbarXStabilizeEnabled;// Was ScrollbarX previously auto-stabilized?
2925
ImU8 ScrollbarXStabilizeToggledHistory;// Used to stabilize scrollbar visibility in case of feedback loops
2926
bool ViewportOwned;
2927
bool Active;// Set to true on Begin(), unless Collapsed
2928
bool WasActive;
2929
bool WriteAccessed;// Set to true when any widget access the current window
2930
bool Collapsed;// Set when collapsing window to become only title-bar
2931
bool WantCollapseToggle;
2932
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)
2935
bool Hidden;// Do not display (== HiddenFrames*** > 0)
2936
bool IsFallbackWindow;// Set on the "Debug##Default" window.
2937
bool IsExplicitChild;// Set when passed _ChildWindow, left to false by BeginDocked()
2938
bool HasCloseButton;// Set when the window has a close button (p_open != NULL)
2939
signedchar ResizeBorderHovered;// Current border being hovered for resize (-1: none, otherwise 0-3)
2940
signedchar ResizeBorderHeld;// Current border being held for resize (-1: none, otherwise 0-3)
2941
short BeginCount;// Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
2942
short BeginCountPreviousFrame;// Number of Begin() during the previous frame
2943
short BeginOrderWithinParent;// Begin() order within immediate parent window, if we are a child window. Otherwise 0.
2944
short BeginOrderWithinContext;// Begin() order within entire imgui context. This is mostly used for debugging submission order related issues.
2945
short FocusOrder;// Order within WindowsFocusOrder[], altered when windows are focused.
2946
ImGuiDir AutoPosLastDirection;
2947
ImS8 AutoFitFramesX, AutoFitFramesY;
2948
bool AutoFitOnlyGrows;
2949
ImS8 HiddenFramesCanSkipItems;// Hide the window for N frames
2950
ImS8 HiddenFramesCannotSkipItems;// Hide the window for N frames while allowing items to be submitted so we can measure their size
2951
ImS8 HiddenFramesForRenderOnly;// Hide the window until frame N at Render() time only
2952
ImS8 DisableInputsFrames;// Disable window interactions for N frames
2953
ImGuiWindowBgClickFlags BgClickFlags :8;// Configure behavior of click+dragging on window bg/void or over items. Default sets by io.ConfigWindowsMoveFromTitleBarOnly. If you use this please report in #3379.
2954
ImGuiCond SetWindowPosAllowFlags :8;// store acceptable condition flags for SetNextWindowPos() use.
2955
ImGuiCond SetWindowSizeAllowFlags :8;// store acceptable condition flags for SetNextWindowSize() use.
2956
ImGuiCond SetWindowCollapsedAllowFlags :8;// store acceptable condition flags for SetNextWindowCollapsed() use.
2957
ImGuiCond SetWindowDockAllowFlags :8;// store acceptable condition flags for SetNextWindowDock() use.
2958
ImVec2 SetWindowPosVal;// store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
2959
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.
2960
2961
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)
2962
ImGuiWindowTempData DC;// Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
2963
2964
// The best way to understand what those rectangles are is to use the 'Metrics->Tools->Show Windows Rectangles' viewer.
2965
// The main 'OuterRect', omitted as a field, is window->Rect().
2966
ImRect OuterRectClipped;// == Window->Rect() just after setup in Begin(). == window->Rect() for root window.
2967
ImRect InnerRect;// Inner rectangle (omit title bar, menu bar, scroll bar)
2968
ImRect InnerClipRect;// == InnerRect shrunk by WindowPadding*0.5f on each side, clipped within viewport or parent clip rect.
2969
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).
2970
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?
2971
ImRect ClipRect;// Current clipping/scissoring rectangle, evolve as we are using PushClipRect(), etc. == DrawList->clip_rect_stack.back().
2972
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.
2973
ImVec2ih HitTestHoleSize;// Define an optional rectangular hole where mouse will pass-through the window.
2974
ImVec2ih HitTestHoleOffset;
2975
2976
int LastFrameActive;// Last frame number the window was Active.
2977
int LastFrameJustFocused;// Last frame number the window was made Focused.
2978
float LastTimeActive;// Last timestamp the window was Active (using float as we don't need high precision there)
2979
ImGuiStorage StateStorage;
2980
ImVector<ImGuiOldColumns> ColumnsStorage;
2981
float FontWindowScale;// User scale multiplier per-window, via SetWindowFontScale()
2982
float FontWindowScaleParents;
2983
float FontRefSize;// This is a copy of window->CalcFontSize() at the time of Begin(), trying to phase out CalcFontSize() especially as it may be called on non-current window.
2984
int SettingsOffset;// Offset into SettingsWindows[] (offsets are always valid as we only grow the array from the back)
2985
2986
ImDrawList* DrawList;// == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
2987
ImDrawList DrawListInst;
2988
ImGuiWindow* ParentWindow;// If we are a child _or_ popup _or_ docked window, this is pointing to our parent. Otherwise NULL.
2989
ImGuiWindow* ParentWindowInBeginStack;
2990
ImGuiWindow* RootWindow;// Point to ourself or first ancestor that is not a child window. Doesn't cross through popups/dock nodes.
2991
ImGuiWindow* RootWindowPopupTree;// Point to ourself or first ancestor that is not a child window. Cross through popups parent<>child.
2992
ImGuiWindow* RootWindowDockTree;// Point to ourself or first ancestor that is not a child window. Cross through dock nodes.
2993
ImGuiWindow* RootWindowForTitleBarHighlight;// Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
2994
ImGuiWindow* RootWindowForNav;// Point to ourself or first ancestor which doesn't have the NavFlattened flag.
2995
ImGuiWindow* ParentWindowForFocusRoute;// Set to manual link a window to its logical parent so that Shortcut() chain are honored (e.g. Tool linked to Document)
2996
2997
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.)
2998
ImGuiID NavLastIds[ImGuiNavLayer_COUNT];// Last known NavId for this window, per layer (0/1)
2999
ImRect NavRectRel[ImGuiNavLayer_COUNT];// Reference rectangle, in window relative space
3000
ImVec2 NavPreferredScoringPosRel[ImGuiNavLayer_COUNT];// Preferred X/Y position updated when moving on a given axis, reset to FLT_MAX.
3001
ImGuiID NavRootFocusScopeId;// Focus Scope ID at the time of Begin()
3002
3003
int MemoryDrawListIdxCapacity;// Backup of last idx/vtx count, so when waking up the window we can preallocate and avoid iterative alloc/copy
3004
int MemoryDrawListVtxCapacity;
3005
bool MemoryCompacted;// Set when window extraneous data have been garbage collected
3006
3007
// Docking
3008
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).
3009
bool DockNodeIsVisible :1;
3010
bool DockTabIsVisible :1;// Is our window visible this frame? ~~ is the corresponding tab selected?
3011
bool DockTabWantClose :1;
3012
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.
3013
ImGuiWindowDockStyle DockStyle;
3014
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.
3015
ImGuiDockNode* DockNodeAsHost;// Which node are we owning (for parent windows)
3016
ImGuiID DockId;// Backup of last valid DockNode->ID, so single window remember their dock node id even when they are not bound any more
// [OBSOLETE] ImGuiWindow::CalcFontSize() was removed in 1.92.0 because error-prone/misleading. You can use window->FontRefSize for a copy of g.FontSize at the time of the last Begin() call for this window.
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]
3045
ImGuiTabBarFlags_IsFocused =1<<21,
3046
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)
3054
ImGuiTabItemFlags_Button =1<<21,// Used by TabItemButton, change the tab item behavior to mimic a button
3055
ImGuiTabItemFlags_Invisible =1<<22,// To reserve space e.g. with ImGuiTabItemFlags_Leading
3056
ImGuiTabItemFlags_Unsorted =1<<23,// [Docking] Trailing tabs with the _Unsorted flag will be sorted based on the DockOrder of their Window.
3057
};
3058
3059
// Storage for one active tab item (sizeof() 48 bytes)
3060
structImGuiTabItem
3061
{
3062
ImGuiID ID;
3063
ImGuiTabItemFlags Flags;
3064
ImGuiWindow* Window;// When TabItem is part of a DockNode's TabBar, we hold on to a window.
3065
int LastFrameVisible;
3066
int LastFrameSelected;// This allows us to infer an ordered list of the last activated tabs with little maintenance
3067
float Offset;// Position relative to beginning of tab bar
3068
float Width;// Width currently displayed
3069
float ContentWidth;// Width of label + padding, stored during BeginTabItem() call (misnamed as "Content" would normally imply width of label only)
3070
float RequestedWidth;// Width optionally requested by caller, -1.0f is unused
3071
ImS32 NameOffset;// When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames
3072
ImS16 BeginOrder;// BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable
3073
ImS16 IndexDuringLayout;// Index only used during TabBarLayout(). Tabs gets reordered so 'Tabs[n].IndexDuringLayout == n' but may mismatch during additions.
3074
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.
3128
#defineIMGUI_TABLE_MAX_COLUMNS512// Arbitrary "safety" maximum, may be lifted in the future if needed. Must fit in ImGuiTableColumnIdx/ImGuiTableDrawChannelIdx.
3129
3130
// [Internal] sizeof() ~ 120
3131
// We use the terminology "Enabled" to refer to a column that is not Hidden by user/api.
3132
// We use the terminology "Clipped" to refer to a column that is out of sight because of scrolling/clipping.
3133
// This is in contrast with some user-facing api such as IsItemVisible() / IsRectVisible() which use "Visible" to mean "not clipped".
3134
structImGuiTableColumn
3135
{
3136
ImGuiTableColumnFlags Flags;// Flags after some patching (not directly same as provided by user). See ImGuiTableColumnFlags_
3137
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.
3138
float MinX;// Absolute positions
3139
float MaxX;
3140
float WidthRequest;// Master width absolute value when !(Flags & _WidthStretch). When Stretch this is derived every frame from StretchWeight in TableUpdateLayout()
3141
float WidthAuto;// Automatic width
3142
float WidthMax;// Maximum width (FIXME: overwritten by each instance)
3143
float StretchWeight;// Master width weight when (Flags & _WidthStretch). Often around ~1.0f initially.
3144
float InitStretchWeightOrWidth;// Value passed to TableSetupColumn(). For Width it is a content width (_without padding_).
3145
ImRect ClipRect;// Clipping rectangle for the column
3146
ImGuiID ID;// Hash of column name (ignoring top of ID stack), used for .ini persistence when available.
3147
ImGuiID UserData;// (Optional) User data value passed to TableSetupColumn()
3148
float WorkMinX;// Contents region min ~(MinX + CellPaddingX + CellSpacingX1) == cursor start position when entering column
3149
float WorkMaxX;// Contents region max ~(MaxX - CellPaddingX - CellSpacingX2)
3150
float ItemWidth;// Current item width for the column, preserved across rows
3151
float ContentMaxXFrozen;// Contents maximum position for frozen rows (apart from headers), from which we can infer content width.
3152
float ContentMaxXUnfrozen;
3153
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
3154
float ContentMaxXHeadersIdeal;
3155
ImS16 NameOffset;// Offset into parent ColumnsNames[]
3156
ImGuiTableColumnIdx DisplayOrder;// Index within Table's IndexToDisplayOrder[] (column may be reordered by users)
3157
ImGuiTableColumnIdx IndexWithinEnabledSet;// Index within enabled/visible set (<= IndexToDisplayOrder)
3158
ImGuiTableColumnIdx PrevEnabledColumn;// Index of prev enabled/visible column within Columns[], -1 if first enabled/visible column
3159
ImGuiTableColumnIdx NextEnabledColumn;// Index of next enabled/visible column within Columns[], -1 if last enabled/visible column
3160
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
3161
ImGuiTableDrawChannelIdx DrawChannelCurrent;// Index within DrawSplitter.Channels[]
3162
ImGuiTableDrawChannelIdx DrawChannelFrozen;// Draw channels for frozen rows (often headers)
3163
ImGuiTableDrawChannelIdx DrawChannelUnfrozen;// Draw channels for unfrozen rows
ImGuiTableColumnIdx ColumnNewIdx;// Index in the current table.
3211
ImGuiTableColumnIdx ColumnOldIdx;// Index in the previous frame table.
3212
ImGuiTableColumn ColumnOldData;// Full backup of the column. Could be avoided by storing 1 of them and applying reconcile in the right order. Not worth bothering.
3213
};
3214
3215
// Transient cell data stored per row.
3216
// sizeof() ~ 6 bytes
3217
structImGuiTableCellData
3218
{
3219
ImU32 BgColor;// Actual color
3220
ImGuiTableColumnIdx Column;// Column number
3221
};
3222
3223
// Parameters for TableAngledHeadersRowEx()
3224
// This may end up being refactored for more general purpose.
3225
// sizeof() ~ 12 bytes
3226
structImGuiTableHeaderData
3227
{
3228
ImGuiTableColumnIdx Index;// Column index
3229
ImU32 TextColor;
3230
ImU32 BgColor0;
3231
ImU32 BgColor1;
3232
};
3233
3234
// 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?)
3235
// sizeof() ~ 24 bytes
3236
structImGuiTableInstanceData
3237
{
3238
ImGuiID TableInstanceID;
3239
float LastOuterHeight;// Outer height from last frame
3240
float LastTopHeadersRowHeight;// Height of first consecutive header rows from last frame (FIXME: this is used assuming consecutive headers are in same frozen set)
3241
float LastFrozenHeight;// Height of frozen section from last frame
3242
int HoveredRowLast;// Index of row which was hovered last frame.
3243
int HoveredRowNext;// Index of row hovered this frame, set after encountering it.
// sizeof() ~ 592 bytes + heap allocs described in TableBeginInitMemory()
3249
struct IMGUI_API ImGuiTable
3250
{
3251
ImGuiID ID;
3252
ImGuiTableFlags Flags;
3253
void* RawData;// Single allocation to hold Columns[], DisplayOrderToIndex[], and RowCellData[]
3254
ImGuiTableTempData* TempData;// Transient data while table is active. Point within g.CurrentTableStack[]
3255
ImSpan<ImGuiTableColumn> Columns;// Point within RawData[]
3256
ImSpan<ImGuiTableColumnIdx> DisplayOrderToIndex;// Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1)
3257
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
3260
ImBitArrayPtr VisibleMaskByIndex;// Column Index -> IsVisibleX|IsVisibleY map (== not hidden by user/api && not hidden by scrolling/cliprect)
3261
ImGuiTableFlags SettingsLoadedFlags;// Which data were loaded from the .ini file (e.g. when order is not altered we won't save order)
3262
int SettingsOffset;// Offset in g.SettingsTables
3263
int LastFrameActive;
3264
int ColumnsCount;// Number of columns declared in BeginTable()
3265
int CurrentRow;
3266
int CurrentColumn;
3267
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 tables with the same ID are multiple tables, they are just synced.
3268
ImS16 InstanceInteracted;// Mark which instance (generally 0) of the same ID is being interacted with
3269
float RowPosY1;
3270
float RowPosY2;
3271
float RowMinHeight;// Height submitted to TableNextRow()
3272
float RowCellPaddingY;// Top and bottom padding. Reloaded during row change.
3273
float RowTextBaseline;
3274
float RowIndentOffsetX;
3275
ImGuiTableRowFlags RowFlags :16;// Current row flags, see ImGuiTableRowFlags_
3276
ImGuiTableRowFlags LastRowFlags :16;
3277
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.
3278
ImU32 RowBgColor[2];// Background color override for current row.
3279
ImU32 BorderColorStrong;
3280
ImU32 BorderColorLight;
3281
float BorderX1;
3282
float BorderX2;
3283
float HostIndentX;
3284
float MinColumnWidth;
3285
float OuterPaddingX;
3286
float CellPaddingX;// Padding from each borders. Locked in BeginTable()/Layout.
3287
float CellSpacingX1;// Spacing between non-bordered cells. Locked in BeginTable()/Layout.
3288
float CellSpacingX2;
3289
float InnerWidth;// User value passed to BeginTable(), see comments at the top of BeginTable() for details.
3290
float ColumnsGivenWidth;// Sum of current column width
3291
float ColumnsAutoFitWidth;// Sum of ideal column width in order nothing to be clipped, used for auto-fitting and content width submission in outer window
3292
float ColumnsStretchSumWeights;// Sum of weight of all enabled stretching columns
3293
float ResizedColumnNextWidth;
3294
float ResizeLockMinContentsX2;// Lock minimum contents width while resizing down in order to not create feedback loops. But we allow growing the table.
3295
float RefScale;// Reference scale to be able to rescale columns on font/dpi changes.
3296
float AngledHeadersHeight;// Set by TableAngledHeadersRow(), used in TableUpdateLayout()
3297
float AngledHeadersSlope;// Set by TableAngledHeadersRow(), used in TableUpdateLayout()
3298
ImRect OuterRect;// Note: for non-scrolling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
3299
ImRect InnerRect;// InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is "
3300
ImRect WorkRect;
3301
ImRect InnerClipRect;
3302
ImRect BgClipRect;// We use this to cpu-clip cell background color fill, evolve during the frame as we cross frozen rows boundaries
3303
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
3304
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.
3305
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.
3306
ImRect HostBackupInnerClipRect;// Backup of InnerWindow->ClipRect during PushTableBackground()/PopTableBackground()
3307
ImGuiWindow* OuterWindow;// Parent window for the table
3308
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
3311
ImGuiTableInstanceData InstanceDataFirst;
3312
ImVector<ImGuiTableInstanceData> InstanceDataExtra;// FIXME-OPT: Using a small-vector pattern would be good.
3313
ImGuiTableColumnSortSpecs SortSpecsSingle;
3314
ImVector<ImGuiTableColumnSortSpecs> SortSpecsMulti;// FIXME-OPT: Using a small-vector pattern would be good.
3315
ImGuiTableSortSpecs SortSpecs;// Public facing sorts specs, this is what we return in TableGetSortSpecs()
3316
ImGuiTableColumnIdx SortSpecsCount;
3317
ImGuiTableColumnIdx ColumnsEnabledCount;// Number of enabled columns (<= ColumnsCount)
3318
ImGuiTableColumnIdx ColumnsEnabledFixedCount;// Number of enabled columns using fixed width (<= ColumnsCount)
3319
ImGuiTableColumnIdx DeclColumnsCount;// Count calls to TableSetupColumn()
3320
ImGuiTableColumnIdx AngledHeadersCount;// Count columns with angled headers
3321
ImGuiTableColumnIdx HoveredColumnBody;// Index of column whose visible region is being hovered. Important: == ColumnsCount when hovering empty region after the right-most column!
3322
ImGuiTableColumnIdx HoveredColumnBorder;// Index of column whose right-border is being hovered (for resizing).
3323
ImGuiTableColumnIdx HighlightColumnHeader;// Index of column which should be highlighted.
3324
ImGuiTableColumnIdx AutoFitSingleColumn;// Index of single column requesting auto-fit.
3325
ImGuiTableColumnIdx ResizedColumn;// Index of column being resized. Reset when InstanceCurrent==0.
3326
ImGuiTableColumnIdx LastResizedColumn;// Index of column being resized from previous frame.
3327
ImGuiTableColumnIdx HeldHeaderColumn;// Index of column header being held.
3328
ImGuiTableColumnIdx LastHeldHeaderColumn;// Index of column header being held from previous frame.
3329
ImGuiTableColumnIdx ReorderColumn;// Index of column being reordered. (not cleared)
3330
ImGuiTableColumnIdx ReorderColumnDstOrder;// Requested display order of column being reordered.
3331
ImGuiTableColumnIdx LeftMostEnabledColumn;// Index of left-most non-hidden column.
3332
ImGuiTableColumnIdx RightMostEnabledColumn;// Index of right-most non-hidden column.
3333
ImGuiTableColumnIdx LeftMostStretchedColumn;// Index of left-most stretched column.
3334
ImGuiTableColumnIdx RightMostStretchedColumn;// Index of right-most stretched column.
3335
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[]
3343
ImGuiTableDrawChannelIdx Bg2DrawChannelUnfrozen;
3344
ImS8 NavLayer;// ImGuiNavLayer at the time of BeginTable().
3345
bool IsLayoutLocked;// Set by TableUpdateLayout() which is called when beginning the first row.
3346
bool IsInsideRow;// Set when inside TableBeginRow()/TableEndRow().
3347
bool IsInitializing;
3348
bool IsReconcileMode;
3349
bool IsSortSpecsDirty;
3350
bool IsUsingHeaders;// Set when the first row had the ImGuiTableRowFlags_Headers flag.
3351
bool IsContextPopupOpen;// Set when default context menu is open (also see: ContextPopupColumn, InstanceInteracted).
3352
bool DisableDefaultContextMenu;// Disable default context menu. You may submit your own using TableBeginContextMenuPopup()/EndPopup()
3353
bool IsSettingsRequestLoad;
3354
bool IsSettingsDirty;// Set when table settings have changed and needs to be reported into ImGuiTableSettings data.
3355
bool IsDefaultDisplayOrder;// Set when display order is unchanged from default (DisplayOrder contains 0...Count-1)
3356
bool IsDefaultVisibility;// Set when enabled/visibility is unchanged from default
3357
bool IsResetAllRequest;// Set to queue a call to TableResetSettings() in BeginTable()
3358
bool IsResetDisplayOrderRequest;
3359
bool IsResetVisibilityRequest;
3360
bool IsUnfrozenRows;// Set when we got past the frozen row.
3361
bool IsDefaultSizingPolicy;// Set if user didn't explicitly set a sizing policy in BeginTable()
3362
bool IsActiveIdAliveBeforeTable;
3363
bool IsActiveIdInTable;
3364
bool HasScrollbarYCurr;// Whether ANY instance of this table had a vertical scrollbar during the current frame.
3365
bool HasScrollbarYPrev;// Whether ANY instance of this table had a vertical scrollbar during the previous.
3366
bool MemoryCompacted;
3367
bool HostSkipItems;// Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
bool IsLoaded :1;// Using during loading to mark finding a matching column.
3418
3419
ImGuiTableColumnSettings()
3420
{
3421
WidthOrWeight =0.0f;
3422
ID =0;
3423
Index =-1;
3424
DisplayOrder = SortOrder =-1;
3425
SortDirection = ImGuiSortDirection_None;
3426
IsEnabled =-1;
3427
IsStretch =0;
3428
IsLoaded =false;
3429
}
3430
};
3431
3432
// This is designed to be stored in a single ImChunkStream (1 header followed by N ImGuiTableColumnSettings, etc.)
3433
structImGuiTableSettings
3434
{
3435
ImGuiID ID;// Set to 0 to invalidate/delete the setting
3436
ImGuiTableFlags SaveFlags;// Indicate data we want to save using the Resizable/Reorderable/Sortable/Hideable flags (could be using its own flags..)
3437
float RefScale;// Reference scale to be able to rescale columns on font/dpi changes.
3438
ImGuiTableColumnIdx ColumnsCount;
3439
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
3440
bool WantApply;// Set when loaded from .ini data (to enable merging/loading .ini data into an already running context)
IMGUI_API intTableGetHoveredRow();// Retrieve *PREVIOUS FRAME* hovered row. This difference with TableGetHoveredColumn() is the reason why this is not public yet.
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().
inlinefloatGetScale(){ ImGuiContext& g =*GImGui;return g.Style._MainScale;}// FIXME-DPI: I don't want to formalize this just yet. Because reasons. Please don't use.
3542
inline ImGuiWindow*GetCurrentWindowRead(){ ImGuiContext& g =*GImGui;return g.CurrentWindow;}
3543
inline ImGuiWindow*GetCurrentWindow(){ ImGuiContext& g =*GImGui; g.CurrentWindow->WriteAccessed =true;return g.CurrentWindow;}
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.
3691
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
3752
// 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.
3753
IMGUI_API voidFocusItem();// Focus last item (no selection/activation).
3754
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. Was called 'ActivateItem()' before 1.89.7.
3755
3756
// Inputs
3757
// 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;}
3788
3789
// [EXPERIMENTAL] Low-Level: Key/Input Ownership
3790
// - The idea is that instead of "eating" a given input, we can link to an owner id.
3791
// - Ownership is most often claimed as a result of reacting to a press/down event (but occasionally may be claimed ahead).
3792
// - Input queries can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_NoOwner (== -1) or a custom ID.
3793
// - Legacy input queries (without specifying an owner or _Any or _None) are equivalent to using ImGuiKeyOwner_Any (== 0).
3794
// - Input ownership is automatically released on the frame after a key is released. Therefore:
3795
// - for ownership registration happening as a result of a down/press event, the SetKeyOwner() call may be done once (common case).
3796
// - 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).
3797
// - 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.
3798
// - This is marked experimental because not all widgets are fully honoring the Set/Test idioms. We will need to move forward step by step.
3799
// Please open a GitHub Issue to submit your usage scenario or if there's a use case you need solved.
// [EXPERIMENTAL] High-Level: Input Access functions w/ support for Key/Input Ownership
3808
// - Important: legacy IsKeyPressed(ImGuiKey, bool repeat=true) _DEFAULTS_ to repeat, new IsKeyPressed() requires _EXPLICIT_ ImGuiInputFlags_Repeat flag.
3809
// - Expected to be later promoted to public API, the prototypes are designed to replace existing ones (since owner_id can default to Any == 0)
3810
// - Specifying a value for 'ImGuiID owner' will test that EITHER the key is NOT owned (UNLESS locked), EITHER the key is owned by 'owner'.
3811
// Legacy functions use ImGuiKeyOwner_Any meaning that they typically ignore ownership, unless a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease.
3812
// - 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 requires explicit ImGuiInputFlags_Repeat.
// - Set Shortcut() and SetNextItemShortcut() in imgui.h
3824
// - When a policy (except for ImGuiInputFlags_RouteAlways *) is set, Shortcut() will register itself with SetShortcutRouting(),
3825
// allowing the system to decide where to route the input among other route-aware calls.
3826
// (* using ImGuiInputFlags_RouteAlways is roughly equivalent to calling IsKeyChordPressed(key) and bypassing route registration and check)
3827
// - When using one of the routing option:
3828
// - 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.)
3829
// - Routes are requested given a chord (key + modifiers) and a routing policy.
3830
// - Routes are resolved during NewFrame(): if keyboard modifiers are matching current ones: SetKeyOwner() is called + route is granted for the frame.
3831
// - 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).
3832
// - Multiple read sites may use the same owner id can all access the granted route.
3833
// - When owner_id is 0 we use the current Focus Scope ID as a owner ID in order to identify our location.
3834
// - You can chain two unrelated windows in the focus stack using SetWindowParentWindowForFocusRoute()
3835
// 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).
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)
3920
// (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!)
// 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.
3966
// NB: All position are in absolute pixels coordinates (we are never using window coordinates internally)
IMGUI_API voidTextAligned(float align_x,float size_x,constchar* fmt,...);// FIXME-WIP: Works but API is likely to be reworked. This is designed for 1 item on the line. (#7024)
IMGUI_API boolTreeNodeUpdateNextOpen(ImGuiID storage_id, ImGuiTreeNodeFlags flags);// Return open state. Consume previous SetNextItemOpen() data, if any. May return true when logging.
4031
4032
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
4033
// 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).
4034
// e.g. " extern template IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDataType data_type, float v); "
4035
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API floatScaleRatioFromValueT(ImGuiDataType data_type, T v, T v_min, T v_max,float logarithmic_zero_epsilon,float zero_deadzone_size);
4036
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API T ScaleValueFromRatioT(ImGuiDataType data_type,float t, T v_min, T v_max,float logarithmic_zero_epsilon,float zero_deadzone_size);
4037
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);
4038
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);
4039
template<typename T> IMGUI_API T RoundScalarWithFormatT(constchar* format, ImGuiDataType data_type, T v);
4040
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;}
4057
inline ImGuiInputTextState*GetInputTextState(ImGuiID id){ ImGuiContext& g =*GImGui;return(id !=0&& g.InputTextState.ID==id)?&g.InputTextState:NULL;}// Get input text state if active
inlineboolIsItemActiveAsInputText(){ ImGuiContext& g =*GImGui;return g.ActiveId!=0&& g.ActiveId== g.LastItemData.ID&& g.InputTextState.ID== g.LastItemData.ID;}// This may be useful to apply workaround that a based on distinguish whenever an item is active as a text input field.
IMGUI_API voidDebugNodeTexture(ImTextureData* tex,int int_id,const ImFontAtlasRect* highlight_rect =NULL);// ID used to facilitate persisting the "current" texture.
typedef ImFontLoader ImFontBuilderIO;// [renamed/changed in 1.92.0] The types are not actually compatible but we provide this as a compile-time error report helper.
// Packed rectangle lookup entry (we need an indirection to allow removing/reordering rectangles)
4203
// User are returned ImFontAtlasRectId values which are meant to be persistent.
4204
// We handle this with an indirection. While Rects[] may be in theory shuffled, compacted etc., RectsIndex[] cannot it is keyed by ImFontAtlasRectId.
4205
// RectsIndex[] is used both as an index into Rects[] and an index into itself. This is basically a free-list. See ImFontAtlasBuildAllocRectIndexEntry() code.
4206
// Having this also makes it easier to e.g. sort rectangles during repack.
4207
structImFontAtlasRectEntry
4208
{
4209
int TargetIndex :20;// When Used: ImFontAtlasRectId -> into Rects[]. When unused: index to next unused RectsIndex[] slot to consume free-list.
4210
unsignedint Generation :10;// Increased each time the entry is reused for a new rectangle.
4211
unsignedint IsUsed :1;
4212
};
4213
4214
// Data available to potential texture post-processing functions
4215
structImFontAtlasPostProcessData
4216
{
4217
ImFontAtlas* FontAtlas;
4218
ImFont* Font;
4219
ImFontConfig* FontSrc;
4220
ImFontBaked* FontBaked;
4221
ImFontGlyph* Glyph;
4222
4223
// Pixel data
4224
void* Pixels;
4225
ImTextureFormat Format;
4226
int Pitch;
4227
int Width;
4228
int Height;
4229
};
4230
4231
// We avoid dragging imstb_rectpack.h into public header (partly because binding generators are having issues with it)
IMGUI_API boolImFontAtlasFontInitOutput(ImFontAtlas*atlas, ImFont*font);// Using FontDestroyOutput/FontInitOutput sequence useful notably if font loader params have changed