summaryrefslogtreecommitdiff
path: root/indra/newview/lltoastpanel.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-10-19 01:45:44 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-10-19 01:45:44 +0000
commit8103710c054ec6ea4a46f9732e569e543691184b (patch)
treeac03dd6d385e3345c57eff0e1064a011597fe5d6 /indra/newview/lltoastpanel.cpp
parent4ee757b45d527699b094bf9422244171fdd7d693 (diff)
Merging revisions 2046-2068 of https://svn.aws.productengine.com/secondlife/pe/stable-2 into P:\svn\viewer-2.0.0, respecting ancestry
* Bugs: EXT-1414 EXT-1213 EXT-1539 EXT-1253 EXT-1446 EXT-1438 EXT-1233 EXT-1466 EXT-1446 EXT-1512 EXT-1231 * Dev: EXT-719 (landmarks) EXT-747 EXT-1446 EXT-1378 EXT-397 EXT-1476 * IM changes
Diffstat (limited to 'indra/newview/lltoastpanel.cpp')
-rw-r--r--indra/newview/lltoastpanel.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp
index 7b477470aa..ef75e06047 100644
--- a/indra/newview/lltoastpanel.cpp
+++ b/indra/newview/lltoastpanel.cpp
@@ -34,6 +34,9 @@
#include "lltoastpanel.h"
+//static
+const S32 LLToastPanel::MIN_PANEL_HEIGHT = 40; // VPAD(4)*2 + ICON_HEIGHT(32)
+
LLToastPanel::LLToastPanel(LLNotificationPtr& notification)
{
mNotification = notification;
@@ -50,8 +53,13 @@ std::string LLToastPanel::getTitle()
}
//snap to the message height if it is visible
-void LLToastPanel::snapToMessageHeight(LLTextBox* message, S32 maxLineCount)
+void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
{
+ if(!message)
+ {
+ return;
+ }
+
//Add message height if it is visible
if (message->getVisible())
{
@@ -61,22 +69,16 @@ void LLToastPanel::snapToMessageHeight(LLTextBox* message, S32 maxLineCount)
LLRect messageRect = message->getRect();
S32 oldTextHeight = messageRect.getHeight();
- //Reshape the toast to give the message max height.
- //This needed to calculate lines count according to specified text
- heightDelta = maxTextHeight - oldTextHeight;
- reshape( getRect().getWidth(), getRect().getHeight() + heightDelta);
-
//Knowing the height is set to max allowed, getTextPixelHeight returns needed text height
//Perhaps we need to pass maxLineCount as parameter to getTextPixelHeight to avoid previous reshape.
- S32 requiredTextHeight = message->getTextPixelHeight();
+ S32 requiredTextHeight = message->getContentsRect().getHeight();
S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
//Calculate last delta height deducting previous heightDelta
heightDelta = newTextHeight - oldTextHeight - heightDelta;
//reshape the panel with new height
- reshape( getRect().getWidth(), getRect().getHeight() + heightDelta);
+ reshape( getRect().getWidth(), llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT));
}
-
}