|
@@ -14,6 +14,7 @@
|
|
|
|
|
|
#include <stdio.h> // FILE*
|
|
#include <stdio.h> // FILE*
|
|
#include <math.h> // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf
|
|
#include <math.h> // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf
|
|
|
|
+#include <limits.h> // INT_MIN, INT_MAX
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
#ifdef _MSC_VER
|
|
#pragma warning (push)
|
|
#pragma warning (push)
|
|
@@ -46,6 +47,8 @@ typedef int ImGuiLayoutType; // enum: horizontal or vertical
|
|
typedef int ImGuiButtonFlags; // flags: for ButtonEx(), ButtonBehavior() // enum ImGuiButtonFlags_
|
|
typedef int ImGuiButtonFlags; // flags: for ButtonEx(), ButtonBehavior() // enum ImGuiButtonFlags_
|
|
typedef int ImGuiItemFlags; // flags: for PushItemFlag() // enum ImGuiItemFlags_
|
|
typedef int ImGuiItemFlags; // flags: for PushItemFlag() // enum ImGuiItemFlags_
|
|
typedef int ImGuiItemStatusFlags; // flags: storage for DC.LastItemXXX // enum ImGuiItemStatusFlags_
|
|
typedef int ImGuiItemStatusFlags; // flags: storage for DC.LastItemXXX // enum ImGuiItemStatusFlags_
|
|
|
|
+typedef int ImGuiNavHighlightFlags; // flags: for RenderNavHighlight() // enum ImGuiNavHighlightFlags_
|
|
|
|
+typedef int ImGuiNavDirSourceFlags; // flags: for GetNavInputAmount2d() // enum ImGuiNavDirSourceFlags_
|
|
typedef int ImGuiSeparatorFlags; // flags: for Separator() - internal // enum ImGuiSeparatorFlags_
|
|
typedef int ImGuiSeparatorFlags; // flags: for Separator() - internal // enum ImGuiSeparatorFlags_
|
|
typedef int ImGuiSliderFlags; // flags: for SliderBehavior() // enum ImGuiSliderFlags_
|
|
typedef int ImGuiSliderFlags; // flags: for SliderBehavior() // enum ImGuiSliderFlags_
|
|
|
|
|
|
@@ -184,7 +187,8 @@ enum ImGuiButtonFlags_
|
|
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_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_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_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_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
|
|
};
|
|
};
|
|
|
|
|
|
enum ImGuiSliderFlags_
|
|
enum ImGuiSliderFlags_
|
|
@@ -261,6 +265,49 @@ enum ImGuiDir
|
|
ImGuiDir_Count_
|
|
ImGuiDir_Count_
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+enum ImGuiInputSource
|
|
|
|
+{
|
|
|
|
+ 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
|
|
|
|
+enum ImGuiInputReadMode
|
|
|
|
+{
|
|
|
|
+ ImGuiInputReadMode_Down,
|
|
|
|
+ ImGuiInputReadMode_Pressed,
|
|
|
|
+ ImGuiInputReadMode_Released,
|
|
|
|
+ ImGuiInputReadMode_Repeat,
|
|
|
|
+ ImGuiInputReadMode_RepeatSlow,
|
|
|
|
+ ImGuiInputReadMode_RepeatFast
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+enum ImGuiNavHighlightFlags_
|
|
|
|
+{
|
|
|
|
+ ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
|
|
|
+ ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
|
|
|
+ ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2,
|
|
|
|
+ ImGuiNavHighlightFlags_NoRounding = 1 << 3
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+enum ImGuiNavDirSourceFlags_
|
|
|
|
+{
|
|
|
|
+ ImGuiNavDirSourceFlags_Keyboard = 1 << 0,
|
|
|
|
+ ImGuiNavDirSourceFlags_PadDPad = 1 << 1,
|
|
|
|
+ ImGuiNavDirSourceFlags_PadLStick = 1 << 2
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+enum ImGuiNavForward
|
|
|
|
+{
|
|
|
|
+ ImGuiNavForward_None,
|
|
|
|
+ ImGuiNavForward_ForwardQueued,
|
|
|
|
+ ImGuiNavForward_ForwardActive
|
|
|
|
+};
|
|
|
|
+
|
|
// 2D axis aligned bounding-box
|
|
// 2D axis aligned bounding-box
|
|
// NB: we can't rely on ImVec2 math operators being available here
|
|
// NB: we can't rely on ImVec2 math operators being available here
|
|
struct IMGUI_API ImRect
|
|
struct IMGUI_API ImRect
|
|
@@ -467,6 +514,20 @@ struct ImDrawDataBuilder
|
|
IMGUI_API void FlattenIntoSingleLayer();
|
|
IMGUI_API void FlattenIntoSingleLayer();
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+struct ImGuiNavMoveResult
|
|
|
|
+{
|
|
|
|
+ ImGuiID ID; // Best candidate
|
|
|
|
+ ImGuiID ParentID; // Best candidate window->IDStack.back() - to compare context
|
|
|
|
+ ImGuiWindow* Window; // Best candidate window
|
|
|
|
+ float DistBox; // Best candidate box distance to current NavId
|
|
|
|
+ float DistCenter; // Best candidate center distance to current NavId
|
|
|
|
+ float DistAxial;
|
|
|
|
+ ImRect RectRel; // Best candidate bounding box in window relative space
|
|
|
|
+
|
|
|
|
+ ImGuiNavMoveResult() { Clear(); }
|
|
|
|
+ void Clear() { ID = ParentID = 0; Window = NULL; DistBox = DistCenter = DistAxial = FLT_MAX; RectRel = ImRect(); }
|
|
|
|
+};
|
|
|
|
+
|
|
// Storage for SetNexWindow** functions
|
|
// Storage for SetNexWindow** functions
|
|
struct ImGuiNextWindowData
|
|
struct ImGuiNextWindowData
|
|
{
|
|
{
|
|
@@ -526,7 +587,6 @@ struct ImGuiContext
|
|
ImGuiStorage WindowsById;
|
|
ImGuiStorage WindowsById;
|
|
int WindowsActiveCount;
|
|
int WindowsActiveCount;
|
|
ImGuiWindow* CurrentWindow; // Being drawn into
|
|
ImGuiWindow* CurrentWindow; // Being drawn into
|
|
- ImGuiWindow* NavWindow; // Nav/focused window for navigation
|
|
|
|
ImGuiWindow* HoveredWindow; // Will catch mouse inputs
|
|
ImGuiWindow* HoveredWindow; // Will catch mouse inputs
|
|
ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only)
|
|
ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only)
|
|
ImGuiID HoveredId; // Hovered widget
|
|
ImGuiID HoveredId; // Hovered widget
|
|
@@ -539,8 +599,10 @@ struct ImGuiContext
|
|
bool ActiveIdIsAlive; // Active widget has been seen this frame
|
|
bool ActiveIdIsAlive; // Active widget has been seen this frame
|
|
bool ActiveIdIsJustActivated; // Set at the time of activation for one frame
|
|
bool ActiveIdIsJustActivated; // Set at the time of activation for one frame
|
|
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
|
|
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
|
|
|
|
+ int ActiveIdAllowNavDirFlags; // Active widget allows using directional navigation (e.g. can activate a button and move away from it)
|
|
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
|
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
|
ImGuiWindow* ActiveIdWindow;
|
|
ImGuiWindow* ActiveIdWindow;
|
|
|
|
+ ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
|
|
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
|
|
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
|
|
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
|
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
|
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
|
|
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
|
|
@@ -551,6 +613,41 @@ struct ImGuiContext
|
|
bool NextTreeNodeOpenVal; // Storage for SetNextTreeNode** functions
|
|
bool NextTreeNodeOpenVal; // Storage for SetNextTreeNode** functions
|
|
ImGuiCond NextTreeNodeOpenCond;
|
|
ImGuiCond NextTreeNodeOpenCond;
|
|
|
|
|
|
|
|
+ // Navigation data (for gamepad/keyboard)
|
|
|
|
+ ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusWindow'
|
|
|
|
+ ImGuiID NavId; // Focused item for navigation
|
|
|
|
+ ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
|
|
|
+ ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
|
|
|
+ ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
|
|
|
+ ImGuiID NavInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0
|
|
|
|
+ ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
|
|
|
+ ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame
|
|
|
|
+ ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest)
|
|
|
|
+ ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
|
|
|
|
+ int NavScoringCount; // 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.
|
|
|
|
+ float NavWindowingHighlightTimer;
|
|
|
|
+ float NavWindowingHighlightAlpha;
|
|
|
|
+ bool NavWindowingToggleLayer;
|
|
|
|
+ ImGuiInputSource NavWindowingInputSource; // Gamepad or keyboard mode
|
|
|
|
+ int NavLayer; // 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.
|
|
|
|
+ int NavIdTabCounter; // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing
|
|
|
|
+ bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRefRectRel is valid
|
|
|
|
+ bool NavMousePosDirty; // When set we will update mouse position if (NavFlags & ImGuiNavFlags_MoveMouse) if set (NB: this not enabled by default)
|
|
|
|
+ bool NavDisableHighlight; // When user starts using mouse, we hide gamepad/keyboard highlight (nb: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)
|
|
|
|
+ bool NavDisableMouseHover; // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.
|
|
|
|
+ bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest
|
|
|
|
+ bool NavInitRequest; // Init request for appearing window to select first item
|
|
|
|
+ bool NavInitRequestFromMove;
|
|
|
|
+ ImGuiID NavInitResultId;
|
|
|
|
+ ImRect NavInitResultRectRel;
|
|
|
|
+ bool NavMoveFromClampedRefRect; // Set by manual scrolling, if we scroll to a point where NavId isn't visible we reset navigation from visible items
|
|
|
|
+ bool NavMoveRequest; // Move request for this frame
|
|
|
|
+ ImGuiNavForward NavMoveRequestForward; // None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)
|
|
|
|
+ ImGuiDir NavMoveDir, NavMoveDirLast; // Direction of the move request (left/right/up/down), direction of the previous move request
|
|
|
|
+ ImGuiNavMoveResult NavMoveResultLocal; // Best move request candidate within NavWindow
|
|
|
|
+ ImGuiNavMoveResult NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using the NavFlattened flag)
|
|
|
|
+
|
|
// Render
|
|
// Render
|
|
ImDrawData DrawData; // Main ImDrawData instance to pass render information to the user
|
|
ImDrawData DrawData; // Main ImDrawData instance to pass render information to the user
|
|
ImDrawDataBuilder DrawDataBuilder;
|
|
ImDrawDataBuilder DrawDataBuilder;
|
|
@@ -620,7 +717,6 @@ struct ImGuiContext
|
|
FrameCountEnded = FrameCountRendered = -1;
|
|
FrameCountEnded = FrameCountRendered = -1;
|
|
WindowsActiveCount = 0;
|
|
WindowsActiveCount = 0;
|
|
CurrentWindow = NULL;
|
|
CurrentWindow = NULL;
|
|
- NavWindow = NULL;
|
|
|
|
HoveredWindow = NULL;
|
|
HoveredWindow = NULL;
|
|
HoveredRootWindow = NULL;
|
|
HoveredRootWindow = NULL;
|
|
HoveredId = 0;
|
|
HoveredId = 0;
|
|
@@ -633,12 +729,38 @@ struct ImGuiContext
|
|
ActiveIdIsAlive = false;
|
|
ActiveIdIsAlive = false;
|
|
ActiveIdIsJustActivated = false;
|
|
ActiveIdIsJustActivated = false;
|
|
ActiveIdAllowOverlap = false;
|
|
ActiveIdAllowOverlap = false;
|
|
|
|
+ ActiveIdAllowNavDirFlags = 0;
|
|
ActiveIdClickOffset = ImVec2(-1,-1);
|
|
ActiveIdClickOffset = ImVec2(-1,-1);
|
|
ActiveIdWindow = NULL;
|
|
ActiveIdWindow = NULL;
|
|
|
|
+ ActiveIdSource = ImGuiInputSource_None;
|
|
MovingWindow = NULL;
|
|
MovingWindow = NULL;
|
|
NextTreeNodeOpenVal = false;
|
|
NextTreeNodeOpenVal = false;
|
|
NextTreeNodeOpenCond = 0;
|
|
NextTreeNodeOpenCond = 0;
|
|
|
|
|
|
|
|
+ NavWindow = NULL;
|
|
|
|
+ NavId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0;
|
|
|
|
+ NavJustTabbedId = NavJustMovedToId = NavNextActivateId = 0;
|
|
|
|
+ NavScoringRectScreen = ImRect();
|
|
|
|
+ NavScoringCount = 0;
|
|
|
|
+ NavWindowingTarget = NULL;
|
|
|
|
+ NavWindowingHighlightTimer = NavWindowingHighlightAlpha = 0.0f;
|
|
|
|
+ NavWindowingToggleLayer = false;
|
|
|
|
+ NavWindowingInputSource = ImGuiInputSource_None;
|
|
|
|
+ NavLayer = 0;
|
|
|
|
+ NavIdTabCounter = INT_MAX;
|
|
|
|
+ NavIdIsAlive = false;
|
|
|
|
+ NavMousePosDirty = false;
|
|
|
|
+ NavDisableHighlight = true;
|
|
|
|
+ NavDisableMouseHover = false;
|
|
|
|
+ NavAnyRequest = false;
|
|
|
|
+ NavInitRequest = false;
|
|
|
|
+ NavInitRequestFromMove = false;
|
|
|
|
+ NavInitResultId = 0;
|
|
|
|
+ NavMoveFromClampedRefRect = false;
|
|
|
|
+ NavMoveRequest = false;
|
|
|
|
+ NavMoveRequestForward = ImGuiNavForward_None;
|
|
|
|
+ NavMoveDir = NavMoveDirLast = ImGuiDir_None;
|
|
|
|
+
|
|
ModalWindowDarkeningRatio = 0.0f;
|
|
ModalWindowDarkeningRatio = 0.0f;
|
|
OverlayDrawList._Data = &DrawListSharedData;
|
|
OverlayDrawList._Data = &DrawListSharedData;
|
|
OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
|
|
OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
|
|
@@ -687,8 +809,8 @@ enum ImGuiItemFlags_
|
|
ImGuiItemFlags_AllowKeyboardFocus = 1 << 0, // true
|
|
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_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_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_NoNav = 1 << 3, // false
|
|
|
|
+ ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false
|
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
|
ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus
|
|
ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus
|
|
};
|
|
};
|
|
@@ -707,15 +829,23 @@ struct IMGUI_API ImGuiDrawContext
|
|
float PrevLineTextBaseOffset;
|
|
float PrevLineTextBaseOffset;
|
|
float LogLinePosY;
|
|
float LogLinePosY;
|
|
int TreeDepth;
|
|
int TreeDepth;
|
|
|
|
+ ImU32 TreeDepthMayCloseOnPop; // Store a copy of !g.NavIdIsAlive for TreeDepth 0..31
|
|
ImGuiID LastItemId;
|
|
ImGuiID LastItemId;
|
|
ImGuiItemStatusFlags LastItemStatusFlags;
|
|
ImGuiItemStatusFlags LastItemStatusFlags;
|
|
ImRect LastItemRect; // Interaction rect
|
|
ImRect LastItemRect; // Interaction rect
|
|
ImRect LastItemDisplayRect; // End-user display rect (only valid if LastItemStatusFlags & ImGuiItemStatusFlags_HasDisplayRect)
|
|
ImRect LastItemDisplayRect; // End-user display rect (only valid if LastItemStatusFlags & ImGuiItemStatusFlags_HasDisplayRect)
|
|
- bool MenuBarAppending;
|
|
|
|
|
|
+ bool NavHideHighlightOneFrame;
|
|
|
|
+ bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f)
|
|
|
|
+ int NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
|
|
|
+ int NavLayerCurrentMask; // = (1 << NavLayerCurrent) used by ItemAdd prior to clipping.
|
|
|
|
+ int NavLayerActiveMask; // Which layer have been written to (result from previous frame)
|
|
|
|
+ int NavLayerActiveMaskNext; // Which layer have been written to (buffer for current frame)
|
|
|
|
+ bool MenuBarAppending; // FIXME: Remove this
|
|
float MenuBarOffsetX;
|
|
float MenuBarOffsetX;
|
|
ImVector<ImGuiWindow*> ChildWindows;
|
|
ImVector<ImGuiWindow*> ChildWindows;
|
|
ImGuiStorage* StateStorage;
|
|
ImGuiStorage* StateStorage;
|
|
ImGuiLayoutType LayoutType;
|
|
ImGuiLayoutType LayoutType;
|
|
|
|
+ ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
|
|
|
|
|
// 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.
|
|
// 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.
|
|
ImGuiItemFlags ItemFlags; // == ItemFlagsStack.back() [empty == ImGuiItemFlags_Default]
|
|
ImGuiItemFlags ItemFlags; // == ItemFlagsStack.back() [empty == ImGuiItemFlags_Default]
|
|
@@ -739,13 +869,19 @@ struct IMGUI_API ImGuiDrawContext
|
|
CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;
|
|
CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;
|
|
LogLinePosY = -1.0f;
|
|
LogLinePosY = -1.0f;
|
|
TreeDepth = 0;
|
|
TreeDepth = 0;
|
|
|
|
+ TreeDepthMayCloseOnPop = 0x00;
|
|
LastItemId = 0;
|
|
LastItemId = 0;
|
|
LastItemStatusFlags = 0;
|
|
LastItemStatusFlags = 0;
|
|
LastItemRect = LastItemDisplayRect = ImRect();
|
|
LastItemRect = LastItemDisplayRect = ImRect();
|
|
|
|
+ NavHideHighlightOneFrame = false;
|
|
|
|
+ NavHasScroll = false;
|
|
|
|
+ NavLayerActiveMask = NavLayerActiveMaskNext = 0x00;
|
|
|
|
+ NavLayerCurrent = 0;
|
|
|
|
+ NavLayerCurrentMask = 1 << 0;
|
|
MenuBarAppending = false;
|
|
MenuBarAppending = false;
|
|
MenuBarOffsetX = 0.0f;
|
|
MenuBarOffsetX = 0.0f;
|
|
StateStorage = NULL;
|
|
StateStorage = NULL;
|
|
- LayoutType = ImGuiLayoutType_Vertical;
|
|
|
|
|
|
+ LayoutType = ParentLayoutType = ImGuiLayoutType_Vertical;
|
|
ItemWidth = 0.0f;
|
|
ItemWidth = 0.0f;
|
|
ItemFlags = ImGuiItemFlags_Default_;
|
|
ItemFlags = ImGuiItemFlags_Default_;
|
|
TextWrapPos = -1.0f;
|
|
TextWrapPos = -1.0f;
|
|
@@ -776,6 +912,7 @@ struct IMGUI_API ImGuiWindow
|
|
float WindowRounding; // Window rounding at the time of begin.
|
|
float WindowRounding; // Window rounding at the time of begin.
|
|
float WindowBorderSize; // Window border size at the time of begin.
|
|
float WindowBorderSize; // Window border size at the time of begin.
|
|
ImGuiID MoveId; // == window->GetID("#MOVE")
|
|
ImGuiID MoveId; // == window->GetID("#MOVE")
|
|
|
|
+ ImGuiID ChildId; // Id of corresponding item in parent window (for child windows)
|
|
ImVec2 Scroll;
|
|
ImVec2 Scroll;
|
|
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)
|
|
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)
|
|
ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
|
|
ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
|
|
@@ -785,6 +922,7 @@ struct IMGUI_API ImGuiWindow
|
|
bool WasActive;
|
|
bool WasActive;
|
|
bool WriteAccessed; // Set to true when any widget access the current window
|
|
bool WriteAccessed; // Set to true when any widget access the current window
|
|
bool Collapsed; // Set when collapsing window to become only title-bar
|
|
bool Collapsed; // Set when collapsing window to become only title-bar
|
|
|
|
+ bool CollapseToggleWanted;
|
|
bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed)
|
|
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)
|
|
bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
|
|
bool CloseButton; // Set when the window has a close button (p_open != NULL)
|
|
bool CloseButton; // Set when the window has a close button (p_open != NULL)
|
|
@@ -819,7 +957,13 @@ struct IMGUI_API ImGuiWindow
|
|
ImGuiWindow* RootWindow; // Generally point to ourself. If we are a child window, this is pointing to the first non-child parent window.
|
|
ImGuiWindow* RootWindow; // Generally point to ourself. If we are a child window, this is pointing to the first non-child parent window.
|
|
ImGuiWindow* RootNonPopupWindow; // Generally point to ourself. Used to display TitleBgActive color and for selecting which window to use for NavWindowing
|
|
ImGuiWindow* RootNonPopupWindow; // Generally point to ourself. Used to display TitleBgActive color and for selecting which window to use for NavWindowing
|
|
|
|
|
|
|
|
+ ImGuiWindow* NavRootWindow; // Generally point to ourself. If we are a child window with the NavFlattened flag, point to a parent window.
|
|
|
|
+ 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.)
|
|
|
|
+ ImGuiID NavLastIds[2]; // Last known NavId for this window, per layer (0/1)
|
|
|
|
+ ImRect NavRectRel[2]; // Reference rectangle, in window relative space
|
|
|
|
+
|
|
// Navigation / Focus
|
|
// Navigation / Focus
|
|
|
|
+ // FIXME-NAV: Merge all this with the new Nav system, at least the request variables should be moved to ImGuiContext
|
|
int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister()
|
|
int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister()
|
|
int FocusIdxTabCounter; // (same, but only count widgets which you can Tab through)
|
|
int FocusIdxTabCounter; // (same, but only count widgets which you can Tab through)
|
|
int FocusIdxAllRequestCurrent; // Item being requested for focus
|
|
int FocusIdxAllRequestCurrent; // Item being requested for focus
|
|
@@ -876,6 +1020,7 @@ namespace ImGui
|
|
IMGUI_API void BringWindowToFront(ImGuiWindow* window);
|
|
IMGUI_API void BringWindowToFront(ImGuiWindow* window);
|
|
IMGUI_API void BringWindowToBack(ImGuiWindow* window);
|
|
IMGUI_API void BringWindowToBack(ImGuiWindow* window);
|
|
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
|
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
|
|
|
+ IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
|
|
|
|
|
IMGUI_API void Initialize();
|
|
IMGUI_API void Initialize();
|
|
|
|
|
|
@@ -884,6 +1029,8 @@ namespace ImGui
|
|
IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id);
|
|
IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id);
|
|
|
|
|
|
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window);
|
|
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window);
|
|
|
|
+ IMGUI_API ImGuiID GetActiveID();
|
|
|
|
+ IMGUI_API void SetFocusID(ImGuiID id, ImGuiWindow* window);
|
|
IMGUI_API void ClearActiveID();
|
|
IMGUI_API void ClearActiveID();
|
|
IMGUI_API void SetHoveredID(ImGuiID id);
|
|
IMGUI_API void SetHoveredID(ImGuiID id);
|
|
IMGUI_API ImGuiID GetHoveredID();
|
|
IMGUI_API ImGuiID GetHoveredID();
|
|
@@ -891,7 +1038,7 @@ namespace ImGui
|
|
|
|
|
|
IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);
|
|
IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);
|
|
IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f);
|
|
IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f);
|
|
- IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id);
|
|
|
|
|
|
+ IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL);
|
|
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
|
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
|
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
|
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
|
IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested
|
|
IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested
|
|
@@ -911,6 +1058,11 @@ namespace ImGui
|
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
|
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
|
|
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
|
|
|
|
|
|
|
|
+ IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
|
|
|
|
+ IMGUI_API void ActivateItem(ImGuiID id); // 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_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);
|
|
|
|
+ IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
|
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
|
|
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
|
|
|
|
|
|
IMGUI_API void Scrollbar(ImGuiLayoutType direction);
|
|
IMGUI_API void Scrollbar(ImGuiLayoutType direction);
|
|
@@ -937,6 +1089,7 @@ namespace ImGui
|
|
IMGUI_API void RenderTriangle(ImVec2 pos, ImGuiDir dir, float scale = 1.0f);
|
|
IMGUI_API void RenderTriangle(ImVec2 pos, ImGuiDir dir, float scale = 1.0f);
|
|
IMGUI_API void RenderBullet(ImVec2 pos);
|
|
IMGUI_API void RenderBullet(ImVec2 pos);
|
|
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz);
|
|
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz);
|
|
|
|
+ IMGUI_API void RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags = ImGuiNavHighlightFlags_TypeDefault); // Navigation highlight
|
|
IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
|
|
IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
|
|
IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.
|
|
IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.
|
|
|
|
|