Use proper width for notification text

Fixes #10109.
This commit is contained in:
François Revol 2014-07-30 22:14:35 +02:00
parent 358a4dd379
commit 2a740449bb
1 changed files with 8 additions and 5 deletions

View File

@ -29,6 +29,8 @@
#include <Roster.h>
#include <StatusBar.h>
#include <Notifications.h>
#include "AppGroupView.h"
#include "NotificationWindow.h"
@ -101,8 +103,6 @@ NotificationView::NotificationView(NotificationWindow* win,
B_DARKEN_1_TINT);
break;
}
SetText();
}
@ -121,6 +121,8 @@ NotificationView::~NotificationView()
void
NotificationView::AttachedToWindow()
{
SetText();
BMessage msg(kRemoveView);
msg.AddPointer("view", this);
@ -431,9 +433,10 @@ NotificationView::GetSupportedSuites(BMessage* msg)
void
NotificationView::SetText(float newMaxWidth)
{
if (newMaxWidth < 0) {
newMaxWidth = 200;
}
if (newMaxWidth < 0 && Parent())
newMaxWidth = Parent()->Bounds().IntegerWidth();
if (newMaxWidth <= 0)
newMaxWidth = kDefaultWidth;
// Delete old lines
LineInfoList::iterator lIt;