2 XML resources file format
3 ===============================
8 XML resource is well-formed XML document, i.e. all tags are paired
9 and there is only one root node, which is always <resource>.
11 In the following text, I will use standard XML terminology:
13 <tag_one prop1="prop" prop2='yes'>
17 Here, tag_one is a node (the word 'tag' refers to the type of the node),
18 prop1 and prop2 are properties and tag_two is a child node of tag_one.
19 Property's default value is the value that will be assigned to the property
20 if you do not specify it explicitly.
22 I will use the term "primary node" to refer to nodes than represent controls,
23 dialogs etc. "Secondary nodes" are nodes used to store data:
25 <dialog name="my_dlg"> primary
26 <title>Demo Dialog...</title> secondary
27 <size>100,200d</size> secondary
29 <button name="wxID_OK"> primary
30 <label>Ok</label> secondary
31 <pos>10,10d</pos> secondary
36 In the example above, <label>, <pos>, <size> and <title> are "variables",
37 i.e. they contain a value and not a list of children (unlike <children> node).
39 Any node (but the root one) may have property "platform" with possible
40 values "unix", "win", "mac" or "os2". All nodes with "platform" property
41 specified and other than the platform the program is currently being executed
42 on will be removed when reading XML resource file.
44 Root node may have children of these and only these types: <menu>, <menubar>,
52 Any primary node may have property "name" used to identify it. Default value
53 is "-1", any string is legal name. Names
54 wxID_OPEN, wxID_CLOSE, wxID_NEW,
55 wxID_SAVE, wxID_SAVEAS, wxID_REVERT,
56 wxID_EXIT, wxID_UNDO, wxID_REDO,
57 wxID_HELP, wxID_PRINT, wxID_PRINT_SETUP,
58 wxID_PREVIEW, wxID_ABOUT, wxID_HELP_CONTENTS,
59 wxID_HELP_COMMANDS, wxID_HELP_PROCEDURES,
60 wxID_CUT, wxID_COPY, wxID_PASTE,
61 wxID_CLEAR, wxID_FIND, wxID_DUPLICATE,
62 wxID_SELECTALL, wxID_OK, wxID_CANCEL,
63 wxID_APPLY, wxID_YES, wxID_NO,
64 wxID_STATIC, wxID_FORWARD, wxID_BACKWARD,
65 wxID_DEFAULT, wxID_MORE, wxID_SETUP,
66 wxID_RESET, wxID_HELP_CONTEXT
67 are translated into corresponding wxWindows ID constant, XMLID macro is used
68 otherwise to generate unique ID. wxWindows control created from named node
69 will have name=name and id=XMLID(name) or wxID_XXXX.
72 3. Common variables types
73 ---------------------------
75 Variables are always of a known type:
77 bool - boolean value. "1", "true", "t", "on" mean TRUE, anything
78 else (namely "0", "false", "f", "off") means FALSE.
79 FIXME: maybe use only 1/0 ??
81 integer - integer value, i.e. digits 0-9 plus optional minus sign.
83 text - anything. Within text node all occurences of $ are replaced
84 by & (used for shortcuts, e.g. "E&xit"), $$ by $, \\, \n, \r,
87 style - (also called flags) list of flags delimined by any combination
88 of spaces and | characters. Resources parser accepts only
89 _registered_ flags -- i.e. flags that are valid for given
90 node/control. Example:
91 <flag>wxEXPAND | wxTOP|wxBOTTOM</flag>
93 color - color in HTML format: #rrggbb where rr,gg,bb are hexadecimal
94 values (00-FF) for red, green and blue components in
97 coord - size or position information. Consists of two integers
98 separated by comma ("x,y"). The values are in pixels
99 unless "d" is attached to the right side of it --
100 in which case the values are interpreted as dialog units.
101 Value of -1 means "use default". Examples:
113 Most common nodes layout is as follows:
115 <primary_node name="name" platform="platform">
126 where children node is supported only by panels, dialogs etc. -- see
127 nodes description for details.
129 In the following text,
131 TYPE var_name [ (= default_value) ]
133 means that given primary node may have child node with name var_name
134 and content type TYPE. If default value is given, the node is optional
135 and default_value will be used if not specified. Otherwise, the node
136 is mandatory and must always be present. For example, "color fg" means
137 than variable tag fg, e.g. <fg>#rr0000</fg> is expected.
141 5. Common controls variables
142 ------------------------------
144 _All_ nodes that represent wxWindows controls (gauge, panel, dialog,
145 textctrl etc.) accept the following properties:
147 coord pos (= -1,-1) position of the control. Default value
148 equals to wxDefaultPosition
149 coord size (= -1,-1) size of the control. Default value equals to
151 text tooltip window's tooltip
152 color bg background color of the control
153 color fg foreground/text color of the control
154 style style control style flag. Default value is
155 control-dependent (but 0 is common value)
156 style exstyle control extended style flag
157 bool enabled (= 1) is the control enabled?
158 bool hidden (= 0) is the control hidden?
159 bool focused (= 0) has the control focus?
162 _Usually_ (but not always, only when it makes sense) controls support text
163 variable label which contains displayed text and/or value which contains
164 editable text. These are always explicitly mentioned in tag description.
170 ---------------------
172 If 'Control' is derived from wxControl, it supports all variables from '5.'
173 'Styles' section lists all acceptable flags for style and exstyle variables.
182 only common controls variables
185 wxNO_3D, wxTAB_TRAVERSAL, wxWS_EX_VALIDATE_RECURSIVELY
195 style style (= wxDEFAULT_DIALOG_style)
196 text title dialog's title
199 wxSTAY_ON_TOP, wxCAPTION, wxDEFAULT_DIALOG_style, wxTHICK_FRAME,
200 wxSYSTEM_MENU, wxRESIZE_BORDER, wxRESIZE_BOX, wxDIALOG_MODAL,
201 wxDIALOG_MODELESS, wxNO_3D, wxTAB_TRAVERSAL,
202 wxWS_EX_VALIDATE_RECURSIVELY
209 wxBoxSizer (not a control)
212 boxsizer's parent must be either <panel>, <dialog> or another
215 If the sizer does not have parent sizer, the sizer will attach itself
216 to the parent panel/dialog using SetAutoLayout(TRUE) and SetSizer().
217 If the parent panel/dialog has default size (i.e. not specified in
218 the resource), the sizer will fit it using wxSizer::Fit(). If the
219 parent panel/dialog is resizable, size hints will be set
223 style orient (= wxHORIZONTAL) orientation, either
224 wxHORIZONTAL or wxVERTICAL
227 wxHORIZONTAL, wxVERTICAL (for orient variable)
229 wxLEFT, wxRIGHT, wxTOP, wxBOTTOM, wxNORTH, wxSOUTH, wxEAST, wxWEST,
230 wxALL, wxGROW, wxEXPAND, wxSHAPED, wxSTRETCH_NOT, wxALIGN_CENTER,
231 wxALIGN_CENTRE, wxALIGN_LEFT, wxALIGN_TOP, wxALIGN_RIGHT,
232 wxALIGN_BOTTOM, wxALIGN_CENTER_HORIZONTAL, wxALIGN_CENTRE_HORIZONTAL,
233 wxALIGN_CENTER_HORIZONTAL, wxALIGN_CENTRE_HORIZONTAL (for flag
234 variable of <item> or <spacer> child nodes)
237 Contains child node <children> which has arbitrary number of
238 <sizeritem> and <spacer> child nodes.
243 integer option (= 0) relative size of the widget
244 style flag (= 0) style flag
245 integer border (= 0) surrounding border
247 Has exactly one child node <window> that contains the control
248 (or child sizer because sizers may be nested)
249 to be inserted into the sizer.
254 integer option (= 0) relative size of the widget
255 style flag (= 0) style flag
256 integer border (= 0) surrounding border
258 Inserts empty space into the sizer
265 wxStaticBoxSizer (not a control)
267 Same as <boxsizer> except that it has additional variable:
269 text label (= "") label of surrounding static box
271 wxStaticBox required by wxStaticBoxSizer is created automatically!
278 wxNotebookSizer (not a control)
281 notebooksizer's parent must be a sizer (not notebooksizer,
291 Has exactly one child node <window> that contains the notebook
292 (nothing else is allowed!) to be inserted into the sizer.
302 text value (= "")default text of the control
305 wxTE_PROCESS_ENTER, wxTE_PROCESS_TAB, wxTE_MULTILINE, wxTE_PASSWORD,
306 wxTE_READONLY, wxHSCROLL
316 integer borders (= 0) window's borders
317 (see wxHtmlWindow::SetBorders)
318 text url (= "") if present, given page will be loaded
319 text htmlcode (= "") if present, given _text_ will be displayed
320 (you will have to use CDATA section
321 to embed HTML code into XML document)
324 wxHW_SCROLLBAR_NEVER, wxHW_SCROLLBAR_AUTO