Supported flags: ImGuiPopupFlags_AnyPopupId, ImGuiPopupFlags_AnyPopupLevel
| 10467 | |
| 10468 | // Supported flags: ImGuiPopupFlags_AnyPopupId, ImGuiPopupFlags_AnyPopupLevel |
| 10469 | bool ImGui::IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags) |
| 10470 | { |
| 10471 | ImGuiContext& g = *GImGui; |
| 10472 | if (popup_flags & ImGuiPopupFlags_AnyPopupId) |
| 10473 | { |
| 10474 | // Return true if any popup is open at the current BeginPopup() level of the popup stack |
| 10475 | // This may be used to e.g. test for another popups already opened to handle popups priorities at the same level. |
| 10476 | IM_ASSERT(id == 0); |
| 10477 | if (popup_flags & ImGuiPopupFlags_AnyPopupLevel) |
| 10478 | return g.OpenPopupStack.Size > 0; |
| 10479 | else |
| 10480 | return g.OpenPopupStack.Size > g.BeginPopupStack.Size; |
| 10481 | } |
| 10482 | else |
| 10483 | { |
| 10484 | if (popup_flags & ImGuiPopupFlags_AnyPopupLevel) |
| 10485 | { |
| 10486 | // Return true if the popup is open anywhere in the popup stack |
| 10487 | for (int n = 0; n < g.OpenPopupStack.Size; n++) |
| 10488 | if (g.OpenPopupStack[n].PopupId == id) |
| 10489 | return true; |
| 10490 | return false; |
| 10491 | } |
| 10492 | else |
| 10493 | { |
| 10494 | // Return true if the popup is open at the current BeginPopup() level of the popup stack (this is the most-common query) |
| 10495 | return g.OpenPopupStack.Size > g.BeginPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].PopupId == id; |
| 10496 | } |
| 10497 | } |
| 10498 | } |
| 10499 | |
| 10500 | bool ImGui::IsPopupOpen(const char* str_id, ImGuiPopupFlags popup_flags) |
| 10501 | { |