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

  • From: aljen-mlists@xxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 11 Feb 2010 05:36:59 +0100 (CET)

Author: aljen
Date: 2010-02-11 05:36:59 +0100 (Thu, 11 Feb 2010)
New Revision: 35447
Changeset: http://dev.haiku-os.org/changeset/35447/haiku

Modified:
   haiku/trunk/src/kits/interface/Box.cpp
Log:
Fixed BBox behaviour when it has layout set and BView based class as a label


Modified: haiku/trunk/src/kits/interface/Box.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Box.cpp      2010-02-10 21:02:25 UTC (rev 
35446)
+++ haiku/trunk/src/kits/interface/Box.cpp      2010-02-11 04:36:59 UTC (rev 
35447)
@@ -551,21 +551,41 @@
        if (!(Flags() & B_SUPPORTS_LAYOUT))
                return;
 
-       // If the user set a layout, we let the base class version call its
-       // hook.
-       if (GetLayout()) {
+       bool layouted = GetLayout() ? true : false;
+
+       // If the user set a layout, let the base class version call its
+       // hook. In case when we have BView as a label, remove it from child 
list
+       // so it won't be layouted with the rest of views and add it again
+       // after that.
+       if (layouted) {
+               if (fLabelView)
+                       RemoveChild(fLabelView);
+
                BView::DoLayout();
-               return;
+
+               if (!fLabelView)
+                       return;
        }
 
+       // Add it again..
+       if (layouted && fLabelView)
+               AddChild(fLabelView, ChildAt(0));
+
        _ValidateLayoutData();
 
+       // Even if the user set a layout, restore label view to it's
+       // desired position.
+
        // layout the label view
        if (fLabelView) {
                fLabelView->MoveTo(fLayoutData->label_box.LeftTop());
                fLabelView->ResizeTo(fLayoutData->label_box.Size());
        }
 
+       // If we have layout return here and do not layout the child
+       if (layouted)
+               return;
+
        // layout the child
        if (BView* child = _Child()) {
                BRect frame(Bounds());


Other related posts:

  • » [haiku-commits] r35447 - haiku/trunk/src/kits/interface - aljen-mlists