1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5
6#include "AbstractGeneralPage.h"
7
8#include <GridLayoutBuilder.h>
9#include <GroupLayoutBuilder.h>
10
11
12AbstractGeneralPage::AbstractGeneralPage()
13	:
14	BGroupView(B_VERTICAL),
15	fDataView(NULL)
16{
17	SetName("General");
18
19	GroupLayout()->SetInsets(10, 10, 10, 10);
20
21	BGroupLayoutBuilder(this)
22		.Add(fDataView = new BGridView(10, 5))
23		.AddGlue()
24	;
25}
26
27
28AbstractGeneralPage::~AbstractGeneralPage()
29{
30}
31
32
33/*!	Throws std::bad_alloc.
34 */
35TextDataView*
36AbstractGeneralPage::AddDataView(const char* label, const char* text)
37{
38	BGridLayout* layout = fDataView->GridLayout();
39	int32 row = layout->CountRows();
40	layout->AddView(new LabelView(label), 0, row);
41
42	TextDataView* dataView = new TextDataView(text);
43	layout->AddView(dataView, 1, row);
44
45	return dataView;
46}
47