Debian Codegraph @

plugins/dm.objectives/ce/ReadableClosedComponentEditor.h

raw
1 #pragma once
2
3 #include "ComponentEditorBase.h"
4 #include "ComponentEditorFactory.h"
5 #include "SpecifierEditCombo.h"
6 #include "../ComponentType.h"
7
8 namespace objectives
9 {
10
11 namespace ce
12 {
13
14 /**
15 * ComponentEditor subclass for COMP_READABLE_CLOSED component type.
16 *
17 * This component requires that the player closes a certain readable
18 * (after having it opened before).
19 */
20 class ReadableClosedComponentEditor :
21 public ComponentEditorBase
22 {
23 private:
24 // Registration class
25 static struct RegHelper
26 {
27 RegHelper() {
28 ComponentEditorFactory::registerType(
29 objectives::ComponentType::COMP_READABLE_CLOSED().getName(),
30 ComponentEditorPtr(new ReadableClosedComponentEditor())
31 );
32 }
33 } regHelper;
34
35 // Component to edit
36 Component* _component;
37
38 // SpecifierEditCombo for the readable
39 SpecifierEditCombo* _readableSpec;
40
41 /**
42 * Construct a default ReadableClosedComponentEditor.
43 */
44 ReadableClosedComponentEditor() :
45 _component(NULL)
46 {}
47
48 /**
49 * Construct an ReadableClosedComponentEditor with a Component object to display and
50 * edit.
51 *
52 * @param component
53 * The Component to edit.
54 */
55 ReadableClosedComponentEditor(wxWindow* parent, Component& component);
56
57 public:
58 /* ComponentEditor implementation */
59
60 ComponentEditorPtr create(wxWindow* parent, Component& component) const
61 {
62 return ComponentEditorPtr(new ReadableClosedComponentEditor(parent, component));
63 }
64
65 void writeToComponent() const;
66 };
67
68 } // namespace ce
69
70 } // namespace objectives