HaikuDepot: Restrict max width of links in package view

This commit is contained in:
Stephan Aßmus 2014-10-18 22:50:48 +02:00
parent 0eb5978482
commit 08f2b2b232

View File

@ -179,6 +179,8 @@ public:
fEnabled(true),
fMouseInside(false)
{
SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
SetExplicitMinSize(BSize(120, B_SIZE_UNSET));
_UpdateLinkColor();
}
@ -200,6 +202,27 @@ public:
Invoke(Message());
}
virtual void Draw(BRect updateRect)
{
if (Text() == NULL)
return;
SetLowColor(ViewColor());
font_height fontHeight;
GetFontHeight(&fontHeight);
BRect bounds = Bounds();
float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent)
- ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent);
float x = 0.0f;
BString text(Text());
TruncateString(&text, B_TRUNCATE_END, bounds.Width());
DrawString(text, BPoint(x, y));
}
void SetEnabled(bool enabled)
{
if (fEnabled != enabled) {
@ -817,7 +840,6 @@ public:
.Add(fWebsiteIconView, 0, 1)
.Add(fWebsiteLinkView, 1, 1)
.End()
.AddGlue()
.End()
.SetInsets(B_USE_DEFAULT_SPACING)
.SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET))