Author: yourpalal Date: 2010-07-29 02:25:12 +0200 (Thu, 29 Jul 2010) New Revision: 37799 Changeset: http://dev.haiku-os.org/changeset/37799 Modified: haiku/trunk/src/kits/interface/TabView.cpp Log: Update BTabView to initialize fContainerView to NULL before calling _InitContainerView() from _InitData(). This fixes a regression DeadYak pointed out to me on IRC. (thanks DeadYak, sorry everyone!) Also a bit of cleanup, improved _InitContainerView() to not AddChild(fContainerView) if it was not created. Also archive BTabView::fBorderStyle. Modified: haiku/trunk/src/kits/interface/TabView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TabView.cpp 2010-07-28 22:28:51 UTC (rev 37798) +++ haiku/trunk/src/kits/interface/TabView.cpp 2010-07-29 00:25:12 UTC (rev 37799) @@ -382,7 +382,8 @@ BTabView::BTabView(const char *name, button_width width, uint32 flags) - : BView(name, flags) + : + BView(name, flags) { _InitObject(true, width); } @@ -390,7 +391,8 @@ BTabView::BTabView(BRect frame, const char *name, button_width width, uint32 resizingMode, uint32 flags) - : BView(frame, name, resizingMode, flags) + : + BView(frame, name, resizingMode, flags) { _InitObject(false, width); } @@ -429,6 +431,9 @@ if (archive->FindInt32("_sel", &fSelection) != B_OK) fSelection = 0; + if (archive->FindInt32("_border_style", (int32*)&fBorderStyle) != B_OK) + fBorderStyle = B_FANCY_BORDER; + int32 i = 0; BMessage tabMsg; @@ -488,6 +493,8 @@ ret = archive->AddFloat("_high", fTabHeight); if (ret == B_OK) ret = archive->AddInt32("_sel", fSelection); + if (ret == B_OK && fBorderStyle != B_FANCY_BORDER) + ret = archive->AddInt32("_border_style", fBorderStyle); if (ret == B_OK && deep) { for (int32 i = 0; i < CountTabs(); i++) { @@ -1361,6 +1368,7 @@ GetFontHeight(&fh); fTabHeight = fh.ascent + fh.descent + fh.leading + 8.0f; + fContainerView = NULL; _InitContainerView(layouted); } @@ -1369,6 +1377,7 @@ BTabView::_InitContainerView(bool layouted) { bool needsLayout = false; + bool createdContainer = false; if (layouted) { if (!GetLayout()) { SetLayout(new(nothrow) BGroupLayout(B_HORIZONTAL)); @@ -1378,16 +1387,18 @@ if (!fContainerView) { fContainerView = new BView("view container", B_WILL_DRAW); fContainerView->SetLayout(new(std::nothrow) BCardLayout()); - needsLayout = true; + createdContainer = true; } } else if (!fContainerView) { fContainerView = new BView(Bounds(), "view container", B_FOLLOW_ALL, B_WILL_DRAW); - needsLayout= true; + createdContainer = true; } - if (needsLayout) { + if (needsLayout || createdContainer) _LayoutContainerView(layouted); + + if (createdContainer) { fContainerView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fContainerView->SetLowColor(fContainerView->ViewColor()); AddChild(fContainerView);