/
StimEditor.h
139 lines (114 loc) · 2.99 KB
/
StimEditor.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
133
134
135
136
137
138
139
#pragma once
#include "ClassEditor.h"
#include "wxutil/XmlResourceBasedWidget.h"
#include "wxutil/menu/PopupMenu.h"
#include <memory>
class wxCheckBox;
class wxStaticText;
class wxSpinCtrl;
class wxSpinCtrlDouble;
class wxMenu;
namespace ui
{
class StimEditor :
public ClassEditor,
private wxutil::XmlResourceBasedWidget
{
private:
struct PropertyWidgets
{
wxCheckBox* active;
wxCheckBox* useBounds;
wxCheckBox* radiusToggle;
wxSpinCtrl* radiusEntry;
wxCheckBox* finalRadiusToggle;
wxSpinCtrl* finalRadiusEntry;
wxCheckBox* timeIntToggle;
wxSpinCtrl* timeIntEntry;
wxStaticText* timeUnitLabel;
struct TimerWidgets
{
wxCheckBox* toggle;
wxPanel* entryHBox;
wxSpinCtrl* hour;
wxSpinCtrl* minute;
wxSpinCtrl* second;
wxSpinCtrl* millisecond;
wxCheckBox* typeToggle;
wxCheckBox* reloadToggle;
wxSpinCtrl* reloadEntry;
wxStaticText* reloadLabel;
wxPanel* reloadHBox;
wxCheckBox* waitToggle;
} timer;
wxCheckBox* durationToggle;
wxSpinCtrl* durationEntry;
wxStaticText* durationUnitLabel;
wxCheckBox* maxFireCountToggle;
wxSpinCtrl* maxFireCountEntry;
wxCheckBox* magnToggle;
wxSpinCtrl* magnEntry;
wxCheckBox* falloffToggle;
wxSpinCtrlDouble* falloffEntry;
wxCheckBox* chanceToggle;
wxSpinCtrlDouble* chanceEntry;
wxCheckBox* velocityToggle;
wxTextCtrl* velocityEntry;
struct BoundsWidgets
{
wxCheckBox* toggle;
wxPanel* panel;
wxStaticText* minLabel;
wxTextCtrl* minEntry;
wxStaticText* maxLabel;
wxTextCtrl* maxEntry;
} bounds;
} _propertyWidgets;
struct ListContextMenu
{
std::unique_ptr<wxMenu> menu;
wxMenuItem* remove;
wxMenuItem* add;
wxMenuItem* enable;
wxMenuItem* disable;
wxMenuItem* duplicate;
} _contextMenu;
wxWindow* _mainPanel;
public:
// Constructor is setting up the stim editing panel
StimEditor(wxWindow* mainPanel, StimTypes& stimTypes);
/** greebo: Sets the new entity (is called by the StimResponseEditor class)
*/
virtual void setEntity(const SREntityPtr& entity) override;
/** greebo: Updates the widgets (e.g. after a selection change)
*/
void update() override;
private:
/** greebo: Retrieves the formatted timer string h:m:s:ms
*/
std::string getTimerString();
/** greebo: Adds a new stim to the list
*/
void addSR() override;
/** greebo: Gets called when a spinbutton changes, overrides the
* method from the base class.
*/
void spinButtonChanged(wxSpinCtrl* ctrl) override;
/** greebo: Updates the associated text fields when a check box
* is toggled.
*/
void checkBoxToggled(wxCheckBox* toggleButton) override;
/** greebo: As the name states, this creates the context menu widgets.
*/
void createContextMenu();
/** greebo: Gets called when the stim selection gets changed
*/
virtual void selectionChanged() override;
void openSRListContextMenu() override;
void setupPage();
void setupEditPanel();
// Context menu callbacks
void onContextMenuAdd(wxCommandEvent& ev);
void onContextMenuDelete(wxCommandEvent& ev);
};
} // namespace ui