mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57: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).
|
||||
g.WithinFrameScopeWithImplicitWindow = true;
|
||||
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);
|
||||
|
||||
// [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.
|
||||
bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags)
|
||||
{
|
||||
// FIXME-NEWBEGIN
|
||||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiStyle& style = g.Style;
|
||||
PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
||||
@ -6760,22 +6761,22 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
}
|
||||
|
||||
// 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,
|
||||
// allowing it to always be able to receive commands without crashing.
|
||||
if (!window->IsFallbackWindow)
|
||||
{
|
||||
if (window->IsFallbackWindow)
|
||||
return true;
|
||||
|
||||
if (window->Flags & ImGuiWindowFlags_Popup)
|
||||
EndPopup();
|
||||
else if (window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||
EndChild();
|
||||
else
|
||||
End();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5422,15 +5422,13 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
||||
|
||||
static bool show_config_info = false;
|
||||
ImGui::Checkbox("Config/Build Information", &show_config_info);
|
||||
if (show_config_info)
|
||||
{
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
|
||||
bool copy_to_clipboard = ImGui::Button("Copy to clipboard");
|
||||
ImVec2 child_size = ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18);
|
||||
ImGui::BeginChildFrame(ImGui::GetID("cfg_infos"), child_size, ImGuiWindowFlags_NoMove);
|
||||
|
||||
const bool copy_to_clipboard = show_config_info && ImGui::Button("Copy to clipboard");
|
||||
const ImVec2 child_size = ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18);
|
||||
if (show_config_info && ImGui::BeginChildFrame(ImGui::GetID("cfg_infos"), child_size, ImGuiWindowFlags_NoMove))
|
||||
{
|
||||
if (copy_to_clipboard)
|
||||
{
|
||||
ImGui::LogToClipboard();
|
||||
@ -5558,6 +5556,7 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
||||
ImGui::LogText("\n```\n");
|
||||
ImGui::LogFinish();
|
||||
}
|
||||
ImGui::EndChildFrame();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
@ -6131,7 +6131,7 @@ bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
|
||||
if (label_size.x > 0)
|
||||
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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user