[haiku-commits] haiku: hrev48044 - src/apps/haikudepot/ui

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 18 Oct 2014 22:58:00 +0200 (CEST)

hrev48044 adds 1 changeset to branch 'master'
old head: 0eb5978482fde54db1789252243c4de907d0264c
new head: 08f2b2b232372d486300cf9add89a35c8bf0d07e
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=08f2b2b+%5E0eb5978

----------------------------------------------------------------------------

08f2b2b: HaikuDepot: Restrict max width of links in package view

                                      [ Stephan Aßmus <superstippi@xxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev48044
Commit:      08f2b2b232372d486300cf9add89a35c8bf0d07e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=08f2b2b
Author:      Stephan Aßmus <superstippi@xxxxxx>
Date:        Sat Oct 18 20:50:48 2014 UTC

----------------------------------------------------------------------------

1 file changed, 23 insertions(+), 1 deletion(-)
src/apps/haikudepot/ui/PackageInfoView.cpp | 24 +++++++++++++++++++++++-

----------------------------------------------------------------------------

diff --git a/src/apps/haikudepot/ui/PackageInfoView.cpp 
b/src/apps/haikudepot/ui/PackageInfoView.cpp
index eb1b6e6..c562e3e 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))


Other related posts:

  • » [haiku-commits] haiku: hrev48044 - src/apps/haikudepot/ui - superstippi