| 1 |
#ifndef PROPERTYBASE_H |
| 2 |
#define PROPERTYBASE_H |
| 3 |
|
| 4 |
#include "wxcLib/json_node.h" |
| 5 |
#include <wx/stattext.h> |
| 6 |
#include <wx/string.h> |
| 7 |
#include <wx/window.h> |
| 8 |
|
| 9 |
enum PropertyeType { |
| 10 |
PT_BOOL, |
| 11 |
PT_CHOICE, |
| 12 |
PT_COLOR_PICKER, |
| 13 |
PT_FILE_PICKER, |
| 14 |
PT_FONT_PICKER, |
| 15 |
PT_MUTLI_STRING_PICKER, |
| 16 |
PT_STRING, |
| 17 |
PT_VIRTUAL_FOLDER_PICKER, |
| 18 |
PT_COMBOX, |
| 19 |
PT_CATEGORY, |
| 20 |
PT_INT, |
| 21 |
PT_COL_HEADER_FLAGS, |
| 22 |
PT_BITMAP, |
| 23 |
PT_BITMAPTEXT_TABLE, |
| 24 |
}; |
| 25 |
|
| 26 |
const extern wxEventType wxEVT_WXC_PROPETY_CHANGED; |
| 27 |
class PropertyBase : public wxEvtHandler |
| 28 |
{ |
| 29 |
protected: |
| 30 |
wxString m_label; |
| 31 |
wxString m_tooltip; |
| 32 |
|
| 33 |
void DoBaseSerialize(JSONElement& json) const; |
| 34 |
void DoBaseUnSerialize(const JSONElement& json); |
| 35 |
void NotifyChanged(); |
| 36 |
|
| 37 |
public: |
| 38 |
PropertyBase(const wxString& tooltip); |
| 39 |
virtual ~PropertyBase(); |
| 40 |
|
| 41 |
void SetLabel(const wxString& label) { this->m_label = label; } |
| 42 |
|
| 43 |
const wxString& GetLabel() const { return m_label; } |
| 44 |
|
| 45 |
wxString GetLabelForUI() const |
| 46 |
{ |
| 47 |
wxString label = wxGetTranslation(GetLabel()); |
| 48 |
label.EndsWith(":", &label); |
| 49 |
return label; |
| 50 |
} |
| 51 |
|
| 52 |
void SetTooltip(const wxString& tooltip) { this->m_tooltip = tooltip; } |
| 53 |
const wxString& GetTooltip() const { return m_tooltip; } |
| 54 |
|
| 55 |
virtual wxArrayString GetOptions() const { return wxArrayString(); } |
| 56 |
|
| 57 |
virtual wxArrayInt GetOptionsValues() const { return wxArrayInt(); } |
| 58 |
|
| 59 |
virtual PropertyeType GetType() = 0; |
| 60 |
virtual void SetValue(const wxString& value) = 0; |
| 61 |
virtual wxString GetValue() const = 0; |
| 62 |
virtual long GetValueLong() const { return 0; } |
| 63 |
virtual JSONElement Serialize() const = 0; |
| 64 |
virtual void UnSerialize(const JSONElement& json) = 0; |
| 65 |
}; |
| 66 |
|
| 67 |
#endif // PROPERTYBASE_H |