-
Notifications
You must be signed in to change notification settings - Fork 8
/
CategorySettingWindow.cpp
57 lines (45 loc) Β· 1.55 KB
/
CategorySettingWindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* Copyright 2015 Your Name <your@email.address>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "CategorySettingWindow.h"
CategorySettingWindow::CategorySettingWindow(vector<BString> vCustomApps)
: BWindow(BRect(),"Category Settings"
,B_TITLED_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS ) {
ResizeTo(400,400);
CenterOnScreen();
buildLayout(vCustomApps);
}
void
CategorySettingWindow::buildLayout(vector<BString> vCustomApps) {
fCategoryMenu = new BPopUpMenu("Select Category..");
fCategoryMenu->AddItem(new BMenuItem("Appearance",
new BMessage(kSetCategory)));
fCategoryMenu->AddItem(new BMenuItem("Input/Output",
new BMessage(kSetCategory)));
fCategoryMenu->AddItem(new BMenuItem("Connectivity",
new BMessage(kSetCategory)));
fCategoryMenu->AddItem(new BMenuItem("System",
new BMessage(kSetCategory)));
fCategoryMenu->AddItem(new BMenuItem("Uncategorized",
new BMessage(kSetCategory)));
for(int i = 0; i<vCustomApps.size(); i++) {
string* str = new string(vCustomApps[i]);
*str += string(": ");
CategoryField = new BMenuField("Category",
str->c_str(), fCategoryMenu);
CategoryField->SetAlignment(B_ALIGN_RIGHT);
}
BButton* bUpdate = new BButton("Apply Changes");
fWindowView = new BView("Main Window View", 0);
BLayoutBuilder::Group<>(fWindowView, B_VERTICAL)
.SetInsets(B_USE_DEFAULT_SPACING)
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.Add(CategoryField)
.End()
.Add(bUpdate)
.End();
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.Add(fWindowView)
.End();
}