summaryrefslogtreecommitdiff
path: root/indra/llui/lldockablefloater.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-10-13 16:25:48 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-10-13 16:25:48 +0000
commit20e56a6925b4d4106059a73a22170beb5a38be1e (patch)
tree6b9d6dec9f628dfa1ab948cbfb10b86fe4cdc826 /indra/llui/lldockablefloater.cpp
parent330e635c2ce2ea0650226f56559cf1068df0320d (diff)
merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1992 https://svn.aws.productengine.com/secondlife/pe/stable-2@2004 -> viewer-2.0.0-3
* Bugs: EXT-1091 EXT-1418 EXT-996 EXT-1150 EXT-1188 EXT-1417 EXT-1181 EXT-1058 EXT-1397 EXT-836 EXT-1437 EXT-1379 * Dev: EXT-1291 EXT-1255 EXT-992 EXT-96 EXT-1157
Diffstat (limited to 'indra/llui/lldockablefloater.cpp')
-rw-r--r--indra/llui/lldockablefloater.cpp58
1 files changed, 54 insertions, 4 deletions
diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index c512ef25be..228d0e701f 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -33,24 +33,36 @@
#include "linden_common.h"
#include "lldockablefloater.h"
+#include "llfloaterreg.h"
//static
LLHandle<LLFloater> LLDockableFloater::sInstanceHandle;
+//static
+void LLDockableFloater::init(LLDockableFloater* thiz)
+{
+ thiz->setDocked(thiz->mDockControl.get() != NULL
+ && thiz->mDockControl.get()->isDockVisible());
+ thiz->resetInstance();
+
+ // all dockable floaters should have close, dock and minimize buttons
+ thiz->setCanClose(TRUE);
+ thiz->setCanDock(true);
+ thiz->setCanMinimize(TRUE);
+}
+
LLDockableFloater::LLDockableFloater(LLDockControl* dockControl,
const LLSD& key, const Params& params) :
LLFloater(key, params), mDockControl(dockControl), mUniqueDocking(true)
{
- setDocked(mDockControl.get() != NULL && mDockControl.get()->isDockVisible());
- resetInstance();
+ init(this);
}
LLDockableFloater::LLDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
const LLSD& key, const Params& params) :
LLFloater(key, params), mDockControl(dockControl), mUniqueDocking(uniqueDocking)
{
- setDocked(mDockControl.get() != NULL && mDockControl.get()->isDockVisible());
- resetInstance();
+ init(this);
}
LLDockableFloater::~LLDockableFloater()
@@ -64,6 +76,33 @@ BOOL LLDockableFloater::postBuild()
return LLView::postBuild();
}
+//static
+void LLDockableFloater::toggleInstance(const LLSD& sdname)
+{
+ LLSD key;
+ std::string name = sdname.asString();
+
+ LLDockableFloater* instance =
+ dynamic_cast<LLDockableFloater*> (LLFloaterReg::findInstance(name));
+ // if floater closed or docked
+ if (instance == NULL || instance != NULL && instance->isDocked())
+ {
+ LLFloaterReg::toggleInstance(name, key);
+ // restore button toggle state
+ if (instance != NULL)
+ {
+ instance->storeVisibilityControl();
+ }
+ }
+ // if floater undocked
+ else if (instance != NULL)
+ {
+ instance->setMinimized(FALSE);
+ instance->setVisible(TRUE);
+ instance->setFocus(TRUE);
+ }
+}
+
void LLDockableFloater::resetInstance()
{
if (mUniqueDocking && sInstanceHandle.get() != this)
@@ -91,6 +130,17 @@ void LLDockableFloater::setVisible(BOOL visible)
LLFloater::setVisible(visible);
}
+void LLDockableFloater::setMinimized(BOOL minimize)
+{
+ if(minimize && isDocked())
+ {
+ setVisible(FALSE);
+ }
+ setCanDock(!minimize);
+
+ LLFloater::setMinimized(minimize);
+}
+
void LLDockableFloater::onDockHidden()
{
setCanDock(FALSE);