mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-11 22:08:26 +00:00
16
imgui.cpp
16
imgui.cpp
@@ -6562,6 +6562,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window_stack_data.Window = window;
|
window_stack_data.Window = window;
|
||||||
window_stack_data.ParentLastItemDataBackup = g.LastItemData;
|
window_stack_data.ParentLastItemDataBackup = g.LastItemData;
|
||||||
window_stack_data.StackSizesOnBegin.SetToContextState(&g);
|
window_stack_data.StackSizesOnBegin.SetToContextState(&g);
|
||||||
|
window_stack_data.DisabledOverrideReenable = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;
|
||||||
g.CurrentWindowStack.push_back(window_stack_data);
|
g.CurrentWindowStack.push_back(window_stack_data);
|
||||||
if (flags & ImGuiWindowFlags_ChildMenu)
|
if (flags & ImGuiWindowFlags_ChildMenu)
|
||||||
g.BeginMenuDepth++;
|
g.BeginMenuDepth++;
|
||||||
@@ -6649,9 +6650,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
UpdateWindowSkipRefresh(window);
|
UpdateWindowSkipRefresh(window);
|
||||||
|
|
||||||
// Nested root windows (typically tooltips) override disabled state
|
// Nested root windows (typically tooltips) override disabled state
|
||||||
if (window->RootWindow == window)
|
if (window_stack_data.DisabledOverrideReenable && window->RootWindow == window)
|
||||||
if ((window->DC.BackupItemDisabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0))
|
BeginDisabledOverrideReenable();
|
||||||
BeginDisabledOverrideReenable();
|
|
||||||
|
|
||||||
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
|
// We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
|
||||||
g.CurrentWindow = NULL;
|
g.CurrentWindow = NULL;
|
||||||
@@ -7252,7 +7252,7 @@ void ImGui::End()
|
|||||||
IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size > 1, "Calling End() too many times!");
|
IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size > 1, "Calling End() too many times!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IM_ASSERT(g.CurrentWindowStack.Size > 0);
|
ImGuiWindowStackData& window_stack_data = g.CurrentWindowStack.back();
|
||||||
|
|
||||||
// Error checking: verify that user doesn't directly call End() on a child window.
|
// Error checking: verify that user doesn't directly call End() on a child window.
|
||||||
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||||
@@ -7264,7 +7264,7 @@ void ImGui::End()
|
|||||||
if (!window->SkipRefresh)
|
if (!window->SkipRefresh)
|
||||||
PopClipRect(); // Inner window clip rectangle
|
PopClipRect(); // Inner window clip rectangle
|
||||||
PopFocusScope();
|
PopFocusScope();
|
||||||
if (window->RootWindow == window && window->DC.BackupItemDisabled)
|
if (window_stack_data.DisabledOverrideReenable && window->RootWindow == window)
|
||||||
EndDisabledOverrideReenable();
|
EndDisabledOverrideReenable();
|
||||||
|
|
||||||
if (window->SkipRefresh)
|
if (window->SkipRefresh)
|
||||||
@@ -7281,12 +7281,12 @@ void ImGui::End()
|
|||||||
ErrorCheckUsingSetCursorPosToExtendParentBoundaries();
|
ErrorCheckUsingSetCursorPosToExtendParentBoundaries();
|
||||||
|
|
||||||
// Pop from window stack
|
// Pop from window stack
|
||||||
g.LastItemData = g.CurrentWindowStack.back().ParentLastItemDataBackup;
|
g.LastItemData = window_stack_data.ParentLastItemDataBackup;
|
||||||
if (window->Flags & ImGuiWindowFlags_ChildMenu)
|
if (window->Flags & ImGuiWindowFlags_ChildMenu)
|
||||||
g.BeginMenuDepth--;
|
g.BeginMenuDepth--;
|
||||||
if (window->Flags & ImGuiWindowFlags_Popup)
|
if (window->Flags & ImGuiWindowFlags_Popup)
|
||||||
g.BeginPopupStack.pop_back();
|
g.BeginPopupStack.pop_back();
|
||||||
g.CurrentWindowStack.back().StackSizesOnBegin.CompareWithContextState(&g);
|
window_stack_data.StackSizesOnBegin.CompareWithContextState(&g);
|
||||||
g.CurrentWindowStack.pop_back();
|
g.CurrentWindowStack.pop_back();
|
||||||
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
|
SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window);
|
||||||
}
|
}
|
||||||
@@ -10030,7 +10030,7 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
EndDisabledOverrideReenable();
|
EndDisabledOverrideReenable();
|
||||||
window->DC.BackupItemDisabled = false;
|
g.CurrentWindowStack.back().DisabledOverrideReenable = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (g.ColorStack.Size > stack_sizes->SizeOfColorStack)
|
while (g.ColorStack.Size > stack_sizes->SizeOfColorStack)
|
||||||
|
@@ -1243,7 +1243,8 @@ struct ImGuiWindowStackData
|
|||||||
{
|
{
|
||||||
ImGuiWindow* Window;
|
ImGuiWindow* Window;
|
||||||
ImGuiLastItemData ParentLastItemDataBackup;
|
ImGuiLastItemData ParentLastItemDataBackup;
|
||||||
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
||||||
|
bool DisabledOverrideReenable; // Non-child window override disabled flag
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiShrinkWidthItem
|
struct ImGuiShrinkWidthItem
|
||||||
@@ -2472,7 +2473,6 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
bool NavWindowHasScrollY; // Set per window when scrolling can be used (== ScrollMax.y > 0.0f)
|
bool NavWindowHasScrollY; // Set per window when scrolling can be used (== ScrollMax.y > 0.0f)
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
bool BackupItemDisabled; // Non-child window override disabled flag
|
|
||||||
bool MenuBarAppending; // FIXME: Remove this
|
bool MenuBarAppending; // FIXME: Remove this
|
||||||
ImVec2 MenuBarOffset; // 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.
|
ImVec2 MenuBarOffset; // 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.
|
||||||
ImGuiMenuColumns MenuColumns; // Simplified columns storage for menu items measurement
|
ImGuiMenuColumns MenuColumns; // Simplified columns storage for menu items measurement
|
||||||
|
Reference in New Issue
Block a user