| 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 KO component type. |
| 18 |
* |
| 19 |
* A KO component requires that an AI must be knocked out. It can use all |
| 20 |
* specifiers except SPEC_GROUP. |
| 21 |
*/ |
| 22 |
class KnockoutComponentEditor |
| 23 |
: public ComponentEditorBase |
| 24 |
{ |
| 25 |
// Registration class |
| 26 |
static struct RegHelper |
| 27 |
{ |
| 28 |
RegHelper() { |
| 29 |
ComponentEditorFactory::registerType( |
| 30 |
objectives::ComponentType::COMP_KO().getName(), |
| 31 |
ComponentEditorPtr(new KnockoutComponentEditor()) |
| 32 |
); |
| 33 |
} |
| 34 |
} regHelper; |
| 35 |
|
| 36 |
// Component to edit |
| 37 |
Component* _component; |
| 38 |
|
| 39 |
// SpecifierEditCombo for the knockout target |
| 40 |
SpecifierEditCombo* _targetCombo; |
| 41 |
|
| 42 |
// The spin button to specify the amount of AI to be knocked out |
| 43 |
wxSpinCtrl* _amount; |
| 44 |
|
| 45 |
/** |
| 46 |
* Construct a default KnockoutComponentEditor. |
| 47 |
*/ |
| 48 |
KnockoutComponentEditor() : |
| 49 |
_component(NULL), |
| 50 |
_amount(NULL) |
| 51 |
{ } |
| 52 |
|
| 53 |
/** |
| 54 |
* Construct a KnockoutComponentEditor with a Component object to display and |
| 55 |
* edit. |
| 56 |
* |
| 57 |
* @param component |
| 58 |
* The Component to edit. |
| 59 |
*/ |
| 60 |
KnockoutComponentEditor(wxWindow* parent, Component& component); |
| 61 |
|
| 62 |
public: |
| 63 |
/* ComponentEditor implementation */ |
| 64 |
|
| 65 |
ComponentEditorPtr create(wxWindow* parent, Component& component) const |
| 66 |
{ |
| 67 |
return ComponentEditorPtr(new KnockoutComponentEditor(parent, component)); |
| 68 |
} |
| 69 |
|
| 70 |
void writeToComponent() const; |
| 71 |
}; |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
} |