HaikuDepot: Allow RatingView to be wider than MinSize().

This commit is contained in:
Stephan Aßmus 2014-09-27 22:45:58 +02:00
parent 823d2b88e9
commit 63269a60e4

View File

@ -8,6 +8,8 @@
#include <stdio.h> #include <stdio.h>
#include <LayoutUtils.h>
RatingView::RatingView(const char* name) RatingView::RatingView(const char* name)
: :
@ -62,6 +64,7 @@ RatingView::Draw(BRect updateRect)
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_OVER);
BRect rect(Bounds()); BRect rect(Bounds());
rect.right = x - 2;
rect.left = ceilf(rect.left + (fRating / 5.0f) * rect.Width()); rect.left = ceilf(rect.left + (fRating / 5.0f) * rect.Width());
rgb_color color = LowColor(); rgb_color color = LowColor();
@ -76,21 +79,22 @@ RatingView::Draw(BRect updateRect)
BSize BSize
RatingView::MinSize() RatingView::MinSize()
{ {
return BSize(16 * 5 + 2 * 4, 16 + 2); BSize size(16 * 5 + 2 * 4, 16 + 2);
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
} }
BSize BSize
RatingView::PreferredSize() RatingView::PreferredSize()
{ {
return MinSize(); return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), MinSize());
} }
BSize BSize
RatingView::MaxSize() RatingView::MaxSize()
{ {
return MinSize(); return BLayoutUtils::ComposeSize(ExplicitMaxSize(), MinSize());
} }