| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "ResponseEffect.h" |
| 4 |
|
| 5 |
class StimTypes; |
| 6 |
class wxTextCtrl; |
| 7 |
class wxComboBox; |
| 8 |
class wxChoice; |
| 9 |
class wxWindow; |
| 10 |
class wxCheckBox; |
| 11 |
class wxBitmapComboBox; |
| 12 |
class wxStaticText; |
| 13 |
class wxArrayString; |
| 14 |
|
| 15 |
class EffectArgumentItem |
| 16 |
{ |
| 17 |
protected: |
| 18 |
// The argument this row is referring to |
| 19 |
ResponseEffect::Argument& _arg; |
| 20 |
|
| 21 |
wxStaticText* _label; |
| 22 |
wxStaticText* _descBox; |
| 23 |
|
| 24 |
public: |
| 25 |
EffectArgumentItem(wxWindow* parent, ResponseEffect::Argument& arg); |
| 26 |
|
| 27 |
// destructor |
| 28 |
virtual ~EffectArgumentItem() {} |
| 29 |
|
| 30 |
/** greebo: This retrieves the string representation of the |
| 31 |
* current value of this row. This has to be |
| 32 |
* implemented by the derived classes. |
| 33 |
*/ |
| 34 |
virtual std::string getValue() = 0; |
| 35 |
|
| 36 |
// Retrieve the label widget |
| 37 |
virtual wxWindow* getLabelWidget(); |
| 38 |
|
| 39 |
// Retrieve the edit widgets (abstract) |
| 40 |
virtual wxWindow* getEditWidget() = 0; |
| 41 |
|
| 42 |
// Retrieves the help widget (a question mark with a tooltip) |
| 43 |
virtual wxWindow* getHelpWidget(); |
| 44 |
|
| 45 |
/** greebo: This saves the value to the according response effect. |
| 46 |
*/ |
| 47 |
virtual void save(); |
| 48 |
}; |
| 49 |
|
| 50 |
/** greebo: This is an item querying a simple string |
| 51 |
*/ |
| 52 |
class StringArgument : |
| 53 |
public EffectArgumentItem |
| 54 |
{ |
| 55 |
protected: |
| 56 |
wxTextCtrl* _entry; |
| 57 |
|
| 58 |
public: |
| 59 |
StringArgument(wxWindow* parent, ResponseEffect::Argument& arg); |
| 60 |
|
| 61 |
virtual wxWindow* getEditWidget(); |
| 62 |
virtual std::string getValue(); |
| 63 |
}; |
| 64 |
|
| 65 |
/** greebo: This is an item querying a float (derives from string) |
| 66 |
*/ |
| 67 |
class FloatArgument : |
| 68 |
public StringArgument |
| 69 |
{ |
| 70 |
public: |
| 71 |
FloatArgument(wxWindow* parent, ResponseEffect::Argument& arg) : |
| 72 |
StringArgument(parent, arg) |
| 73 |
{} |
| 74 |
}; |
| 75 |
|
| 76 |
/** greebo: This is an item querying a vector (derives from string) |
| 77 |
*/ |
| 78 |
class VectorArgument : |
| 79 |
public StringArgument |
| 80 |
{ |
| 81 |
public: |
| 82 |
VectorArgument(wxWindow* parent, ResponseEffect::Argument& arg) : |
| 83 |
StringArgument(parent, arg) |
| 84 |
{} |
| 85 |
}; |
| 86 |
|
| 87 |
class BooleanArgument : |
| 88 |
public EffectArgumentItem |
| 89 |
{ |
| 90 |
wxCheckBox* _checkButton; |
| 91 |
public: |
| 92 |
BooleanArgument(wxWindow* parent, ResponseEffect::Argument& arg); |
| 93 |
|
| 94 |
virtual wxWindow* getEditWidget(); |
| 95 |
virtual std::string getValue(); |
| 96 |
}; |
| 97 |
|
| 98 |
/** greebo: This is an item querying an entity name (entry/dropdown combo) |
| 99 |
*/ |
| 100 |
class EntityArgument : |
| 101 |
public EffectArgumentItem |
| 102 |
{ |
| 103 |
wxComboBox* _comboBox; |
| 104 |
public: |
| 105 |
// Pass the entity name list to this item so that the auto-completion |
| 106 |
// of the entity combo box works correctly |
| 107 |
EntityArgument(wxWindow* parent, ResponseEffect::Argument& arg, |
| 108 |
const wxArrayString& entityChoices); |
| 109 |
|
| 110 |
virtual wxWindow* getEditWidget(); |
| 111 |
virtual std::string getValue(); |
| 112 |
}; |
| 113 |
|
| 114 |
/** greebo: This is an item querying an stimtype (dropdown combo) |
| 115 |
*/ |
| 116 |
class StimTypeArgument : |
| 117 |
public EffectArgumentItem |
| 118 |
{ |
| 119 |
private: |
| 120 |
const StimTypes& _stimTypes; |
| 121 |
|
| 122 |
#ifdef USE_BMP_COMBO_BOX |
| 123 |
wxBitmapComboBox* _comboBox; |
| 124 |
#else |
| 125 |
wxComboBox* _comboBox; |
| 126 |
#endif |
| 127 |
|
| 128 |
public: |
| 129 |
// Pass the reference to the StimType helper class |
| 130 |
StimTypeArgument(wxWindow* parent, |
| 131 |
ResponseEffect::Argument& arg, |
| 132 |
const StimTypes& stimTypes); |
| 133 |
|
| 134 |
virtual wxWindow* getEditWidget(); |
| 135 |
virtual std::string getValue(); |
| 136 |
}; |