Debian Codegraph @

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