]>
Commit | Line | Data |
---|---|---|
a302d595 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: xrc_format.h | |
3 | // Purpose: XRC format specification | |
4 | // Author: Vaclav Slavik | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
1dfb6ff0 FM |
9 | |
10 | /* | |
11 | NOTE: to make doxygen happy about <custom-tags> we're forced to | |
12 | escape all < and > symbols which appear inside a doxygen comment | |
13 | */ | |
14 | ||
15 | ||
a302d595 VS |
16 | /** |
17 | ||
18 | @page xrc_format XRC file format | |
19 | ||
20 | Table of contents: | |
21 | - @ref xrc_format_overview | |
22 | - @ref xrc_format_root | |
23 | - @ref xrc_format_objects | |
24 | - @ref xrc_format_object | |
25 | - @ref xrc_format_object_ref | |
26 | - @ref xrc_format_datatypes | |
27 | - @ref xrc_format_windows | |
28 | - @ref xrc_format_std_props | |
29 | - @ref xrc_format_controls | |
30 | - @ref xrc_format_sizers | |
31 | - @ref xrc_format_other_objects | |
32 | - @ref xrc_format_platform | |
33 | - @ref xrc_format_extending | |
34 | - @ref xrc_format_extending_subclass | |
35 | - @ref xrc_format_extending_unknown | |
36 | - @ref xrc_format_extending_custom | |
37 | - @ref xrc_format_packed | |
38 | - @ref xrc_format_oldversions | |
39 | ||
40 | This document describes the format of XRC resource files, as used by | |
41 | wxXmlResource. | |
42 | ||
43 | ||
1dfb6ff0 FM |
44 | <hr> |
45 | ||
46 | ||
a302d595 VS |
47 | @section xrc_format_overview Overview |
48 | ||
49 | XRC file is a XML file with all of its elements in the | |
50 | @c http://www.wxwidgets.org/wxxrc namespace. For backward compatibility, | |
51 | @c http://www.wxwindows.org/wxxrc namespace is accepted as well (and treated | |
52 | as identical to @c http://www.wxwidgets.org/wxxrc), but it shouldn't be used | |
53 | in new XRC files. | |
54 | ||
55 | XRC file contains definitions for one or more @em objects -- typically | |
56 | windows. The objects may themselves contain child objects. | |
57 | ||
58 | Objects defined at the top level, under the | |
59 | @ref xrc_format_root "root element", can be accessed using | |
60 | wxXmlResource::LoadDialog() and other LoadXXX methods. They must have | |
61 | @c name attribute that is used as LoadXXX's argument (see | |
62 | @ref xrc_format_object for details). | |
63 | ||
64 | Child objects are not directly accessible via wxXmlResource, they can only | |
65 | be accessed using XRCCTRL(). | |
66 | ||
67 | ||
1dfb6ff0 | 68 | @section xrc_format_root Root element: \<resource\> |
a302d595 | 69 | |
1dfb6ff0 | 70 | The root element is always @c \<resource\>. It has one optional attribute, @c |
a302d595 VS |
71 | version. If set, it specifies version of the file. In absence of @c version |
72 | attribute, the default is @c "0.0.0.0". | |
73 | ||
74 | The version consists of four integers separated by periods. The first three | |
75 | components are major, minor and release number of the wxWidgets release when | |
76 | the change was introduced, the last one is revision number and is 0 for the | |
77 | first incompatible change in given wxWidgets release, 1 for the second and so | |
78 | on. The version changes only if there was an incompatible change introduced; | |
79 | merely adding new kind of objects does not constitute incompatible change. | |
80 | ||
81 | At the time of writing, the latest version is @c "2.5.3.0". | |
82 | ||
83 | Note that even though @c version attribute is optional, it should always be | |
84 | specified to take advantage of the latest capabilities: | |
85 | ||
86 | @code | |
87 | <?xml version="1.0"?> | |
88 | <resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0"> | |
89 | ... | |
90 | </resource> | |
91 | @endcode | |
92 | ||
1dfb6ff0 | 93 | @c \<resource\> may have arbitrary number of |
a302d595 VS |
94 | @ref xrc_format_objects "object elements" as its children; they are referred |
95 | to as @em toplevel objects in the rest of this document. Unlike objects defined | |
96 | deeper in the hierarchy, toplevel objects @em must have their @c name attribute | |
97 | set and it must be set to a value unique among root's children. | |
98 | ||
99 | ||
100 | ||
101 | @section xrc_format_objects Defining objects | |
102 | ||
1dfb6ff0 | 103 | @subsection xrc_format_object \<object\> |
a302d595 | 104 | |
1dfb6ff0 | 105 | The @c \<object\> element represents a single object (typically a GUI element) |
a302d595 VS |
106 | and it usually maps directly to a wxWidgets class instance. It has one |
107 | mandatory attribute, @c class, and optional @c name and @c subclass attributes. | |
108 | ||
109 | The @c class attribute must always be present, it tells XRC what wxWidgets | |
110 | object should be created and by which wxXmlResourceHandler. | |
111 | ||
112 | @c name is the identifier used to identify the object. This name serves three | |
113 | purposes: | |
114 | ||
115 | -# It is used by wxXmlResource's various LoadXXX() methods to find the | |
116 | resource by name passed as argument. | |
117 | -# wxWindow's name (see wxWindow::GetName()) is set to it. | |
118 | -# Numeric ID of a window or menu item is derived from the name. | |
119 | If the value represents an integer (in decimal notation), it is used for | |
120 | the numeric ID unmodified. If it is one of the wxID_XXX literals defined | |
121 | by wxWidgets (see @ref page_stockitems), its respective value is used. | |
122 | Otherwise, the name is transformed into dynamically generated ID. See | |
123 | wxXmlResource::GetXRCID() for more information. | |
124 | ||
125 | Name attributes must be unique at the top level (where the name is used to | |
126 | load resources) and should be unique among all controls within the same | |
127 | toplevel window (wxDialog, wxFrame). | |
128 | ||
129 | The @c subclass attribute optional name of class whose constructor will be | |
130 | called instead of the constructor for "class". | |
131 | See @ref xrc_format_extending_subclass for more details. | |
132 | ||
1dfb6ff0 | 133 | @c \<object\> element may -- and almost always do -- have children elements. |
a302d595 VS |
134 | These come in two varieties: |
135 | ||
136 | -# Object's properties. A @em property is a value describing part of object's | |
137 | behaviour, for example the "label" property on wxButton defines its label. | |
138 | In the most common form, property is a single element with text content | |
1dfb6ff0 | 139 | ("<label>Cancel</label>"), but they may use nested subelements too (e.g. |
a302d595 VS |
140 | @ref xrc_format_type_font "font property"). A property can only be |
141 | listed once in an object's definition. | |
142 | -# Child objects. Window childs, sizers, sizer items or notebook pages | |
143 | are all examples of child objects. They are represented using nested | |
1dfb6ff0 | 144 | @c \<object\> elements and are can be repeated more than once. The specifics |
a302d595 VS |
145 | of which object classes are allowed as children are class-specific and |
146 | are documented below in @ref xrc_format_controls. | |
147 | ||
148 | Example: | |
149 | @code | |
150 | <object class="wxDialog" name="example_dialog"> | |
151 | <!-- properties: --> | |
152 | <title>Non-Derived Dialog Example</title> | |
153 | <centered>1</centered> | |
154 | <!-- child objects: --> | |
155 | <object class="wxBoxSizer"> | |
156 | <orient>wxVERTICAL</orient> | |
157 | <cols>1</cols> | |
158 | <rows>0</rows> | |
159 | ... | |
160 | </object> | |
161 | </object> | |
162 | @endcode | |
163 | ||
164 | ||
165 | @subsection xrc_format_object_ref <object_ref> | |
166 | ||
1dfb6ff0 FM |
167 | Anywhere an @c \<object\> element can be used, @c \<object_ref\> may be used |
168 | instead. @c \<object_ref\> is a @em reference to another named (i.e. with the | |
169 | @c name attribute) @c \<object\> element. It has one mandatory attribute, | |
170 | @c ref, with value containing the name of a named @c \<object\> element. When an | |
171 | @c \<object_ref\> is encountered, a copy of the referenced @c \<object\> element | |
172 | is made in place of @c \<object_ref\> occurrence and processed as usual. | |
a302d595 VS |
173 | |
174 | For example, the following code: | |
175 | @code | |
176 | <object class="wxDialog" name="my_dlg"> | |
177 | ... | |
178 | </object> | |
179 | <object_ref name="my_dlg_alias" ref="my_dlg"/> | |
180 | @endcode | |
181 | is equivalent to | |
182 | @code | |
183 | <object class="wxDialog" name="my_dlg"> | |
184 | ... | |
185 | </object> | |
186 | <object class="wxDialog" name="my_dlg_alias"> | |
187 | ... <!-- same as in my_dlg --> | |
188 | </object> | |
189 | @endcode | |
190 | ||
191 | Additionally, it is possible to override some parts of the referenced object | |
1dfb6ff0 | 192 | in the @c \<object_ref\> pointing to it. This is useful for putting repetitive |
a302d595 VS |
193 | parts of XRC definitions into a template that can be reused and customized in |
194 | several places. The two parts are merged as follows: | |
195 | ||
196 | -# The referred object is used as the initial content. | |
1dfb6ff0 FM |
197 | -# All attributes set on @c \<object_ref\> are added to it. |
198 | -# All child elements of @c \<object_ref\> are scanned. If an element with | |
a302d595 VS |
199 | the same name (and, if specified, the @c name attribute too) is found |
200 | in the referred object, they are recursively merged. | |
1dfb6ff0 | 201 | -# Child elements in @c \<object_ref\> that do not have a match in the referred |
a302d595 VS |
202 | object are appended to the list of children of the resulting element by |
203 | default. Optionally, they may have @c insert_at attribute with two possible | |
204 | values, "begin" or "end". When set to "begin", the element is prepended to | |
205 | the list of children instead of appended. | |
206 | ||
207 | For example, "my_dlg" in this snippet: | |
208 | @code | |
209 | <object class="wxDialog" name="template"> | |
210 | <title>Dummy dialog</title> | |
211 | <size>400,400</size> | |
212 | </object> | |
213 | <object_ref ref="template" name="my_dlg"> | |
214 | <title>My dialog</title> | |
215 | <centered>1</centered> | |
216 | </object> | |
217 | @endcode | |
218 | is identical to: | |
219 | @code | |
220 | <object_ref ref="template" name="my_dlg"> | |
221 | <title>My dialog</title> | |
222 | <size>400,400</size> | |
223 | <centered>1</centered> | |
224 | </object> | |
225 | @endcode | |
226 | ||
227 | ||
228 | @section xrc_format_datatypes Data types | |
229 | ||
230 | There are several property data types that are frequently reused by different | |
231 | properties. Rather than describing their format in the documentation of | |
232 | every property, we list commonly used types in this section and document | |
233 | their format. | |
234 | ||
235 | ||
236 | @subsection xrc_format_type_bool Boolean | |
237 | ||
238 | Boolean values are expressed using either "1" literal (true) or "0" (false). | |
239 | ||
240 | ||
241 | @subsection xrc_format_type_float Floating-point value | |
242 | ||
243 | Floating point values use POSIX (C locale) formatting -- decimal separator | |
244 | is "." regardless of the locale. | |
245 | ||
246 | ||
247 | @subsection xrc_format_type_colour Colour | |
248 | ||
249 | Colour specification can be either any string colour representation accepted | |
250 | by wxColour::Set() or any wxSYS_COLOUR_XXX symbolic name accepted by | |
251 | wxSystemSettings::GetColour(). In particular, the following forms are supported: | |
252 | ||
253 | @li named colours from wxColourDatabase | |
254 | @li HTML-like "#rrggbb" syntax (but not "#rgb") | |
255 | @li CSS-style "rgb(r,g,b)" and "rgba(r,g,b,a)" | |
256 | @li wxSYS_COLOUR_XXX symbolic names | |
257 | ||
258 | Some examples: | |
259 | @code | |
260 | <fg>red</fg> | |
261 | <fg>#ff0000</fg> | |
262 | <fg>rgb(255,0,0)</fg> | |
263 | <fg>wxSYS_COLOUR_HIGHLIGHT</fg> | |
264 | @endcode | |
265 | ||
266 | ||
267 | @subsection xrc_format_type_size Size | |
268 | ||
269 | Sizes and positions have the form of string with two comma-separated integer | |
270 | components, with optional "d" suffix. Semi-formally: | |
271 | ||
272 | size := x "," y ["d"] | |
273 | ||
274 | where x and y are integers. Either of the components (or both) may be "-1" to | |
275 | signify default value. As a shortcut, empty string is equivalent to "-1,-1" | |
276 | (= wxDefaultSize or wxDefaultPosition). | |
277 | ||
278 | When the "d" suffix is used, integer values are interpreted as | |
279 | @ref wxWindow::ConvertDialogToPixels() "dialog units" in the parent window. | |
280 | ||
281 | Examples: | |
282 | @code | |
283 | 42,-1 | |
284 | 100,100 | |
285 | 100,50d | |
286 | @endcode | |
287 | ||
288 | @subsection xrc_format_type_pos Position | |
289 | ||
290 | Same as @ref xrc_format_type_size. | |
291 | ||
292 | ||
293 | @subsection xrc_format_type_dimension Dimension | |
294 | ||
295 | Similarly to @ref xrc_format_type_size "sizes", dimensions are expressed | |
296 | as integers with optional "d" suffix. When "d" suffix is used, the integer | |
297 | preceding it is interpreted as dialog units in the parent window. | |
298 | ||
299 | ||
300 | @subsection xrc_format_type_text Text | |
301 | ||
302 | String properties use several escape sequences that are translated according to | |
303 | the following table: | |
304 | @beginDefList | |
305 | @itemdef{ "_", "&" (used for accelerators in wxWidgets) } | |
306 | @itemdef{ "__", "_" } | |
307 | @itemdef{ "\n", line break } | |
308 | @itemdef{ "\r", carriage return } | |
309 | @itemdef{ "\t", tab } | |
310 | @itemdef{ "\\", "\" } | |
311 | @endDefList | |
312 | ||
313 | By default, the text is translated using wxLocale::GetTranslation() before | |
314 | it is used. This can be disabled either globally by not passing | |
315 | wxXRC_USE_LOCALE to wxXmlResource constructor, or by setting the @c translate | |
316 | attribute on the property node to "0": | |
317 | @code | |
318 | <!-- this is not translated: --> | |
319 | <label translate="0">_Unix</label> | |
320 | <!-- but this is: --> | |
321 | <help>Use Unix-style newlines</help> | |
322 | @endcode | |
323 | ||
324 | @note Even though the "_" character is used instead of "&" for accelerators, | |
325 | it is still possible to use "&". The latter has to be encoded as "&", | |
326 | though, so using "_" is more convenient. | |
327 | ||
328 | @see @ref xrc_format_pre_v2530, @ref xrc_format_pre_v2301 | |
329 | ||
330 | ||
331 | @subsection xrc_format_type_text_notrans Non-translatable text | |
332 | ||
333 | Like @ref xrc_format_type_text, but the text is never translated and | |
334 | @c translate attribute cannot be used. | |
335 | ||
336 | ||
be42eeb0 VS |
337 | @subsection xrc_format_type_string URL |
338 | ||
339 | An unformatted string. Unlike with @ref xrc_format_type_text, no escaping | |
340 | or translations are done. | |
341 | ||
342 | ||
343 | @subsection xrc_format_type_url URL | |
344 | ||
345 | Any URL accepted by wxFileSystem (typically relative to XRC file's location, | |
346 | but can be absolute too). Unlike with @ref xrc_format_type_text, no escaping | |
347 | or translations are done. | |
348 | ||
349 | ||
a302d595 VS |
350 | @subsection xrc_format_type_bitmap Bitmap |
351 | ||
352 | Bitmap properties contain specification of a single bitmap or icon. In the most | |
353 | basic form, their text value is simply a relative filename (or another | |
354 | wxFileSystem URL) of the bitmap to use. For example: | |
355 | @code | |
356 | <object class="tool" name="wxID_NEW"> | |
357 | <tooltip>New</tooltip> | |
358 | <bitmap>new.png</bitmap> | |
359 | </object> | |
360 | @endcode | |
361 | The value is interpreted as path relative to the location of XRC file where the | |
362 | reference occurs. | |
363 | ||
364 | Alternatively, it is possible to specify the bitmap using wxArtProvider IDs. | |
365 | In this case, the property element has no textual value (filename) and instead | |
366 | has the @c stock_id XML attribute that contains stock art ID as accepted by | |
367 | wxArtProvider::GetBitmap(). This can be either custom value (if the app uses | |
368 | app-specific art provider) or one of the predefined wxART_XXX constants. | |
369 | ||
370 | Optionally, @c stock_client attribute may be specified too and contain one of | |
371 | the predefined wxArtClient values. If it is not specified, the default client | |
372 | ID most appropriate in the context where the bitmap is referenced will be used. | |
373 | In most cases, specifying @c stock_client is not needed. | |
374 | ||
375 | Examples of stock bitmaps usage: | |
376 | @code | |
377 | <bitmap stock_id="fixed-width"/> <!-- custom app-specific art --> | |
674d80a7 | 378 | <bitmap stock_id="wxART_FILE_OPEN"/> <!-- standard art --> |
a302d595 VS |
379 | @endcode |
380 | ||
381 | Specifying the bitmap directly and using @c stock_id are mutually exclusive. | |
382 | ||
383 | ||
384 | @subsection xrc_format_type_style Style | |
385 | ||
386 | Style properties (such as window's style or sizer flags) use syntax similar to | |
387 | C++: the style value is OR-combination of individual flags. Symbolic names | |
388 | identical to those used in C++ code are used for the flags. Flags are separated | |
389 | with "|" (whitespace is allowed but not required around it). | |
390 | ||
391 | The flags that are allowed for a given property are context-dependent. | |
392 | ||
393 | Examples: | |
394 | @code | |
395 | <style>wxCAPTION|wxSYSTEM_MENU | wxRESIZE_BORDER</style> | |
396 | <exstyle>wxDIALOG_EX_CONTEXTHELP</exstyle> | |
397 | @endcode | |
398 | ||
399 | ||
400 | @subsection xrc_format_type_font Font | |
401 | ||
402 | XRC uses similar, but more flexible, abstract description of fonts to that | |
403 | used by wxFont class. A font can be described either in terms of its elementary | |
404 | properties, or it can be derived from one of system fonts. | |
405 | ||
406 | The font property element is "composite" element: unlike majority of | |
407 | properties, it doesn't have text value but contains several child elements | |
408 | instead. These children are handled in the same way as object properties | |
409 | and can be one of the following "sub-properties": | |
410 | ||
411 | @beginTable | |
412 | @hdr3col{property, type, description} | |
413 | @row3col{size, unsigned integer, | |
414 | Pixel size of the font (default: wxNORMAL_FONT's size or @c sysfont's | |
415 | size if the @c sysfont property is used.} | |
416 | @row3col{style, enum, | |
417 | One of "normal", "italic" or "slant" (default: normal).} | |
418 | @row3col{weight, enum, | |
419 | One of "normal", "bold" or "light" (default: normal).} | |
420 | @row3col{family, enum, | |
421 | One of "roman", "script", "decorative", "swiss", "modern" or "teletype" | |
422 | (default: roman).} | |
423 | @row3col{underlined, @ref xrc_format_type_bool, | |
424 | Whether the font should be underlined (default: 0).} | |
425 | @row3col{face, , | |
426 | Comma-separated list of face names; the first one available is used | |
427 | (default: unspecified).} | |
428 | @row3col{encoding, , | |
429 | Charset of the font, unused in Unicode build), as string | |
430 | (default: unspecified).} | |
431 | @row3col{sysfont, , | |
432 | Symbolic name of system standard font(one of wxSYS_*_FONT constants).} | |
433 | @row3col{relativesize, float, | |
434 | Float, font size relative to chosen system font's size; can only be | |
435 | used when 'sysfont' is used and when 'size' is not used.} | |
436 | @endTable | |
437 | ||
438 | All of them are optional, if they are missing, appropriate wxFont default is | |
439 | used. If the @c sysfont property is used, then the defaults are taken from it | |
440 | instead. | |
441 | ||
442 | Examples: | |
443 | @code | |
444 | <font> | |
445 | <!-- fixed font: Arial if available, fall back to Helvetica --> | |
446 | <face>arial,helvetica</face> | |
447 | <size>12</size> | |
448 | </font> | |
449 | ||
450 | <font> | |
451 | <!-- enlarged, enboldened standard font: --> | |
452 | <sysfont>wxSYS_DEFAULT_GUI_FONT</sysfont> | |
453 | <weight>bold</weight> | |
454 | <relativesize>1.5</relativesize> | |
455 | </font> | |
456 | @endcode | |
457 | ||
458 | ||
459 | @section xrc_format_windows Controls and windows | |
460 | ||
461 | This section describes support wxWindow-derived classes in XRC format. | |
462 | ||
463 | @subsection xrc_format_std_props Standard properties | |
464 | ||
465 | The following properties are always (unless stated otherwise in | |
466 | control-specific docs) available for @em windows objects. They are omitted | |
467 | from properties lists below. | |
468 | ||
469 | @beginTable | |
470 | @hdr3col{property, type, description} | |
be42eeb0 | 471 | @row3col{pos, @ref xrc_format_type_pos, |
a302d595 VS |
472 | Initial position of the window (default: wxDefaultPosition).} |
473 | @row3col{size, @ref xrc_format_type_size, | |
474 | Initial size of the window (default: wxDefaultSize).} | |
475 | @row3col{style, @ref xrc_format_type_style, | |
476 | Window style for this control. The allowed values depend on what | |
477 | window is being created, consult respective class' constructor | |
478 | documentation for details (default: window-dependent default, usually | |
479 | wxFOO_DEFAULT_STYLE if defined for class wxFoo, 0 if not).} | |
480 | @row3col{exstyle, @ref xrc_format_type_style, | |
481 | Extra style for the window, if any. See wxWindow::SetExtraStyle() | |
482 | (default: not set).} | |
483 | @row3col{fg, @ref xrc_format_type_colour, | |
484 | Foreground colour of the window (default: window's default).} | |
485 | @row3col{bg, @ref xrc_format_type_colour, | |
486 | Background colour of the window (default: window's default).} | |
487 | @row3col{enabled, @ref xrc_format_type_bool, | |
488 | If set to 0, the control is disabled (default: 1).} | |
489 | @row3col{hidden, @ref xrc_format_type_bool, | |
490 | If set to 1, the control is created hidden (default: 0).} | |
491 | @row3col{tooltip, @ref xrc_format_type_text, | |
492 | Tooltip to use for the control (default: not set).} | |
493 | @row3col{font, @ref xrc_format_type_font, | |
494 | Font to use for the control (default: window's default).} | |
495 | @row3col{help, @ref xrc_format_type_text, | |
496 | Context-sensitive help for the control, used by wxHelpProvider | |
497 | (default: not set).} | |
498 | @endTable | |
499 | ||
500 | All of these properties are optional. | |
501 | ||
502 | ||
503 | @subsection xrc_format_controls Supported controls | |
504 | ||
be42eeb0 VS |
505 | This section lists all controls supported by default. For each control, its |
506 | control-specific properties are listed. If the control can have child objects, | |
507 | it is documented there too; unless said otherwise, XRC elements for these | |
508 | controls cannot have children. | |
509 | ||
a302d595 | 510 | @subsubsection xrc_wxanimationctrl wxAnimationCtrl |
be42eeb0 VS |
511 | |
512 | @beginTable | |
513 | @hdr3col{property, type, description} | |
514 | @row3col{animation, @ref xrc_format_type_url, | |
515 | Animation file to load into the control (required).} | |
516 | @endTable | |
517 | ||
a302d595 VS |
518 | |
519 | @subsubsection xrc_wxbitmapbutton wxBitmapButton | |
be42eeb0 VS |
520 | |
521 | @beginTable | |
522 | @hdr3col{property, type, description} | |
523 | @row3col{default, @ref xrc_format_type_bool, | |
524 | Should this button be the default button in dialog (default: 0)?} | |
525 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
526 | Bitmap to show on the button (required).} | |
527 | @row3col{selected, @ref xrc_format_type_bitmap, | |
528 | Bitmap to show when the button is selected (default: none, same as @c bitmap).} | |
529 | @row3col{focus, @ref xrc_format_type_bitmap, | |
530 | Bitmap to show when the button has focus (default: none, same as @c bitmap).} | |
531 | @row3col{disabled, @ref xrc_format_type_bitmap, | |
532 | Bitmap to show when the button is disabled (default: none, same as @c bitmap).} | |
533 | @row3col{hover, @ref xrc_format_type_bitmap, | |
534 | Bitmap to show when mouse cursor hovers above the bitmap (default: none, same as @c bitmap).} | |
535 | @endTable | |
536 | ||
a302d595 VS |
537 | |
538 | @subsubsection xrc_wxbitmapcombobox wxBitmapComboBox | |
be42eeb0 VS |
539 | |
540 | @beginTable | |
541 | @hdr3col{property, type, description} | |
542 | @row3col{selection, integer, | |
543 | Index of the initially selected item or -1 for no selection (default: -1).} | |
544 | @row3col{value, @ref xrc_format_type_string, | |
545 | Initial value in the control (doesn't have to be one of @ content values; | |
546 | default: empty).} | |
547 | @endTable | |
548 | ||
549 | If both @c value and @c selection are specified and @c selection is not -1, | |
550 | then @c selection takes precedence. | |
551 | ||
552 | A wxBitmapComboBox can have one or more child objects of the @c ownerdrawnitem | |
553 | pseudo-class. @c ownerdrawnitem objects have the following properties: | |
554 | ||
555 | @beginTable | |
556 | @hdr3col{property, type, description} | |
557 | @row3col{text, @ref xrc_format_type_text, | |
558 | Item's label (required).} | |
559 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
560 | Item's bitmap (default: no bitmap).} | |
561 | @endTable | |
562 | ||
563 | Example: | |
564 | @code | |
565 | <object class="wxBitmapComboBox"> | |
566 | <selection>1</selection> | |
567 | <object class="ownerdrawnitem"> | |
568 | <text>Foo</text> | |
569 | <bitmap>foo.png</bitmap> | |
570 | </object> | |
571 | <object class="ownerdrawnitem"> | |
572 | <text>Bar</text> | |
573 | <bitmap>bar.png</bitmap> | |
574 | </object> | |
575 | </object> | |
576 | @endcode | |
577 | ||
a302d595 VS |
578 | |
579 | @subsubsection xrc_wxbutton wxButton | |
be42eeb0 VS |
580 | |
581 | @beginTable | |
582 | @hdr3col{property, type, description} | |
583 | @row3col{label, @ref xrc_format_type_text, | |
584 | Label to display on the button (required).} | |
585 | @row3col{default, @ref xrc_format_type_bool, | |
586 | Should this button be the default button in dialog (default: 0)?} | |
587 | @endTable | |
588 | ||
a302d595 VS |
589 | |
590 | @subsubsection xrc_wxcalendarctrl wxCalendarCtrl | |
be42eeb0 VS |
591 | |
592 | No additional properties. | |
593 | ||
a302d595 VS |
594 | |
595 | @subsubsection xrc_wxcheckbox wxCheckBox | |
be42eeb0 VS |
596 | |
597 | @beginTable | |
598 | @hdr3col{property, type, description} | |
599 | @row3col{label, @ref xrc_format_type_text, | |
600 | Label to use for the checkbox (required).} | |
601 | @row3col{checked, @ref xrc_format_type_bool, | |
602 | Should the checkbox be checked initially (default: 0)?} | |
603 | @endTable | |
604 | ||
a302d595 VS |
605 | |
606 | @subsubsection xrc_wxchecklistbox wxCheckListBox | |
be42eeb0 VS |
607 | |
608 | @beginTable | |
609 | @hdr3col{property, type, description} | |
610 | @row3col{content, , | |
611 | Content of the control; this property has any number of @c \<item\> XML | |
612 | elements as its children, with the items text as their text values | |
613 | (default: empty).} | |
614 | @endTable | |
615 | ||
616 | The @c \<item\> elements have listbox items' labels as their text values. They | |
617 | can also have optional @c checked XML attribute -- if set to "1", the value is | |
618 | initially checked. | |
619 | ||
620 | Example: | |
621 | @code | |
622 | <object class="wxCheckListBox"> | |
623 | <content> | |
624 | <item checked="1">Download library</item> | |
625 | <item checked="1">Compile samples</item> | |
626 | <item checked="1">Skim docs</item> | |
627 | <item checked="1">Finish project</item> | |
628 | <item>Wash car</item> | |
629 | </content> | |
630 | </object> | |
631 | @endcode | |
632 | ||
a302d595 VS |
633 | |
634 | @subsubsection xrc_wxchoice wxChoice | |
be42eeb0 VS |
635 | |
636 | @beginTable | |
637 | @hdr3col{property, type, description} | |
638 | @row3col{selection, integer, | |
639 | Index of the initially selected item or -1 for no selection (default: -1).} | |
640 | @row3col{content, , | |
641 | Content of the control; this property has any number of @c \<item\> XML | |
642 | elements as its children, with the items text as their text values | |
643 | (default: empty).} | |
644 | @endTable | |
645 | ||
646 | Example: | |
647 | @code | |
648 | <object class="wxChoice" name="controls_choice"> | |
649 | <content> | |
650 | <item>See</item> | |
651 | <item>Hear</item> | |
652 | <item>Feel</item> | |
653 | <item>Smell</item> | |
654 | <item>Taste</item> | |
655 | <item>The Sixth Sense!</item> | |
656 | </content> | |
657 | </object> | |
658 | @endcode | |
659 | ||
a302d595 VS |
660 | |
661 | @subsubsection xrc_wxchoicebook wxChoicebook | |
be42eeb0 VS |
662 | |
663 | No additional properties. | |
664 | ||
665 | A choicebook can have one or more child objects of the @c choicebookpage | |
666 | pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its | |
667 | @c notebookpage). @c choicebookpage objects have the following properties: | |
668 | ||
669 | @beginTable | |
670 | @hdr3col{property, type, description} | |
671 | @row3col{label, @ref xrc_format_type_text, | |
672 | Sheet page's title (required).} | |
673 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
674 | Bitmap shown alongside the label (default: none).} | |
675 | @row3col{selected, @ref xrc_format_type_bool, | |
676 | Is the page selected initially (only one page can be selected; default: 0)?} | |
677 | @endTable | |
678 | ||
679 | Each @c choicebookpage has exactly one non-toplevel window as its child. | |
680 | ||
a302d595 VS |
681 | |
682 | @subsubsection xrc_wxcollapsiblepane wxCollapsiblePane | |
be42eeb0 VS |
683 | |
684 | @beginTable | |
685 | @hdr3col{property, type, description} | |
686 | @row3col{label, @ref xrc_format_type_text, | |
687 | Label to use for the collapsible section (required).} | |
688 | @row3col{collapsed, @ref xrc_format_type_bool, | |
689 | Should the pane be collapsed initially (default: 0)?} | |
690 | @endTable | |
691 | ||
692 | wxCollapsiblePane may contain single optional child object of the @c panewindow | |
693 | pseudo-class type. @c panewindow itself must contain exactly one child that | |
694 | is a @ref xrc_format_sizers "sizer" or a non-toplevel window | |
695 | object. | |
696 | ||
a302d595 VS |
697 | |
698 | @subsubsection xrc_wxcolourpickerctrl wxColourPickerCtrl | |
be42eeb0 VS |
699 | |
700 | @beginTable | |
701 | @hdr3col{property, type, description} | |
702 | @row3col{value, @ref xrc_format_type_colour, | |
703 | Initial value of the control (default: wxBLACK).} | |
704 | @endTable | |
705 | ||
a302d595 VS |
706 | |
707 | @subsubsection xrc_wxcombobox wxComboBox | |
be42eeb0 VS |
708 | |
709 | @beginTable | |
710 | @hdr3col{property, type, description} | |
711 | @row3col{selection, integer, | |
712 | Index of the initially selected item or -1 for no selection (default: not used).} | |
713 | @row3col{content, , | |
714 | Content of the control; this property has any number of @c \<item\> XML | |
715 | elements as its children, with the items text as their text values | |
716 | (default: empty).} | |
717 | @row3col{value, @ref xrc_format_type_string, | |
718 | Initial value in the control (doesn't have to be one of @ content values; | |
719 | default: empty).} | |
720 | @endTable | |
721 | ||
722 | If both @c value and @c selection are specified and @c selection is not -1, | |
723 | then @c selection takes precedence. | |
724 | ||
725 | Example: | |
726 | @code | |
727 | <object class="wxComboBox" name="controls_combobox"> | |
728 | <style>wxCB_DROPDOWN</style> | |
729 | <value>nedit</value> | |
730 | <content> | |
731 | <item>vim</item> | |
732 | <item>emacs</item> | |
733 | <item>notepad.exe</item> | |
734 | <item>bbedit</item> | |
735 | </content> | |
736 | </object> | |
737 | @endcode | |
a302d595 VS |
738 | |
739 | @subsubsection xrc_wxdatepickerctrl wxDatePickerCtrl | |
be42eeb0 VS |
740 | |
741 | No additional properties. | |
742 | ||
a302d595 VS |
743 | |
744 | @subsubsection xrc_wxdialog wxDialog | |
be42eeb0 VS |
745 | |
746 | @beginTable | |
747 | @hdr3col{property, type, description} | |
748 | @row3col{title, @ref xrc_format_type_text, | |
749 | Dialog's title (default: empty).} | |
750 | @row3col{icon, @ref xrc_format_type_bitmap, | |
751 | Dialog's icon (default: not used).} | |
752 | @row3col{centered, @ref xrc_format_type_bool, | |
753 | Whether the dialog should be centered on the screen (default: 0).} | |
754 | @endTable | |
755 | ||
756 | wxDialog may have optional children: either exactly one | |
757 | @ref xrc_format_sizers "sizer" child or any number of non-toplevel window | |
758 | objects. If sizer child is used, it sets | |
759 | @ref wxSizer::SetSizeHints() "size hints" too. | |
a302d595 VS |
760 | |
761 | @subsubsection xrc_wxdirpickerctrl wxDirPickerCtrl | |
be42eeb0 VS |
762 | |
763 | @beginTable | |
764 | @hdr3col{property, type, description} | |
765 | @row3col{value, @ref xrc_format_type_string, | |
766 | Initial value of the control (default: empty).} | |
767 | @row3col{message, @ref xrc_format_type_text, | |
768 | Message shown to the user in wxDirDialog shown by the control (required).} | |
769 | @endTable | |
770 | ||
a302d595 VS |
771 | |
772 | @subsubsection xrc_wxfilepickerctrl wxFilePickerCtrl | |
be42eeb0 VS |
773 | |
774 | @beginTable | |
775 | @hdr3col{property, type, description} | |
776 | @row3col{value, @ref xrc_format_type_string, | |
777 | Initial value of the control (default: empty).} | |
778 | @row3col{message, @ref xrc_format_type_text, | |
779 | Message shown to the user in wxDirDialog shown by the control (required).} | |
780 | @row3col{wildcard, @ref xrc_format_type_string, | |
781 | Message shown to the user in wxDirDialog shown by the control (required).} | |
782 | @endTable | |
783 | ||
a302d595 VS |
784 | |
785 | @subsubsection xrc_wxfontpickerctrl wxFontPickerCtrl | |
be42eeb0 VS |
786 | |
787 | @beginTable | |
788 | @hdr3col{property, type, description} | |
789 | @row3col{value, @ref xrc_format_type_font, | |
790 | Initial value of the control (default: wxNORMAL_FONT).} | |
791 | @endTable | |
a302d595 VS |
792 | |
793 | @subsubsection xrc_wxfrane wxFrame | |
be42eeb0 VS |
794 | |
795 | @beginTable | |
796 | @hdr3col{property, type, description} | |
797 | @row3col{title, @ref xrc_format_type_text, | |
798 | Frame's title (default: empty).} | |
799 | @row3col{icon, @ref xrc_format_type_bitmap, | |
800 | Frame's icon (default: not used).} | |
801 | @row3col{centered, @ref xrc_format_type_bool, | |
802 | Whether the frame should be centered on the screen (default: 0).} | |
803 | @endTable | |
804 | ||
805 | wxFrame may have optional children: either exactly one | |
806 | @ref xrc_format_sizers "sizer" child or any number of non-toplevel window | |
807 | objects. If sizer child is used, it sets | |
808 | @ref wxSizer::SetSizeHints() "size hints" too. | |
809 | ||
a302d595 VS |
810 | |
811 | @subsubsection xrc_wxgauge wxGauge | |
be42eeb0 VS |
812 | |
813 | @beginTable | |
814 | @hdr3col{property, type, description} | |
815 | @row3col{range, integer, | |
033508e1 | 816 | Maximum value of the gauge (default: 100).} |
be42eeb0 VS |
817 | @row3col{value, integer, |
818 | Initial value of the control (default: 0).} | |
819 | @row3col{shadow, @ref xrc_format_type_dimension, | |
820 | Rendered shadow size (default: none; ignored by most platforms).} | |
821 | @row3col{bezel, @ref xrc_format_type_dimension, | |
822 | Rendered bezel size (default: none; ignored by most platforms).} | |
823 | @endTable | |
a302d595 VS |
824 | |
825 | @subsubsection xrc_wxgenericdirctrl wxGenericDirCtrl | |
be42eeb0 VS |
826 | |
827 | @beginTable | |
828 | @hdr3col{property, type, description} | |
829 | @row3col{defaultfolder, @ref xrc_format_type_text, | |
830 | Initial folder (default: empty).} | |
831 | @row3col{filter, @ref xrc_format_type_text, | |
832 | Filter string, using the same syntax as used by wxFileDialog, e.g. | |
833 | "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg" (default: empty).} | |
834 | @row3col{defaultfilter, integer, | |
835 | Zero-based index of default filter (default: 0).} | |
836 | @endTable | |
a302d595 VS |
837 | |
838 | @subsubsection xrc_wxgrid wxGrid | |
be42eeb0 VS |
839 | |
840 | No additional properties. | |
841 | ||
a302d595 VS |
842 | |
843 | @subsubsection xrc_wxhtmlwindow wxHtmlWindow | |
be42eeb0 VS |
844 | |
845 | @beginTable | |
846 | @hdr3col{property, type, description} | |
847 | @row3col{url, @ref xrc_format_type_url, | |
848 | Page to display in the window.} | |
849 | @row3col{htmlcode, @ref xrc_format_type_text, | |
850 | HTML markup to display in the window.} | |
851 | @row3col{borders, @ref xrc_format_type_dimension, | |
852 | Border around HTML content (default: 0).} | |
853 | @endTable | |
854 | ||
855 | At most one of @c url and @c htmlcode properties may be specified, they are | |
856 | mutually exclusive. If neither is set, the window is initialized to show empty | |
857 | page. | |
858 | ||
a302d595 VS |
859 | |
860 | @subsubsection xrc_wxhyperlinkctrl wxHyperlinkCtrl | |
be42eeb0 VS |
861 | |
862 | @beginTable | |
863 | @hdr3col{property, type, description} | |
864 | @row3col{label, @ref xrc_format_type_text, | |
865 | Label to display on the control (required).} | |
866 | @row3col{url, @ref xrc_format_type_url, | |
867 | URL to open when the link is clicked (required).} | |
868 | @endTable | |
869 | ||
a302d595 VS |
870 | |
871 | @subsubsection xrc_wxlistbox wxListBox | |
be42eeb0 VS |
872 | |
873 | @beginTable | |
874 | @hdr3col{property, type, description} | |
875 | @row3col{selection, integer, | |
876 | Index of the initially selected item or -1 for no selection (default: -1).} | |
877 | @row3col{content, , | |
878 | Content of the control; this property has any number of @c \<item\> XML | |
879 | elements as its children, with the items text as their text values | |
880 | (default: empty).} | |
881 | @endTable | |
882 | ||
883 | Example: | |
884 | @code | |
885 | <object class="wxListBox" name="controls_listbox"> | |
886 | <size>250,160</size> | |
887 | <style>wxLB_SINGLE</style> | |
888 | <content> | |
889 | <item>Milk</item> | |
890 | <item>Pizza</item> | |
891 | <item>Bread</item> | |
892 | <item>Orange juice</item> | |
893 | <item>Paper towels</item> | |
894 | </content> | |
895 | </object> | |
896 | @endcode | |
897 | ||
a302d595 VS |
898 | |
899 | @subsubsection xrc_wxlistbook wxListbook | |
be42eeb0 VS |
900 | |
901 | No additional properties. | |
902 | ||
903 | A listbook can have one or more child objects of the @c listbookpage | |
904 | pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its | |
905 | @c notebookpage). @c listbookpage objects have the following properties: | |
906 | ||
907 | @beginTable | |
908 | @hdr3col{property, type, description} | |
909 | @row3col{label, @ref xrc_format_type_text, | |
910 | Sheet page's title (required).} | |
911 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
912 | Bitmap shown alongside the label (default: none).} | |
913 | @row3col{selected, @ref xrc_format_type_bool, | |
914 | Is the page selected initially (only one page can be selected; default: 0)?} | |
915 | @endTable | |
916 | ||
917 | Each @c listbookpage has exactly one non-toplevel window as its child. | |
918 | ||
a302d595 VS |
919 | |
920 | @subsubsection xrc_wxlistctrl wxListCtrl | |
be42eeb0 VS |
921 | |
922 | No additional properties. | |
923 | ||
a302d595 VS |
924 | |
925 | @subsubsection xrc_wxmdiparentframe wxMDIParentFrame | |
be42eeb0 VS |
926 | |
927 | wxMDIParentFrame supports the same properties that @ref xrc_wxfrane does. | |
928 | ||
929 | wxMDIParentFrame may have optional children. When used, the child objects | |
930 | must be of wxMDIChildFrame type. | |
931 | ||
a302d595 VS |
932 | |
933 | @subsubsection xrc_wxmdichildframe wxMDIChildFrame | |
be42eeb0 VS |
934 | |
935 | wxMDIChildFrame supports the same properties that @ref xrc_wxfrane and | |
936 | @ref xrc_wxmdiparentframe do. | |
937 | ||
938 | wxMDIChildFrame can only be used as as immediate child of @ref | |
939 | xrc_wxmdiparentframe. | |
940 | ||
941 | wxMDIChildFrame may have optional children: either exactly one | |
942 | @ref xrc_format_sizers "sizer" child or any number of non-toplevel window | |
943 | objects. If sizer child is used, it sets | |
944 | @ref wxSizer::SetSizeHints() "size hints" too. | |
945 | ||
a302d595 VS |
946 | |
947 | @subsubsection xrc_wxmenu wxMenu | |
be42eeb0 VS |
948 | |
949 | @beginTable | |
950 | @hdr3col{property, type, description} | |
951 | @row3col{label, @ref xrc_format_type_text, | |
952 | Menu's label (default: empty, but required for menus other | |
953 | than popup menus).} | |
954 | @row3col{help, @ref xrc_format_type_text, | |
955 | Help shown in statusbar when the menu is selected (only for submenus | |
956 | of another wxMenu, default: none).} | |
957 | @row3col{enabled, @ref xrc_format_type_bool, | |
958 | Is the submenu item enabled (only for submenus of another wxMenu, | |
959 | default: 1)?} | |
960 | @endTable | |
961 | ||
962 | Note that unlike most controls, wxMenu does @em not have | |
963 | @ref xrc_format_std_props. | |
964 | ||
965 | A menu object can have one or more child objects of the wxMenuItem or wxMenu | |
966 | classes or @c break or @c separator pseudo-classes. | |
967 | ||
968 | The @c separator pseudo-class is used to insert separators into the menu and | |
969 | has neither properties nor children. Likewise, @c break inserts a break (see | |
970 | wxMenu::Break()). | |
971 | ||
972 | wxMenuItem objects support the following properties: | |
973 | ||
974 | @beginTable | |
975 | @hdr3col{property, type, description} | |
976 | @row3col{label, @ref xrc_format_type_text, | |
977 | Item's label (required).} | |
978 | @row3col{accel, @ref xrc_format_type_text_notrans, | |
979 | Item's accelerator (default: none).} | |
980 | @row3col{radio, @ref xrc_format_type_bool, | |
981 | Item's kind is wxITEM_RADIO (default: 0)?} | |
982 | @row3col{checkable, @ref xrc_format_type_bool, | |
983 | Item's kind is wxITEM_CHECK (default: 0)?} | |
984 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
985 | Bitmap to show with the item (default: none).} | |
986 | @row3col{bitmap2, @ref xrc_format_type_bitmap, | |
987 | Bitmap for the checked state (wxMSW, if checkable; default: none).} | |
988 | @row3col{help, @ref xrc_format_type_text, | |
989 | Help shown in statusbar when the item is selected (default: none).} | |
990 | @row3col{enabled, @ref xrc_format_type_bool, | |
991 | Is the item enabled (default: 1)?} | |
992 | @row3col{checked, @ref xrc_format_type_bool, | |
993 | Is the item checked initially (default: 0)?} | |
994 | @endTable | |
995 | ||
996 | Example: | |
997 | @code | |
998 | <object class="wxMenu" name="menu_edit"> | |
999 | <style>wxMENU_TEAROFF</style> | |
1000 | <label>_Edit</label> | |
1001 | <object class="wxMenuItem" name="wxID_FIND"> | |
1002 | <label>_Find...</label> | |
1003 | <accel>Ctrl-F</accel> | |
1004 | </object> | |
1005 | <object class="separator"/> | |
1006 | <object class="wxMenuItem" name="menu_fuzzy"> | |
1007 | <label>Translation is _fuzzy</label> | |
1008 | <checkable>1</checkable> | |
1009 | </object> | |
1010 | <object class="wxMenu" name="submenu"> | |
1011 | <label>A submenu</label> | |
1012 | <object class="wxMenuItem" name="foo">...</object> | |
1013 | ... | |
1014 | </object> | |
1015 | <object class="separator" platform="unix"/> | |
1016 | <object class="wxMenuItem" name="wxID_PREFERENCES" platform="unix"> | |
1017 | <label>_Preferences</label> | |
1018 | </object> | |
1019 | </object> | |
1020 | @endcode | |
a302d595 VS |
1021 | |
1022 | @subsubsection xrc_wxmenubar wxMenuBar | |
be42eeb0 VS |
1023 | |
1024 | No properties. Note that unlike most controls, wxMenuBar does @em not have | |
1025 | @ref xrc_format_std_props. | |
1026 | ||
1027 | A menubar can have one or more child objects of the @ref xrc_wxmenu "wxMenu" | |
1028 | class. | |
1029 | ||
a302d595 VS |
1030 | |
1031 | @subsubsection xrc_wxnotebook wxNotebook | |
be42eeb0 VS |
1032 | |
1033 | No additional properties. | |
1034 | ||
1035 | A notebook can have one or more child objects of the @c notebookpage | |
1036 | pseudo-class. @c notebookpage objects have the following properties: | |
1037 | ||
1038 | @beginTable | |
1039 | @hdr3col{property, type, description} | |
1040 | @row3col{label, @ref xrc_format_type_text, | |
1041 | Page's title (required).} | |
1042 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
1043 | Bitmap shown alongside the label (default: none).} | |
1044 | @row3col{selected, @ref xrc_format_type_bool, | |
1045 | Is the page selected initially (only one page can be selected; default: 0)?} | |
1046 | @endTable | |
1047 | ||
1048 | Each @c notebookpage has exactly one non-toplevel window as its child. | |
1049 | ||
1050 | Example: | |
1051 | @code | |
1052 | <object class="wxNotebook"> | |
1053 | <style>wxBK_BOTTOM</style> | |
1054 | <object class="notebookpage"> | |
1055 | <label>Page 1</label> | |
1056 | <object class="wxPanel" name="page_1"> | |
1057 | ... | |
1058 | </object> | |
1059 | </object> | |
1060 | <object class="notebookpage"> | |
1061 | <label>Page 2</label> | |
1062 | <object class="wxPanel" name="page_2"> | |
1063 | ... | |
1064 | </object> | |
1065 | </object> | |
1066 | </object> | |
1067 | @endcode | |
1068 | ||
a302d595 VS |
1069 | |
1070 | @subsubsection xrc_wxownerdrawncombobox wxOwnerDrawnComboBox | |
be42eeb0 VS |
1071 | |
1072 | wxOwnerDrawnComboBox has the same properties as | |
1073 | @ref xrc_wxcombobox "wxComboBox", plus the following additional properties: | |
1074 | ||
1075 | @beginTable | |
1076 | @hdr3col{property, type, description} | |
1077 | @row3col{buttonsize, @ref xrc_format_type_size, | |
1078 | Size of the dropdown button (default: default).} | |
1079 | @endTable | |
1080 | ||
a302d595 VS |
1081 | |
1082 | @subsubsection xrc_wxpanel wxPanel | |
be42eeb0 VS |
1083 | |
1084 | No additional properties. | |
1085 | ||
1086 | wxPanel may have optional children: either exactly one | |
1087 | @ref xrc_format_sizers "sizer" child or any number of non-toplevel window | |
1088 | objects. | |
1089 | ||
a302d595 VS |
1090 | |
1091 | @subsubsection xrc_wxpropertysheetdialog wxPropertySheetDialog | |
be42eeb0 VS |
1092 | |
1093 | @beginTable | |
1094 | @hdr3col{property, type, description} | |
1095 | @row3col{title, @ref xrc_format_type_text, | |
1096 | Dialog's title (default: empty).} | |
1097 | @row3col{icon, @ref xrc_format_type_bitmap, | |
1098 | Dialog's icon (default: not used).} | |
1099 | @row3col{centered, @ref xrc_format_type_bool, | |
1100 | Whether the dialog should be centered on the screen (default: 0).} | |
1101 | @row3col{buttons, @ref xrc_format_type_style, | |
1102 | Buttons to show, combination of flags accepted by | |
1103 | wxPropertySheetDialog::CreateButtons() (default: 0).} | |
1104 | @endTable | |
1105 | ||
1106 | A sheet dialog can have one or more child objects of the @c propertysheetpage | |
1107 | pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its | |
1108 | @c notebookpage). @c propertysheetpage objects have the following properties: | |
1109 | ||
1110 | @beginTable | |
1111 | @hdr3col{property, type, description} | |
1112 | @row3col{label, @ref xrc_format_type_text, | |
1113 | Sheet page's title (required).} | |
1114 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
1115 | Bitmap shown alongside the label (default: none).} | |
1116 | @row3col{selected, @ref xrc_format_type_bool, | |
1117 | Is the page selected initially (only one page can be selected; default: 0)?} | |
1118 | @endTable | |
1119 | ||
1120 | Each @c propertysheetpage has exactly one non-toplevel window as its child. | |
1121 | ||
a302d595 VS |
1122 | |
1123 | @subsubsection xrc_wxradiobutton wxRadioButton | |
be42eeb0 VS |
1124 | |
1125 | @beginTable | |
1126 | @hdr3col{property, type, description} | |
1127 | @row3col{label, @ref xrc_format_type_text, | |
1128 | Label shown on the radio button (required).} | |
1129 | @row3col{value, @ref xrc_format_type_bool, | |
1130 | Initial value of the control (default: 0).} | |
1131 | @endTable | |
1132 | ||
a302d595 VS |
1133 | |
1134 | @subsubsection xrc_wxradiobox wxRadioBox | |
be42eeb0 VS |
1135 | |
1136 | @beginTable | |
1137 | @hdr3col{property, type, description} | |
1138 | @row3col{label, @ref xrc_format_type_text, | |
1139 | Label for the whole box (required).} | |
1140 | @row3col{dimension, integer, | |
1141 | Specifies the maximum number of rows (if style contains | |
1142 | @c wxRA_SPECIFY_ROWS) or columns (if style contains @c wxRA_SPECIFY_COLS) | |
1143 | for a two-dimensional radiobox (default: 1).} | |
1144 | @row3col{selection, integer, | |
1145 | Index of the initially selected item or -1 for no selection (default: -1).} | |
1146 | @row3col{content, , | |
1147 | Content of the control; this property has any number of @c \<item\> XML | |
1148 | elements as its children, with the items text as their text values | |
1149 | (see below; default: empty).} | |
1150 | @endTable | |
1151 | ||
1152 | The @c \<item\> elements have radio buttons' labels as their text values. They | |
1153 | can also have some optional XML @em attributes (not properties!): | |
1154 | ||
1155 | @beginTable | |
1156 | @hdr3col{attribute, type, description} | |
1157 | @row3col{tooltip, @ref xrc_format_type_string, | |
1158 | Tooltip to show over this ratio button (default: none).} | |
1159 | @row3col{helptext, @ref xrc_format_type_string, | |
1160 | Contextual help for this radio button (default: none).} | |
1161 | @row3col{enabled, @ref xrc_format_type_bool, | |
1162 | Is the button enabled (default: 1)?} | |
1163 | @row3col{hidden, @ref xrc_format_type_bool, | |
1164 | Is the button hidden initially (default: 0)?} | |
1165 | @endTable | |
1166 | ||
1167 | Example: | |
1168 | @code | |
1169 | <object class="wxRadioBox" name="controls_radiobox"> | |
1170 | <style>wxRA_SPECIFY_COLS</style> | |
1171 | <label>Radio stations</label> | |
1172 | <dimension>1</dimension> | |
1173 | <selection>0</selection> | |
1174 | <content> | |
1175 | <item tooltip="Powerful radio station" helptext="This station is for amateurs of hard rock and heavy metal">Power 108</item> | |
1176 | <item tooltip="Disabled radio station" enabled="0">Power 0</item> | |
1177 | <item tooltip="">WMMS 100.7</item> | |
1178 | <item tooltip="E=mc^2">Energy 98.3</item> | |
1179 | <item helptext="Favourite chukcha's radio">CHUM FM</item> | |
1180 | <item>92FM</item> | |
1181 | <item hidden="1">Very quit station</item> | |
1182 | </content> | |
1183 | </object> | |
1184 | @endcode | |
1185 | ||
a302d595 VS |
1186 | |
1187 | @subsubsection xrc_wxrichtextctrl wxRichTextCtrl | |
be42eeb0 VS |
1188 | |
1189 | @beginTable | |
1190 | @hdr3col{property, type, description} | |
1191 | @row3col{value, @ref xrc_format_type_text, | |
1192 | Initial value of the control (default: empty).} | |
1193 | @row3col{maxlength, integer, | |
1194 | Maximum length of the text entered (default: unlimited).} | |
1195 | @endTable | |
1196 | ||
a302d595 VS |
1197 | |
1198 | @subsubsection xrc_wxscrollbar wxScrollBar | |
be42eeb0 VS |
1199 | |
1200 | @beginTable | |
1201 | @hdr3col{property, type, description} | |
1202 | @row3col{value, integer, | |
1203 | Initial position of the scrollbar (default: 0).} | |
1204 | @row3col{range, integer, | |
1205 | Maximum value of the gauge (default: 10).} | |
1206 | @row3col{thumbsize, integer, | |
1207 | Size of the thumb (default: 1).} | |
1208 | @row3col{pagesize, integer, | |
1209 | Page size (default: 1).} | |
1210 | @endTable | |
a302d595 VS |
1211 | |
1212 | @subsubsection xrc_wxscrolledwindow wxScrolledWindow | |
be42eeb0 VS |
1213 | |
1214 | @beginTable | |
1215 | @hdr3col{property, type, description} | |
1216 | @row3col{scrollrate, @ref xrc_format_type_size, | |
1217 | Scroll rate in @em x and @em y directions (default: not set; | |
1218 | required if the window has a sizer child).} | |
1219 | @endTable | |
1220 | ||
1221 | wxScrolledWindow may have optional children: either exactly one | |
1222 | @ref xrc_format_sizers "sizer" child or any number of non-toplevel window | |
1223 | objects. If sizer child is used, wxSizer::FitInside() is used (instead of | |
1224 | wxSizer::Fit() as usual) and so the children don't determine scrolled window's | |
1225 | minimal size, they only affect @em virtual size. Usually, both @c scrollrate | |
1226 | and either @c size or @c minsize on containing sizer item should be used | |
1227 | in this case. | |
1228 | ||
a302d595 VS |
1229 | |
1230 | @subsubsection xrc_wxsimplehtmllistbox wxSimpleHtmlListBox | |
a302d595 | 1231 | |
be42eeb0 VS |
1232 | wxSimpleHtmlListBox has same properties as @ref xrc_wxlistbox "wxListBox". |
1233 | The only difference is that the text contained in @c \<item\> elements is | |
1234 | HTML markup. Note that the markup has to be escaped: | |
1235 | ||
1236 | @code | |
1237 | <object class="wxSimpleHtmlListBox"> | |
1238 | <content> | |
1239 | <item><b>Bold</b> Milk</item> | |
1240 | </content> | |
1241 | </object> | |
1242 | @endcode | |
1243 | ||
1244 | (X)HTML markup elements cannot be included directly: | |
1245 | ||
1246 | @code | |
1247 | <object class="wxSimpleHtmlListBox"> | |
1248 | <content> | |
1249 | <!-- This is incorrect, doesn't work! --> | |
1250 | <item><b>Bold</b> Milk</item> | |
1251 | </content> | |
1252 | </object> | |
1253 | @endcode | |
1254 | ||
1255 | ||
1256 | @subsubsection xrc_wxslider wxSlider | |
1257 | ||
1258 | @beginTable | |
1259 | @hdr3col{property, type, description} | |
1260 | @row3col{value, integer, | |
033508e1 | 1261 | Initial value of the control (default: 0).} |
be42eeb0 | 1262 | @row3col{min, integer, |
033508e1 | 1263 | Minimum allowed value (default: 0).} |
be42eeb0 | 1264 | @row3col{max, integer, |
033508e1 | 1265 | Maximum allowed value (default: 100).} |
be42eeb0 VS |
1266 | @row3col{pagesize, integer, |
1267 | Line size; number of steps the slider moves when the user moves | |
1268 | pages up or down (default: unset).} | |
1269 | @row3col{linesize, integer, | |
1270 | Line size; number of steps the slider moves when the user moves it | |
1271 | up or down a line (default: unset).} | |
1272 | @row3col{tickfreq, integer, | |
1273 | Tick marks frequency (Windows only; default: unset).} | |
1274 | @row3col{tick, integer, | |
1275 | Tick position (Windows only; default: unset).} | |
1276 | @row3col{thumb, integer, | |
1277 | Thumb length (Windows only; default: unset).} | |
1278 | @row3col{selmin, integer, | |
1279 | Selection start position (Windows only; default: unset).} | |
1280 | @row3col{selmax, integer, | |
1281 | Selection end position (Windows only; default: unset).} | |
1282 | @endTable | |
1283 | ||
a302d595 | 1284 | |
07c22580 | 1285 | @subsubsection xrc_wxspinbutton wxSpinButton |
be42eeb0 VS |
1286 | |
1287 | @beginTable | |
1288 | @hdr3col{property, type, description} | |
1289 | @row3col{value, integer, | |
033508e1 | 1290 | Initial value of the control (default: 0).} |
be42eeb0 | 1291 | @row3col{min, integer, |
033508e1 | 1292 | Minimum allowed value (default: 0).} |
be42eeb0 | 1293 | @row3col{max, integer, |
033508e1 | 1294 | Maximum allowed value (default: 100).} |
be42eeb0 VS |
1295 | @endTable |
1296 | ||
a302d595 | 1297 | |
07c22580 VS |
1298 | @subsubsection xrc_wxspinctrl wxSpinCtrl |
1299 | ||
1300 | wxSpinCtrl supports the properties as @ref xrc_wxspinbutton. | |
1301 | ||
1302 | ||
a302d595 | 1303 | @subsubsection xrc_wxsplitterwindow wxSplitterWindow |
be42eeb0 VS |
1304 | |
1305 | @beginTable | |
1306 | @hdr3col{property, type, description} | |
1307 | @row3col{orientation, @ref xrc_format_type_string, | |
1308 | Orientation of the splitter, either "vertical" or "horizontal" (default: horizontal).} | |
1309 | @row3col{sashpos, integer, | |
1310 | Initial position of the sash (default: 0).} | |
1311 | @row3col{minsize, integer, | |
1312 | Minimum child size (default: not set).} | |
1313 | @row3col{minsize, @ref xrc_format_type_float, | |
1314 | Sash gravity, see wxSplitterWindow::SetSashGravity() (default: not set).} | |
1315 | @endTable | |
1316 | ||
1317 | wxSplitterWindow must have one or two children that are non-toplevel window | |
1318 | objects. If there's only one child, it is used as wxSplitterWindow's only | |
1319 | visible child. If there are two children, the first one is used for left/top | |
1320 | child and the second one for right/bottom child window. | |
1321 | ||
a302d595 VS |
1322 | |
1323 | @subsubsection xrc_wxsearchctrl wxSearchCtrl | |
be42eeb0 VS |
1324 | |
1325 | @beginTable | |
1326 | @hdr3col{property, type, description} | |
1327 | @row3col{value, @ref xrc_format_type_text, | |
1328 | Initial value of the control (default: empty).} | |
1329 | @endTable | |
1330 | ||
a302d595 VS |
1331 | |
1332 | @subsubsection xrc_wxstatusbar wxStatusBar | |
be42eeb0 VS |
1333 | |
1334 | @beginTable | |
1335 | @hdr3col{property, type, description} | |
1336 | @row3col{fields, integer, | |
1337 | Number of status bar fields (default: 1).} | |
1338 | @row3col{widths, @ref xrc_format_type_string, | |
1339 | Comma-separated list of @em fields integers. Each value specifies width | |
1340 | of one field; the values are interpreted using the same convention used | |
1341 | by wxStatusBar::SetStatusWidths().} | |
1342 | @row3col{styles, @ref xrc_format_type_string, | |
1343 | Comma-separated list of @em fields flags. Each value specifies status bar | |
1344 | fieldd style and can be one of @c wxSB_NORMAL, @c wxSB_FLAT or | |
1345 | @c wxSB_RAISED. See wxStatusBar::SetStatusStyles() for their description.} | |
1346 | @endTable | |
1347 | ||
1348 | ||
a302d595 VS |
1349 | |
1350 | @subsubsection xrc_wxstaticbitmap wxStaticBitmap | |
be42eeb0 VS |
1351 | |
1352 | @beginTable | |
1353 | @hdr3col{property, type, description} | |
1354 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
1355 | Bitmap to display (required).} | |
1356 | @endTable | |
a302d595 VS |
1357 | |
1358 | @subsubsection xrc_wxstaticbox wxStaticBox | |
be42eeb0 VS |
1359 | |
1360 | @beginTable | |
1361 | @hdr3col{property, type, description} | |
1362 | @row3col{label, @ref xrc_format_type_text, | |
1363 | Static box's label (required).} | |
1364 | @endTable | |
1365 | ||
a302d595 VS |
1366 | |
1367 | @subsubsection xrc_wxstaticline wxStaticLine | |
be42eeb0 VS |
1368 | |
1369 | No additional properties. | |
1370 | ||
a302d595 VS |
1371 | |
1372 | @subsubsection xrc_wxstatictext wxStaticText | |
be42eeb0 VS |
1373 | |
1374 | @beginTable | |
1375 | @hdr3col{property, type, description} | |
1376 | @row3col{label, @ref xrc_format_type_text, | |
1377 | Label to display (required).} | |
1378 | @row3col{wrap, integer, | |
1379 | Number of characters per line to wrap the text for, see | |
1380 | wxStaticText::Wrap() (default: no wrap).} | |
1381 | @endTable | |
a302d595 VS |
1382 | |
1383 | @subsubsection xrc_wxtextctrl wxTextCtrl | |
be42eeb0 VS |
1384 | |
1385 | @beginTable | |
1386 | @hdr3col{property, type, description} | |
1387 | @row3col{value, @ref xrc_format_type_text, | |
1388 | Initial value of the control (default: empty).} | |
1389 | @row3col{maxlength, integer, | |
1390 | Maximum length of the text which can be entered by user (default: unlimited).} | |
1391 | @endTable | |
1392 | ||
a302d595 VS |
1393 | |
1394 | @subsubsection xrc_wxtogglebuttton wxToggleButton | |
be42eeb0 VS |
1395 | |
1396 | @beginTable | |
1397 | @hdr3col{property, type, description} | |
1398 | @row3col{label, @ref xrc_format_type_text, | |
1399 | Label to display on the button (required).} | |
1400 | @row3col{checked, @ref xrc_format_type_bool, | |
1401 | Should the button be checked/pressed initially (default: 0)?} | |
1402 | @endTable | |
a302d595 VS |
1403 | |
1404 | @subsubsection xrc_wxtoolbar wxToolBar | |
be42eeb0 VS |
1405 | |
1406 | @beginTable | |
1407 | @hdr3col{property, type, description} | |
1408 | @row3col{bitmapsize, @ref xrc_format_type_size, | |
1409 | Size of toolbar bitmaps (default: not set).} | |
1410 | @row3col{margins, @ref xrc_format_type_size, | |
1411 | Margins (default: platform default).} | |
1412 | @row3col{packing, integer, | |
1413 | Packing, see wxToolBar::SetToolPacking() (default: not set).} | |
1414 | @row3col{separation, integer, | |
1415 | Default separator size, see wxToolBar::SetToolSeparation() (default: not set).} | |
1416 | @row3col{dontattachtoframe, @ref xrc_format_type_bool, | |
1417 | If set to 0 and the toolbar object is child of a wxFrame, | |
1418 | wxFrame::SetToolBar() is called; otherwise, you have to add it to a frame | |
1419 | manually. The toolbar is attached by default, you have to set this property | |
1420 | to 1 to disable this behaviour (default: 0).} | |
1421 | @endTable | |
1422 | ||
1423 | A toolbar can have one or more child objects of any wxControl-derived class or | |
1424 | one of two pseudo-classes: @c separator or @c tool. | |
1425 | ||
1426 | The @c separator pseudo-class is used to insert separators into the toolbar and | |
1427 | has neither properties nor children. | |
1428 | ||
1429 | The @c tool pseudo-class objects specify toolbar buttons and have the following | |
1430 | properties: | |
1431 | ||
1432 | @beginTable | |
1433 | @hdr3col{property, type, description} | |
1434 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
1435 | Tool's bitmap (required).} | |
1436 | @row3col{bitmap2, @ref xrc_format_type_bitmap, | |
1437 | Bitmap for disabled tool (default: derived from @c bitmap).} | |
1438 | @row3col{label, @ref xrc_format_type_text, | |
1439 | Label to display on the tool (default: no label).} | |
1440 | @row3col{radio, @ref xrc_format_type_bool, | |
1441 | Item's kind is wxITEM_RADIO (default: 0)?} | |
1442 | @row3col{toggle, @ref xrc_format_type_bool, | |
1443 | Item's kind is wxITEM_CHECK (default: 0)?} | |
1444 | @row3col{tooltip, @ref xrc_format_type_text, | |
1445 | Tooltip to use for the tool (default: none).} | |
1446 | @row3col{longhelp, @ref xrc_format_type_text, | |
1447 | Help text shown in statusbar when the mouse is on the tool (default: none).} | |
1448 | @row3col{disabled, @ref xrc_format_type_bool, | |
1449 | Is the tool initially disabled (default: 0)?} | |
1450 | @endTable | |
1451 | ||
1452 | @c radio and @c toggle are mutually exclusive. | |
1453 | ||
1454 | Children that are neither @c tool nor @c separator must be instances of classes | |
1455 | derived from wxControl and are added to the toolbar using | |
1456 | wxToolBar::AddControl(). | |
1457 | ||
1458 | Example: | |
1459 | @code | |
1460 | <object class="wxToolBar"> | |
1461 | <style>wxTB_FLAT|wxTB_NODIVIDER</style> | |
1462 | <object class="tool" name="foo"> | |
1463 | <bitmap>foo.png</bitmap> | |
1464 | <label>Foo</label> | |
1465 | </object> | |
1466 | <object class="tool" name="bar"> | |
1467 | <bitmap>bar.png</bitmap> | |
1468 | <label>Bar</label> | |
1469 | </object> | |
1470 | <object class="separator"/> | |
1471 | <object class="wxComboBox"> | |
1472 | <content> | |
1473 | <item>Just</item> | |
1474 | <item>a combobox</item> | |
1475 | <item>in the toolbar</item> | |
1476 | </content> | |
1477 | </object> | |
1478 | </object> | |
1479 | ||
1480 | @endcode | |
1481 | ||
a302d595 VS |
1482 | |
1483 | @subsubsection xrc_wxtreectrl wxTreeCtrl | |
be42eeb0 VS |
1484 | |
1485 | No additional properties. | |
1486 | ||
a302d595 VS |
1487 | |
1488 | @subsubsection xrc_wxtreebook wxTreebook | |
be42eeb0 VS |
1489 | |
1490 | No additional properties. | |
1491 | ||
1492 | A treebook can have one or more child objects of the @c treebookpage | |
1493 | pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its | |
1494 | @c notebookpage). @c treebookpage objects have the following properties: | |
1495 | ||
1496 | @beginTable | |
1497 | @hdr3col{property, type, description} | |
1498 | @row3col{depth, integer, | |
1499 | Page's depth in the labels tree (required; see below).} | |
1500 | @row3col{label, @ref xrc_format_type_text, | |
1501 | Sheet page's title (required).} | |
1502 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
1503 | Bitmap shown alongside the label (default: none).} | |
1504 | @row3col{selected, @ref xrc_format_type_bool, | |
1505 | Is the page selected initially (only one page can be selected; default: 0)?} | |
1506 | @endTable | |
1507 | ||
1508 | Each @c treebookpage has exactly one non-toplevel window as its child. | |
1509 | ||
1510 | The tree of labels is not described using nested @c treebookpage objects, but | |
1511 | using the @em depth property. Toplevel pages have depth 0, their child pages | |
1512 | have depth 1 and so on. A @c treebookpage's label is inserted as child of | |
1513 | the latest preceding page with depth equal to @em depth-1. For example, this | |
1514 | XRC markup: | |
1515 | ||
1516 | @code | |
1517 | <object class="wxTreebook"> | |
1518 | ... | |
1519 | <object class="treebookpage"> | |
1520 | <depth>0</depth> | |
1521 | <label>Page 1</label> | |
1522 | <object class="wxPanel">...</object> | |
1523 | </object> | |
1524 | <object class="treebookpage"> | |
1525 | <depth>1</depth> | |
1526 | <label>Subpage 1A</label> | |
1527 | <object class="wxPanel">...</object> | |
1528 | </object> | |
1529 | <object class="treebookpage"> | |
1530 | <depth>2</depth> | |
1531 | <label>Subsubpage 1</label> | |
1532 | <object class="wxPanel">...</object> | |
1533 | </object> | |
1534 | <object class="treebookpage"> | |
1535 | <depth>1</depth> | |
1536 | <label>Subpage 1B</label> | |
1537 | <object class="wxPanel">...</object> | |
1538 | </object> | |
1539 | <object class="treebookpage"> | |
1540 | <depth>2</depth> | |
1541 | <label>Subsubpage 2</label> | |
1542 | <object class="wxPanel">...</object> | |
1543 | </object> | |
1544 | <object class="treebookpage"> | |
1545 | <depth>0</depth> | |
1546 | <label>Page 2</label> | |
1547 | <object class="wxPanel">...</object> | |
1548 | </object> | |
1549 | </object> | |
1550 | @endcode | |
1551 | ||
1552 | corresponds to the following tree of labels: | |
1553 | ||
1554 | - Page 1 | |
1555 | - Subpage 1A | |
1556 | - Subsubpage 1 | |
1557 | - Subpage 1B | |
1558 | - Subsubpage 2 | |
1559 | - Page 2 | |
1560 | ||
a302d595 VS |
1561 | |
1562 | @subsubsection xrc_wxwizard wxWizard | |
be42eeb0 VS |
1563 | |
1564 | @beginTable | |
1565 | @hdr3col{property, type, description} | |
1566 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
1567 | Bitmap to display on the left side of the wizard (default: none).} | |
1568 | @endTable | |
1569 | ||
1570 | A wizard object can have one or more child objects of the wxWizardPage or | |
1571 | wxWizardPageSimple classes. They both support the following properties | |
1572 | (in addition to @ref xrc_format_std_props): | |
1573 | ||
1574 | @beginTable | |
1575 | @hdr3col{property, type, description} | |
1576 | @row3col{bitmap, @ref xrc_format_type_bitmap, | |
1577 | Page-specific bitmap (default: none).} | |
1578 | @endTable | |
1579 | ||
1580 | wxWizardPageSimple pages are automatically chained together; wxWizardPage pages | |
1581 | transitions must be handled programatically. | |
a302d595 VS |
1582 | |
1583 | ||
1584 | @section xrc_format_sizers Sizers | |
1585 | ||
1586 | Sizers are handled slightly differently in XRC resources than they are in | |
1587 | wxWindow hierarchy. wxWindow's sizers hierarchy is parallel to the wxWindow | |
1588 | children hieararchy: child windows are children of their parent window and | |
1589 | the sizer (or sizers) form separate hierarchy attached to the window with | |
1590 | wxWindow::SetSizer(). | |
1591 | ||
1592 | In XRC, the two hierarchies are merged together: sizers are children of other | |
1593 | sizers or windows and they can contain child window objects. | |
1594 | ||
1595 | If a sizer is child of a window object in the resource, it must be the only | |
1596 | child and it will be attached to the parent with wxWindow::SetSizer(). | |
1597 | Additionally, if the window doesn't have its size explicitly set, | |
1598 | wxSizer::Fit() is used to resize the window. If the parent window is | |
1599 | toplevel window, wxSizer::SetSizeHints() is called to set its hints. | |
1600 | ||
1601 | A sizer object can have one or more child objects of one of two pseudo-classes: | |
1602 | @c sizeritem or @c spacer (see @ref xrc_format_wxstddialogbuttonsizer for | |
1603 | an exception). The former specifies an element (another sizer or a window) | |
1604 | to include in the sizer, the latter adds empty space to the sizer. | |
1605 | ||
1606 | @c sizeritem objects have exactly one child object: either another sizer | |
1607 | object, or a window object. @c spacer objects don't have any children, but | |
1608 | they have one property: | |
1609 | ||
1610 | @beginTable | |
1611 | @hdr3col{property, type, description} | |
1612 | @row3col{size, @ref xrc_format_type_size, Size of the empty space (required).} | |
1613 | @endTable | |
1614 | ||
1615 | Both @c sizeritem and @c spacer objects can have any of the following | |
1616 | properties: | |
1617 | ||
1618 | @beginTable | |
1619 | @hdr3col{property, type, description} | |
1620 | @row3col{option, integer, | |
1621 | The "option" value for sizers. Used by wxBoxSizer to set proportion of | |
1622 | the item in the growable direction (default: 0).} | |
1623 | @row3col{flag, @ref xrc_format_type_style, | |
1624 | wxSizerItem flags (default: 0).} | |
1625 | @row3col{border, @ref xrc_format_type_dimension, | |
1626 | Size of the border around the item (directions are specified in flags) | |
1627 | (default: 0).} | |
1628 | @row3col{minsize, @ref xrc_format_type_size, | |
1629 | Minimal size of this item (default: no min size).} | |
1630 | @row3col{ratio, @ref xrc_format_type_size, | |
1631 | Item ratio, see wxSizer::SetRatio() (default: no ratio).} | |
1632 | @row3col{cellpos, @ref xrc_format_type_pos, | |
1633 | (wxGridBagSizer only) Position, see wxGBSizerItem::SetPos() (required). } | |
1634 | @row3col{cellspan, @ref xrc_format_type_size, | |
1635 | (wxGridBagSizer only) Span, see wxGBSizerItem::SetSpan() (required). } | |
1636 | @endTable | |
1637 | ||
1638 | Example of sizers XRC code: | |
1639 | @code | |
1640 | <object class="wxDialog" name="derived_dialog"> | |
1641 | <title>Derived Dialog Example</title> | |
1642 | <centered>1</centered> | |
1643 | <!-- this sizer is set to be this dialog's sizer: --> | |
1644 | <object class="wxFlexGridSizer"> | |
1645 | <cols>1</cols> | |
1646 | <rows>0</rows> | |
1647 | <vgap>0</vgap> | |
1648 | <hgap>0</hgap> | |
1649 | <growablecols>0</growablecols> | |
1650 | <growablerows>0</growablerows> | |
1651 | <object class="sizeritem"> | |
1652 | <flag>wxALIGN_CENTRE|wxALL</flag> | |
1653 | <border>5</border> | |
1654 | <object class="wxButton" name="my_button"> | |
1655 | <label>My Button</label> | |
1656 | </object> | |
1657 | </object> | |
1658 | <object class="sizeritem"> | |
1659 | <flag>wxALIGN_CENTRE|wxALL</flag> | |
1660 | <border>5</border> | |
1661 | <object class="wxBoxSizer"> | |
1662 | <orient>wxHORIZONTAL</orient> | |
1663 | <object class="sizeritem"> | |
1664 | <flag>wxALIGN_CENTRE|wxALL</flag> | |
1665 | <border>5</border> | |
1666 | <object class="wxCheckBox" name="my_checkbox"> | |
1667 | <label>Enable this text control:</label> | |
1668 | </object> | |
1669 | </object> | |
1670 | <object class="sizeritem"> | |
1671 | <flag>wxALIGN_CENTRE|wxALL</flag> | |
1672 | <border>5</border> | |
1673 | <object class="wxTextCtrl" name="my_textctrl"> | |
1674 | <size>80,-1</size> | |
1675 | <value></value> | |
1676 | </object> | |
1677 | </object> | |
1678 | </object> | |
1679 | </object> | |
1680 | ... | |
1681 | </object> | |
1682 | </object> | |
1683 | @endcode | |
1684 | ||
1685 | The sizer classes that can be used are listed below, together with their | |
1686 | class-specific properties. All classes support the following properties: | |
1687 | ||
1688 | @beginTable | |
1689 | @hdr3col{property, type, description} | |
1690 | @row3col{minsize, @ref xrc_format_type_size, | |
1691 | Minimal size that this sizer will have, see wxSizer::SetMinSize() | |
1692 | (default: no min size).} | |
1693 | @endTable | |
1694 | ||
1695 | @subsection xrc_format_wxboxsizer wxBoxSizer | |
1696 | ||
1697 | @beginTable | |
1698 | @hdr3col{property, type, description} | |
1699 | @row3col{orient, @ref xrc_format_type_style, | |
1700 | Sizer orientation, "wxHORIZONTAL" or "wxVERTICAL" (default: wxHORIZONTAL).} | |
1701 | @endTable | |
1702 | ||
1703 | @subsection xrc_format_wxstaticsboxizer wxStaticBoxSizer | |
1704 | ||
1705 | @beginTable | |
1706 | @hdr3col{property, type, description} | |
1707 | @row3col{orient, @ref xrc_format_type_style, | |
1708 | Sizer orientation, "wxHORIZONTAL" or "wxVERTICAL" (default: wxHORIZONTAL).} | |
1709 | @row3col{label, @ref xrc_format_type_text, | |
1710 | Label to be used for the static box around the sizer (required).} | |
1711 | @endTable | |
1712 | ||
1713 | @subsection xrc_format_wxgridsizer wxGridSizer | |
1714 | ||
1715 | @beginTable | |
1716 | @hdr3col{property, type, description} | |
1717 | @row3col{rows, integer, Number of rows in the grid (required).} | |
1718 | @row3col{cols, integer, Number of columns in the grid (required).} | |
1719 | @row3col{vgap, integer, Vertical gap between children (default: 0).} | |
1720 | @row3col{hgap, integer, Horizontal gap between children (default: 0).} | |
1721 | @endTable | |
1722 | ||
1723 | @subsection xrc_format_wxflexgridsizer wxFlexGridSizer | |
1724 | ||
1725 | @beginTable | |
1726 | @hdr3col{property, type, description} | |
1727 | @row3col{rows, integer, Number of rows in the grid (required).} | |
1728 | @row3col{cols, integer, Number of columns in the grid (required).} | |
1729 | @row3col{vgap, integer, Vertical gap between children (default: 0).} | |
1730 | @row3col{hgap, integer, Horizontal gap between children (default: 0).} | |
1731 | @row3col{growablerows, comma-separated integers list, | |
1732 | Comma-separated list of indexes of rows that are growable | |
1733 | (default: none).} | |
1734 | @row3col{growablecols, comma-separated integers list, | |
1735 | Comma-separated list of indexes of columns that are growable | |
1736 | (default: none).} | |
1737 | @endTable | |
1738 | ||
1739 | @subsection xrc_format_wxgridbagsizer wxGridBagSizer | |
1740 | ||
1741 | @beginTable | |
1742 | @hdr3col{property, type, description} | |
1743 | @row3col{vgap, integer, Vertical gap between children (default: 0).} | |
1744 | @row3col{hgap, integer, Horizontal gap between children (default: 0).} | |
1745 | @row3col{growablerows, comma-separated integers list, | |
1746 | Comma-separated list of indexes of rows that are growable | |
1747 | (default: none).} | |
1748 | @row3col{growablecols, comma-separated integers list, | |
1749 | Comma-separated list of indexes of columns that are growable | |
1750 | (default: none).} | |
1751 | @endTable | |
1752 | ||
1753 | @subsection xrc_format_wxwrapsizer wxWrapSizer | |
1754 | ||
1755 | @beginTable | |
1756 | @hdr3col{property, type, description} | |
1757 | @row3col{orient, @ref xrc_format_type_style, | |
1758 | Sizer orientation, "wxHORIZONTAL" or "wxVERTICAL" (required).} | |
1759 | @row3col{flag, @ref xrc_format_type_style, wxWrapSizer flags (default: 0).} | |
1760 | @endTable | |
1761 | ||
1762 | @subsection xrc_format_wxstddialogbuttonsizer wxStdDialogButtonSizer | |
1763 | ||
1764 | Unlike other sizers, wxStdDialogButtonSizer doesn't have neither @c sizeritem | |
1765 | nor @c spacer children. Instead, it has one or more children of the | |
1766 | @c button pseudo-class. @c button objects have no properties and they must | |
1767 | always have exactly one child of the @c wxButton class or a class derived from | |
1768 | wxButton. | |
1769 | ||
1770 | Example: | |
1771 | @code | |
1772 | <object class="wxStdDialogButtonSizer"> | |
1773 | <object class="button"> | |
1774 | <object class="wxButton" name="wxID_OK"> | |
1775 | <label>OK</label> | |
1776 | </object> | |
1777 | </object> | |
1778 | <object class="button"> | |
1779 | <object class="wxButton" name="wxID_CANCEL"> | |
1780 | <label>Cancel</label> | |
1781 | </object> | |
1782 | </object> | |
1783 | </object> | |
1784 | @endcode | |
1785 | ||
1786 | ||
1787 | ||
1788 | @section xrc_format_other_objects Other objects | |
1789 | ||
1790 | In addition to describing UI elements, XRC files can contain non-windows | |
1791 | objects such as bitmaps or icons. This is a concession to Windows developers | |
1792 | used to storing them in Win32 resources. | |
1793 | ||
1794 | Note that unlike Win32 resources, bitmaps included in XRC files are @em not | |
1795 | embedded in the XRC file itself. XRC file only contains a reference to another | |
1796 | file with bitmap data. | |
1797 | ||
1798 | @subsection xrc_format_bitmap wxBitmap | |
1799 | ||
1dfb6ff0 | 1800 | Bitmaps are stored in @c \<object\> element with class set to @c wxBitmap. Such |
a302d595 VS |
1801 | bitmaps can then be loaded using wxXmlResource::LoadBitmap(). The content of |
1802 | the element is exactly same as in the case of | |
1803 | @ref xrc_format_type_bitmap "bitmap properties", except that toplevel | |
1dfb6ff0 | 1804 | @c \<object\> is used. |
a302d595 VS |
1805 | |
1806 | For example, instead of: | |
1807 | @code | |
1808 | <bitmap>mybmp.png</bitmap> | |
1809 | <bitmap stock_id="wxART_NEW"/> | |
1810 | @endcode | |
1811 | toplevel wxBitmap resources would look like: | |
1812 | @code | |
1813 | <object class="wxBitmap" name="my_bitmap">mybmp.png</object> | |
1814 | <object class="wxBitmap" name="my_new_bitmap" stock_id="wxART_NEW"/> | |
1815 | @endcode | |
1816 | ||
1817 | ||
1818 | @subsection xrc_format_icon wxIcon | |
1819 | ||
1820 | wxIcon resources are identical to @ref xrc_format_bitmap "wxBitmap ones", | |
1821 | except that the class is @c wxIcon. | |
1822 | ||
1823 | ||
1824 | @section xrc_format_platform Platform specific content | |
1825 | ||
1826 | It is possible to conditionally process parts of XRC files on some platforms | |
1827 | only and ignore them on other platforms. @em Any element in XRC file, be it | |
1828 | toplevel or arbitrarily nested one, can have the @c platform attribute. When | |
1829 | used, @c platform contains |-separated list of platforms that this element | |
1830 | should be processed on. It is filtered out and ignored on any other platforms. | |
1831 | ||
1832 | Possible elemental values are: | |
1833 | @beginDefList | |
1834 | @itemdef{ @c win, Windows } | |
1835 | @itemdef{ @c mac, Mac OS X (or Mac Classic in wxWidgets version supporting it } | |
1836 | @itemdef{ @c unix, Any Unix platform @em except OS X } | |
1837 | @itemdef{ @c os2, OS/2 } | |
1838 | @endDefList | |
1839 | ||
1840 | Examples: | |
1841 | @code | |
1842 | <label platform="win">Windows</label> | |
1843 | <label platform="unix">Unix</label> | |
1844 | <label platform="mac">Mac OS X</label> | |
1845 | <help platform="mac|unix">Not a Windows machine</help> | |
1846 | @endcode | |
1847 | ||
1848 | ||
1849 | ||
1850 | @section xrc_format_extending Extending XRC format | |
1851 | ||
1852 | The XRC format is designed to be extensible and allows specifying and loading | |
1853 | custom controls. The three available mechanisms are described in the rest of | |
1854 | this section in the order of increasing complexity. | |
1855 | ||
1856 | @subsection xrc_format_extending_subclass Subclassing | |
1857 | ||
1858 | The simplest way to add custom controls is to set the @c subclass attribute | |
1dfb6ff0 | 1859 | of @c \<object\> element: |
a302d595 VS |
1860 | |
1861 | @code | |
1862 | <object name="my_value" class="wxTextCtrl" subclass="MyTextCtrl"> | |
1863 | <style>wxTE_MULTILINE</style> | |
1864 | ...etc., setup wxTextCtrl as usual... | |
1865 | </object> | |
1866 | @endcode | |
1867 | ||
1868 | In that case, wxXmlResource will create an instance of the specified subclass | |
1869 | (@c MyTextCtrl in the example above) instead of the class (@c wxTextCtrl above) | |
1870 | when loading the resource. However, the rest of the object's loading (calling | |
1871 | its Create() method, setting its properties, loading any children etc.) | |
1872 | will proceed in @em exactly the same way as it would without @c subclass | |
1873 | attribute. In other words, this approach is only sufficient when the custom | |
1874 | class is just a small modification (e.g. overridden methods or customized | |
1875 | events handling) of an already supported classes. | |
1876 | ||
1877 | The subclass must satisfy a number of requirements: | |
1878 | ||
1879 | -# It must be derived from the class specified in @c class attribute. | |
1880 | -# It must be visible in wxWidget's pseudo-RTTI mechanism, i.e. there must be | |
1881 | a DECLARE_DYNAMIC_CLASS() entry for it. | |
1882 | -# It must support two-phase creation. In particular, this means that it has | |
1883 | to have default constructor. | |
1884 | -# It cannot provide custom Create() method and must be constructible using | |
1885 | base @c class' Create() method (this is because XRC will call Create() of | |
1886 | @c class, not @c subclass). In other words, @em creation of the control | |
1887 | must not be customized. | |
1888 | ||
1889 | ||
1890 | @subsection xrc_format_extending_unknown <object class="unknown"> | |
1891 | ||
1892 | A more flexible solution is to put a @em placeholder in the XRC file and | |
1893 | replace it with custom control after the resource is loaded. This is done by | |
1894 | using the @c unknown pseudo-class: | |
1895 | ||
1896 | @code | |
1897 | <object class="unknown" name="my_placeholder"/> | |
1898 | @endcode | |
1899 | ||
1900 | The placeholder is inserted as dummy wxPanel that will hold custom control in | |
1901 | it. At runtime, after the resource is loaded and a window created from it | |
1902 | (using e.g. wxXmlResource::LoadDialog()), use code must call | |
1903 | wxXmlResource::AttachUnknownControl() to insert the desired control into | |
1904 | placeholder container. | |
1905 | ||
1906 | This method makes it possible to insert controls that are not known to XRC at | |
1907 | all, but it's also impossible to configure the control in XRC description in | |
1908 | any way. The only properties that can be specified are | |
1909 | the @ref xrc_format_std_props "standard window properties". | |
1910 | ||
1911 | @note @c unknown class cannot be combined with @c subclass attribute, | |
1912 | they are mutually exclusive. | |
1913 | ||
1914 | ||
1915 | @subsection xrc_format_extending_custom Adding custom classes | |
1916 | ||
1917 | Finally, XRC allows adding completely new classes in addition to the ones | |
1918 | listed in this document. A class for which wxXmlResourceHandler is implemented | |
1919 | can be used as first-class object in XRC simply by passing class name as the | |
1920 | value of @c class attribute: | |
1921 | ||
1922 | @code | |
1923 | <object name="my_ctrl" class="MyWidget"> | |
1924 | <my_prop>foo</my_prop> | |
1925 | ...etc., whatever MyWidget handler accepts... | |
1926 | </object> | |
1927 | @endcode | |
1928 | ||
1929 | The only requirements on the class are that | |
1930 | -# the class must derive from wxObject | |
1931 | -# it must support wxWidget's pseudo-RTTI mechanism | |
1932 | ||
1dfb6ff0 | 1933 | Child elements of @c \<object\> are handled by the custom handler and there are |
a302d595 VS |
1934 | no limitations on them imposed by XRC format. |
1935 | ||
1936 | This is the only mechanism that works for toplevel objects -- custom controls | |
1937 | are accessible using type-unsafe wxXmlResource::LoadObject() method. | |
1938 | ||
1939 | ||
1940 | ||
1941 | @section xrc_format_packed Packed XRC files | |
1942 | ||
1943 | In addition to plain XRC files, wxXmlResource supports (if wxFileSystem support | |
1944 | is compiled in) compressed XRC resources. Compressed resources have either | |
1945 | .zip or .xrs extension and are simply ZIP files that contain arbitrary | |
1946 | number of XRC files and their dependencies (bitmaps, icons etc.). | |
1947 | ||
1948 | ||
1949 | ||
1950 | @section xrc_format_oldversions Older format versions | |
1951 | ||
1952 | This section describes differences in older revisions of XRC format (i.e. | |
1dfb6ff0 | 1953 | files with older values of @c version attribute of @c \<resource\>). |
a302d595 VS |
1954 | |
1955 | ||
1956 | @subsection xrc_format_pre_v2530 Versions before 2.5.3.0 | |
1957 | ||
1958 | Version 2.5.3.0 introduced C-like handling of "\\" in text. In older versions, | |
1959 | "\n", "\t" and "\r" escape sequences were replaced with respective characters | |
1960 | in the same matter it's done in C, but "\\" was left intact instead of being | |
1961 | replaced with single "\", as one would expect. Starting with 2.5.3.0, all of | |
1962 | them are handled in C-like manner. | |
1963 | ||
1964 | ||
1965 | @subsection xrc_format_pre_v2301 Versions before 2.3.0.1 | |
1966 | ||
1967 | Prior to version 2.3.0.1, "$" was used for accelerators instead of "_" | |
1968 | or "&". For example, | |
1969 | @code | |
1970 | <label>$File</label> | |
1971 | @endcode | |
1972 | was used in place of current version's | |
1973 | @code | |
1974 | <label>_File</label> | |
1975 | @endcode | |
1976 | (or "&File"). | |
1977 | ||
1978 | */ |