Debian Codegraph @

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