Debian Codegraph @

wxcrafter/src/wxgui_defs.h

raw
1 #ifndef WXGUI_DEFS_H
2 #define WXGUI_DEFS_H
3
4 #include "json_node.h"
5
6 #include <wx/string.h>
7
8 class wxcWidget;
9 #define CHECK_POINTER(d) \
10 if(!d) \
11 return;
12 #define CHECK_POINTER_RET_NULL(d) \
13 if(!d) \
14 return NULL;
15 #define CHECK_POINTER_RET_FALSE(d) \
16 if(!d) \
17 return false;
18 #define CHECK_TREEITEM(item) \
19 if(item.IsOk() == false) \
20 return;
21
22 #define STRINGFY(flag) wxString(#flag, wxConvUTF8)
23
24 #define ADD_STYLE(styleBit, isSet) \
25 { \
26 WxStyleInfo style; \
27 style.is_set = isSet; \
28 style.style_bit = styleBit; \
29 style.style_name = wxString(#styleBit, wxConvUTF8); \
30 m_styles.PushBack(style.style_name, style); \
31 }
32
33 #define PREPEND_STYLE(styleBit, isSet) \
34 { \
35 WxStyleInfo style; \
36 style.is_set = isSet; \
37 style.style_bit = styleBit; \
38 style.style_name = wxString(#styleBit, wxConvUTF8); \
39 m_styles.PushFront(style.style_name, style); \
40 }
41
42 #define PREPEND_STYLE_STR(styleName, styleBit, isSet) \
43 { \
44 WxStyleInfo style; \
45 style.is_set = isSet; \
46 style.style_bit = styleBit; \
47 style.style_name = styleName; \
48 m_styles.PushFront(style.style_name, style); \
49 }
50
51 #define PREPEND_STYLE_FALSE(styleBit) PREPEND_STYLE_STR(wxT(#styleBit), styleBit, false)
52 #define PREPEND_STYLE_TRUE(styleBit) PREPEND_STYLE_STR(wxT(#styleBit), styleBit, true)
53
54 #define HAS_STYLE(styleBit) m_styles.Contains(wxString(#styleBit, wxConvUTF8))
55
56 #define REMOVE_STYLE(styleBit) \
57 { \
58 wxString name = wxString(#styleBit, wxConvUTF8); \
59 if(m_styles.Contains(name)) \
60 m_styles.Remove(name); \
61 }
62
63 #define ADD_SIZER_FLAG(styleBit, isSet) \
64 { \
65 WxStyleInfo style; \
66 style.is_set = isSet; \
67 style.style_bit = styleBit; \
68 style.style_name = wxString(#styleBit, wxConvUTF8); \
69 DoAddSizerFlag(style.style_name, style); \
70 }
71
72 #define GENERAL_PROPERTIES_NODE wxT("General Properties")
73
74 // Default values
75 #define DEFAULT_SIZER_PROPORTION 0
76 #define DEFAULT_SIZER_BORDER 5
77
78 #define DEFAULT_SIZER_PROPORTION_STR wxT("0")
79 #define DEFAULT_SIZER_BORDER_STR wxT("5")
80
81 /////////////////////////
82 // Toolbar IDs
83 /////////////////////////
84
85 #define ID_TOOL_ALIGN_LEFT 3800
86 #define ID_TOOL_ALIGN_HCENTER 3801
87 #define ID_TOOL_ALIGN_RIGHT 3802
88 #define ID_TOOL_ALIGN_TOP 3803
89 #define ID_TOOL_ALIGN_VCENTER 3804
90 #define ID_TOOL_ALIGN_BOTTOM 3805
91 #define ID_TOOL_BORDER_LEFT 3806
92 #define ID_TOOL_BORDER_TOP 3807
93 #define ID_TOOL_BORDER_RIGHT 3808
94 #define ID_TOOL_BORDER_BOTTOM 3809
95 #define ID_TOOL_BORDER_ALL 3810
96 #define ID_TOOL_WXEXPAND 3811
97 #define ID_TOOL_PROP1 3812
98
99 #define ID_OPEN_WXGUI_PROJECT 3850
100 #define ID_SAVE_WXGUI_PROJECT 3851
101
102 #define ID_MOVE_NODE_UP 3852
103 #define ID_MOVE_NODE_DOWN 3853
104 #define ID_MOVE_NODE_INTO_SIZER 3854
105 #define ID_MOVE_NODE_INTO_SIBLING 3855
106 #define ID_DELETE_NODE 3856
107 #define ID_WXGUI_PROJECT_SETTINGS 3857
108 #define ID_CUT 3858
109 #define ID_COPY 3859
110 #define ID_PASTE 3860
111 #define ID_RENAME 3861
112 #define ID_DUPLICATE 3862
113 #define ID_SHOW_PREVIEW 3863
114 #define ID_CANCEL_PREVIEW 3864
115
116 #define BASE_CLASS_SUFFIX wxT("BaseClass")
117
118 /////////////////////////
119 // Properties
120 /////////////////////////
121 #define PROP_TASKBAR_ICONTYPE wxTRANSLATE("Icon Type:")
122 #define PROP_BG wxTRANSLATE("Bg Colour:")
123 #define PROP_FG wxTRANSLATE("Fg Colour:")
124 #define PROP_FONT wxTRANSLATE("Font:")
125 #define PROP_WINDOW_ID wxTRANSLATE("ID:")
126 #define PROP_NAME wxTRANSLATE("Name:")
127 #define PROP_SUBCLASS_NAME wxTRANSLATE("Class Name:")
128 #define PROP_SUBCLASS_INCLUDE wxTRANSLATE("Include File:")
129 #define PROP_SUBCLASS_STYLE wxTRANSLATE("Style:")
130 #define PROP_STATE_HIDDEN wxTRANSLATE("Hidden")
131 #define PROP_STATE_DISABLED wxTRANSLATE("Disabled")
132 #define PROP_HAS_FOCUS wxTRANSLATE("Focused")
133 #define PROP_TOOLTIP wxTRANSLATE("Tooltip:")
134 #define PROP_LABEL wxTRANSLATE("Label:")
135 #define PROP_CENTRE_ON_SCREEN wxTRANSLATE("Centre:")
136 #define PROP_ACCELERATOR wxTRANSLATE("Shortcut:")
137 #define PROP_DEFAULT_BUTTON wxTRANSLATE("Default Button")
138 #define PROP_WRAP wxTRANSLATE("Wrap:")
139 #define PROP_COLS wxTRANSLATE("# Columns:")
140 #define PROP_COLS_LIST wxTRANSLATE("Columns:")
141 #define PROP_COL_LABEL_V_ALIGN wxTRANSLATE("Col Label Vertical Align")
142 #define PROP_COL_LABEL_H_ALIGN wxTRANSLATE("Col Label Horizontal Align")
143 #define PROP_ROWS_LIST wxTRANSLATE("Rows:")
144 #define PROP_ROW_LABEL_V_ALIGN wxTRANSLATE("Row Label Vertical Align")
145 #define PROP_ROW_LABEL_H_ALIGN wxTRANSLATE("Row Label Horizontal Align")
146 #define PROP_GRID_NATIVE_LOOK wxTRANSLATE("Use Native Header")
147 #define PROP_GRID_NATIVE_COL_LABELS wxTRANSLATE("Use Native Column Labels")
148 #define PROP_ROWS wxTRANSLATE("# Rows:")
149 #define PROP_GROW_COLS wxTRANSLATE("Growable columns:")
150 #define PROP_GROW_ROWS wxTRANSLATE("Growable rows:")
151 #define PROP_HGAP wxTRANSLATE("Horizontal gap:")
152 #define PROP_VGAP wxTRANSLATE("Vertical gap:")
153 #define PROP_VALUE wxTRANSLATE("Value:")
154 #define PROP_MAXLENGTH wxTRANSLATE("Max Length:")
155 #define PROP_AUTO_COMPLETE_DIRS wxTRANSLATE("Auto Complete Directories:")
156 #define PROP_AUTO_COMPLETE_FILES wxTRANSLATE("Auto Complete Files:")
157 #define PROP_ORIENTATION wxTRANSLATE("Orientation:")
158 #define PROP_MINSIZE wxTRANSLATE("Minimum Size:")
159 #define PROP_BITMAP_PATH wxTRANSLATE("Bitmap File:")
160 #define PROP_BITMAP_PATH_16 wxTRANSLATE("Bitmap File (16x16) :")
161 #define PROP_BITMAP_PATH_32 wxTRANSLATE("Bitmap File (32x32) :")
162 #define PROP_BITMAP_PATH_64 wxTRANSLATE("Bitmap File (64x64) :")
163 #define PROP_BITMAP_PATH_128 wxTRANSLATE("Bitmap File (128x128):")
164 #define PROP_BITMAP_PATH_256 wxTRANSLATE("Bitmap File (256x256):")
165 #define PROP_DISABLED_BITMAP_PATH wxTRANSLATE("Disabled-Bitmap File")
166 #define PROP_OPTIONS wxTRANSLATE("Choices:")
167 #define PROP_CB_CHOICES wxTRANSLATE("ComboBox Choices:")
168 #define PROP_SELECTION wxTRANSLATE("Selection:")
169 #define PROP_SIZE wxTRANSLATE("Size:")
170 #define PROP_TITLE wxTRANSLATE("Title:")
171 #define PROP_PERSISTENT wxTRANSLATE("Enable Window Persistency:")
172 #define PROP_FILE wxTRANSLATE("File:")
173 #define PROP_VIRTUAL_FOLDER wxTRANSLATE("Virtual Folder:")
174 #define PROP_WIDTH wxTRANSLATE("Width:")
175 #define PROP_HEIGHT wxTRANSLATE("Height:")
176 #define PROP_MAJORDIM wxTRANSLATE("Major Dimension:")
177 #define PROP_MINVALUE wxTRANSLATE("Min value:")
178 #define PROP_MAXVALUE wxTRANSLATE("Max value:")
179 #define PROP_RANGE wxTRANSLATE("Range:")
180 #define PROP_URL wxTRANSLATE("URL:")
181 #define PROP_HTMLCODE wxTRANSLATE("HTML Code:")
182 #define PROP_AUTOSIZE_COL wxTRANSLATE("Fit Content to Columns")
183 #define PROP_ALLOW_EDITING wxTRANSLATE("Allow Cell Editing")
184 #define PROP_CHECKED wxTRANSLATE("Checked")
185 #define PROP_SHOW_CANCEL_BTN wxTRANSLATE("Show Cancel Button")
186 #define PROP_SHOW_SEARCH_BTN wxTRANSLATE("Show Search Button")
187 #define PROP_MESSAGE wxTRANSLATE("Message:")
188 #define PROP_WILDCARD wxTRANSLATE("Wildcard:")
189 #define PROP_THUMBSIZE wxTRANSLATE("Thumbsize:")
190 #define PROP_PAGESIZE wxTRANSLATE("Page Size:")
191 #define PROP_NORMAL_COLOR wxTRANSLATE("Normal Colour:")
192 #define PROP_VISITED_COLOR wxTRANSLATE("Visited Colour:")
193 #define PROP_HOVER_COLOR wxTRANSLATE("Hover Colour:")
194 #define PROP_DEFAULT_FOLDER wxTRANSLATE("Default Path:")
195 #define PROP_DEFAULT_FILTER wxTRANSLATE("Filter Index:")
196 #define PROP_FILTER wxTRANSLATE("Filter:")
197 #define PROP_SHOW_HIDDEN wxTRANSLATE("Show Hidden Files:")
198 #define PROP_SCROLL_RATE_X wxTRANSLATE("Scroll Rate X:")
199 #define PROP_SCROLL_RATE_Y wxTRANSLATE("Scroll Rate Y:")
200 #define PROP_SELECTED wxTRANSLATE("Selected")
201 #define PROP_EXPANDED wxTRANSLATE("Expand Node")
202 #define PROP_NULL_BOOK_PAGE wxTRANSLATE("Null Page")
203 #define PROP_SPLIT_MODE wxTRANSLATE("Split Mode:")
204 #define PROP_SASH_GRAVITY wxTRANSLATE("Sash Gravity:")
205 #define PROP_MIN_PANE_SIZE wxTRANSLATE("Minimum Pane Size:")
206 #define PROP_SASH_POS wxTRANSLATE("Sash Position:")
207 #define PROP_SPLITTER_LEFT wxTRANSLATE("Set Splitter Left:")
208 #define PROP_CELLPOS wxTRANSLATE("Cell Position:")
209 #define PROP_CELLSPAN wxTRANSLATE("Cell Span:")
210 #define PROP_KIND wxTRANSLATE("Kind:")
211 #define PROP_HELP wxTRANSLATE("Help String:")
212 #define PROP_MARGINS wxTRANSLATE("Margins:")
213 #define PROP_BITMAP_SIZE wxTRANSLATE("Bitmap Size:")
214 #define PROP_FIELD_COUNT wxTRANSLATE("Field Count:")
215 #define PROP_PADDING wxTRANSLATE("Padding:")
216 #define PROP_SEPARATOR_SIZE wxTRANSLATE("Separator Size:")
217 #define PROP_STC_MARGIN_LINE_NUMBERS wxTRANSLATE("Line Number Margin")
218 #define PROP_STC_MARGIN_SYMBOL wxTRANSLATE("Symbol Margin")
219 #define PROP_STC_MARGIN_FOLD wxTRANSLATE("Fold Margin")
220 #define PROP_STC_MARGIN_SEPARATOR wxTRANSLATE("Separator Margin")
221 #define PROP_STC_LEXER wxTRANSLATE("Lexer")
222 #define PROP_STC_WRAP wxTRANSLATE("Wrap Text")
223 #define PROP_STC_INDENT_GUIDES wxTRANSLATE("Indentation Guides")
224 #define PROP_STC_VIEW_EOL wxTRANSLATE("Display EOL Markers")
225 #define PROP_STC_EOL_MODE wxTRANSLATE("EOL Mode")
226 #define PROP_CLASS_DECORATOR wxTRANSLATE("Class Decorator")
227 #define PROP_DV_LISTCTRL_COL_TYPES wxTRANSLATE("Column Type")
228 #define PROP_DV_LISTCTRL_COL_ALIGN wxTRANSLATE("Alignment")
229 #define PROP_DV_MODEL_CLASS_NAME wxTRANSLATE("Generated Model Class Name")
230 #define PROP_DV_CELLMODE wxTRANSLATE("Cell Mode")
231 #define PROP_DV_COLFLAGS wxTRANSLATE("Column Flags")
232 #define PROP_DV_CONTAINER_ITEM_HAS_COLUMNS wxTRANSLATE("Container Item Has Columns")
233 #define PROP_COLOR_GRADIENT_START wxTRANSLATE("Gradient Start")
234 #define PROP_COLOR_GRADIENT_END wxTRANSLATE("Gradient End")
235 #define PROP_NOTE wxTRANSLATE("Note")
236 #define PROP_COLLAPSED wxTRANSLATE("Collapsed")
237 #define PROP_INFOBAR_ICON_ID wxTRANSLATE("Icon ID")
238 #define PROP_INFOBAR_BTN_ID wxTRANSLATE("Button ID")
239 #define PROP_AUI_SASH_SIZE wxTRANSLATE("Sash Size")
240 #define PROP_AUI_PANE_BORDER_SIZE wxTRANSLATE("Pane Border Size")
241 #define PROP_AUI_SASH_COLOUR wxTRANSLATE("Sash Colour")
242 #define PROP_AUI_CAPTION_COLOUR wxTRANSLATE("Caption Colour")
243 #define PROP_AUI_CAPTION_COLOUR_GRADIENT wxTRANSLATE("Caption Gradient Colour")
244 #define PROP_AUI_INACTIVE_CAPTION_COLOUR wxTRANSLATE("Inactive Caption Colour")
245 #define PROP_AUI_INACTIVE_CAPTION_COLOUR_GRADIENT wxTRANSLATE("Inactive Caption Gradient Colour")
246 #define PROP_AUI_ACTIVE_CAPTION_TEXT_COLOUR wxTRANSLATE("Active Caption Text Colour")
247 #define PROP_AUI_INACTIVE_CAPTION_TEXT_COLOUR wxTRANSLATE("Inactive Caption Text Colour")
248 #define PROP_AUI_GRADIENT_TYPE wxTRANSLATE("Gradient Type")
249 #define PROP_IMGLIST_MASK wxTRANSLATE("Bitmap Mask")
250 #define PROP_BASE_CLASS_SUFFIX wxTRANSLATE("Base Class Suffix")
251 #define PROP_INTERVAL wxTRANSLATE("Interval")
252 #define PROP_START_TIMER wxTRANSLATE("Start the timer")
253 #define PROP_ONE_SHOT_TIMER wxTRANSLATE("One Shot Timer")
254 #define PROP_OUTPUT_FILE_NAME wxTRANSLATE("Output File Name")
255 #define PROP_INHERITED_CLASS wxTRANSLATE("Inherited Class")
256 #define PROP_KEYWORDS_SET_1 wxTRANSLATE("Keywords Set 1")
257 #define PROP_KEYWORDS_SET_2 wxTRANSLATE("Keywords Set 2")
258 #define PROP_KEYWORDS_SET_3 wxTRANSLATE("Keywords Set 3")
259 #define PROP_KEYWORDS_SET_4 wxTRANSLATE("Keywords Set 4")
260 #define PROP_KEYWORDS_SET_5 wxTRANSLATE("Keywords Set 5")
261 #define PROP_CONTROL_SPECIFIC_SETTINGS wxTRANSLATE("Control Specific Settings")
262 #define PROP_RIBBON_THEME wxTRANSLATE("Ribbon Theme")
263 #define PROP_RIBBON_TOOLBAR_MIN_ROWS wxTRANSLATE("Minimum #Rows")
264 #define PROP_RIBBON_TOOLBAR_MAX_ROWS wxTRANSLATE("Maximum #Rows")
265 #define PROP_MC_BACKENDNAME wxTRANSLATE("Backend")
266 #define PROP_MC_CONTROLS wxTRANSLATE("wxMediaCtrl Controls")
267 #define PROP_MC_NO_CONTROLS "wxMEDIACTRLPLAYERCONTROLS_NONE"
268 #define PROP_MC_DEFAULT_CONTROLS "wxMEDIACTRLPLAYERCONTROLS_DEFAULT"
269 #define PROP_FRAME_TYPE wxTRANSLATE("wxFrame Type")
270 #define PROP_COL_FLAGS wxTRANSLATE("Column Flags")
271 #define PROP_EFFECT wxTRANSLATE("Show Effect")
272 #define PROP_CUSTOM_EDITOR wxTRANSLATE("Property Editor Control")
273 #define PROP_DROPDOWN_MENU wxTRANSLATE("Construct the Dropdown Menu:")
274 #define PROP_HINT wxTRANSLATE("Text Hint")
275 #define PROP_DIRECTION wxTRANSLATE("Direction")
276 #define PROP_ANIM_AUTO_PLAY wxTRANSLATE("Load and play")
277 #define PROP_PROPORTION wxTRANSLATE("Proportion:")
278 #define PROP_SPELLCHECK wxTRANSLATE("Enable Spell Checking")
279 #define PROP_KEEP_CLASS_MEMBER wxTRANSLATE("Keep as a class member")
280 ///////////////////////////////////////////////////////////////////////////////////////
281
282 struct WxStyleInfo {
283 wxString style_name;
284 int style_bit;
285 bool is_set;
286 wxArrayString style_group;
287
288 bool operator==(const WxStyleInfo& src) const { return style_bit == src.style_bit; }
289
290 bool operator<(const WxStyleInfo& src) const { return style_bit < src.style_bit; }
291
292 /**
293 * @brief check 'styleAsString' and update it depending on the style_group
294 * @param styleAsString comma delimited styles
295 */
296 void UpdateStyleString(wxString& styleAsString) const;
297 bool IsGroupConditionMet(wxcWidget* widget) const;
298 JSONElement ToJSON() const
299 {
300 JSONElement json = JSONElement::createObject();
301 json.addProperty(wxT("style_name"), style_name);
302 json.addProperty(wxT("style_bit"), style_bit);
303 json.addProperty(wxT("is_set"), is_set);
304 return json;
305 }
306
307 void FromJSON(const JSONElement& json)
308 {
309 style_name = json.namedObject(wxT("style_name")).toString();
310 style_bit = json.namedObject(wxT("style_bit")).toInt();
311 is_set = json.namedObject(wxT("is_set")).toBool();
312 }
313 };
314 /////////////////////////////////////////////////////////////////////////////////////////
315
316 #endif // WXGUI_DEFS_H