// 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
#ifdef __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
structImRect;// An axis-aligned rectangle (2 points)
structImDrawDataBuilder;// Helper to build a ImDrawData instance
structImDrawListSharedData;// Data shared between all ImDrawList instances
structImGuiColMod;// Stacked color modifier, backup of modified data so we can restore it
structImGuiColumnData;// Storage data for a single column
structImGuiColumnsSet;// Storage data for a columns set
structImGuiContext;// Main imgui context
structImGuiGroupData;// Stacked storage data for BeginGroup()/EndGroup()
structImGuiItemHoveredDataBackup;// Backup and restore IsItemHovered() internal data
structImGuiMenuColumns;// Simple column measurement, currently used for MenuItem() only
structImGuiNavMoveResult;// Result of a directional navigation move query result
structImGuiNextWindowData;// Storage for SetNexWindow** functions
structImGuiPopupRef;// Storage for current popup stack
structImGuiSettingsHandler;
structImGuiStyleMod;// Stacked style modifier, backup of modified data so we can restore it
structImGuiTextEditState;// Internal state of the currently focused/edited text input box
structImGuiWindow;// Storage for one window
structImGuiWindowTempData;// Temporary storage for one, that's the data which in theory we could ditch at the end of the frame
structImGuiWindowSettings;// Storage for window settings stored in .ini file (we keep one of those even if the actual window wasn't instanced during this session)
typedefintImGuiLayoutType;// enum: horizontal or vertical // enum ImGuiLayoutType_
typedefintImGuiButtonFlags;// flags: for ButtonEx(), ButtonBehavior() // enum ImGuiButtonFlags_
typedefintImGuiItemFlags;// flags: for PushItemFlag() // enum ImGuiItemFlags_
typedefintImGuiItemStatusFlags;// flags: storage for DC.LastItemXXX // enum ImGuiItemStatusFlags_
typedefintImGuiNavHighlightFlags;// flags: for RenderNavHighlight() // enum ImGuiNavHighlightFlags_
typedefintImGuiNavDirSourceFlags;// flags: for GetNavInputAmount2d() // enum ImGuiNavDirSourceFlags_
typedefintImGuiNavMoveFlags;// flags: for navigation requests // enum ImGuiNavMoveFlags_
typedefintImGuiSeparatorFlags;// flags: for Separator() - internal // enum ImGuiSeparatorFlags_
typedefintImGuiSliderFlags;// flags: for SliderBehavior() // enum ImGuiSliderFlags_
#define IM_NEWLINE "\r\n" // Play it nice with Windows users (2018/05 news: Microsoft announced that Notepad will finally display Unix-style carriage returns!)
IMGUI_APIintImTextCountCharsFromUtf8(constchar*in_text,constchar*in_text_end);// return number of UTF-8 code-points (NOT bytes count)
IMGUI_APIintImTextCountUtf8BytesFromStr(constImWchar*in_text,constImWchar*in_text_end);// return number of bytes to express string as UTF-8 code-points
// Helpers: Misc
IMGUI_APIImU32ImHash(constvoid*data,intdata_size,ImU32seed=0);// Pass data_size==0 for zero-terminated strings
// 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.
staticinlinefloatImFloorStd(floatx){returnfloorf(x);}// we already uses our own ImFloor() { return (float)(int)v } internally so the standard one wrapper is named differently (it's used by stb_truetype)
staticinlinefloatImCeil(floatx){returnceilf(x);}
#endif
// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support for variety of types: signed/unsigned int/long long float/double, using templates here but we could also redefine them 6 times
ImGuiButtonFlags_PressedOnClickRelease=1<<1,// return true on click + release on same item [DEFAULT if no PressedOn* flag is set]
ImGuiButtonFlags_PressedOnClick=1<<2,// return true on click (default requires click+release)
ImGuiButtonFlags_PressedOnRelease=1<<3,// return true on release (default requires click+release)
ImGuiButtonFlags_PressedOnDoubleClick=1<<4,// return true on double-click (default requires click+release)
ImGuiButtonFlags_FlattenChildren=1<<5,// allow interactions even if a child window is overlapping
ImGuiButtonFlags_AllowItemOverlap=1<<6,// require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap()
ImGuiButtonFlags_DontClosePopups=1<<7,// disable automatically closing parent popup on press // [UNUSED]
ImGuiButtonFlags_AlignTextBaseLine=1<<9,// 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<<10,// disable interaction if a key modifier is held
ImGuiButtonFlags_NoHoldingActiveID=1<<11,// don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
ImGuiButtonFlags_PressedOnDragDropHold=1<<12,// press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
ImGuiButtonFlags_NoNavFocus=1<<13// 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.
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.
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;// == ImHash(TypeName, 0, 0)
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*ParentWindow;// Set on OpenPopup()
intOpenFrameCount;// Set on OpenPopup()
ImGuiIDOpenParentId;// Set on OpenPopup(), we need this to differenciate 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
ImGuiInputSourceActiveIdSource;// Activating with mouse or nav (gamepad/keyboard)
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.
ImGuiWindow*MovingWindow;// Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
ImGuiIDNavJustMovedToId;// Just navigated to this id (result of a successfully MoveRequest)
ImGuiIDNavNextActivateId;// Set by ActivateItem(), queued until next frame
ImGuiInputSourceNavInputSource;// Keyboard or Gamepad mode?
ImRectNavScoringRectScreen;// Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
intNavScoringCount;// Metrics for debugging
ImGuiWindow*NavWindowingTarget;// When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) this window is temporarily displayed front-most.
floatNavWindowingHighlightTimer;
floatNavWindowingHighlightAlpha;
boolNavWindowingToggleLayer;
intNavLayer;// 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.
boolNavInitRequest;// Init request for appearing window to select first item
boolNavInitRequestFromMove;
ImGuiIDNavInitResultId;
ImRectNavInitResultRectRel;
boolNavMoveFromClampedRefRect;// Set by manual scrolling, if we scroll to a point where NavId isn't visible we reset navigation from visible items
boolNavMoveRequest;// Move request for this frame
ImGuiNavMoveFlagsNavMoveRequestFlags;
ImGuiNavForwardNavMoveRequestForward;// None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)
ImGuiDirNavMoveDir,NavMoveDirLast;// Direction of the move request (left/right/up/down), direction of the previous move request
ImGuiDirNavMoveClipDir;
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)
ImGuiTextBufferLogClipboard;// Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
// 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_AllowKeyboardFocus=1<<0,// true
ImGuiItemFlags_ButtonRepeat=1<<1,// false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
ImGuiItemFlags_Disabled=1<<2,// false // FIXME-WIP: Disable interactions but doesn't affect visuals. Should be: grey out and disable interactions with widgets that affect data + view widgets (WIP)
ImGuiItemFlags_NoNav=1<<3,// false
ImGuiItemFlags_NoNavDefaultFocus=1<<4,// false
ImGuiItemFlags_SelectableDontClosePopup=1<<5,// false // MenuItem/Selectable() automatically closes current Popup window
ImVec2CursorMaxPos;// Used to implicitly calculate the size of our contents, always growing during the frame. Turned into window->SizeContents at the beginning of next frame
ImRectLastItemDisplayRect;// End-user display rect (only valid if LastItemStatusFlags & ImGuiItemStatusFlags_HasDisplayRect)
boolNavHideHighlightOneFrame;
boolNavHasScroll;// Set when scrolling can be used (ScrollMax > 0.0f)
intNavLayerCurrent;// 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)
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.
// 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.
intStackSizesBackup[6];// Store size of various stacks for asserting
floatIndentX;// Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
floatGroupOffsetX;
floatColumnsOffsetX;// 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.
ImVec2SizeFullAtLastBegin;// Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars.
ImVec2SizeContents;// Size of contents (== extents reach of the drawing cursor) from previous frame. Include decoration, window title, border, menu, etc.
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
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.
ImGuiWindowTempDataDC;// Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
ImRectOuterRectClipped;// = WindowRect just after setup in Begin(). == window->Rect() for root window.
ImRectInnerMainRect,InnerClipRect;
ImRectContentsRegionRect;// FIXME: This is currently confusing/misleading. Maximum visible content position ~~ Pos + (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis
intLastFrameActive;// Last frame number the window was Active.
floatFontWindowScale;// User scale multiplier per-window
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*RootWindowForTabbing;// Point to ourself or first ancestor which can be CTRL-Tabbed into.
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[2];// Last known NavId for this window, per layer (0/1)
ImRectNavRectRel[2];// Reference rectangle, in window relative space
intFocusIdxAllCounter;// Start at -1 and increase as assigned via FocusItemRegister()
intFocusIdxTabCounter;// (same, but only count widgets which you can Tab through)
intFocusIdxAllRequestCurrent;// Item being requested for focus
intFocusIdxTabRequestCurrent;// Tab-able item being requested for focus
intFocusIdxAllRequestNext;// Item being requested for focus, for next update (relies on layout to be stable between the frame pressing TAB and the next frame)
IMGUI_APIvoidShutdown(ImGuiContext*context);// Since 1.60 this is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext().
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.
IMGUI_APIvoidVerticalSeparator();// Vertical separator, for menu bars (use current line height). not exposed because it is misleading what it doesn't have an effect on regular layout.
IMGUI_APIvoidBeginColumns(constchar*str_id,intcount,ImGuiColumnsFlagsflags=0);// setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().
// NB: All position are in absolute pixels coordinates (never using window coordinates internally)
// 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.
IMGUI_APIboolTreeNodeBehaviorIsOpen(ImGuiIDid,ImGuiTreeNodeFlagsflags=0);// Consume previous SetNextTreeNodeOpened() data, if any. May return true when logging