Debian Codegraph @

plugins/dm.objectives/ce/DistanceComponentEditor.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 wxTextCtrl;
9 class wxSpinCtrl;
10 class wxSpinCtrlDouble;
11
12 namespace objectives
13 {
14
15 namespace ce
16 {
17
18 /**
19 * ComponentEditor subclass for COMP_DISTANCE component type.
20 *
21 * An COMP_DISTANCE component usually uses a two specifiers.
22 */
23 class DistanceComponentEditor :
24 public ComponentEditorBase
25 {
26 // Registration class
27 static struct RegHelper
28 {
29 RegHelper() {
30 ComponentEditorFactory::registerType(
31 objectives::ComponentType::COMP_DISTANCE().getName(),
32 ComponentEditorPtr(new DistanceComponentEditor())
33 );
34 }
35 } regHelper;
36
37 // Component to edit
38 Component* _component;
39
40 // Name of the entity in question
41 wxTextCtrl* _entity;
42
43 // Name of the location entity
44 wxTextCtrl* _location;
45
46 // The distance between these two
47 wxSpinCtrl* _distance;
48
49 // The evaluation interval in seconds
50 wxSpinCtrlDouble* _interval;
51
52 /**
53 * Construct a default DistanceComponentEditor.
54 */
55 DistanceComponentEditor() :
56 _component(NULL),
57 _entity(NULL),
58 _location(NULL),
59 _distance(NULL),
60 _interval(NULL)
61 {}
62
63 /**
64 * Construct a DistanceComponentEditor with a Component object to display and
65 * edit.
66 *
67 * @param component
68 * The Component to edit.
69 */
70 DistanceComponentEditor(wxWindow* parent, Component& component);
71
72 public:
73 /* ComponentEditor implementation */
74
75 ComponentEditorPtr create(wxWindow* parent, Component& component) const {
76 return ComponentEditorPtr(new DistanceComponentEditor(parent, component));
77 }
78
79 void writeToComponent() const;
80 };
81
82 } // namespace ce
83
84 } // namespace objectives