1. FOR FIRST-TIME USERS ISSUES COMPILING/LINKING/RUNNING or LOADING FONTS, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions).
4. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the link provided in (1) (2).
4. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the links above.
5. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.
// (minor and older changes stripped away, please see git history for details)
// 2021-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2021-08-23: OpenGL: Fixed ES 3.0 shader ("#version 300 es") use normal precision floats to avoid wobbly rendering at HD resolutions.
// 2021-08-19: OpenGL: Embed and use our own minimal GL loader (imgui_impl_opengl3_loader.h), removing requirement and support for third-party loader.
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
// 2021-06-25: OpenGL: Use OES_vertex_array extension on Emscripten + backup/restore current state.
Read `PROGRAMMER GUIDE` section of [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cpp). <BR>
The [Wiki](https://github.com/ocornut/imgui/wiki) is a hub to many resources and links.
For first-time users having issues compiling/linking/running or issues loading fonts, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions).
@ -162,7 +162,9 @@ See: [Wiki](https://github.com/ocornut/imgui/wiki) for many links, references, a
See: [Articles about the IMGUI paradigm](https://github.com/ocornut/imgui/wiki#about-the-imgui-paradigm) to read/learn about the Immediate Mode GUI paradigm.
For questions, bug reports, requests, feedback, you may post on [GitHub Issues](https://github.com/ocornut/imgui/issues) or [GitHub Discussions](https://github.com/ocornut/imgui/discussions). Please read and fill the New Issue template carefully.
Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions).
For other questions, bug reports, requests, feedback, you may post on [GitHub Issues](https://github.com/ocornut/imgui/issues). Please read and fill the New Issue template carefully.
Private support is available for paying business customers (E-mail: _contact @ dearimgui dot com_).
// We track click ownership. When clicked outside of a window the click is owned by the application and won't report hovering nor request capture even while dragging over our windows afterward.
intmouse_earliest_button_down=-1;
// We track click ownership. When clicked outside of a window the click is owned by the application and
// won't report hovering nor request capture even while dragging over our windows afterward.
// Update io.WantCaptureMouse for the user application (true = dispatch mouse info to imgui, false = dispatch mouse info to Dear ImGui + app)
// Update io.WantCaptureMouse for the user application (true = dispatch mouse info to Dear ImGui only, false = dispatch mouse to Dear ImGui + underlying app)
// Update io.WantCaptureMouseAllowPopupClose (experimental) to give a chance for app to react to popup closure with a drag
// Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to imgui, false = dispatch keyboard info to Dear ImGui + app)
// Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to Dear ImGui only, false = dispatch keyboard info to Dear ImGui + underlying app)
// Since 1.71, child window can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call.
// Child windows can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call (since 1.71)
// When using overlapping child windows, this will break the assumption that child z-order is mapped to submission order.
// We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping child.
// We also disabled this when we have dimming overlay behind this specific one child.
// FIXME: More code may rely on explicit sorting of overlapping child window and would need to disable this somehow. Please get in contact if you are affected.
// FIXME: User code may rely on explicit sorting of overlapping child window and would need to disable this somehow. Please get in contact if you are affected (github #4493)
// - Those can be nested but this cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep things disabled)
// - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled)
// - Visually this is currently altering alpha, but it is expected that in a future styling system this would work differently.
// - Feedback welcome at https://github.com/ocornut/imgui/issues/211
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.
// Lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)
// Groups are currently a mishmash of functionalities which should perhaps be clarified and separated.
// Make all menus and popups wrap around for now, may need to expose that policy.
// Make all menus and popups wrap around for now, may need to expose that policy (e.g. focus scope could include wrap/loop policy flags used by new move requests)
// Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window)
// (Preserve g.NavMoveRequestFlags, g.NavMoveClipDir which were set by the NavMoveRequestForward() function)
// If we initiate a movement request and have no current NavId, we initiate a InitDefautRequest that will be used as a fallback if the direction fails to find a match
if(g.NavMoveDir!=ImGuiDir_None)
{
g.NavMoveRequest=true;
g.NavMoveRequestKeyMods=io.KeyMods;
g.NavMoveDirLast=g.NavMoveDir;
}
if(g.NavMoveRequest&&g.NavId==0)
{
IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n",g.NavWindow->Name,g.NavLayer);
g.NavInitRequest=g.NavInitRequestFromMove=true;
// Reassigning with same value, we're being explicit here.
// *Fallback* manual-scroll with Nav directional keys when window has no navigable item
ImGuiWindow*window=g.NavWindow;
constfloatscroll_speed=IM_ROUND(window->CalcFontSize()*100*io.DeltaTime);// We need round the scrolling speed because sub-pixel scroll isn't reliably supported.
// When using gamepad, we project the reference nav bounding box into window visible area.
// This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, since with gamepad every movements are relative
// (can't focus a visible object like we can with the mouse).
window_rect_rel.Expand(ImVec2(-ImMin(window_rect_rel.GetWidth(),pad),-ImMin(window_rect_rel.GetHeight(),pad)));// Terrible approximation for the intent of starting navigation from first fully visible item
// For scoring we use a single segment on the left side our current item bounding box (not touching the edge to avoid box overlap with zero-spaced items)
IM_ASSERT(!g.NavScoringRect.IsInverted());// Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem().
// Apply result from previous frame navigation directional move request
staticvoidImGui::NavUpdateMoveResult()
voidImGui::NavUpdateCreateMoveRequest()
{
ImGuiContext&g=*GImGui;
ImGuiIO&io=g.IO;
ImGuiWindow*window=g.NavWindow;
if(g.NavMoveRequestForwardToNextFrame)
{
// Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window)
// (preserve most state, which were already set by the NavMoveRequestForward() function)
// If we initiate a movement request and have no current NavId, we initiate a InitDefaultRequest that will be used as a fallback if the direction fails to find a match
if(g.NavMoveDir!=ImGuiDir_None)
{
IM_ASSERT(window!=NULL);
g.NavMoveRequest=true;
g.NavMoveRequestKeyMods=io.KeyMods;
g.NavMoveDirLast=g.NavMoveDir;
g.NavMoveResultLocal.Clear();
g.NavMoveResultLocalVisibleSet.Clear();
g.NavMoveResultOther.Clear();
}
// Moving with no reference triggers a init request
if(g.NavMoveRequest&&g.NavId==0)
{
IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n",g.NavWindow->Name,g.NavLayer);
g.NavInitRequest=g.NavInitRequestFromMove=true;
g.NavInitResultId=0;
g.NavDisableHighlight=false;
}
// When using gamepad, we project the reference nav bounding box into window visible area.
// This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, since with gamepad every movements are relative
// (can't focus a visible object like we can with the mouse).
window_rect_rel.Expand(ImVec2(-ImMin(window_rect_rel.GetWidth(),pad),-ImMin(window_rect_rel.GetHeight(),pad)));// Terrible approximation for the intent of starting navigation from first fully visible item
// For scoring we use a single segment on the left side our current item bounding box (not touching the edge to avoid box overlap with zero-spaced items)
IM_ASSERT(!g.NavScoringRect.IsInverted());// Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem().
// Process NavCancel input (to close a popup, get back to parent, clear focus)
// FIXME: In order to support e.g. Escape to clear a selection we'll need:
// - either to store the equivalent of ActiveIdUsingKeyInputMask for a FocusScope and test for it.
// - either to move most/all of those tests to the epilogue/end functions of the scope they are dealing with (e.g. exit child window in EndChild()) or in EndFrame(), to allow an earlier intercept
// - For first-time users having issues compiling/linking/running or issues loading fonts:
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
/*
@ -61,8 +64,8 @@ Index of this file:
// Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
@ -166,7 +169,7 @@ struct ImGuiTextFilter; // Helper to parse and apply text filters (e
structImGuiViewport;// A Platform Window (always 1 unless multi-viewport are enabled. One per platform window to output to). In the future may represent Platform Monitor
structImGuiWindowClass;// Window class (rare/advanced uses: provide hints to the platform backend via altered viewport flags and parent/child info)
// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags and to not pollute the top of this file)
// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags without overhead, and to not pollute the top of this file)
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
@ -207,27 +210,22 @@ typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: f
typedefintImGuiViewportFlags;// -> enum ImGuiViewportFlags_ // Flags: for ImGuiViewport
typedefintImGuiWindowFlags;// -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild()
// Other types
#ifndef ImTextureID // ImTextureID [configurable type: override in imconfig.h with '#define ImTextureID xxx']
typedefvoid*ImTextureID;// User data for rendering backend to identify a texture. This is whatever to you want it to be! read the FAQ about ImTextureID for details.
// ImTexture: user data for renderer backend to identify a texture [Compile-time configurable type]
// - To use something else than an opaque void* pointer: override with e.g. '#define ImTextureID MyTextureType*' in your imconfig.h file.
// - This can be whatever to you want it to be! read the FAQ about ImTextureID for details.
#ifndef ImTextureID
typedefvoid*ImTextureID;// Default: store a pointer or an integer fitting in a pointer (most renderer backends are ok with that)
#endif
typedefunsignedintImGuiID;// A unique ID used by widgets, typically hashed from a stack of string.
typedefint(*ImGuiInputTextCallback)(ImGuiInputTextCallbackData*data);// Callback function for ImGui::InputText()
typedefvoid(*ImGuiSizeCallback)(ImGuiSizeCallbackData*data);// Callback function for ImGui::SetNextWindowSizeConstraints()
typedefvoid*(*ImGuiMemAllocFunc)(size_tsz,void*user_data);// Function signature for ImGui::SetAllocatorFunctions()
typedefvoid(*ImGuiMemFreeFunc)(void*ptr,void*user_data);// Function signature for ImGui::SetAllocatorFunctions()
// Character types
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
typedefunsignedshortImWchar16;// A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings.
typedefunsignedintImWchar32;// A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
#ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16]
// - To use 16-bit indices + allow large meshes: backend need to set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset (recommended).
// - To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in your imconfig.h file.
#ifndef ImDrawIdx
typedefunsignedshortImDrawIdx;// Default: 16-bit (for maximum compatibility with renderer backends)
#endif
// Basic scalar data types
// Scalar data types
typedefunsignedintImGuiID;// A unique ID used by widgets (typically the result of hashing a stack of string)
typedefsignedcharImS8;// 8-bit signed integer
typedefunsignedcharImU8;// 8-bit unsigned integer
typedefsignedshortImS16;// 16-bit signed integer
@ -246,7 +244,24 @@ typedef signed long long ImS64; // 64-bit signed integer (post C++11)
// 2D vector (often used to store positions or sizes)
// Character types
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
typedefunsignedshortImWchar16;// A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings.
typedefunsignedintImWchar32;// A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
#ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16]
typedefImWchar32ImWchar;
#else
typedefImWchar16ImWchar;
#endif
// Callback and functions types
typedefint(*ImGuiInputTextCallback)(ImGuiInputTextCallbackData*data);// Callback function for ImGui::InputText()
typedefvoid(*ImGuiSizeCallback)(ImGuiSizeCallbackData*data);// Callback function for ImGui::SetNextWindowSizeConstraints()
typedefvoid*(*ImGuiMemAllocFunc)(size_tsz,void*user_data);// Function signature for ImGui::SetAllocatorFunctions()
typedefvoid(*ImGuiMemFreeFunc)(void*ptr,void*user_data);// Function signature for ImGui::SetAllocatorFunctions()
// ImVec2: 2D vector used to store positions, sizes etc. [Compile-time configurable type]
// This is a frequently used type in the API. Consider using IM_VEC2_CLASS_EXTRA to create implicit cast from/to our preferred type.
IM_MSVC_RUNTIME_CHECKS_OFF
structImVec2
{
@ -260,7 +275,7 @@ struct ImVec2
#endif
};
// 4D vector (often used to store floating-point colors)
// ImVec4: 4D vector used to store clipping rectangles, colors etc. [Compile-time configurable type]
structImVec4
{
floatx,y,z,w;
@ -377,9 +392,8 @@ namespace ImGui
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
IMGUI_APIImVec2GetContentRegionMax();// current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
IMGUI_APIImVec2GetWindowContentRegionMin();// content boundaries min (roughly (0,0)-Scroll), in window coordinates
IMGUI_APIImVec2GetWindowContentRegionMax();// content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
IMGUI_APIfloatGetWindowContentRegionWidth();//
IMGUI_APIImVec2GetWindowContentRegionMin();// content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates
IMGUI_APIImVec2GetWindowContentRegionMax();// content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
// Windows Scrolling
IMGUI_APIfloatGetScrollX();// get scrolling amount [0 .. GetScrollMaxX()]
// - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors)
// - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled)
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.
IMGUI_APIvoidBeginDisabled(booldisabled=true);
IMGUI_APIvoidEndDisabled();
@ -1987,6 +2002,7 @@ struct ImGuiIO
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
boolWantCaptureMouseUnlessPopupClose;// Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
ImGuiKeyModFlagsKeyMods;// Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
ImGuiKeyModFlagsKeyModsPrev;// Previous key mods
ImVec2MousePosPrev;// Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
@ -1995,7 +2011,8 @@ struct ImGuiIO
boolMouseClicked[5];// Mouse button went from !Down to Down
boolMouseDoubleClicked[5];// Has mouse button been double-clicked?
boolMouseReleased[5];// Mouse button went from Down to !Down
boolMouseDownOwned[5];// Track if button was clicked inside a dear imgui window. We don't request mouse capture from the application if click started outside ImGui bounds.
boolMouseDownOwned[5];// Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds.
boolMouseDownOwnedUnlessPopupClose[5];//Track if button was clicked inside a dear imgui window.
boolMouseDownWasDoubleClick[5];// Track if button down was a double-click
floatMouseDownDuration[5];// Duration the mouse button has been down (0.0f == just clicked)
floatMouseDownDurationPrev[5];// Previous time the mouse button has been down
// To allow large meshes with 16-bit indices: set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset in the renderer backend (recommended).
// To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in imconfig.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
// Helper macros
#if defined(__clang__)
#define IM_NORETURN __attribute__((noreturn))
#else
#define IM_NORETURN
#endif
// Legacy defines
#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Renamed in 1.74
#error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
@ -933,49 +928,6 @@ enum ImGuiInputReadMode
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)
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 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)
ImGuiNavMoveFlags_AlsoScoreVisibleSet=1<<5,// Store alternate result in NavMoveResultLocalVisibleSet that only comprise elements that are already fully visible (used by PageUp/PageDown)
ImGuiNavMoveFlags_ScrollToEdge=1<<6,
ImGuiNavMoveFlags_Forwarded=1<<7
};
enumImGuiNavLayer
{
ImGuiNavLayer_Main=0,// Main scrolling layer
ImGuiNavLayer_Menu=1,// Menu layer (access with Alt/ImGuiNavInput_Menu)
ImGuiNavLayer_COUNT
};
structImGuiNavItemData
{
ImGuiWindow*Window;// Init,Move // Best candidate window (result->ItemWindow->RootWindowForNav == request->Window)
ImGuiIDID;// Init,Move // Best candidate item ID
ImGuiIDFocusScopeId;// Init,Move // Best candidate focus scope ID
ImRectRectRel;// Init,Move // Best candidate bounding box in window relative space
floatDistBox;// Move // Best candidate box distance to current NavId
floatDistCenter;// Move // Best candidate center distance to current NavId
floatDistAxial;// Move // Best candidate axial distance to current NavId
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.
boolNavAnyRequest;// ~~ NavMoveRequest || NavInitRequest this is to perform early out in ItemAdd()
boolNavInitRequest;// Init request for appearing window to select first item
boolNavInitRequestFromMove;
ImGuiIDNavInitResultId;// Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)
ImRectNavInitResultRectRel;// Init request result rectangle (relative to parent window)
boolNavMoveRequest;// Move request for this frame
boolNavMoveRequestForwardToNextFrame;
ImGuiNavMoveFlagsNavMoveRequestFlags;
ImGuiNavForwardNavMoveRequestForward;// None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)
ImGuiKeyModFlagsNavMoveRequestKeyMods;
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?
ImGuiNavItemDataNavMoveResultLocal;// Best move request candidate within NavWindow
ImGuiNavItemDataNavMoveResultLocalVisibleSet;// Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
ImGuiNavItemDataNavMoveResultOther;// Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
ImGuiWindow*NavWrapRequestWindow;// Window which requested trying nav wrap-around.
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool focused = FocusableItemRegister(...)'
// (New) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'
// Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()
inlineboolFocusableItemRegister(ImGuiWindow*window,ImGuiIDid){IM_ASSERT(0);IM_UNUSED(window);IM_UNUSED(id);returnfalse;}// -> pass ImGuiItemAddFlags_Focusable flag to ItemAdd()
inlineboolFocusableItemRegister(ImGuiWindow*window,ImGuiIDid){IM_ASSERT(0);IM_UNUSED(window);IM_UNUSED(id);returnfalse;}// -> pass ImGuiItemAddFlags_Focusable flag to ItemAdd()
if(g.NavId==id&&g.NavMoveRequest &&g.NavMoveDir ==ImGuiDir_Right&&!is_open)// If there's something upcoming on the line we may want to give it the priority?
if(g.NavId==id&&g.NavMoveDir ==ImGuiDir_Right&&!is_open)// If there's something upcoming on the line we may want to give it the priority?
// To do so we claim focus back, restore NavId and then process the movement request for yet another frame.
// This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth the hassle/cost)
// This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth bothering)