MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / IsRootOfOpenMenuSet

Function IsRootOfOpenMenuSet

plugins/Cardinal/src/DearImGui/imgui_widgets.cpp:6871–6886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6869}
6870
6871static bool IsRootOfOpenMenuSet()
6872{
6873 ImGuiContext& g = *GImGui;
6874 ImGuiWindow* window = g.CurrentWindow;
6875 if ((g.OpenPopupStack.Size <= g.BeginPopupStack.Size) || (window->Flags & ImGuiWindowFlags_ChildMenu))
6876 return false;
6877
6878 // Initially we used 'OpenParentId' to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items) based on parent ID.
6879 // This would however prevent the use of e.g. PuhsID() user code submitting menus.
6880 // Previously this worked between popup and a first child menu because the first child menu always had the _ChildWindow flag,
6881 // making hovering on parent popup possible while first child menu was focused - but this was generally a bug with other side effects.
6882 // Instead we don't treat Popup specifically (in order to consistently support menu features in them), maybe the first child menu of a Popup
6883 // doesn't have the _ChildWindow flag, and we rely on this IsRootOfOpenMenuSet() check to allow hovering between root window/popup and first chilld menu.
6884 const ImGuiPopupData* upper_popup = &g.OpenPopupStack[g.BeginPopupStack.Size];
6885 return (/*upper_popup->OpenParentId == window->IDStack.back() &&*/ upper_popup->Window && (upper_popup->Window->Flags & ImGuiWindowFlags_ChildMenu));
6886}
6887
6888bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
6889{

Callers 2

BeginMenuExMethod · 0.85
MenuItemExMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected