-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemonstrationWindow.cpp
More file actions
72 lines (61 loc) · 1.63 KB
/
DemonstrationWindow.cpp
File metadata and controls
72 lines (61 loc) · 1.63 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "DemonstrationWindow.h"
#include<iostream>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "DemonstrationWindow"
DemonstrationWindow::DemonstrationWindow() :
BWindow(BRect(100,100,800,700),"Démonstrations",B_TITLED_WINDOW,B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
fHost(new BString("")),
fPort(0),
fServerWindow(NULL)
{
fMenuBar = new BMenuBar("menubar");
//Serveur
BMenu* menu = new BMenu("Serveur");
BMenuItem* item = new BMenuItem("New", new BMessage(kServerSettings), 'P');
menu->AddItem(item);
fMenuBar->AddItem(menu);
fSessionView = new SessionView("Session");
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(fMenuBar)
.Add(fSessionView)
.End();
}
DemonstrationWindow::~DemonstrationWindow() {
}
void DemonstrationWindow::MessageReceived(BMessage* message)
{
switch(message->what) {
case (kServerSettings): {
bool init = false;
if (!fServerWindow) {
init = true;
fServerWindow = new ServerWindow(*fHost, fPort, fLocal);
fServerWindow->AddToSubset(this);
}
fServerWindow->SetTarget(fSessionView);
fServerWindow->Show();
if(init) {
fServerWindow->Show();
} else {
fServerWindow->Activate();
}
if (fLocal)
fServerWindow->PostMessage(new BMessage(kLocalServer));
else
fServerWindow->PostMessage(new BMessage(kDistantServer));
break;
}
default:
BWindow::MessageReceived(message);
}
}
void DemonstrationWindow::ActiveButtons(bool activate) {
}
bool DemonstrationWindow::QuitRequested()
{
//TODO wait for receive thread
return true;
}
void DemonstrationWindow::SetServerWindow(ServerWindow* window) {
fServerWindow = window;
}