* Added constructor that takes a name for the view.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36725 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-05-07 17:24:22 +00:00
parent 48e6f7c038
commit 542aff1be0
2 changed files with 17 additions and 5 deletions
+5 -1
View File
@@ -1,10 +1,11 @@
/* /*
* Copyright 2006, Haiku, Inc. All rights reserved. * Copyright 2006-2010, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _GROUP_VIEW_H #ifndef _GROUP_VIEW_H
#define _GROUP_VIEW_H #define _GROUP_VIEW_H
#include <GroupLayout.h> #include <GroupLayout.h>
#include <View.h> #include <View.h>
@@ -14,6 +15,9 @@ public:
BGroupView( BGroupView(
enum orientation orientation = B_HORIZONTAL, enum orientation orientation = B_HORIZONTAL,
float spacing = 0.0f); float spacing = 0.0f);
BGroupView(const char* name,
enum orientation orientation = B_HORIZONTAL,
float spacing = 0.0f);
virtual ~BGroupView(); virtual ~BGroupView();
virtual void SetLayout(BLayout* layout); virtual void SetLayout(BLayout* layout);
+12 -4
View File
@@ -3,22 +3,30 @@
* All rights reserved. Distributed under the terms of the MIT License. * All rights reserved. Distributed under the terms of the MIT License.
*/ */
#include <GroupView.h> #include <GroupView.h>
// constructor
BGroupView::BGroupView(enum orientation orientation, float spacing) BGroupView::BGroupView(enum orientation orientation, float spacing)
: BView(NULL, 0, new BGroupLayout(orientation, spacing)) : BView(NULL, 0, new BGroupLayout(orientation, spacing))
{ {
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
} }
// destructor
BGroupView::BGroupView(const char* name, enum orientation orientation,
float spacing)
: BView(name, 0, new BGroupLayout(orientation, spacing))
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
BGroupView::~BGroupView() BGroupView::~BGroupView()
{ {
} }
// SetLayout
void void
BGroupView::SetLayout(BLayout* layout) BGroupView::SetLayout(BLayout* layout)
{ {
@@ -29,7 +37,7 @@ BGroupView::SetLayout(BLayout* layout)
BView::SetLayout(layout); BView::SetLayout(layout);
} }
// GroupLayout
BGroupLayout* BGroupLayout*
BGroupView::GroupLayout() const BGroupView::GroupLayout() const
{ {