summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2009-10-17 11:56:26 -0400
committerNat Goodspeed <nat@lindenlab.com>2009-10-17 11:56:26 -0400
commit2a5c25cb3a47a319559aae6de1206e91b3c1647e (patch)
treed0c18558f544ab747ca30dbfe2f36347374e0a80 /indra
parent050ae3cf5107140a58f6aeae865d254b74a23d44 (diff)
New LLFloater methods capture LLFloaterReg visibility tests.
The logic was redundantly expressed in LLFloaterReg -- and would be useful elsewhere -- so was introduced as LLFloater::isShown(). Thanks to Richard and James for suggesting the terminology.
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfloater.cpp10
-rw-r--r--indra/llui/llfloater.h8
-rw-r--r--indra/llui/llfloaterreg.cpp11
3 files changed, 19 insertions, 10 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 66defbbf0a..d7a24192bb 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2605,3 +2605,13 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o
moveResizeHandlesToFront();
}
+bool LLFloater::isShown() const
+{
+ return ! isMinimized() && isInVisibleChain();
+}
+
+/* static */
+bool LLFloater::isShown(const LLFloater* floater)
+{
+ return floater && floater->isShown();
+}
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 466d060068..ef609860d1 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -185,7 +185,13 @@ public:
void addDependentFloater(LLHandle<LLFloater> dependent_handle, BOOL reposition = TRUE);
LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); }
void removeDependentFloater(LLFloater* dependent);
- BOOL isMinimized() { return mMinimized; }
+ BOOL isMinimized() const { return mMinimized; }
+ /// isShown() differs from getVisible() in that isShown() also considers
+ /// isMinimized(). isShown() is true only if visible and not minimized.
+ bool isShown() const;
+ /// The static isShown() can accept a NULL pointer (which of course
+ /// returns false). When non-NULL, it calls the non-static isShown().
+ static bool isShown(const LLFloater* floater);
BOOL isFrontmost();
BOOL isDependent() { return !mDependeeHandle.isDead(); }
void setCanMinimize(BOOL can_minimize);
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 8617ba940e..589a34b2c8 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -247,7 +247,7 @@ bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key)
bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key)
{
LLFloater* instance = findInstance(name, key);
- if (instance && !instance->isMinimized() && instance->isInVisibleChain())
+ if (LLFloater::isShown(instance))
{
// When toggling *visibility*, close the host instead of the floater when hosted
if (instance->getHost())
@@ -267,14 +267,7 @@ bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key)
bool LLFloaterReg::instanceVisible(const std::string& name, const LLSD& key)
{
LLFloater* instance = findInstance(name, key);
- if (instance && !instance->isMinimized() && instance->isInVisibleChain())
- {
- return true;
- }
- else
- {
- return false;
- }
+ return LLFloater::isShown(instance);
}
//static