From a77ec88a9d444be0804db6f573b135fdbf324384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 7 May 2010 15:08:27 +0000 Subject: [PATCH] * Fixed Group(BWindow*, ...) and Grid(BWindow*, ...) constructors to no longer leak a view. * Also set the view's background color to B_PANEL_BACKGROUND_COLOR to make this better usable in applications. * Removed the admittedly useless Group(BView*, ...) constructor I introduced earlier. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36723 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/LayoutBuilder.h | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/headers/os/interface/LayoutBuilder.h b/headers/os/interface/LayoutBuilder.h index 4375293efd..cd2086b080 100644 --- a/headers/os/interface/LayoutBuilder.h +++ b/headers/os/interface/LayoutBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, Haiku, Inc. All rights reserved. + * Copyright 2009-2010, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LAYOUT_BUILDER_H @@ -56,9 +56,6 @@ public: inline Group(BWindow* window, enum orientation orientation = B_HORIZONTAL, float spacing = 0.0f); - inline Group(BView* window, - enum orientation orientation = B_HORIZONTAL, - float spacing = 0.0f); inline Group(BGroupLayout* layout); inline Group(BGroupView* view); @@ -243,19 +240,12 @@ template Group::Group(BWindow* window, enum orientation orientation, float spacing) : - fLayout((new BGroupView(orientation, spacing))->GroupLayout()) + fLayout(new BGroupLayout(orientation, spacing)) { window->SetLayout(fLayout); -} - -template -Group::Group(BView* view, enum orientation orientation, - float spacing) - : - fLayout((new BGroupView(orientation, spacing))->GroupLayout()) -{ - view->SetLayout(fLayout); + fLayout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + // TODO: we get a white background if we don't do this } @@ -442,9 +432,12 @@ template Grid::Grid(BWindow* window, float horizontalSpacing, float verticalSpacing) : - fLayout((new BGridView(horizontalSpacing, verticalSpacing))->GridLayout()) + fLayout(new BGridLayout(horizontalSpacing, verticalSpacing)) { window->SetLayout(fLayout); + + fLayout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + // TODO: we get a white background if we don't do this }