| 1 |
#pragma once |
| 2 |
|
| 3 |
#include <functional> |
| 4 |
#include <memory> |
| 5 |
|
| 6 |
class wxWindow; |
| 7 |
|
| 8 |
namespace objectives |
| 9 |
{ |
| 10 |
|
| 11 |
class Component; |
| 12 |
|
| 13 |
namespace ce |
| 14 |
{ |
| 15 |
|
| 16 |
class SpecifierPanel; |
| 17 |
|
| 18 |
/** |
| 19 |
* Shared pointer typedef for SpecifierPanel. |
| 20 |
*/ |
| 21 |
typedef std::shared_ptr<SpecifierPanel> SpecifierPanelPtr; |
| 22 |
|
| 23 |
/** |
| 24 |
* Compound widget for editing a single Specifier type. |
| 25 |
* |
| 26 |
* A SpecifierPanel is a horizontal box containing widget(s) that are intended |
| 27 |
* to edit a single type of specifier. For example, a SpecifierPanel for |
| 28 |
* SPEC_NONE would contain no editable widgets, whereas the SpecifierPanel for |
| 29 |
* SPEC_CLASSNAME might provide a text entry box and a browse button to select |
| 30 |
* an entity class from the entity class tree. |
| 31 |
* |
| 32 |
* SpecifierPanel subclasses are created through the virtual constructor idiom, |
| 33 |
* based on the Specifier type that needs to be edited. They accept and return |
| 34 |
* a std::string containing the specifier value to be used. |
| 35 |
* |
| 36 |
* All SpecifierPanel subclasses are responsible for destroying their GTK |
| 37 |
* widgets in their own destructors. |
| 38 |
*/ |
| 39 |
class SpecifierPanel |
| 40 |
{ |
| 41 |
public: |
| 42 |
virtual ~SpecifierPanel() {} |
| 43 |
|
| 44 |
/** |
| 45 |
* Retrieve the widget which can be packed into a parent container. |
| 46 |
*/ |
| 47 |
virtual wxWindow* getWidget() = 0; |
| 48 |
|
| 49 |
/** |
| 50 |
* Set the value of the string which should be edited by this widget. The |
| 51 |
* child editing widgets will be immediately updated to reflect the new |
| 52 |
* value. |
| 53 |
*/ |
| 54 |
virtual void setValue(const std::string& val) = 0; |
| 55 |
|
| 56 |
/** |
| 57 |
* Get the current value of the string which is being edited by this widget. |
| 58 |
*/ |
| 59 |
virtual std::string getValue() const = 0; |
| 60 |
|
| 61 |
/** |
| 62 |
* Connect the changed callback to be invoked when the contents of this panel change. |
| 63 |
*/ |
| 64 |
virtual void setChangedCallback(const std::function<void()>& callback) = 0; |
| 65 |
|
| 66 |
/** |
| 67 |
* Create a SpecifierPanel subclass of the same type as this one. |
| 68 |
* |
| 69 |
* This method is required for the virtual constructor idiom, and is not |
| 70 |
* used by other code. |
| 71 |
* |
| 72 |
* @return |
| 73 |
* A SpecifierPanel subclass of the same type as this one. |
| 74 |
*/ |
| 75 |
virtual SpecifierPanelPtr create(wxWindow* parent) const = 0; |
| 76 |
}; |
| 77 |
|
| 78 |
} |
| 79 |
|
| 80 |
} |