1 //MainControlWindow.cpp
2
3 #include <Application.h>
4 #include <Alert.h>
5 #include <Message.h>
6 #include <TranslatorRoster.h>
7 #include "WorkWindow.h"
8 #include "MainControlWindow.h"
9
MainControlWindow()10 MainControlWindow::MainControlWindow()
11 : BWindow(BRect(100, 100, 220, 230), "Multi Test", B_TITLED_WINDOW, B_WILL_DRAW)
12 {
13 fbtnAddView = new BButton(BRect(10, 10, 110, 60), "Add Test Window", "Add Test Window",
14 new BMessage(ADD_VIEW_BUTTON_ID));
15 AddChild(fbtnAddView);
16
17 fbtnAddTranslators = new BButton(BRect(10, 70, 110, 120), "Add Translators", "Add Translators",
18 new BMessage(ADD_TRANSLATORS_BUTTON_ID));
19 AddChild(fbtnAddTranslators);
20
21 for (int i = 0; i < 5; i++) {
22 WorkWindow *pWindow;
23 pWindow = new WorkWindow(BRect(100 + (10*i), 100, 300 + (10*i), 300));
24 pWindow->Show();
25 }
26 }
27
28 bool
QuitRequested()29 MainControlWindow::QuitRequested()
30 {
31 be_app->PostMessage(B_QUIT_REQUESTED);
32 return BWindow::QuitRequested();
33 }
34
35 void
MessageReceived(BMessage * pMsg)36 MainControlWindow::MessageReceived(BMessage *pMsg)
37 {
38 switch (pMsg->what) {
39 case ADD_VIEW_BUTTON_ID:
40 //BAlert *pAlert;
41 //pAlert = new BAlert("Title", "text", "OK");
42 //pAlert->Go();
43 WorkWindow *pWindow;
44 pWindow = new WorkWindow(BRect(100, 100, 300, 300));
45 pWindow->Show();
46 break;
47
48 case ADD_TRANSLATORS_BUTTON_ID:
49 BTranslatorRoster *pRoster;
50 pRoster = BTranslatorRoster::Default();
51 pRoster->AddTranslators();
52 break;
53
54 default:
55 BWindow::MessageReceived(pMsg);
56 break;
57 }
58 }
59