Debian Codegraph @

plugins/dm.objectives/ce/KillComponentEditor.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 KILL component type.
18 *
19 * A KILL component requires that an AI must be killed. It can use all
20 * specifiers except SPEC_GROUP.
21 */
22 class KillComponentEditor
23 : public ComponentEditorBase
24 {
25 // Registration class
26 static struct RegHelper
27 {
28 RegHelper() {
29 ComponentEditorFactory::registerType(
30 objectives::ComponentType::COMP_KILL().getName(),
31 ComponentEditorPtr(new KillComponentEditor())
32 );
33 }
34 } regHelper;
35
36 // Component to edit
37 Component* _component;
38
39 // SpecifierEditCombo for the kill target
40 SpecifierEditCombo* _targetCombo;
41
42 // The spin button to specify the amount of AI to be killed
43 wxSpinCtrl* _amount;
44
45 /**
46 * Construct a default KillComponentEditor.
47 */
48 KillComponentEditor() :
49 _component(NULL),
50 _amount(NULL)
51 { }
52
53 /**
54 * Construct a KillComponentEditor with a Component object to display and
55 * edit.
56 *
57 * @param component
58 * The Component to edit.
59 */
60 KillComponentEditor(wxWindow* parent, Component& component);
61
62 public:
63 /* ComponentEditor implementation */
64
65 ComponentEditorPtr create(wxWindow* parent, Component& component) const
66 {
67 return ComponentEditorPtr(new KillComponentEditor(parent, component));
68 }
69
70 void writeToComponent() const;
71 };
72
73 }
74
75 }