Debian Codegraph @

wxcrafter/src/color_property.cpp

raw
1 #include "color_property.h"
2 #include "json_node.h"
3 #include "wxgui_globals.h"
4 #include "wxgui_helpers.h"
5 #include <wx/app.h>
6
7 const wxEventType wxEVT_COLOR_UPDATE = wxNewEventType();
8
9 ColorProperty::ColorProperty(const wxString& label, const wxString& colour, const wxString& tooltip)
10 : PropertyBase(tooltip)
11 {
12 SetLabel(label);
13 m_colourName = colour;
14 }
15
16 ColorProperty::~ColorProperty() {}
17
18 wxString ColorProperty::GetValue() const { return m_colourName; }
19
20 JSONElement ColorProperty::Serialize() const
21 {
22 JSONElement json = JSONElement::createObject();
23 json.addProperty(wxT("type"), wxT("colour"));
24 DoBaseSerialize(json);
25 json.addProperty(wxT("colour"), m_colourName);
26 return json;
27 }
28
29 void ColorProperty::SetValue(const wxString& value) { m_colourName = value; }
30
31 void ColorProperty::UnSerialize(const JSONElement& json)
32 {
33 DoBaseUnSerialize(json);
34 SetValue(json.namedObject(wxT("colour")).toString());
35 }