[haiku-commits] r35888 - haiku/trunk/src/kits/interface

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 17 Mar 2010 13:15:14 +0100 (CET)

Author: stippi
Date: 2010-03-17 13:15:14 +0100 (Wed, 17 Mar 2010)
New Revision: 35888
Changeset: http://dev.haiku-os.org/changeset/35888/haiku

Modified:
   haiku/trunk/src/kits/interface/TabView.cpp
Log:
Just realized that BTabViews don't have a BLayout set when not layouted. But
just in case someone calls the BSize methods on such a tab view, provide a fall
back implementation. This one should now also report the correct size, only
less efficient.


Modified: haiku/trunk/src/kits/interface/TabView.cpp
===================================================================
--- haiku/trunk/src/kits/interface/TabView.cpp  2010-03-17 12:10:05 UTC (rev 
35887)
+++ haiku/trunk/src/kits/interface/TabView.cpp  2010-03-17 12:15:14 UTC (rev 
35888)
@@ -1053,7 +1053,18 @@
 BSize
 BTabView::MinSize()
 {
-       BSize size = GetLayout()->MinSize();
+       BSize size;
+       if (GetLayout())
+               size = GetLayout()->MinSize();
+       else {
+               size = _TabsMinSize();
+               BSize containerSize = fContainerView->MinSize();
+               containerSize.width += 2 * _BorderWidth();
+               containerSize.height += _BorderWidth();
+               if (containerSize.width > size.width)
+                       size.width = containerSize.width;
+               size.height += containerSize.height;
+       }
        return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
 }
 
@@ -1061,7 +1072,18 @@
 BSize
 BTabView::MaxSize()
 {
-       BSize size = GetLayout()->MaxSize();
+       BSize size;
+       if (GetLayout())
+               size = GetLayout()->MaxSize();
+       else {
+               size = _TabsMinSize();
+               BSize containerSize = fContainerView->MaxSize();
+               containerSize.width += 2 * _BorderWidth();
+               containerSize.height += _BorderWidth();
+               if (containerSize.width > size.width)
+                       size.width = containerSize.width;
+               size.height += containerSize.height;
+       }
        return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
 }
 
@@ -1069,7 +1091,18 @@
 BSize
 BTabView::PreferredSize()
 {
-       BSize size = GetLayout()->PreferredSize();
+       BSize size;
+       if (GetLayout())
+               size = GetLayout()->PreferredSize();
+       else {
+               size = _TabsMinSize();
+               BSize containerSize = fContainerView->PreferredSize();
+               containerSize.width += 2 * _BorderWidth();
+               containerSize.height += _BorderWidth();
+               if (containerSize.width > size.width)
+                       size.width = containerSize.width;
+               size.height += containerSize.height;
+       }
        return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size);
 }
 


Other related posts:

  • » [haiku-commits] r35888 - haiku/trunk/src/kits/interface - superstippi