| 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_ALERT component type. |
| 18 |
* |
| 19 |
* A COMP_ALERT component requires that an AI must be alerted or not alerted. |
| 20 |
*/ |
| 21 |
class AlertComponentEditor : |
| 22 |
public ComponentEditorBase |
| 23 |
{ |
| 24 |
// Registration class |
| 25 |
static struct RegHelper |
| 26 |
{ |
| 27 |
RegHelper() { |
| 28 |
ComponentEditorFactory::registerType( |
| 29 |
objectives::ComponentType::COMP_ALERT().getName(), |
| 30 |
ComponentEditorPtr(new AlertComponentEditor()) |
| 31 |
); |
| 32 |
} |
| 33 |
} regHelper; |
| 34 |
|
| 35 |
// Component to edit |
| 36 |
Component* _component; |
| 37 |
|
| 38 |
// SpecifierEditCombo for the kill target |
| 39 |
SpecifierEditCombo* _targetCombo; |
| 40 |
|
| 41 |
// An entry box for the amount and the alert level |
| 42 |
wxSpinCtrl* _amount; |
| 43 |
wxSpinCtrl* _alertLevel; |
| 44 |
|
| 45 |
/** |
| 46 |
* Construct a default AlertComponentEditor. |
| 47 |
*/ |
| 48 |
AlertComponentEditor() : |
| 49 |
_component(NULL), |
| 50 |
_amount(NULL), |
| 51 |
_alertLevel(NULL) |
| 52 |
{} |
| 53 |
|
| 54 |
/** |
| 55 |
* Construct a AlertComponentEditor with a Component object to display and |
| 56 |
* edit. |
| 57 |
* |
| 58 |
* @param component |
| 59 |
* The Component to edit. |
| 60 |
*/ |
| 61 |
AlertComponentEditor(wxWindow* parent, Component& component); |
| 62 |
|
| 63 |
public: |
| 64 |
|
| 65 |
/* ComponentEditor implementation */ |
| 66 |
|
| 67 |
ComponentEditorPtr create(wxWindow* parent, Component& component) const |
| 68 |
{ |
| 69 |
return ComponentEditorPtr(new AlertComponentEditor(parent, component)); |
| 70 |
} |
| 71 |
|
| 72 |
void writeToComponent() const; |
| 73 |
}; |
| 74 |
|
| 75 |
} // namespace ce |
| 76 |
|
| 77 |
} // namespace objectives |