Attention! BeginPopup() adds default flags which BeginPopupEx()!
| 9999 | |
| 10000 | // Attention! BeginPopup() adds default flags which BeginPopupEx()! |
| 10001 | bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags flags) |
| 10002 | { |
| 10003 | ImGuiContext& g = *GImGui; |
| 10004 | if (!IsPopupOpen(id, ImGuiPopupFlags_None)) |
| 10005 | { |
| 10006 | g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values |
| 10007 | return false; |
| 10008 | } |
| 10009 | |
| 10010 | char name[20]; |
| 10011 | if (flags & ImGuiWindowFlags_ChildMenu) |
| 10012 | ImFormatString(name, IM_ARRAYSIZE(name), "##Menu_%02d", g.BeginMenuCount); // Recycle windows based on depth |
| 10013 | else |
| 10014 | ImFormatString(name, IM_ARRAYSIZE(name), "##Popup_%08x", id); // Not recycling, so we can close/open during the same frame |
| 10015 | |
| 10016 | flags |= ImGuiWindowFlags_Popup; |
| 10017 | bool is_open = Begin(name, NULL, flags); |
| 10018 | if (!is_open) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display) |
| 10019 | EndPopup(); |
| 10020 | |
| 10021 | return is_open; |
| 10022 | } |
| 10023 | |
| 10024 | bool ImGui::BeginPopup(const char* str_id, ImGuiWindowFlags flags) |
| 10025 | { |
nothing calls this directly
no test coverage detected