| 1 |
#include "winid_property.h" |
| 2 |
#include "wxgui_defs.h" |
| 3 |
#include <algorithm> |
| 4 |
#include <wx/choice.h> |
| 5 |
#include <wx/combobox.h> |
| 6 |
|
| 7 |
const wxEventType wxEVT_WINID_UPDATED = ::wxNewEventType(); |
| 8 |
|
| 9 |
wxArrayString WinIdProperty::s_options; |
| 10 |
wxStringSet_t WinIdProperty::m_winIdSet; |
| 11 |
|
| 12 |
WinIdProperty::WinIdProperty() |
| 13 |
: PropertyBase(PROP_WINDOW_ID) |
| 14 |
{ |
| 15 |
SetLabel(PROP_WINDOW_ID); |
| 16 |
m_winid = wxT("wxID_ANY"); |
| 17 |
|
| 18 |
if(s_options.IsEmpty()) { |
| 19 |
s_options.Add(wxT("wxID_ANY")); |
| 20 |
s_options.Add(wxT("wxID_SEPARATOR")); |
| 21 |
s_options.Add(wxT("wxID_OPEN")); |
| 22 |
s_options.Add(wxT("wxID_CLOSE")); |
| 23 |
s_options.Add(wxT("wxID_NEW")); |
| 24 |
s_options.Add(wxT("wxID_SAVE")); |
| 25 |
s_options.Add(wxT("wxID_SAVEAS")); |
| 26 |
s_options.Add(wxT("wxID_REVERT")); |
| 27 |
s_options.Add(wxT("wxID_EXIT")); |
| 28 |
s_options.Add(wxT("wxID_UNDO")); |
| 29 |
s_options.Add(wxT("wxID_REDO")); |
| 30 |
s_options.Add(wxT("wxID_HELP")); |
| 31 |
s_options.Add(wxT("wxID_PRINT")); |
| 32 |
s_options.Add(wxT("wxID_PRINT_SETUP")); |
| 33 |
s_options.Add(wxT("wxID_PAGE_SETUP")); |
| 34 |
s_options.Add(wxT("wxID_PREVIEW")); |
| 35 |
s_options.Add(wxT("wxID_ABOUT")); |
| 36 |
s_options.Add(wxT("wxID_HELP_CONTENTS")); |
| 37 |
s_options.Add(wxT("wxID_HELP_INDEX")); |
| 38 |
s_options.Add(wxT("wxID_HELP_SEARCH")); |
| 39 |
s_options.Add(wxT("wxID_HELP_COMMANDS")); |
| 40 |
s_options.Add(wxT("wxID_HELP_PROCEDURES")); |
| 41 |
s_options.Add(wxT("wxID_HELP_CONTEXT")); |
| 42 |
s_options.Add(wxT("wxID_CLOSE_ALL")); |
| 43 |
s_options.Add(wxT("wxID_PREFERENCES")); |
| 44 |
s_options.Add(wxT("wxID_EDIT")); |
| 45 |
s_options.Add(wxT("wxID_CUT")); |
| 46 |
s_options.Add(wxT("wxID_COPY")); |
| 47 |
s_options.Add(wxT("wxID_PASTE")); |
| 48 |
s_options.Add(wxT("wxID_CLEAR")); |
| 49 |
s_options.Add(wxT("wxID_FIND")); |
| 50 |
s_options.Add(wxT("wxID_DUPLICATE")); |
| 51 |
s_options.Add(wxT("wxID_SELECTALL")); |
| 52 |
s_options.Add(wxT("wxID_DELETE")); |
| 53 |
s_options.Add(wxT("wxID_REPLACE")); |
| 54 |
s_options.Add(wxT("wxID_REPLACE_ALL")); |
| 55 |
s_options.Add(wxT("wxID_PROPERTIES")); |
| 56 |
s_options.Add(wxT("wxID_VIEW_DETAILS")); |
| 57 |
s_options.Add(wxT("wxID_VIEW_LARGEICONS")); |
| 58 |
s_options.Add(wxT("wxID_VIEW_SMALLICONS")); |
| 59 |
s_options.Add(wxT("wxID_VIEW_LIST")); |
| 60 |
s_options.Add(wxT("wxID_VIEW_SORTDATE")); |
| 61 |
s_options.Add(wxT("wxID_VIEW_SORTNAME")); |
| 62 |
s_options.Add(wxT("wxID_VIEW_SORTSIZE")); |
| 63 |
s_options.Add(wxT("wxID_VIEW_SORTTYPE")); |
| 64 |
s_options.Add(wxT("wxID_OK")); |
| 65 |
s_options.Add(wxT("wxID_CANCEL")); |
| 66 |
s_options.Add(wxT("wxID_APPLY")); |
| 67 |
s_options.Add(wxT("wxID_YES")); |
| 68 |
s_options.Add(wxT("wxID_NO")); |
| 69 |
s_options.Add(wxT("wxID_STATIC")); |
| 70 |
s_options.Add(wxT("wxID_FORWARD")); |
| 71 |
s_options.Add(wxT("wxID_BACKWARD")); |
| 72 |
s_options.Add(wxT("wxID_DEFAULT")); |
| 73 |
s_options.Add(wxT("wxID_MORE")); |
| 74 |
s_options.Add(wxT("wxID_SETUP")); |
| 75 |
s_options.Add(wxT("wxID_RESET")); |
| 76 |
s_options.Add(wxT("wxID_CONTEXT_HELP")); |
| 77 |
s_options.Add(wxT("wxID_YESTOALL")); |
| 78 |
s_options.Add(wxT("wxID_NOTOALL")); |
| 79 |
s_options.Add(wxT("wxID_ABORT")); |
| 80 |
s_options.Add(wxT("wxID_RETRY")); |
| 81 |
s_options.Add(wxT("wxID_IGNORE")); |
| 82 |
s_options.Add(wxT("wxID_ADD")); |
| 83 |
s_options.Add(wxT("wxID_REMOVE")); |
| 84 |
s_options.Add(wxT("wxID_UP")); |
| 85 |
s_options.Add(wxT("wxID_DOWN")); |
| 86 |
s_options.Add(wxT("wxID_HOME")); |
| 87 |
s_options.Add(wxT("wxID_REFRESH")); |
| 88 |
s_options.Add(wxT("wxID_STOP")); |
| 89 |
s_options.Add(wxT("wxID_INDEX")); |
| 90 |
s_options.Add(wxT("wxID_BOLD")); |
| 91 |
s_options.Add(wxT("wxID_ITALIC")); |
| 92 |
s_options.Add(wxT("wxID_JUSTIFY_CENTER")); |
| 93 |
s_options.Add(wxT("wxID_JUSTIFY_FILL")); |
| 94 |
s_options.Add(wxT("wxID_JUSTIFY_RIGHT")); |
| 95 |
s_options.Add(wxT("wxID_JUSTIFY_LEFT")); |
| 96 |
s_options.Add(wxT("wxID_UNDERLINE")); |
| 97 |
s_options.Add(wxT("wxID_INDENT")); |
| 98 |
s_options.Add(wxT("wxID_UNINDENT")); |
| 99 |
s_options.Add(wxT("wxID_ZOOM_100")); |
| 100 |
s_options.Add(wxT("wxID_ZOOM_FIT")); |
| 101 |
s_options.Add(wxT("wxID_ZOOM_IN")); |
| 102 |
s_options.Add(wxT("wxID_ZOOM_OUT")); |
| 103 |
s_options.Add(wxT("wxID_UNDELETE")); |
| 104 |
s_options.Add(wxT("wxID_REVERT_TO_SAVED")); |
| 105 |
s_options.Add(wxT("wxID_CDROM")); |
| 106 |
s_options.Add(wxT("wxID_CONVERT")); |
| 107 |
s_options.Add(wxT("wxID_EXECUTE")); |
| 108 |
s_options.Add(wxT("wxID_FLOPPY")); |
| 109 |
s_options.Add(wxT("wxID_HARDDISK")); |
| 110 |
s_options.Add(wxT("wxID_BOTTOM")); |
| 111 |
s_options.Add(wxT("wxID_FIRST")); |
| 112 |
s_options.Add(wxT("wxID_LAST")); |
| 113 |
s_options.Add(wxT("wxID_TOP")); |
| 114 |
s_options.Add(wxT("wxID_INFO")); |
| 115 |
s_options.Add(wxT("wxID_JUMP_TO")); |
| 116 |
s_options.Add(wxT("wxID_NETWORK")); |
| 117 |
s_options.Add(wxT("wxID_SELECT_COLOR")); |
| 118 |
s_options.Add(wxT("wxID_SELECT_FONT")); |
| 119 |
s_options.Add(wxT("wxID_SORT_ASCENDING")); |
| 120 |
s_options.Add(wxT("wxID_SORT_DESCENDING")); |
| 121 |
s_options.Add(wxT("wxID_SPELL_CHECK")); |
| 122 |
s_options.Add(wxT("wxID_STRIKETHROUGH")); |
| 123 |
std::sort(s_options.begin(), s_options.end()); |
| 124 |
|
| 125 |
m_winIdSet.insert(s_options.begin(), s_options.end()); |
| 126 |
} |
| 127 |
} |
| 128 |
|
| 129 |
WinIdProperty::~WinIdProperty() {} |
| 130 |
|
| 131 |
JSONElement WinIdProperty::Serialize() const |
| 132 |
{ |
| 133 |
JSONElement json = JSONElement::createObject(); |
| 134 |
json.addProperty(wxT("type"), wxT("winid")); |
| 135 |
DoBaseSerialize(json); |
| 136 |
json.addProperty(wxT("m_winid"), m_winid); |
| 137 |
return json; |
| 138 |
} |
| 139 |
|
| 140 |
void WinIdProperty::UnSerialize(const JSONElement& json) |
| 141 |
{ |
| 142 |
DoBaseUnSerialize(json); |
| 143 |
// Backward compatability |
| 144 |
if(json.hasNamedObject(wxT("m_winid"))) |
| 145 |
m_winid = json.namedObject(wxT("m_winid")).toString(); |
| 146 |
else |
| 147 |
m_winid = json.namedObject(wxT("m_value")).toString(); |
| 148 |
} |