Debian Codegraph @

plugins/dm.objectives/ce/PickpocketComponentEditor.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_PICKPOCKET component type.
18 *
19 * An COMP_PICKPOCKET component uses a single specifier and one argument.
20 */
21 class PickpocketComponentEditor :
22 public ComponentEditorBase
23 {
24 // Registration class
25 static struct RegHelper
26 {
27 RegHelper() {
28 ComponentEditorFactory::registerType(
29 objectives::ComponentType::COMP_PICKPOCKET().getName(),
30 ComponentEditorPtr(new PickpocketComponentEditor())
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 with the amount of pickpockets
42 wxSpinCtrl* _amount;
43
44 /**
45 * Construct a default PickpocketComponentEditor.
46 */
47 PickpocketComponentEditor() :
48 _component(NULL),
49 _amount(NULL)
50 {}
51
52 /**
53 * Construct a PickpocketComponentEditor with a Component object to display and
54 * edit.
55 *
56 * @param component
57 * The Component to edit.
58 */
59 PickpocketComponentEditor(wxWindow* parent, Component& component);
60
61 public:
62 /* ComponentEditor implementation */
63
64 ComponentEditorPtr create(wxWindow* parent, Component& component) const
65 {
66 return ComponentEditorPtr(new PickpocketComponentEditor(parent, component));
67 }
68
69 void writeToComponent() const;
70 };
71
72 } // namespace ce
73
74 } // namespace objectives