1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 10:11:00 +01:00

WIP Menus: scrolling section of the window is clipped by the menu bar (#126)

This commit is contained in:
ocornut 2015-05-18 15:54:56 +01:00
parent a17c930d1f
commit 7184de24b8

View File

@ -3759,7 +3759,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.
const ImRect title_bar_rect = window->TitleBarRect();
ImVec4 clip_rect(title_bar_rect.Min.x+0.5f+window->WindowPadding().x*0.5f, title_bar_rect.Max.y+0.5f, window->Rect().Max.x+0.5f-window->WindowPadding().x*0.5f, window->Rect().Max.y-1.5f);
ImVec4 clip_rect(title_bar_rect.Min.x+0.5f+window->WindowPadding().x*0.5f, title_bar_rect.Max.y+window->MenuBarHeight()+0.5f, window->Rect().Max.x+0.5f-window->WindowPadding().x*0.5f, window->Rect().Max.y-1.5f);
if (window->ScrollbarY)
clip_rect.z -= style.ScrollbarWidth;
PushClipRect(clip_rect);
@ -7452,7 +7452,8 @@ bool ImGui::BeginMenuBar()
IM_ASSERT(!window->DC.MenuBarAppending);
window->DC.MenuBarAppending = true;
ImGui::PushID("##menubar");
ImRect rect = window->MenuBarRect();
PushClipRect(ImVec4(rect.Min.x+0.5f, rect.Min.y-0.5f, rect.Max.x+0.5f, rect.Max.y-1.5f), false);
return true;
}
@ -7465,6 +7466,7 @@ void ImGui::EndMenuBar()
IM_ASSERT(window->Flags & ImGuiWindowFlags_MenuBar);
IM_ASSERT(window->DC.MenuBarAppending);
window->DC.MenuBarAppending = false;
PopClipRect();
ImGui::PopID();
}