Debian Codegraph @

plugins/dm.objectives/ce/CustomComponentEditor.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_CUSTOM_ASYNC component type.
16 *
17 * A COMP_CUSTOM_ASYNC component requires no specifiers, the state of these
18 * components are controlled manually (by script or trigger).
19 */
20 class CustomComponentEditor :
21 public ComponentEditorBase
22 {
23 // Registration class
24 static struct RegHelper
25 {
26 RegHelper() {
27 ComponentEditorFactory::registerType(
28 objectives::ComponentType::COMP_CUSTOM_ASYNC().getName(),
29 ComponentEditorPtr(new CustomComponentEditor())
30 );
31 }
32 } regHelper;
33
34 // Component to edit
35 Component* _component;
36
37 /**
38 * Construct a default CustomComponentEditor.
39 */
40 CustomComponentEditor() :
41 _component(NULL)
42 {}
43
44 /**
45 * Construct an CustomComponentEditor with a Component object to display and
46 * edit.
47 *
48 * @param component
49 * The Component to edit.
50 */
51 CustomComponentEditor(wxWindow* parent, Component& component);
52
53 public:
54 /* ComponentEditor implementation */
55
56 ComponentEditorPtr create(wxWindow* parent, Component& component) const
57 {
58 return ComponentEditorPtr(new CustomComponentEditor(parent, component));
59 }
60
61 void writeToComponent() const;
62 };
63
64 } // namespace ce
65
66 } // namespace objectives