mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
WIP Menus: Fixed some alignment issues with non standard styles. Tweaked menu-bar color (#126)
This commit is contained in:
parent
14bcfef041
commit
292f08b11e
13
imgui.cpp
13
imgui.cpp
@ -597,7 +597,7 @@ ImGuiStyle::ImGuiStyle()
|
|||||||
Colors[ImGuiCol_FrameBgActive] = ImVec4(0.90f, 0.65f, 0.65f, 0.45f);
|
Colors[ImGuiCol_FrameBgActive] = ImVec4(0.90f, 0.65f, 0.65f, 0.45f);
|
||||||
Colors[ImGuiCol_TitleBg] = ImVec4(0.50f, 0.50f, 1.00f, 0.45f);
|
Colors[ImGuiCol_TitleBg] = ImVec4(0.50f, 0.50f, 1.00f, 0.45f);
|
||||||
Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.40f, 0.40f, 0.80f, 0.20f);
|
Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.40f, 0.40f, 0.80f, 0.20f);
|
||||||
Colors[ImGuiCol_MenuBarBg] = ImVec4(0.35f, 0.35f, 0.45f, 0.55f);
|
Colors[ImGuiCol_MenuBarBg] = ImVec4(0.40f, 0.40f, 0.55f, 0.60f);
|
||||||
Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.40f, 0.40f, 0.80f, 0.15f);
|
Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.40f, 0.40f, 0.80f, 0.15f);
|
||||||
Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.80f, 0.30f);
|
Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.80f, 0.30f);
|
||||||
Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.80f, 0.40f);
|
Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.80f, 0.40f);
|
||||||
@ -3480,9 +3480,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_auto_fit = ImClamp(window->SizeContents + window_padding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - window_padding));
|
size_auto_fit = ImClamp(window->SizeContents + window_padding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - window_padding));
|
||||||
if (size_auto_fit.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
|
if (size_auto_fit.y + style.ItemSpacing.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar))
|
||||||
size_auto_fit.x += style.ScrollbarWidth;
|
size_auto_fit.x += style.ScrollbarWidth;
|
||||||
size_auto_fit.y -= style.ItemSpacing.y;
|
size_auto_fit.y = ImMax(size_auto_fit.y - style.ItemSpacing.y, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle automatic resize
|
// Handle automatic resize
|
||||||
@ -3654,7 +3654,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Scrollbar
|
// Scrollbar
|
||||||
window->ScrollbarY = (window->SizeContents.y > window->Size.y) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
window->ScrollbarY = (window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
||||||
|
|
||||||
// Window background
|
// Window background
|
||||||
if (bg_alpha > 0.0f)
|
if (bg_alpha > 0.0f)
|
||||||
@ -3725,7 +3725,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
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.MenuBarAppending = false;
|
window->DC.MenuBarAppending = false;
|
||||||
window->DC.MenuBarOffsetX = window->DC.ColumnsStartX;
|
window->DC.MenuBarOffsetX = ImMax(window->DC.ColumnsStartX, style.ItemSpacing.x);
|
||||||
window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;
|
window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;
|
||||||
window->DC.ChildWindows.resize(0);
|
window->DC.ChildWindows.resize(0);
|
||||||
window->DC.ItemWidth.resize(0);
|
window->DC.ItemWidth.resize(0);
|
||||||
@ -7478,6 +7478,7 @@ bool ImGui::BeginMainMenuBar()
|
|||||||
ImGui::PopStyleVar(2);
|
ImGui::PopStyleVar(2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
g.CurrentWindow->DC.MenuBarOffsetX += g.Style.DisplaySafeAreaPadding.x;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7541,7 +7542,7 @@ bool ImGui::BeginMenu(const char* label)
|
|||||||
{
|
{
|
||||||
// FIXME: Should be moved at a lower-level once we have horizontal layout (#97)
|
// FIXME: Should be moved at a lower-level once we have horizontal layout (#97)
|
||||||
pos = window->DC.CursorPos = ImVec2(window->Pos.x + window->DC.MenuBarOffsetX, window->Pos.y + window->TitleBarHeight() + style.FramePadding.y);
|
pos = window->DC.CursorPos = ImVec2(window->Pos.x + window->DC.MenuBarOffsetX, window->Pos.y + window->TitleBarHeight() + style.FramePadding.y);
|
||||||
popup_pos = ImVec2(pos.x - style.ItemSpacing.x, pos.y);
|
popup_pos = ImVec2(pos.x - window->WindowPadding().x, pos.y);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
|
||||||
float w = label_size.x;
|
float w = label_size.x;
|
||||||
pressed = SelectableEx(label, opened, ImVec2(w, 0.0f), ImVec2(w, 0.0f), true);
|
pressed = SelectableEx(label, opened, ImVec2(w, 0.0f), ImVec2(w, 0.0f), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user