mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-29 01:19:02 +08:00
BeginCombo(), BeginMainMenuBar(), BeginChildFrame(): restore modified style at end of Begin instead of End so doesn't affect child windows, BeginTooltip() etc.. (allowed since 7b6b7038c5
)
This commit is contained in:
parent
bef0a13283
commit
09ea376a6a
19
imgui.cpp
19
imgui.cpp
@ -5320,14 +5320,15 @@ bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags ext
|
|||||||
PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
|
PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
|
||||||
PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
|
PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
|
||||||
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
||||||
return BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);
|
bool ret = BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);
|
||||||
|
PopStyleVar(3);
|
||||||
|
PopStyleColor();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::EndChildFrame()
|
void ImGui::EndChildFrame()
|
||||||
{
|
{
|
||||||
EndChild();
|
EndChild();
|
||||||
PopStyleVar(3);
|
|
||||||
PopStyleColor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save and compare stack sizes on Begin()/End() to detect usage errors
|
// Save and compare stack sizes on Begin()/End() to detect usage errors
|
||||||
@ -11065,13 +11066,13 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Horizontally align ourselves with the framed text
|
// Horizontally align ourselves with the framed text
|
||||||
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
|
|
||||||
|
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;
|
||||||
if (!Begin(name, NULL, window_flags))
|
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
|
||||||
|
bool ret = Begin(name, NULL, window_flags);
|
||||||
|
PopStyleVar();
|
||||||
|
if (!ret)
|
||||||
{
|
{
|
||||||
EndPopup();
|
EndPopup();
|
||||||
PopStyleVar();
|
|
||||||
IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
|
IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -11081,7 +11082,6 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
|
|||||||
void ImGui::EndCombo()
|
void ImGui::EndCombo()
|
||||||
{
|
{
|
||||||
EndPopup();
|
EndPopup();
|
||||||
PopStyleVar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Old API, prefer using BeginCombo() nowadays if you can.
|
// Old API, prefer using BeginCombo() nowadays if you can.
|
||||||
@ -11436,11 +11436,11 @@ bool ImGui::BeginMainMenuBar()
|
|||||||
PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0,0));
|
PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0,0));
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar;
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar;
|
||||||
bool is_open = Begin("##MainMenuBar", NULL, window_flags) && BeginMenuBar();
|
bool is_open = Begin("##MainMenuBar", NULL, window_flags) && BeginMenuBar();
|
||||||
|
PopStyleVar(2);
|
||||||
g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
|
g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
|
||||||
if (!is_open)
|
if (!is_open)
|
||||||
{
|
{
|
||||||
End();
|
End();
|
||||||
PopStyleVar(2);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -11456,7 +11456,6 @@ void ImGui::EndMainMenuBar()
|
|||||||
FocusFrontMostActiveWindow(g.NavWindow);
|
FocusFrontMostActiveWindow(g.NavWindow);
|
||||||
|
|
||||||
End();
|
End();
|
||||||
PopStyleVar(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::BeginMenuBar()
|
bool ImGui::BeginMenuBar()
|
||||||
|
Loading…
Reference in New Issue
Block a user