summaryrefslogtreecommitdiff
path: root/indra/llui/llfloater.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2008-07-18 17:50:25 +0000
committerJames Cook <james@lindenlab.com>2008-07-18 17:50:25 +0000
commited386ae547c225e352c39e8d14921572ee534b0b (patch)
treef67ff767edfc07900c0c8c16cd4439eb38d05be0 /indra/llui/llfloater.cpp
parent292627c09df6085c985a189edd5df06d3ca1eb47 (diff)
merge support-featurettes-snapshot-merge-2 for QAR-754, includes:
* featurettes-4 89061:89589 (which is all of featurettes-1, -2, and -3, and part of -4) * gteam-showstoppers-3 91950:91951 (which is all of gteam-showstoppers-1, -2, and -3) * featurettes-5 92149:92150 (patch for last line of chat text not visible in chat history, DEV-17771) * snapshot-3 91988:91991 (which is all of snapshot-1, -2, and -3) Merging revisions 92190-92387 of svn+ssh://svn.lindenlab.com/svn/linden/branches/support-featurettes-snapshot-merge-2 into release, respecting ancestry * QAR-590 Merge Lock Request for Support Sprint * QAR-627 Merge snapshot improvements * QAR-686 Merge Lock request for Featurettes
Diffstat (limited to 'indra/llui/llfloater.cpp')
-rw-r--r--indra/llui/llfloater.cpp78
1 files changed, 31 insertions, 47 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 18ffbdfbcd..838f6fa193 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1082,38 +1082,37 @@ void LLFloater::removeDependentFloater(LLFloater* floaterp)
floaterp->mDependeeHandle = LLHandle<LLFloater>();
}
-// virtual
-BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask)
+BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButtons index)
{
- if( mMinimized )
+ if( mButtonsEnabled[index] )
{
- // Offer the click to the close button.
- if( mButtonsEnabled[BUTTON_CLOSE] )
- {
- S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft;
- S32 local_y = y - mButtons[BUTTON_CLOSE]->getRect().mBottom;
+ LLButton* my_butt = mButtons[index];
+ S32 local_x = x - my_butt->getRect().mLeft;
+ S32 local_y = y - my_butt->getRect().mBottom;
- if (mButtons[BUTTON_CLOSE]->pointInView(local_x, local_y)
- && mButtons[BUTTON_CLOSE]->handleMouseDown(local_x, local_y, mask))
- {
- // close button handled it, return
- return TRUE;
- }
- }
-
- // Offer the click to the restore button.
- if( mButtonsEnabled[BUTTON_RESTORE] )
+ if (
+ my_butt->pointInView(local_x, local_y) &&
+ my_butt->handleMouseDown(local_x, local_y, mask))
{
- S32 local_x = x - mButtons[BUTTON_RESTORE]->getRect().mLeft;
- S32 local_y = y - mButtons[BUTTON_RESTORE]->getRect().mBottom;
-
- if (mButtons[BUTTON_RESTORE]->pointInView(local_x, local_y)
- && mButtons[BUTTON_RESTORE]->handleMouseDown(local_x, local_y, mask))
- {
- // restore button handled it, return
- return TRUE;
- }
+ // the button handled it
+ return TRUE;
}
+ }
+ return FALSE;
+}
+
+// virtual
+BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask)
+{
+ if( mMinimized )
+ {
+ // Offer the click to titlebar buttons.
+ // Note: this block and the offerClickToButton helper method can be removed
+ // because the parent container will handle it for us but we'll keep it here
+ // for safety until after reworking the panel code to manage hidden children.
+ if(offerClickToButton(x, y, mask, BUTTON_CLOSE)) return TRUE;
+ if(offerClickToButton(x, y, mask, BUTTON_RESTORE)) return TRUE;
+ if(offerClickToButton(x, y, mask, BUTTON_TEAR_OFF)) return TRUE;
// Otherwise pass to drag handle for movement
return mDragHandle->handleMouseDown(x, y, mask);
@@ -1248,6 +1247,7 @@ void LLFloater::onClickTearOff(void *userdata)
LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get();
if (new_host)
{
+ self->setMinimized(FALSE); // to reenable minimize button if it was minimized
new_host->showFloater(self);
// make sure host is visible
new_host->open();
@@ -1420,31 +1420,15 @@ void LLFloater::draw()
void LLFloater::setCanMinimize(BOOL can_minimize)
{
- // removing minimize/restore button programmatically,
- // go ahead and uniminimize floater
+ // if removing minimize/restore button programmatically,
+ // go ahead and unminimize floater
if (!can_minimize)
{
setMinimized(FALSE);
}
- if (can_minimize)
- {
- if (isMinimized())
- {
- mButtonsEnabled[BUTTON_MINIMIZE] = FALSE;
- mButtonsEnabled[BUTTON_RESTORE] = TRUE;
- }
- else
- {
- mButtonsEnabled[BUTTON_MINIMIZE] = TRUE;
- mButtonsEnabled[BUTTON_RESTORE] = FALSE;
- }
- }
- else
- {
- mButtonsEnabled[BUTTON_MINIMIZE] = FALSE;
- mButtonsEnabled[BUTTON_RESTORE] = FALSE;
- }
+ mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized();
+ mButtonsEnabled[BUTTON_RESTORE] = can_minimize && isMinimized();
updateButtons();
}