xref: /haiku/src/kits/interface/GroupView.cpp (revision 50b3e74489a1a46fec88df793e4f6780e4de933c)
1 /*
2  * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <GroupView.h>
8 
9 
10 BGroupView::BGroupView(enum orientation orientation, float spacing)
11 	: BView(NULL, 0, new BGroupLayout(orientation, spacing))
12 {
13 	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
14 }
15 
16 
17 BGroupView::BGroupView(const char* name, enum orientation orientation,
18 	float spacing)
19 	: BView(name, 0, new BGroupLayout(orientation, spacing))
20 {
21 	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
22 }
23 
24 
25 BGroupView::~BGroupView()
26 {
27 }
28 
29 
30 void
31 BGroupView::SetLayout(BLayout* layout)
32 {
33 	// only BGroupLayouts are allowed
34 	if (!dynamic_cast<BGroupLayout*>(layout))
35 		return;
36 
37 	BView::SetLayout(layout);
38 }
39 
40 
41 BGroupLayout*
42 BGroupView::GroupLayout() const
43 {
44 	return dynamic_cast<BGroupLayout*>(GetLayout());
45 }
46