Attention! BeginPopup() adds default flags which BeginPopupEx()!
| 10460 | |
| 10461 | // Attention! BeginPopup() adds default flags which BeginPopupEx()! |
| 10462 | bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags flags) |
| 10463 | { |
| 10464 | ImGuiContext& g = *GImGui; |
| 10465 | if (!IsPopupOpen(id, ImGuiPopupFlags_None)) |
| 10466 | { |
| 10467 | g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values |
| 10468 | return false; |
| 10469 | } |
| 10470 | |
| 10471 | char name[20]; |
| 10472 | if (flags & ImGuiWindowFlags_ChildMenu) |
| 10473 | ImFormatString(name, IM_ARRAYSIZE(name), "##Menu_%02d", g.BeginMenuCount); // Recycle windows based on depth |
| 10474 | else |
| 10475 | ImFormatString(name, IM_ARRAYSIZE(name), "##Popup_%08x", id); // Not recycling, so we can close/open during the same frame |
| 10476 | |
| 10477 | flags |= ImGuiWindowFlags_Popup; |
| 10478 | bool is_open = Begin(name, NULL, flags); |
| 10479 | if (!is_open) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display) |
| 10480 | EndPopup(); |
| 10481 | |
| 10482 | return is_open; |
| 10483 | } |
| 10484 | |
| 10485 | bool ImGui::BeginPopup(const char* str_id, ImGuiWindowFlags flags) |
| 10486 | { |
nothing calls this directly
no test coverage detected