// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
// Set:
// #define IMGUI_DEFINE_MATH_OPERATORS
// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)
#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)
#endif
// Clang/GCC warnings with -Weverything
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function" // for stb_textedit.h
#pragma clang diagnostic ignored "-Wmissing-prototypes" // for stb_textedit.h
#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
#endif
// Legacy defines
#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Renamed in 1.74
#error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
#endif
#ifdef IMGUI_DISABLE_MATH_FUNCTIONS // Renamed in 1.74
// Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall
staticinlineImU32ImHash(constvoid*data,intsize,ImU32seed=0){returnsize?ImHashData(data,(size_t)size,seed):ImHashStr((constchar*)data,0,seed);}// [moved to ImHashStr/ImHashData in 1.68]
IMGUI_APIintImTextCountCharsFromUtf8(constchar*in_text,constchar*in_text_end);// return number of UTF-8 code-points (NOT bytes count)
IMGUI_APIintImTextCountUtf8BytesFromChar(constchar*in_text,constchar*in_text_end);// return number of bytes to express one char in UTF-8
IMGUI_APIintImTextCountUtf8BytesFromStr(constImWchar*in_text,constImWchar*in_text_end);// return number of bytes to express string in UTF-8
// Helpers: ImVec2/ImVec4 operators
// We are keeping those disabled by default so they don't leak in user space, to allow user enabling implicit cast operators between ImVec2 and their own types (using IM_VEC2_CLASS_EXTRA etc.)
// We unfortunately don't have a unary- operator for ImVec2 because this would needs to be defined inside the class itself.
// - Wrapper for standard libs functions. (Note that imgui_demo.cpp does _not_ use them to keep the code easy to copy)
#ifndef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS
#define ImFabs(X) fabsf(X)
#define ImSqrt(X) sqrtf(X)
#define ImFmod(X, Y) fmodf((X), (Y))
#define ImCos(X) cosf(X)
#define ImSin(X) sinf(X)
#define ImAcos(X) acosf(X)
#define ImAtan2(Y, X) atan2f((Y), (X))
#define ImAtof(STR) atof(STR)
#define ImFloorStd(X) floorf(X) // We already uses our own ImFloor() { return (float)(int)v } internally so the standard one wrapper is named differently (it's used by e.g. stb_truetype)
#define ImCeil(X) ceilf(X)
staticinlinefloatImPow(floatx,floaty){returnpowf(x,y);}// DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision
IMGUI_APIImVec2ImBezierClosestPoint(constImVec2&p1,constImVec2&p2,constImVec2&p3,constImVec2&p4,constImVec2&p,intnum_segments);// For curves with explicit number of segments
IMGUI_APIImVec2ImBezierClosestPointCasteljau(constImVec2&p1,constImVec2&p2,constImVec2&p3,constImVec2&p4,constImVec2&p,floattess_tol);// For auto-tessellated curves you can use tess_tol = style.CurveTessellationTol
ImGuiButtonFlags_PressedOnClick=1<<1,// return true on click (mouse down event)
ImGuiButtonFlags_PressedOnClickRelease=1<<2,// [Default] return true on click + release on same item <-- this is what the majority of Button are using
ImGuiButtonFlags_PressedOnClickReleaseAnywhere=1<<3,// return true on click + release even if the release event is not done while hovering the item
ImGuiButtonFlags_PressedOnRelease=1<<4,// return true on release (default requires click+release)
ImGuiButtonFlags_PressedOnDoubleClick=1<<5,// return true on double-click (default requires click+release)
ImGuiButtonFlags_PressedOnDragDropHold=1<<6,// return true when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
ImGuiButtonFlags_FlattenChildren=1<<7,// allow interactions even if a child window is overlapping
ImGuiButtonFlags_AllowItemOverlap=1<<8,// require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap()
ImGuiButtonFlags_DontClosePopups=1<<9,// disable automatically closing parent popup on press // [UNUSED]
ImGuiButtonFlags_AlignTextBaseLine=1<<11,// vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
ImGuiButtonFlags_NoKeyModifiers=1<<12,// disable mouse interaction if a key modifier is held
ImGuiButtonFlags_NoHoldingActiveId=1<<13,// don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
ImGuiButtonFlags_NoNavFocus=1<<14,// don't override navigation focus when activated
ImGuiColumnsFlags_NoResize=1<<1,// Disable resizing columns when clicking on the dividers
ImGuiColumnsFlags_NoPreserveWidths=1<<2,// Disable column width preservation when adjusting columns
ImGuiColumnsFlags_NoForceWithinWindow=1<<3,// Disable forcing columns to fit within window
ImGuiColumnsFlags_GrowParentContentsSize=1<<4// (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.
};
// Extend ImGuiSelectableFlags_
enumImGuiSelectableFlagsPrivate_
{
// NB: need to be in sync with last value of ImGuiSelectableFlags_
ImGuiSelectableFlags_SelectOnClick=1<<21,// Override button behavior to react on Click (default is Click+Release)
ImGuiSelectableFlags_SelectOnRelease=1<<22,// Override button behavior to react on Release (default is Click+Release)
ImGuiSelectableFlags_SpanAvailWidth=1<<23,// 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)
ImGuiSelectableFlags_DrawHoveredWhenHeld=1<<24,// Always show active when held, even is not hovered. This concept could probably be renamed/formalized somehow.
ImGuiSeparatorFlags_Horizontal=1<<0,// Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar
ImGuiSeparatorFlags_Vertical=1<<1,
ImGuiSeparatorFlags_SpanAllColumns=1<<2
};
// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().
// This is going to be exposed in imgui.h when stabilized enough.
enumImGuiItemFlags_
{
ImGuiItemFlags_None=0,
ImGuiItemFlags_NoTabStop=1<<0,// false
ImGuiItemFlags_ButtonRepeat=1<<1,// false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
ImGuiItemFlags_Disabled=1<<2,// false // [BETA] Disable interactions but doesn't affect visuals yet. See github.com/ocornut/imgui/issues/211
ImGuiItemFlags_NoNav=1<<3,// false
ImGuiItemFlags_NoNavDefaultFocus=1<<4,// false
ImGuiItemFlags_SelectableDontClosePopup=1<<5,// false // MenuItem/Selectable() automatically closes current Popup window
ImGuiItemFlags_MixedValue=1<<6,// 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)
ImGuiItemFlags_Default_=0
};
// Storage for LastItem data
enumImGuiItemStatusFlags_
{
ImGuiItemStatusFlags_None=0,
ImGuiItemStatusFlags_HoveredRect=1<<0,
ImGuiItemStatusFlags_HasDisplayRect=1<<1,
ImGuiItemStatusFlags_Edited=1<<2,// Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
ImGuiItemStatusFlags_ToggledSelection=1<<3,// Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected" because reporting the change allows us to handle clipping with less issues.
ImGuiItemStatusFlags_ToggledOpen=1<<4,// Set when TreeNode() reports toggling their open state.
ImGuiItemStatusFlags_HasDeactivated=1<<5,// Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
ImGuiItemStatusFlags_Deactivated=1<<6// Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
#ifdef IMGUI_ENABLE_TEST_ENGINE
,// [imgui_tests only]
ImGuiItemStatusFlags_Openable=1<<10,//
ImGuiItemStatusFlags_Opened=1<<11,//
ImGuiItemStatusFlags_Checkable=1<<12,//
ImGuiItemStatusFlags_Checked=1<<13//
#endif
};
enumImGuiTextFlags_
{
ImGuiTextFlags_None=0,
ImGuiTextFlags_NoWidthForLargeClippedText=1<<0
};
enumImGuiTooltipFlags_
{
ImGuiTooltipFlags_None=0,
ImGuiTooltipFlags_OverridePreviousTooltip=1<<0// Override will clear/ignore previously submitted tooltip (defaults to append)
};
// FIXME: this is in development, not exposed/functional as a generic feature yet.
// Horizontal/Vertical enums are fixed to 0/1 so they may be used to index ImVec2
enumImGuiLayoutType_
{
ImGuiLayoutType_Horizontal=0,
ImGuiLayoutType_Vertical=1
};
enumImGuiLogType
{
ImGuiLogType_None=0,
ImGuiLogType_TTY,
ImGuiLogType_File,
ImGuiLogType_Buffer,
ImGuiLogType_Clipboard
};
// X/Y enums are fixed to 0/1 so they may be used to index ImVec2
enumImGuiAxis
{
ImGuiAxis_None=-1,
ImGuiAxis_X=0,
ImGuiAxis_Y=1
};
enumImGuiPlotType
{
ImGuiPlotType_Lines,
ImGuiPlotType_Histogram
};
enumImGuiInputSource
{
ImGuiInputSource_None=0,
ImGuiInputSource_Mouse,
ImGuiInputSource_Nav,
ImGuiInputSource_NavKeyboard,// Only used occasionally for storage, not tested/handled by most code
ImGuiInputSource_NavGamepad,// "
ImGuiInputSource_COUNT
};
// FIXME-NAV: Clarify/expose various repeat delay/rate
enumImGuiInputReadMode
{
ImGuiInputReadMode_Down,
ImGuiInputReadMode_Pressed,
ImGuiInputReadMode_Released,
ImGuiInputReadMode_Repeat,
ImGuiInputReadMode_RepeatSlow,
ImGuiInputReadMode_RepeatFast
};
enumImGuiNavHighlightFlags_
{
ImGuiNavHighlightFlags_None=0,
ImGuiNavHighlightFlags_TypeDefault=1<<0,
ImGuiNavHighlightFlags_TypeThin=1<<1,
ImGuiNavHighlightFlags_AlwaysDraw=1<<2,// Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse.
ImGuiNavHighlightFlags_NoRounding=1<<3
};
enumImGuiNavDirSourceFlags_
{
ImGuiNavDirSourceFlags_None=0,
ImGuiNavDirSourceFlags_Keyboard=1<<0,
ImGuiNavDirSourceFlags_PadDPad=1<<1,
ImGuiNavDirSourceFlags_PadLStick=1<<2
};
enumImGuiNavMoveFlags_
{
ImGuiNavMoveFlags_None=0,
ImGuiNavMoveFlags_LoopX=1<<0,// On failed request, restart from opposite side
ImGuiNavMoveFlags_LoopY=1<<1,
ImGuiNavMoveFlags_WrapX=1<<2,// On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)
ImGuiNavMoveFlags_WrapY=1<<3,// This is not super useful for 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)
ImGuiNavMoveFlags_AlsoScoreVisibleSet=1<<5,// Store alternate result in NavMoveResultLocalVisibleSet that only comprise elements that are already fully visible.
ImGuiNavMoveFlags_ScrollToEdge=1<<6
};
enumImGuiNavForward
{
ImGuiNavForward_None,
ImGuiNavForward_ForwardQueued,
ImGuiNavForward_ForwardActive
};
enumImGuiNavLayer
{
ImGuiNavLayer_Main=0,// Main scrolling layer
ImGuiNavLayer_Menu=1,// Menu layer (access with Alt/ImGuiNavInput_Menu)
ImGuiNavLayer_COUNT
};
enumImGuiPopupPositionPolicy
{
ImGuiPopupPositionPolicy_Default,
ImGuiPopupPositionPolicy_ComboBox
};
// 1D vector (this odd construct is used to facilitate the transition between 1D and 2D, and the maintenance of some branches/patches)
voidClipWith(constImRect&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.
voidClipWithFull(constImRect&r){Min=ImClamp(Min,r.Min,r.Max);Max=ImClamp(Max,r.Min,r.Max);}// Full version, ensure both points are fully clipped.
constchar*TypeName;// Short description stored in .ini file. Disallowed characters: '[' ']'
ImGuiIDTypeHash;// == ImHashStr(TypeName)
void*(*ReadOpenFn)(ImGuiContext*ctx,ImGuiSettingsHandler*handler,constchar*name);// Read: Called when entering into a new ini entry e.g. "[Window][Name]"
void(*ReadLineFn)(ImGuiContext*ctx,ImGuiSettingsHandler*handler,void*entry,constchar*line);// Read: Called for every line of text within an ini entry
void(*WriteAllFn)(ImGuiContext*ctx,ImGuiSettingsHandler*handler,ImGuiTextBuffer*out_buf);// Write: Output every entries into 'out_buf'
ImGuiWindow*Window;// Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
ImGuiWindow*SourceWindow;// Set on OpenPopup() copy of NavWindow at the time of opening the popup
intOpenFrameCount;// Set on OpenPopup()
ImGuiIDOpenParentId;// Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)
ImVec2OpenPopupPos;// Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse)
ImVec2OpenMousePos;// Set on OpenPopup(), copy of mouse position at the time of opening popup
// You may want to create your own instance of this if you want to use ImDrawList completely without ImGui. In that case, watch out for future changes to this structure.
structIMGUI_APIImDrawListSharedData
{
ImVec2TexUvWhitePixel;// UV of white pixel in the atlas
ImFont*Font;// Current/default font (optional, for simplified AddText overload)
floatFontSize;// Current/default font size (optional, for simplified AddText overload)
floatCurveTessellationTol;// Tessellation tolerance when using PathBezierCurveTo()
floatCircleSegmentMaxError;// Number of circle segments to use per pixel of radius for AddCircle() etc
ImVec4ClipRectFullscreen;// Value for PushClipRectFullscreen()
ImDrawListFlagsInitialFlags;// Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards)
ImU8CircleSegmentCounts[64];// Precomputed segment count for given radius (array index + 1) before we calculate it dynamically (to avoid calculation overhead)
ImDrawListSharedData();
voidSetCircleSegmentMaxError(floatmax_error);
};
structImDrawDataBuilder
{
ImVector<ImDrawList*>Layers[2];// Global layers for: regular, tooltip
ImGuiIDFocusScopeId;// Set by SetNextItemMultiSelectData() (!= 0 signify value has been set, so it's an alternate version of HasSelectionData, we don't use Flags for this because they are cleared too early. This is mostly used for debugging)
floatFontSize;// (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.
floatFontBaseSize;// (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.
ImDrawListSharedDataDrawListSharedData;
doubleTime;
intFrameCount;
intFrameCountEnded;
intFrameCountRendered;
boolWithinFrameScope;// Set by NewFrame(), cleared by EndFrame()
boolWithinFrameScopeWithImplicitWindow;// Set by NewFrame(), cleared by EndFrame() when the implicit debug window has been pushed
boolWithinEndChild;// Set within EndChild()
// Windows state
ImVector<ImGuiWindow*>Windows;// Windows, sorted in display order, back to front
ImVector<ImGuiWindow*>WindowsFocusOrder;// Windows, sorted in focus order, back to front. (FIXME: We could only store root windows here! Need to sort out the Docking equivalent which is RootWindowDockStop and is unfortunately a little more dynamic)
ImVector<ImGuiWindow*>WindowsTempSortBuffer;// Temporary buffer used in EndFrame() to reorder windows so parents are kept before their child
ImVector<ImGuiWindow*>CurrentWindowStack;
ImGuiStorageWindowsById;// Map window's ImGuiID to ImGuiWindow*
intWindowsActiveCount;// Number of unique windows submitted by frame
ImGuiWindow*CurrentWindow;// Window being drawn into
ImGuiWindow*HoveredWindow;// Will catch mouse inputs
ImGuiWindow*HoveredRootWindow;// Will catch mouse inputs (for focus/move only)
ImGuiWindow*MovingWindow;// Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
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.
ImVec2WheelingWindowRefMousePos;
floatWheelingWindowTimer;
// Item/widgets state and tracking information
ImGuiIDHoveredId;// Hovered widget
boolHoveredIdAllowOverlap;
ImGuiIDHoveredIdPreviousFrame;
floatHoveredIdTimer;// Measure contiguous hovering time
floatHoveredIdNotActiveTimer;// Measure contiguous hovering time where the item has not been active
ImGuiIDActiveId;// Active widget
ImGuiIDActiveIdIsAlive;// Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
floatActiveIdTimer;
boolActiveIdIsJustActivated;// Set at the time of activation for one frame
boolActiveIdAllowOverlap;// Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
boolActiveIdHasBeenPressedBefore;// 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.
boolActiveIdHasBeenEditedBefore;// Was the value associated to the widget Edited over the course of the Active state.
ImU32ActiveIdUsingNavInputMask;// Active widget will want to read those nav inputs.
ImU64ActiveIdUsingKeyInputMask;// Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
ImVec2ActiveIdClickOffset;// Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
ImGuiWindow*ActiveIdWindow;
ImGuiInputSourceActiveIdSource;// Activating with mouse or nav (gamepad/keyboard)
intActiveIdMouseButton;
ImGuiIDActiveIdPreviousFrame;
boolActiveIdPreviousFrameIsAlive;
boolActiveIdPreviousFrameHasBeenEditedBefore;
ImGuiWindow*ActiveIdPreviousFrameWindow;
ImGuiIDLastActiveId;// Store the last non-zero ActiveId, useful for animation.
floatLastActiveIdTimer;// Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
// Next window/item data
ImGuiNextWindowDataNextWindowData;// Storage for SetNextWindow** functions
ImGuiNextItemDataNextItemData;// Storage for SetNextItem** functions
// Shared stacks
ImVector<ImGuiColorMod>ColorModifiers;// Stack for PushStyleColor()/PopStyleColor()
ImVector<ImGuiStyleMod>StyleModifiers;// Stack for PushStyleVar()/PopStyleVar()
ImVector<ImFont*>FontStack;// Stack for PushFont()/PopFont()
ImVector<ImGuiPopupData>OpenPopupStack;// Which popups are open (persistent)
ImVector<ImGuiPopupData>BeginPopupStack;// Which level of BeginPopup() we are in (reset every frame)
// Gamepad/keyboard Navigation
ImGuiWindow*NavWindow;// Focused window for navigation. Could be called 'FocusWindow'
ImGuiIDNavId;// Focused item for navigation
ImGuiIDNavFocusScopeId;
ImGuiIDNavActivateId;// ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
ImGuiNavLayerNavLayer;// Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
intNavIdTabCounter;// == NavWindow->DC.FocusIdxTabCounter at time of NavId processing
boolNavIdIsAlive;// Nav widget has been seen this frame ~~ NavRefRectRel is valid
boolNavMousePosDirty;// When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)
boolNavDisableHighlight;// When user starts using mouse, we hide gamepad/keyboard highlight (NB: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)
boolNavDisableMouseHover;// When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.
ImGuiDirNavMoveDir,NavMoveDirLast;// Direction of the move request (left/right/up/down), direction of the previous move request
ImGuiDirNavMoveClipDir;// FIXME-NAV: Describe the purpose of this better. Might want to rename?
ImGuiNavMoveResultNavMoveResultLocal;// Best move request candidate within NavWindow
ImGuiNavMoveResultNavMoveResultLocalVisibleSet;// Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
ImGuiNavMoveResultNavMoveResultOther;// Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
// Navigation: Windowing (CTRL+TAB, holding Menu button + directional pads to move/resize)
ImGuiWindow*NavWindowingTarget;// When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) this window is temporarily displayed top-most.
ImGuiWindow*NavWindowingTargetAnim;// Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f
ImGuiWindow*NavWindowingList;
floatNavWindowingTimer;
floatNavWindowingHighlightAlpha;
boolNavWindowingToggleLayer;
// Legacy Focus/Tabbing system (older than Nav, active even if Nav is disabled, misnamed. FIXME-NAV: This needs a redesign!)
ImGuiWindow*FocusRequestCurrWindow;//
ImGuiWindow*FocusRequestNextWindow;//
intFocusRequestCurrCounterRegular;// Any item being requested for focus, stored as an index (we on layout to be stable between the frame pressing TAB and the next frame, semi-ouch)
intFocusRequestCurrCounterTabStop;// Tab item being requested for focus, stored as an index
intFocusRequestNextCounterRegular;// Stored for next frame
intFocusRequestNextCounterTabStop;// "
boolFocusTabPressed;//
// Render
ImDrawDataDrawData;// Main ImDrawData instance to pass render information to the user
ImDrawDataBuilderDrawDataBuilder;
floatDimBgRatio;// 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
ImDrawListBackgroundDrawList;// First draw list to be rendered.
ImDrawListForegroundDrawList;// Last draw list to be rendered. This is where we the render software mouse cursor (if io.MouseDrawCursor is set) and most debug overlays.
// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.
// FIXME: That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered.
structIMGUI_APIImGuiWindowTempData
{
// Layout
ImVec2CursorPos;// Current emitting position, in absolute coordinates.
ImVec2CursorPosPrevLine;
ImVec2CursorStartPos;// Initial position after Begin(), generally ~ window position + WindowPadding.
ImVec2CursorMaxPos;// Used to implicitly calculate the size of our contents, always growing during the frame. Used to calculate window->ContentSize at the beginning of next frame
ImVec2CurrLineSize;
ImVec2PrevLineSize;
floatCurrLineTextBaseOffset;// Baseline offset (0.0f by default on a new line, generally == style.FramePadding.y when a framed item has been added).
floatPrevLineTextBaseOffset;
ImVec1Indent;// Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
ImVec1ColumnsOffset;// 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.
ImVec1GroupOffset;
// Last item status
ImGuiIDLastItemId;// ID for last item
ImGuiItemStatusFlagsLastItemStatusFlags;// Status flags for last item (see ImGuiItemStatusFlags_)
ImRectLastItemRect;// Interaction rect for last item
ImRectLastItemDisplayRect;// End-user display rect for last item (only valid if LastItemStatusFlags & ImGuiItemStatusFlags_HasDisplayRect)
// Keyboard/Gamepad navigation
ImGuiNavLayerNavLayerCurrent;// Current layer, 0..31 (we currently only use 0..1)
intNavLayerCurrentMask;// = (1 << NavLayerCurrent) used by ItemAdd prior to clipping.
intNavLayerActiveMask;// Which layer have been written to (result from previous frame)
intNavLayerActiveMaskNext;// Which layer have been written to (buffer for current frame)
ImGuiIDNavFocusScopeIdCurrent;// Current focus scope ID while appending
boolNavHideHighlightOneFrame;
boolNavHasScroll;// Set when scrolling can be used (ScrollMax > 0.0f)
// Miscellaneous
boolMenuBarAppending;// FIXME: Remove this
ImVec2MenuBarOffset;// 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.
ImGuiMenuColumnsMenuColumns;// Simplified columns storage for menu items measurement
intTreeDepth;// Current tree depth.
ImU32TreeJumpToParentOnPopMask;// Store a copy of !g.NavIdIsAlive for TreeDepth 0..31.. Could be turned into a ImU64 if necessary.
ImVector<ImGuiWindow*>ChildWindows;
ImGuiStorage*StateStorage;// Current persistent per-window storage (store e.g. tree node open/close state)
ImGuiColumns*CurrentColumns;// Current columns set
ImGuiLayoutTypeLayoutType;
ImGuiLayoutTypeParentLayoutType;// Layout type of parent window at the time of Begin()
intFocusCounterRegular;// (Legacy Focus/Tabbing system) Sequential counter, start at -1 and increase as assigned via FocusableItemRegister() (FIXME-NAV: Needs redesign)
intFocusCounterTabStop;// (Legacy Focus/Tabbing system) Same, but only count widgets which you can Tab through.
// Local parameters stacks
// 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.
ImGuiWindowFlagsFlags;// See enum ImGuiWindowFlags_
ImVec2Pos;// Position (always rounded-up to nearest pixel)
ImVec2Size;// Current size (==SizeFull or collapsed title bar size)
ImVec2SizeFull;// Size when non collapsed
ImVec2ContentSize;// 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.
ImVec2ContentSizeExplicit;// Size of contents/scrollable client area explicitly request by the user via SetNextWindowContentSize().
ImVec2WindowPadding;// Window padding at the time of Begin().
floatWindowRounding;// Window rounding at the time of Begin().
floatWindowBorderSize;// Window border size at the time of Begin().
intNameBufLen;// Size of buffer storing Name. May be larger than strlen(Name)!
ImGuiIDMoveId;// == window->GetID("#MOVE")
ImGuiIDChildId;// ID of corresponding item in parent window (for navigation to return from child window to parent window)
ImVec2Scroll;
ImVec2ScrollMax;
ImVec2ScrollTarget;// target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
ImVec2ScrollTargetCenterRatio;// 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
ImVec2ScrollbarSizes;// 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.
boolScrollbarX,ScrollbarY;// Are scrollbars visible?
boolActive;// Set to true on Begin(), unless Collapsed
boolWasActive;
boolWriteAccessed;// Set to true when any widget access the current window
boolCollapsed;// Set when collapsing window to become only title-bar
boolWantCollapseToggle;
boolSkipItems;// Set when items can safely be all clipped (e.g. window not visible or collapsed)
boolAppearing;// Set during the frame where the window is appearing (or re-appearing)
boolHidden;// Do not display (== (HiddenFrames*** > 0))
boolIsFallbackWindow;// Set on the "Debug##Default" window.
boolHasCloseButton;// Set when the window has a close button (p_open != NULL)
signedcharResizeBorderHeld;// Current border being held for resize (-1: none, otherwise 0-3)
shortBeginCount;// Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
shortBeginOrderWithinParent;// Order within immediate parent window, if we are a child window. Otherwise 0.
shortBeginOrderWithinContext;// Order within entire imgui context. This is mostly used for debugging submission order related issues.
ImGuiIDPopupId;// ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)
ImS8AutoFitFramesX,AutoFitFramesY;
ImS8AutoFitChildAxises;
boolAutoFitOnlyGrows;
ImGuiDirAutoPosLastDirection;
intHiddenFramesCanSkipItems;// Hide the window for N frames
intHiddenFramesCannotSkipItems;// Hide the window for N frames while allowing items to be submitted so we can measure their size
ImGuiCondSetWindowPosAllowFlags;// store acceptable condition flags for SetNextWindowPos() use.
ImGuiCondSetWindowSizeAllowFlags;// store acceptable condition flags for SetNextWindowSize() use.
ImGuiCondSetWindowCollapsedAllowFlags;// store acceptable condition flags for SetNextWindowCollapsed() use.
ImVec2SetWindowPosVal;// store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
ImVec2SetWindowPosPivot;// 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.
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)
ImGuiWindowTempDataDC;// Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
// The best way to understand what those rectangles are is to use the 'Metrics -> Tools -> Show windows rectangles' viewer.
// The main 'OuterRect', omitted as a field, is window->Rect().
ImRectOuterRectClipped;// == Window->Rect() just after setup in Begin(). == window->Rect() for root window.
ImRectInnerRect;// Inner rectangle (omit title bar, menu bar, scroll bar)
ImRectInnerClipRect;// == InnerRect shrunk by WindowPadding*0.5f on each side, clipped within viewport or parent clip rect.
ImRectWorkRect;// Cover the whole scrolling region, shrunk by WindowPadding*1.0f on each side. This is meant to replace ContentRegionRect over time (from 1.71+ onward).
ImRectClipRect;// Current clipping/scissoring rectangle, evolve as we are using PushClipRect(), etc. == DrawList->clip_rect_stack.back().
ImRectContentRegionRect;// 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.
intLastFrameActive;// Last frame number the window was Active.
floatLastTimeActive;// Last timestamp the window was Active (using float as we don't need high precision there)
floatItemWidthDefault;
ImGuiStorageStateStorage;
ImVector<ImGuiColumns>ColumnsStorage;
floatFontWindowScale;// User scale multiplier per-window, via SetWindowFontScale()
intSettingsOffset;// Offset into SettingsWindows[] (offsets are always valid as we only grow the array from the back)
ImDrawList*DrawList;// == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
ImDrawListDrawListInst;
ImGuiWindow*ParentWindow;// If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
ImGuiWindow*RootWindow;// Point to ourself or first ancestor that is not a child window.
ImGuiWindow*RootWindowForTitleBarHighlight;// Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
ImGuiWindow*RootWindowForNav;// Point to ourself or first ancestor which doesn't have the NavFlattened flag.
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.)
ImGuiIDNavLastIds[ImGuiNavLayer_COUNT];// Last known NavId for this window, per layer (0/1)
ImRectNavRectRel[ImGuiNavLayer_COUNT];// Reference rectangle, in window relative space
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]
ImGuiTabBarFlags_IsFocused=1<<21,
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
};
// Extend ImGuiTabItemFlags_
enumImGuiTabItemFlagsPrivate_
{
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)
};
// Storage for one active tab item (sizeof() 26~32 bytes)
structImGuiTabItem
{
ImGuiIDID;
ImGuiTabItemFlagsFlags;
intLastFrameVisible;
intLastFrameSelected;// This allows us to infer an ordered list of the last activated tabs with little maintenance
intNameOffset;// When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames
floatOffset;// Position relative to beginning of tab
floatWidth;// Width currently displayed
floatContentWidth;// Width of actual contents, stored during BeginTabItem() call
inlineImDrawList*GetForegroundDrawList(ImGuiWindow*window){IM_UNUSED(window);ImGuiContext&g=*GImGui;return&g.ForegroundDrawList;}// This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'docking' branches.
// Init
IMGUI_APIvoidInitialize(ImGuiContext*context);
IMGUI_APIvoidShutdown(ImGuiContext*context);// Since 1.60 this is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext().
IMGUI_APIboolIsItemToggledSelection();// Was the last item selection toggled? (after Selectable(), TreeNode() etc. We only returns toggle _event_ in order to handle clipping correctly)
IMGUI_APIvoidLogBegin(ImGuiLogTypetype,intauto_open_depth);// -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.
IMGUI_APIvoidLogToBuffer(intauto_open_depth=-1);// Start logging/capturing to internal buffer
IMGUI_APIboolIsPopupOpen(ImGuiIDid);// Test for id within current popup stack level (currently begin-ed into); this doesn't scan the whole popup stack!
IMGUI_APIvoidActivateItem(ImGuiIDid);// Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again.
// Internal Columns API (this is not exposed because we will encourage transitioning to the Tables api)
IMGUI_APIvoidBeginColumns(constchar*str_id,intcount,ImGuiColumnsFlagsflags=0);// setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().
// 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.
// NB: All position are in absolute pixels coordinates (we are never using window coordinates internally)
IMGUI_APIboolTreeNodeBehaviorIsOpen(ImGuiIDid,ImGuiTreeNodeFlagsflags=0);// Consume previous SetNextItemOpen() data, if any. May return true when logging
IMGUI_APIvoidTreePushOverrideID(ImGuiIDid);
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
// 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).
// e.g. " extern template IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDataType data_type, float v); "
inlineImGuiInputTextState*GetInputTextState(ImGuiIDid){ImGuiContext&g=*GImGui;return(g.InputTextState.ID==id)?&g.InputTextState:NULL;}// Get input text state if active