forked from Voidious/BerryBots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewmatch.h
132 lines (121 loc) · 4.33 KB
/
newmatch.h
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
Copyright (C) 2012-2015 - Voidious
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BB_NEW_MATCH
#define BB_NEW_MATCH
#include <wx/wx.h>
#include "menubarmaker.h"
class NewMatchListener {
public:
virtual void startMatch(const char *stagePath, char **teamPaths,
int numTeams) = 0;
virtual void previewStage(const char *stagePath) = 0;
virtual void refreshFiles() = 0;
virtual void onClose() = 0;
virtual void onEscape() = 0;
virtual void onUpdateUi() = 0;
virtual void reloadBaseDirs() = 0;
virtual ~NewMatchListener() {};
};
class NewMatchDialog : public wxFrame {
wxPanel *mainPanel_;
wxBoxSizer *mainSizer_;
wxBoxSizer *borderSizer_;
wxStaticText *stageLabel_;
wxStaticText *previewLabel_;
wxListBox *stageSelect_;
wxStaticText *shipsLabel_;
wxListBox *shipsSelect_;
wxButton *addArrow_;
wxButton *removeArrow_;
wxButton *clearButton_;
wxListBox *loadedShipsSelect_;
wxButton *startButton_;
wxButton *refreshButton_;
wxButton *basedirButton_;
wxButton *browseStagesButton_;
wxButton *browseShipsButton_;
wxButton *browseApidocsButton_;
wxStaticText *stagesDirLabel_;
wxStaticText *shipsDirLabel_;
wxStaticText *keyboardLabel_;
wxBitmap helpBitmap_;
wxBitmap folderHomeBitmap_;
int numStages_;
int numShips_;
int numLoadedShips_;
NewMatchListener *listener_;
MenuBarMaker *menuBarMaker_;
bool menusInitialized_;
wxEventFilter *eventFilter_;
public:
NewMatchDialog(NewMatchListener *listener, MenuBarMaker *menuBarMaker);
~NewMatchDialog();
wxBitmap loadBitmapIcon(std::string path, int size);
void clearStages();
void addStage(char *stage);
void clearShips();
void addShip(char *ship);
void onActivate(wxActivateEvent &event);
void onClose(wxCommandEvent &event);
void onAddShips(wxCommandEvent &event);
void addSelectedShips();
void onRemoveShips(wxCommandEvent &event);
void removeSelectedLoadedShips();
void removeStaleLoadedShips();
void onClearLoadedShips(wxCommandEvent &event);
void clearLoadedShips();
void onStartMatch(wxCommandEvent &event);
void startMatch();
void onRefreshFiles(wxCommandEvent &event);
void refreshFiles();
void onBrowseStages(wxCommandEvent &event);
void onBrowseShips(wxCommandEvent &event);
void onBrowseApidocs(wxCommandEvent &event);
void onChangeBaseDir(wxCommandEvent &event);
void onEscape();
void onSelectStage(wxUpdateUIEvent &event);
void onSelectShip(wxUpdateUIEvent &event);
void onSelectLoadedShip(wxUpdateUIEvent &event);
void onUpdateUi(wxUpdateUIEvent &event);
void onSetBaseDirs();
void previewSelectedStage();
void previewNextStage();
void previewPreviousStage();
void previewStage(int i);
bool stageSelectHasFocus();
bool shipsSelectHasFocus();
bool loadedShipsSelectHasFocus();
void validateButtons();
void validateButtonNonEmptyListBox(wxButton *button, wxListBox *listBox);
void validateButtonSelectedListBox(wxButton *button, wxListBox *listBox);
void setMnemonicLabels(bool modifierDown);
void focusStageSelect();
void selectStage(const char *stageName);
char** getStageNames();
char** getShipNames();
private:
char** getSelectStrings(wxListBox *listBox);
std::string condenseIfNecessary(std::string s);
};
class NewMatchEventFilter : public wxEventFilter {
NewMatchDialog *newMatchDialog_;
public:
NewMatchEventFilter(NewMatchDialog *newMatchDialog);
~NewMatchEventFilter();
virtual int FilterEvent(wxEvent& event);
};
#endif