xref: /haiku/src/apps/debuganalyzer/gui/AbstractGeneralPage.cpp (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
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 
12 AbstractGeneralPage::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 
28 AbstractGeneralPage::~AbstractGeneralPage()
29 {
30 }
31 
32 
33 /*!	Throws std::bad_alloc.
34  */
35 TextDataView*
36 AbstractGeneralPage::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