Debian Codegraph @

plugins/dm.objectives/ce/AIFindBodyComponentEditor.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 wxSpinCtrl;
9
10 namespace objectives
11 {
12
13 namespace ce
14 {
15
16 /**
17 * ComponentEditor subclass for COMP_AI_FIND_BODY component type.
18 *
19 * An COMP_AI_FIND_BODY component doesn't use specifiers.
20 */
21 class AIFindBodyComponentEditor :
22 public ComponentEditorBase
23 {
24 private:
25
26 // Registration class
27 static struct RegHelper
28 {
29 RegHelper() {
30 ComponentEditorFactory::registerType(
31 objectives::ComponentType::COMP_AI_FIND_BODY().getName(),
32 ComponentEditorPtr(new AIFindBodyComponentEditor())
33 );
34 }
35 } regHelper;
36
37 // Component to edit
38 Component* _component;
39
40 // SpecifierEditCombo for the body to be found
41 SpecifierEditCombo* _bodyCombo;
42
43 // The spin button to specify the amount of AI to be knocked out
44 wxSpinCtrl* _amount;
45
46 /**
47 * Construct a default AIFindBodyComponentEditor.
48 */
49 AIFindBodyComponentEditor() :
50 _component(NULL),
51 _amount(NULL)
52 {}
53
54 /**
55 * Construct a AIFindBodyComponentEditor with a Component object to display and
56 * edit.
57 *
58 * @param component
59 * The Component to edit.
60 */
61 AIFindBodyComponentEditor(wxWindow* parent, Component& component);
62
63 public:
64 // ComponentEditor implementation
65
66 ComponentEditorPtr create(wxWindow* parent, Component& component) const
67 {
68 return ComponentEditorPtr(new AIFindBodyComponentEditor(parent, component));
69 }
70
71 void writeToComponent() const;
72 };
73
74 } // namespace ce
75
76 } // namespace objectives