From 08f2b2b232372d486300cf9add89a35c8bf0d07e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 18 Oct 2014 22:50:48 +0200 Subject: [PATCH] HaikuDepot: Restrict max width of links in package view --- src/apps/haikudepot/ui/PackageInfoView.cpp | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/apps/haikudepot/ui/PackageInfoView.cpp b/src/apps/haikudepot/ui/PackageInfoView.cpp index eb1b6e6c4a..c562e3e658 100644 --- a/src/apps/haikudepot/ui/PackageInfoView.cpp +++ b/src/apps/haikudepot/ui/PackageInfoView.cpp @@ -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))