Debian Codegraph @

plugins/dm.objectives/ce/CustomClockedComponentEditor.h

raw
1 #pragma once
2
3 #include "ComponentEditorBase.h"
4 #include "ComponentEditorFactory.h"
5 #include "SpecifierEditCombo.h"
6 #include "../ComponentType.h"
7
8 class wxSpinCtrlDouble;
9 class wxTextCtrl;
10
11 namespace objectives
12 {
13
14 namespace ce
15 {
16
17 /**
18 * ComponentEditor subclass for COMP_CUSTOM_CLOCKED component type.
19 *
20 * An COMP_CUSTOM_CLOCKED component requires no specifiers, just one arguments
21 * and a special spawnarg.
22 */
23 class CustomClockedComponentEditor :
24 public ComponentEditorBase
25 {
26 // Registration class
27 static struct RegHelper
28 {
29 RegHelper() {
30 ComponentEditorFactory::registerType(
31 objectives::ComponentType::COMP_CUSTOM_CLOCKED().getName(),
32 ComponentEditorPtr(new CustomClockedComponentEditor())
33 );
34 }
35 } regHelper;
36
37 // Component to edit
38 Component* _component;
39
40 // The text field for the script function name
41 wxTextCtrl* _scriptFunction;
42
43 // The spin button for the clock interval
44 wxSpinCtrlDouble* _interval;
45
46 /**
47 * Construct a default CustomClockedComponentEditor.
48 */
49 CustomClockedComponentEditor() :
50 _component(NULL),
51 _scriptFunction(NULL),
52 _interval(NULL)
53 {}
54
55 /**
56 * Construct an CustomClockedComponentEditor with a Component object to display and
57 * edit.
58 *
59 * @param component
60 * The Component to edit.
61 */
62 CustomClockedComponentEditor(wxWindow* parent, Component& component);
63
64 public:
65 /* ComponentEditor implementation */
66
67 ComponentEditorPtr create(wxWindow* parent, Component& component) const
68 {
69 return ComponentEditorPtr(new CustomClockedComponentEditor(parent, component));
70 }
71
72 void writeToComponent() const;
73 };
74
75 } // namespace ce
76
77 } // namespace objectives