https://github.com/libsdl-org/Maelstrom/commit/869f8d1f04e1ed146a5eda4ac963b86e7f9560f1
From 869f8d1f04e1ed146a5eda4ac963b86e7f9560f1 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 10 Dec 2012 05:03:37 -0800
Subject: [PATCH] See whether a panel is shown, identified by name.
---
screenlib/UIManager.cpp | 11 +++++++++++
screenlib/UIManager.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/screenlib/UIManager.cpp b/screenlib/UIManager.cpp
index 40199a3d..4c7f72a2 100644
--- a/screenlib/UIManager.cpp
+++ b/screenlib/UIManager.cpp
@@ -218,6 +218,17 @@ UIManager::GetCurrentPanel()
return NULL;
}
+bool
+UIManager::IsShown(const char *name) const
+{
+ for (int i = 0; i < m_panels.length(); ++i) {
+ if (strcmp(name, m_panels[i]->GetName()) == 0) {
+ return m_visible.find(m_panels[i]);
+ }
+ }
+ return false;
+}
+
bool
UIManager::IsShown(UIPanel *panel) const
{
diff --git a/screenlib/UIManager.h b/screenlib/UIManager.h
index 39a558dc..4e29335f 100644
--- a/screenlib/UIManager.h
+++ b/screenlib/UIManager.h
@@ -89,6 +89,7 @@ class UIManager : public UIArea, public UIFontInterface, public UIImageInterface
m_panels.remove(panel);
}
+ bool IsShown(const char *name) const;
bool IsShown(UIPanel *panel) const;
void ShowPanel(UIPanel *panel);
void ShowPanel(const char *name) {