* 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
This commit is contained in:
Axel Dörfler 2010-05-07 15:08:27 +00:00
parent 7ea7d8a204
commit a77ec88a9d

View File

@ -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<typename ParentBuilder>
Group<ParentBuilder>::Group(BWindow* window, enum orientation orientation,
float spacing)
:
fLayout((new BGroupView(orientation, spacing))->GroupLayout())
fLayout(new BGroupLayout(orientation, spacing))
{
window->SetLayout(fLayout);
}
template<typename ParentBuilder>
Group<ParentBuilder>::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<typename ParentBuilder>
Grid<ParentBuilder>::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
}