mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Nav: Internal nenaming
This commit is contained in:
parent
50ba543743
commit
4b4e455c40
20
imgui.cpp
20
imgui.cpp
@ -2173,7 +2173,7 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id, const ImRect* nav_bb_ar
|
|||||||
window->DC.LastItemRect = bb;
|
window->DC.LastItemRect = bb;
|
||||||
window->DC.LastItemRectHoveredRect = false;
|
window->DC.LastItemRectHoveredRect = false;
|
||||||
if (id != NULL)
|
if (id != NULL)
|
||||||
window->DC.NavLayerActiveFlagsNext |= (1 << window->DC.NavLayerCurrent);
|
window->DC.NavLayerActiveMaskNext |= (1 << window->DC.NavLayerCurrent);
|
||||||
|
|
||||||
// Navigation processing runs prior to clipping early-out
|
// Navigation processing runs prior to clipping early-out
|
||||||
// (a) So that NavInitDefaultRequest can be honored, for newly opened windows to select a default widget
|
// (a) So that NavInitDefaultRequest can be honored, for newly opened windows to select a default widget
|
||||||
@ -2188,8 +2188,8 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id, const ImRect* nav_bb_ar
|
|||||||
const ImRect nav_bb_rel(nav_bb.Min - g.NavWindow->Pos, nav_bb.Max - g.NavWindow->Pos);
|
const ImRect nav_bb_rel(nav_bb.Min - g.NavWindow->Pos, nav_bb.Max - g.NavWindow->Pos);
|
||||||
if (g.NavInitDefaultRequest && g.NavLayer == window->DC.NavLayerCurrent)
|
if (g.NavInitDefaultRequest && g.NavLayer == window->DC.NavLayerCurrent)
|
||||||
{
|
{
|
||||||
// Even if 'ImGuiItemFlags_AllowNavDefaultFocus' is off (typically collapse/close button) we record the first ResultId so they can be used as fallback
|
|
||||||
if (!(window->DC.ItemFlags & ImGuiItemFlags_NoNavDefaultFocus))
|
if (!(window->DC.ItemFlags & ImGuiItemFlags_NoNavDefaultFocus))
|
||||||
|
// Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback
|
||||||
g.NavInitDefaultRequest = g.NavInitDefaultResultExplicit = false; // Found a match, clear request
|
g.NavInitDefaultRequest = g.NavInitDefaultResultExplicit = false; // Found a match, clear request
|
||||||
if (g.NavInitDefaultResultId == 0 || !(window->DC.ItemFlags & ImGuiItemFlags_NoNavDefaultFocus))
|
if (g.NavInitDefaultResultId == 0 || !(window->DC.ItemFlags & ImGuiItemFlags_NoNavDefaultFocus))
|
||||||
{
|
{
|
||||||
@ -2695,9 +2695,9 @@ static void NavUpdate()
|
|||||||
// Single press toggles NavLayer
|
// Single press toggles NavLayer
|
||||||
if (g.NavWindowingToggleLayer && g.NavWindow)
|
if (g.NavWindowingToggleLayer && g.NavWindow)
|
||||||
{
|
{
|
||||||
if ((g.NavWindow->DC.NavLayerActiveFlags & (1<<1)) == 0 && (g.NavWindow->RootWindow->DC.NavLayerActiveFlags & (1<<1)) != 0)
|
if ((g.NavWindow->DC.NavLayerActiveMask & (1<<1)) == 0 && (g.NavWindow->RootWindow->DC.NavLayerActiveMask & (1<<1)) != 0)
|
||||||
ImGui::FocusWindow(g.NavWindow->RootWindow);
|
ImGui::FocusWindow(g.NavWindow->RootWindow);
|
||||||
g.NavLayer = (g.NavWindow->DC.NavLayerActiveFlags & (1<<1)) ? (g.NavLayer ^ 1) : 0;
|
g.NavLayer = (g.NavWindow->DC.NavLayerActiveMask & (1<<1)) ? (g.NavLayer ^ 1) : 0;
|
||||||
g.NavDisableHighlight = false;
|
g.NavDisableHighlight = false;
|
||||||
g.NavDisableMouseHover = true;
|
g.NavDisableMouseHover = true;
|
||||||
if (g.NavLayer == 0 && g.NavWindow->NavLastId)
|
if (g.NavLayer == 0 && g.NavWindow->NavLastId)
|
||||||
@ -2790,7 +2790,7 @@ static void NavUpdate()
|
|||||||
{
|
{
|
||||||
// Fallback manual-scroll with NavUp/NavDown when window has no navigable item
|
// Fallback manual-scroll with NavUp/NavDown when window has no navigable item
|
||||||
const float scroll_speed = ImFloor(g.NavWindow->CalcFontSize() * 100 * g.IO.DeltaTime + 0.5f); // We need round the scrolling speed because sub-pixel scroll isn't reliably supported.
|
const float scroll_speed = ImFloor(g.NavWindow->CalcFontSize() * 100 * g.IO.DeltaTime + 0.5f); // We need round the scrolling speed because sub-pixel scroll isn't reliably supported.
|
||||||
if (!g.NavWindow->DC.NavLayerActiveFlags && g.NavWindow->DC.NavHasScroll && g.NavMoveRequest && (g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down))
|
if (!g.NavWindow->DC.NavLayerActiveMask && g.NavWindow->DC.NavHasScroll && g.NavMoveRequest && (g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down))
|
||||||
SetWindowScrollY(g.NavWindow, ImFloor(g.NavWindow->Scroll.y + ((g.NavMoveDir == ImGuiDir_Up) ? -1.0f : +1.0f) * scroll_speed));
|
SetWindowScrollY(g.NavWindow, ImFloor(g.NavWindow->Scroll.y + ((g.NavMoveDir == ImGuiDir_Up) ? -1.0f : +1.0f) * scroll_speed));
|
||||||
|
|
||||||
// Manual scroll with NavScrollXXX keys
|
// Manual scroll with NavScrollXXX keys
|
||||||
@ -4462,7 +4462,7 @@ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
|
|||||||
child_window->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
child_window->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
||||||
|
|
||||||
// Process navigation-in immediately so NavInit can run on first frame
|
// Process navigation-in immediately so NavInit can run on first frame
|
||||||
if (/*!(flags & ImGuiWindowFlags_NavFlattened) &&*/ (child_window->DC.NavLayerActiveFlags != 0 || child_window->DC.NavHasScroll) && g.NavActivateId == id)
|
if (/*!(flags & ImGuiWindowFlags_NavFlattened) &&*/ (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll) && g.NavActivateId == id)
|
||||||
{
|
{
|
||||||
ImGui::FocusWindow(child_window);
|
ImGui::FocusWindow(child_window);
|
||||||
NavInitWindow(child_window, false);
|
NavInitWindow(child_window, false);
|
||||||
@ -4506,7 +4506,7 @@ void ImGui::EndChild()
|
|||||||
ImGuiWindow* parent_window = GetCurrentWindow();
|
ImGuiWindow* parent_window = GetCurrentWindow();
|
||||||
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
|
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
|
||||||
ItemSize(sz);
|
ItemSize(sz);
|
||||||
if (/*!(window->Flags & ImGuiWindowFlags_NavFlattened) &&*/ (window->DC.NavLayerActiveFlags != 0 || window->DC.NavHasScroll))
|
if (/*!(window->Flags & ImGuiWindowFlags_NavFlattened) &&*/ (window->DC.NavLayerActiveMask != 0 || window->DC.NavHasScroll))
|
||||||
{
|
{
|
||||||
ItemAdd(bb, &window->ChildId);
|
ItemAdd(bb, &window->ChildId);
|
||||||
RenderNavHighlight(bb, window->ChildId);
|
RenderNavHighlight(bb, window->ChildId);
|
||||||
@ -5194,8 +5194,8 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
|||||||
window->DC.CursorMaxPos = window->DC.CursorStartPos;
|
window->DC.CursorMaxPos = window->DC.CursorStartPos;
|
||||||
window->DC.CurrentLineHeight = window->DC.PrevLineHeight = 0.0f;
|
window->DC.CurrentLineHeight = window->DC.PrevLineHeight = 0.0f;
|
||||||
window->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f;
|
window->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f;
|
||||||
window->DC.NavLayerActiveFlags = window->DC.NavLayerActiveFlagsNext;
|
window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext;
|
||||||
window->DC.NavLayerActiveFlagsNext = 0x00;
|
window->DC.NavLayerActiveMaskNext = 0x00;
|
||||||
window->DC.NavHasScroll = (GetScrollMaxY() > 0.0f);
|
window->DC.NavHasScroll = (GetScrollMaxY() > 0.0f);
|
||||||
window->DC.MenuBarAppending = false;
|
window->DC.MenuBarAppending = false;
|
||||||
window->DC.MenuBarOffsetX = ImMax(window->WindowPadding.x, style.ItemSpacing.x);
|
window->DC.MenuBarOffsetX = ImMax(window->WindowPadding.x, style.ItemSpacing.x);
|
||||||
@ -11585,7 +11585,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
||||||
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
||||||
ImGui::BulletText("Active: %d, Accessed: %d", window->Active, window->Accessed);
|
ImGui::BulletText("Active: %d, Accessed: %d", window->Active, window->Accessed);
|
||||||
ImGui::BulletText("NavLastId: 0x%08x, NavLayerActiveFlags: %02X", window->NavLastId, window->DC.NavLayerActiveFlags);
|
ImGui::BulletText("NavLastId: 0x%08x, NavLayerActiveMask: %02X", window->NavLastId, window->DC.NavLayerActiveMask);
|
||||||
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
|
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
|
||||||
if (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, "ChildWindows");
|
if (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, "ChildWindows");
|
||||||
ImGui::BulletText("Storage: %d bytes", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair));
|
ImGui::BulletText("Storage: %d bytes", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair));
|
||||||
|
@ -662,7 +662,7 @@ struct IMGUI_API ImGuiDrawContext
|
|||||||
bool LastItemRectHoveredRect;
|
bool LastItemRectHoveredRect;
|
||||||
bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f)
|
bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f)
|
||||||
int NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
int NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
||||||
int NavLayerActiveFlags, NavLayerActiveFlagsNext; // Which layer have been written to.
|
int NavLayerActiveMask, NavLayerActiveMaskNext; // Which layer have been written to.
|
||||||
bool MenuBarAppending;
|
bool MenuBarAppending;
|
||||||
float MenuBarOffsetX;
|
float MenuBarOffsetX;
|
||||||
ImVector<ImGuiWindow*> ChildWindows;
|
ImVector<ImGuiWindow*> ChildWindows;
|
||||||
@ -705,7 +705,7 @@ struct IMGUI_API ImGuiDrawContext
|
|||||||
LastItemRect = ImRect();
|
LastItemRect = ImRect();
|
||||||
LastItemRectHoveredRect = false;
|
LastItemRectHoveredRect = false;
|
||||||
NavHasScroll = false;
|
NavHasScroll = false;
|
||||||
NavLayerActiveFlags = NavLayerActiveFlagsNext = 0x00;
|
NavLayerActiveMask = NavLayerActiveMaskNext = 0x00;
|
||||||
NavLayerCurrent = 0;
|
NavLayerCurrent = 0;
|
||||||
MenuBarAppending = false;
|
MenuBarAppending = false;
|
||||||
MenuBarOffsetX = 0.0f;
|
MenuBarOffsetX = 0.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user