diff options
Diffstat (limited to 'tracker_frame.cpp')
-rw-r--r-- | tracker_frame.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tracker_frame.cpp b/tracker_frame.cpp index b33cce9..d58dfe8 100644 --- a/tracker_frame.cpp +++ b/tracker_frame.cpp | |||
@@ -1,14 +1,21 @@ | |||
1 | #include "tracker_frame.h" | 1 | #include "tracker_frame.h" |
2 | 2 | ||
3 | #include "ap_state.h" | ||
4 | #include "connection_dialog.h" | ||
3 | #include "tracker_panel.h" | 5 | #include "tracker_panel.h" |
4 | 6 | ||
7 | enum TrackerFrameIds { ID_CONNECT = 1 }; | ||
8 | |||
5 | TrackerFrame::TrackerFrame() | 9 | TrackerFrame::TrackerFrame() |
6 | : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker") { | 10 | : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker") { |
7 | ::wxInitAllImageHandlers(); | 11 | ::wxInitAllImageHandlers(); |
8 | 12 | ||
13 | GetAPState().SetTrackerFrame(this); | ||
14 | |||
9 | SetSize(1280, 728); | 15 | SetSize(1280, 728); |
10 | 16 | ||
11 | wxMenu *menuFile = new wxMenu(); | 17 | wxMenu *menuFile = new wxMenu(); |
18 | menuFile->Append(ID_CONNECT, "&Connect"); | ||
12 | menuFile->Append(wxID_EXIT); | 19 | menuFile->Append(wxID_EXIT); |
13 | 20 | ||
14 | wxMenu *menuHelp = new wxMenu(); | 21 | wxMenu *menuHelp = new wxMenu(); |
@@ -25,13 +32,27 @@ TrackerFrame::TrackerFrame() | |||
25 | 32 | ||
26 | Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT); | 33 | Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT); |
27 | Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT); | 34 | Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT); |
35 | Bind(wxEVT_MENU, &TrackerFrame::OnConnect, this, ID_CONNECT); | ||
28 | 36 | ||
29 | new TrackerPanel(this); | 37 | new TrackerPanel(this); |
30 | } | 38 | } |
31 | 39 | ||
40 | void TrackerFrame::SetStatusMessage(std::string message) { | ||
41 | SetStatusText(message); | ||
42 | } | ||
43 | |||
32 | void TrackerFrame::OnAbout(wxCommandEvent &event) { | 44 | void TrackerFrame::OnAbout(wxCommandEvent &event) { |
33 | wxMessageBox("Lingo Archipelago Tracker by hatkirby", | 45 | wxMessageBox("Lingo Archipelago Tracker by hatkirby", |
34 | "About lingo-ap-tracker", wxOK | wxICON_INFORMATION); | 46 | "About lingo-ap-tracker", wxOK | wxICON_INFORMATION); |
35 | } | 47 | } |
36 | 48 | ||
37 | void TrackerFrame::OnExit(wxCommandEvent &event) { Close(true); } | 49 | void TrackerFrame::OnExit(wxCommandEvent &event) { Close(true); } |
50 | |||
51 | void TrackerFrame::OnConnect(wxCommandEvent &event) { | ||
52 | ConnectionDialog dlg; | ||
53 | |||
54 | if (dlg.ShowModal() == wxID_OK) { | ||
55 | GetAPState().Connect(dlg.GetServerValue(), dlg.GetPlayerValue(), | ||
56 | dlg.GetPasswordValue()); | ||
57 | } | ||
58 | } | ||