-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.cpp
108 lines (87 loc) · 2.05 KB
/
MainWindow.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include "MainWindow.h"
#include "SignatureWindow.h"
const BRect rect(100,100,500,400);
MainWindow::MainWindow(void)
: BWindow(rect, B_TRANSLATE_SYSTEM_NAME("Student"),B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
fMenuBar = new BMenuBar("menubar");
BMenu *menu;
BMenuItem* item;
//Signatures
menu = new BMenu("Signatures");
item = new BMenuItem("New", new BMessage(kNewSignature), 'S');
menu->AddItem(item);
fMenuBar->AddItem(menu);
//Théories
menu = new BMenu("Théories");
item = new BMenuItem("New", new BMessage(kNewTheory), 'N');
menu->AddItem(item);
fMenuBar->AddItem(menu);
//Démonstrations
menu = new BMenu("Démonstrations");
item = new BMenuItem("New", new BMessage(kNouvelleDemonstration), 'D');
menu->AddItem(item);
fMenuBar->AddItem(menu);
//Latex
menu = new BMenu("LaTeX");
item = new BMenuItem("Saisie", new BMessage(kLatex), 'L');
menu->AddItem(item);
fMenuBar->AddItem(menu);
//A propos
//TODO
menu = new BMenu("A Propos");
fMenuBar->AddItem(menu);
menu->Invalidate();
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.Add(fMenuBar)
.AddGroup(B_VERTICAL)
.SetInsets(5, 5, 5, 5)
.AddGroup(B_HORIZONTAL)
;
}
void
MainWindow::MessageReceived(BMessage *msg)
{
switch (msg->what)
{
case (kLatex):
{
LWindow* lWindow = new LWindow();
lWindow->Show();
break;
}
case (kNewTheory):
{
TheorieWindow* theorieWindow = new TheorieWindow();
theorieWindow->Show();
break;
}
case (kNewSignature):
{
SignatureWindow* sigWindow = new SignatureWindow();
sigWindow->Show();
break;
}
case (kNouvelleDemonstration):
{
DemonstrationWindow* demonstrationWindow = new DemonstrationWindow();
demonstrationWindow->Show();
BMessage messageStatus;
messageStatus.what= kStatusChange;
messageStatus.AddString("status", "Not connected.");
demonstrationWindow->PostMessage(&messageStatus);
break;
}
default:
{
BWindow::MessageReceived(msg);
break;
}
}
}
bool
MainWindow::QuitRequested(void)
{
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}