Calling ResizeToPreferred() on a BBox now honours its current size, IOW it won't get

any smaller due to this (before, a box without a label would resize itself to 0/0).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19919 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-23 17:27:32 +00:00
parent f9c52afd6a
commit 15e334974b
+11 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2006, Haiku, Inc.
* Copyright (c) 2001-2007, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
@@ -360,7 +360,16 @@ BBox::ResolveSpecifier(BMessage *message, int32 index,
void
BBox::ResizeToPreferred()
{
BView::ResizeToPreferred();
float width, height;
GetPreferredSize(&width, &height);
// make sure the box don't get smaller than it already is
if (width < Bounds().Width())
width = Bounds().Width();
if (height < Bounds().Height())
height = Bounds().Height();
BView::ResizeTo(width, height);
}