summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp15
-rw-r--r--indra/llui/llbutton.h1
-rw-r--r--indra/llui/lldockablefloater.cpp58
-rw-r--r--indra/llui/lldockablefloater.h10
-rw-r--r--indra/llui/llfloater.cpp5
-rw-r--r--indra/llui/lltextbase.cpp3
-rw-r--r--indra/llui/llui.cpp3
7 files changed, 89 insertions, 6 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 219c2ee254..f28fca35c5 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -52,6 +52,7 @@
#include "llrender.h"
#include "lluictrlfactory.h"
#include "llhelp.h"
+#include "lldockablefloater.h"
static LLDefaultChildRegistry::Register<LLButton> r("button");
@@ -1057,6 +1058,20 @@ void LLButton::setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname)
}
// static
+void LLButton::setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname)
+{
+ LLButton* button = dynamic_cast<LLButton*>(ctrl);
+ if (!button)
+ return;
+ // Get the visibility control name for the floater
+ std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString());
+ // Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
+ button->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name));
+ // Set the clicked callback to toggle the floater
+ button->setClickedCallback(boost::bind(&LLDockableFloater::toggleInstance, sdname));
+}
+
+// static
void LLButton::showHelp(LLUICtrl* ctrl, const LLSD& sdname)
{
// search back through the button's parents for a panel
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 73ba457d34..7ca520b935 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -232,6 +232,7 @@ public:
static void onHeldDown(void *userdata); // to be called by gIdleCallbacks
static void toggleFloaterAndSetToggleState(LLUICtrl* ctrl, const LLSD& sdname);
static void setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname);
+ static void setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname);
static void showHelp(LLUICtrl* ctrl, const LLSD& sdname);
void setForcePressedState(BOOL b) { mForcePressedState = b; }
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);
diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index 7d91d007ee..499ce9ae8d 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -44,6 +44,8 @@
class LLDockableFloater : public LLFloater
{
static const U32 UNDOCK_LEAP_HEIGHT = 12;
+
+ static void init(LLDockableFloater* thiz);
public:
LOG_CLASS(LLDockableFloater);
LLDockableFloater(LLDockControl* dockControl, const LLSD& key,
@@ -54,6 +56,8 @@ public:
static LLHandle<LLFloater> getInstanceHandle() { return sInstanceHandle; }
+ static void toggleInstance(const LLSD& sdname);
+
/**
* If descendant class overrides postBuild() in order to perform specific
* construction then it must still invoke its superclass' implementation.
@@ -68,6 +72,12 @@ public:
*/
/*virtual*/ void setVisible(BOOL visible);
+ /**
+ * If descendant class overrides setMinimized() then it must still invoke its
+ * superclass' implementation.
+ */
+ /*virtual*/ void setMinimized(BOOL minimize);
+
virtual void onDockHidden();
virtual void onDockShown();
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 51e2b5dea4..8d2783db20 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -926,6 +926,9 @@ void LLFloater::setMinimized(BOOL minimize)
if (minimize)
{
+ // minimized flag should be turned on before release focus
+ mMinimized = TRUE;
+
mExpandedRect = getRect();
// If the floater has been dragged while minimized in the
@@ -987,8 +990,6 @@ void LLFloater::setMinimized(BOOL minimize)
}
}
- mMinimized = TRUE;
-
// Reshape *after* setting mMinimized
reshape( minimized_width, floater_header_size, TRUE);
}
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 123e59ae6a..e85bee7775 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -415,6 +415,9 @@ void LLTextBase::drawCursor()
return;
}
+ if (!mTextRect.contains(cursor_rect))
+ return;
+
// Draw the cursor
// (Flash the cursor every half second starting a fixed time after the last keystroke)
F32 elapsed = mCursorBlinkTimer.getElapsedTimeF32();
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index c89e5944fa..9a90ee267e 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1556,6 +1556,9 @@ void LLUI::initClass(const settings_map_t& settings,
// Button initialization callback for toggle buttons
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.SetFloaterToggle", boost::bind(&LLButton::setFloaterToggle, _1, _2));
+ // Button initialization callback for toggle buttons on dockale floaters
+ LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.SetDockableFloaterToggle", boost::bind(&LLButton::setDockableFloaterToggle, _1, _2));
+
// Display the help topic for the current context
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.ShowHelp", boost::bind(&LLButton::showHelp, _1, _2));