mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-23 04:17:00 +00:00
Begin: WIP consistent Begin/End behavior, more fixes.
This commit is contained in:
parent
f4edca3e65
commit
1848480798
15
imgui.cpp
15
imgui.cpp
@ -4115,7 +4115,9 @@ void ImGui::NewFrame()
|
|||||||
// - The fallback window exceptionally doesn't call End() automatically if Begin() returns false (this is intended).
|
// - The fallback window exceptionally doesn't call End() automatically if Begin() returns false (this is intended).
|
||||||
g.WithinFrameScopeWithImplicitWindow = true;
|
g.WithinFrameScopeWithImplicitWindow = true;
|
||||||
SetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver);
|
SetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver);
|
||||||
Begin("Debug##Default");
|
bool ret = Begin("Debug##Default");
|
||||||
|
IM_UNUSED(ret);
|
||||||
|
IM_ASSERT(ret);
|
||||||
IM_ASSERT(g.CurrentWindow->IsFallbackWindow == true);
|
IM_ASSERT(g.CurrentWindow->IsFallbackWindow == true);
|
||||||
|
|
||||||
// [DEBUG] When io.ConfigDebugBeginReturnValue is set, we make Begin() return false at different level of the window stack to validate Begin()/End() behavior in user code.
|
// [DEBUG] When io.ConfigDebugBeginReturnValue is set, we make Begin() return false at different level of the window stack to validate Begin()/End() behavior in user code.
|
||||||
@ -5215,7 +5217,6 @@ void ImGui::EndChild()
|
|||||||
// Helper to create a child window / scrolling region that looks like a normal widget frame.
|
// Helper to create a child window / scrolling region that looks like a normal widget frame.
|
||||||
bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags)
|
bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags)
|
||||||
{
|
{
|
||||||
// FIXME-NEWBEGIN
|
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
const ImGuiStyle& style = g.Style;
|
const ImGuiStyle& style = g.Style;
|
||||||
PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
||||||
@ -6760,22 +6761,22 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME-OPT
|
// FIXME-OPT
|
||||||
if (window->SkipItems || g.DebugBeginReturnValueCullDepth == g.CurrentWindowStack.Size)
|
bool debug_skip = (g.DebugBeginReturnValueCullDepth == g.CurrentWindowStack.Size) && (window->Flags & ImGuiWindowFlags_DockNodeHost) == 0;
|
||||||
|
if (window->SkipItems || debug_skip)
|
||||||
{
|
{
|
||||||
// The implicit fallback is NOT automatically ended as an exception to the rule,
|
// The implicit fallback is NOT automatically ended as an exception to the rule,
|
||||||
// allowing it to always be able to receive commands without crashing.
|
// allowing it to always be able to receive commands without crashing.
|
||||||
if (!window->IsFallbackWindow)
|
if (window->IsFallbackWindow)
|
||||||
{
|
return true;
|
||||||
|
|
||||||
if (window->Flags & ImGuiWindowFlags_Popup)
|
if (window->Flags & ImGuiWindowFlags_Popup)
|
||||||
EndPopup();
|
EndPopup();
|
||||||
else if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
else if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||||
EndChild();
|
EndChild();
|
||||||
else
|
else
|
||||||
End();
|
End();
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5422,15 +5422,13 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
|||||||
|
|
||||||
static bool show_config_info = false;
|
static bool show_config_info = false;
|
||||||
ImGui::Checkbox("Config/Build Information", &show_config_info);
|
ImGui::Checkbox("Config/Build Information", &show_config_info);
|
||||||
if (show_config_info)
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
ImGuiStyle& style = ImGui::GetStyle();
|
||||||
|
const bool copy_to_clipboard = show_config_info && ImGui::Button("Copy to clipboard");
|
||||||
bool copy_to_clipboard = ImGui::Button("Copy to clipboard");
|
const ImVec2 child_size = ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18);
|
||||||
ImVec2 child_size = ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18);
|
if (show_config_info && ImGui::BeginChildFrame(ImGui::GetID("cfg_infos"), child_size, ImGuiWindowFlags_NoMove))
|
||||||
ImGui::BeginChildFrame(ImGui::GetID("cfg_infos"), child_size, ImGuiWindowFlags_NoMove);
|
{
|
||||||
|
|
||||||
if (copy_to_clipboard)
|
if (copy_to_clipboard)
|
||||||
{
|
{
|
||||||
ImGui::LogToClipboard();
|
ImGui::LogToClipboard();
|
||||||
@ -5558,6 +5556,7 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
|||||||
ImGui::LogText("\n```\n");
|
ImGui::LogText("\n```\n");
|
||||||
ImGui::LogFinish();
|
ImGui::LogFinish();
|
||||||
}
|
}
|
||||||
|
ImGui::EndChildFrame();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
@ -6131,7 +6131,7 @@ bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
|
|||||||
if (label_size.x > 0)
|
if (label_size.x > 0)
|
||||||
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
||||||
|
|
||||||
// FIXME-NEWBEGIN
|
// FIXME-NEWBEGIN: Use to be return true so we'll trigger more issues.
|
||||||
return BeginChildFrame(id, frame_bb.GetSize());
|
return BeginChildFrame(id, frame_bb.GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user