summaryrefslogtreecommitdiff
path: root/indra/llui/lldockablefloater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lldockablefloater.cpp')
-rw-r--r--indra/llui/lldockablefloater.cpp59
1 files changed, 53 insertions, 6 deletions
diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index d0789d6502..29f78f6290 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -34,10 +34,14 @@
#include "lldockablefloater.h"
+//static
+LLDockableFloater* LLDockableFloater::instance = NULL;
+
LLDockableFloater::LLDockableFloater(LLDockControl* dockControl,
const LLSD& key, const Params& params) :
LLFloater(key, params), mDockControl(dockControl)
{
+ resetInstance();
}
LLDockableFloater::~LLDockableFloater()
@@ -51,23 +55,66 @@ BOOL LLDockableFloater::postBuild()
return LLView::postBuild();
}
+void LLDockableFloater::resetInstance()
+{
+ if (instance != this)
+ {
+ if (instance != NULL && instance->isDocked())
+ {
+ //closeFloater() is not virtual
+ if (instance->canClose())
+ {
+ instance->closeFloater();
+ }
+ else
+ {
+ instance->setVisible(FALSE);
+ }
+ }
+ instance = this;
+ }
+}
+
+void LLDockableFloater::setVisible(BOOL visible)
+{
+ if(visible && isDocked())
+ {
+ resetInstance();
+ }
+ LLFloater::setVisible(visible);
+}
+
void LLDockableFloater::setDocked(bool docked, bool pop_on_undock)
{
- if (docked)
+ if (mDockControl.get() != NULL)
{
- mDockControl.get()->on();
+ if (docked)
+ {
+ resetInstance();
+ mDockControl.get()->on();
+ }
+ else
+ {
+ mDockControl.get()->off();
+ }
}
- else
+
+ if (!docked && pop_on_undock)
{
- mDockControl.get()->off();
+ // visually pop up a little bit to emphasize the undocking
+ translate(0, UNDOCK_LEAP_HEIGHT);
}
+
LLFloater::setDocked(docked, pop_on_undock);
}
void LLDockableFloater::draw()
{
- mDockControl.get()->repositionDockable();
- mDockControl.get()->drawToungue();
+ if (mDockControl.get() != NULL)
+ {
+ mDockControl.get()->repositionDockable();
+ mDockControl.get()->drawToungue();
+ }
LLFloater::draw();
}