Don't hardcode the NotificationView width to 300px.

This commit is contained in:
Alex Wilson
2012-04-01 11:54:23 +12:00
parent 2fab0e4804
commit c2fbfb1d58
2 changed files with 6 additions and 11 deletions
+5 -10
View File
@@ -516,24 +516,19 @@ NotificationView::MessageID() const
} }
BSize void
NotificationView::_CalculateSize() NotificationView::_CalculateSize()
{ {
BSize size; float height = fHeight;
size.width = 300;
size.height = fHeight;
if (fNotification->Type() == B_PROGRESS_NOTIFICATION) { if (fNotification->Type() == B_PROGRESS_NOTIFICATION) {
font_height fh; font_height fh;
be_plain_font->GetHeight(&fh); be_plain_font->GetHeight(&fh);
float fontHeight = fh.ascent + fh.descent + fh.leading; float fontHeight = fh.ascent + fh.descent + fh.leading;
size.height += 9 + (kSmallPadding * 2) + (kEdgePadding * 1) height += 9 + (kSmallPadding * 2) + (kEdgePadding * 1)
+ fontHeight * 2; + fontHeight * 2;
} }
SetExplicitMinSize(size); SetExplicitMinSize(BSize(0, height));
SetExplicitMaxSize(size); SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, height));
return size;
} }
+1 -1
View File
@@ -51,7 +51,7 @@ public:
const char* MessageID() const; const char* MessageID() const;
private: private:
BSize _CalculateSize(); void _CalculateSize();
struct LineInfo { struct LineInfo {
BFont font; BFont font;