Debian Codegraph @

plugins/dm.objectives/ce/LocationComponentEditor.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_LOCATION component type.
16 *
17 * An COMP_LOCATION component usually uses a two specifiers.
18 */
19 class LocationComponentEditor :
20 public ComponentEditorBase
21 {
22 // Registration class
23 static struct RegHelper
24 {
25 RegHelper() {
26 ComponentEditorFactory::registerType(
27 objectives::ComponentType::COMP_LOCATION().getName(),
28 ComponentEditorPtr(new LocationComponentEditor())
29 );
30 }
31 } regHelper;
32
33 // Component to edit
34 Component* _component;
35
36 // SpecifierEditCombo for the entity in question
37 SpecifierEditCombo* _entSpec;
38
39 // SpecifierEditCombo for the location the entity should be in (or not)
40 SpecifierEditCombo* _locationSpec;
41
42 /**
43 * Construct a default LocationComponentEditor.
44 */
45 LocationComponentEditor() :
46 _component(NULL)
47 {}
48
49 /**
50 * Construct a LocationComponentEditor with a Component object to display and
51 * edit.
52 *
53 * @param component
54 * The Component to edit.
55 */
56 LocationComponentEditor(wxWindow* parent, Component& component);
57
58 public:
59 /* ComponentEditor implementation */
60
61 ComponentEditorPtr create(wxWindow* parent, Component& component) const
62 {
63 return ComponentEditorPtr(new LocationComponentEditor(parent, component));
64 }
65
66 void writeToComponent() const;
67 };
68
69 } // namespace ce
70
71 } // namespace objectives