summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2011-09-29 14:42:30 -0700
committerLeslie Linden <leslie@lindenlab.com>2011-09-29 14:42:30 -0700
commit896ea6f81eaf409aae22158816226f09a459ca34 (patch)
treef1992756f492fad8edd35137868099cf3cd60668 /indra
parent71ed326f51770b215ba5dd2ac8d159c3b764c2d2 (diff)
EXP-1278 FIX -- Implement 3-way toolbar button functionality
Toolbar buttons now affect their floaters as indicated in the FUI_Button_states wiki page -- https://wiki.lindenlab.com/wiki/FUI_Button_states
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfloaterreg.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index bc740dde17..8a0513f246 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -455,12 +455,42 @@ void LLFloaterReg::toggleFloaterInstance(const LLSD& sdname)
//static
void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname)
{
- // Do some extra logic here for 3-state toolbar floater toggling madness :)
-
+ //
+ // Floaters controlled by the toolbar behave a bit differently from others.
+ // Namely they have 3-4 states as defined in the design wiki page here:
+ // https://wiki.lindenlab.com/wiki/FUI_Button_states
+ //
+ // The basic idea is this:
+ // * If the target floater is minimized, this button press will un-minimize it.
+ // * Else if the target floater is closed open it.
+ // * Else if the target floater does not have focus, give it focus.
+ // * Also, if it is not on top, bring it forward when focus is given.
+ // * Else the target floater is open, close it.
+ //
+
+ // First parse the parameter
LLSD key;
std::string name = sdname.asString();
parse_name_key(name, key);
- toggleInstance(name, key);
+
+ LLFloater* instance = findInstance(name, key);
+
+ if (LLFloater::isMinimized(instance))
+ {
+ instance->setMinimized(FALSE);
+ }
+ else if (!LLFloater::isShown(instance))
+ {
+ showInstance(name, key, TRUE);
+ }
+ else if (!instance->hasFocus())
+ {
+ instance->setFocus(TRUE);
+ }
+ else
+ {
+ instance->closeFloater();
+ }
}
//static