]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: xrc_format.h | |
3 | // Purpose: XRC format specification | |
4 | // Author: Vaclav Slavik | |
5 | // Licence: wxWindows licence | |
6 | ///////////////////////////////////////////////////////////////////////////// | |
7 | ||
8 | ||
9 | /* | |
10 | NOTE: To make doxygen happy about <custom-tags> we're forced to | |
11 | escape all < and > symbols which appear inside a doxygen comment. | |
12 | Also, don't use < and > symbols in section titles. | |
13 | */ | |
14 | ||
15 | ||
16 | /** | |
17 | ||
18 | @page overview_xrcformat XRC File Format | |
19 | ||
20 | @tableofcontents | |
21 | ||
22 | This document describes the format of XRC resource files, as used by | |
23 | wxXmlResource. | |
24 | ||
25 | XRC file is a XML file with all of its elements in the | |
26 | @c http://www.wxwidgets.org/wxxrc namespace. For backward compatibility, | |
27 | @c http://www.wxwindows.org/wxxrc namespace is accepted as well (and treated | |
28 | as identical to @c http://www.wxwidgets.org/wxxrc), but it shouldn't be used | |
29 | in new XRC files. | |
30 | ||
31 | XRC file contains definitions for one or more @em objects -- typically | |
32 | windows. The objects may themselves contain child objects. | |
33 | ||
34 | Objects defined at the top level, under the | |
35 | @ref overview_xrcformat_root "root element", can be accessed using | |
36 | wxXmlResource::LoadDialog() and other LoadXXX methods. They must have | |
37 | @c name attribute that is used as LoadXXX's argument (see | |
38 | @ref overview_xrcformat_object for details). | |
39 | ||
40 | Child objects are not directly accessible via wxXmlResource, they can only | |
41 | be accessed using XRCCTRL(). | |
42 | ||
43 | ||
44 | ||
45 | @section overview_xrcformat_root Resource Root Element | |
46 | ||
47 | The root element is always @c \<resource\>. It has one optional attribute, @c | |
48 | version. If set, it specifies version of the file. In absence of @c version | |
49 | attribute, the default is @c "0.0.0.0". | |
50 | ||
51 | The version consists of four integers separated by periods. The first three | |
52 | components are major, minor and release number of the wxWidgets release when | |
53 | the change was introduced, the last one is revision number and is 0 for the | |
54 | first incompatible change in given wxWidgets release, 1 for the second and so | |
55 | on. The version changes only if there was an incompatible change introduced; | |
56 | merely adding new kind of objects does not constitute incompatible change. | |
57 | ||
58 | At the time of writing, the latest version is @c "2.5.3.0". | |
59 | ||
60 | Note that even though @c version attribute is optional, it should always be | |
61 | specified to take advantage of the latest capabilities: | |
62 | ||
63 | @code | |
64 | <?xml version="1.0"?> | |
65 | <resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0"> | |
66 | ... | |
67 | </resource> | |
68 | @endcode | |
69 | ||
70 | @c \<resource\> may have arbitrary number of | |
71 | @ref overview_xrcformat_objects "object elements" as its children; they are referred | |
72 | to as @em toplevel objects in the rest of this document. Unlike objects defined | |
73 | deeper in the hierarchy, toplevel objects @em must have their @c name attribute | |
74 | set and it must be set to a value unique among root's children. | |
75 | ||
76 | ||
77 | ||
78 | @section overview_xrcformat_objects Defining Objects | |
79 | ||
80 | @subsection overview_xrcformat_object Object Element | |
81 | ||
82 | The @c \<object\> element represents a single object (typically a GUI element) | |
83 | and it usually maps directly to a wxWidgets class instance. It has one | |
84 | mandatory attribute, @c class, and optional @c name and @c subclass attributes. | |
85 | ||
86 | The @c class attribute must always be present, it tells XRC what wxWidgets | |
87 | object should be created and by which wxXmlResourceHandler. | |
88 | ||
89 | @c name is the identifier used to identify the object. This name serves three | |
90 | purposes: | |
91 | ||
92 | -# It is used by wxXmlResource's various LoadXXX() methods to find the | |
93 | resource by name passed as argument. | |
94 | -# wxWindow's name (see wxWindow::GetName()) is set to it. | |
95 | -# Numeric ID of a window or menu item is derived from the name. | |
96 | If the value represents an integer (in decimal notation), it is used for | |
97 | the numeric ID unmodified. If it is one of the wxID_XXX literals defined | |
98 | by wxWidgets (see @ref page_stockitems), its respective value is used. | |
99 | Otherwise, the name is transformed into dynamically generated ID. See | |
100 | wxXmlResource::GetXRCID() for more information. | |
101 | ||
102 | Name attributes must be unique at the top level (where the name is used to | |
103 | load resources) and should be unique among all controls within the same | |
104 | toplevel window (wxDialog, wxFrame). | |
105 | ||
106 | The @c subclass attribute optional name of class whose constructor will be | |
107 | called instead of the constructor for "class". | |
108 | See @ref overview_xrcformat_extending_subclass for more details. | |
109 | ||
110 | @c \<object\> element may -- and almost always do -- have children elements. | |
111 | These come in two varieties: | |
112 | ||
113 | -# Object's properties. A @em property is a value describing part of object's | |
114 | behaviour, for example the "label" property on wxButton defines its label. | |
115 | In the most common form, property is a single element with text content | |
116 | ("\<label\>Cancel\</label\>"), but they may use nested subelements too (e.g. | |
117 | @ref overview_xrcformat_type_font "font property"). A property can only be | |
118 | listed once in an object's definition. | |
119 | -# Child objects. Window childs, sizers, sizer items or notebook pages | |
120 | are all examples of child objects. They are represented using nested | |
121 | @c \<object\> elements and are can be repeated more than once. The specifics | |
122 | of which object classes are allowed as children are class-specific and | |
123 | are documented below in @ref overview_xrcformat_controls. | |
124 | ||
125 | Example: | |
126 | @code | |
127 | <object class="wxDialog" name="example_dialog"> | |
128 | <!-- properties: --> | |
129 | <title>Non-Derived Dialog Example</title> | |
130 | <centered>1</centered> | |
131 | <!-- child objects: --> | |
132 | <object class="wxBoxSizer"> | |
133 | <orient>wxVERTICAL</orient> | |
134 | <cols>1</cols> | |
135 | <rows>0</rows> | |
136 | ... | |
137 | </object> | |
138 | </object> | |
139 | @endcode | |
140 | ||
141 | ||
142 | @subsection overview_xrcformat_object_ref Object References | |
143 | ||
144 | Anywhere an @c \<object\> element can be used, @c \<object_ref\> may be used | |
145 | instead. @c \<object_ref\> is a @em reference to another named (i.e. with the | |
146 | @c name attribute) @c \<object\> element. It has one mandatory attribute, | |
147 | @c ref, with value containing the name of a named @c \<object\> element. When an | |
148 | @c \<object_ref\> is encountered, a copy of the referenced @c \<object\> element | |
149 | is made in place of @c \<object_ref\> occurrence and processed as usual. | |
150 | ||
151 | For example, the following code: | |
152 | @code | |
153 | <object class="wxDialog" name="my_dlg"> | |
154 | ... | |
155 | </object> | |
156 | <object_ref name="my_dlg_alias" ref="my_dlg"/> | |
157 | @endcode | |
158 | is equivalent to | |
159 | @code | |
160 | <object class="wxDialog" name="my_dlg"> | |
161 | ... | |
162 | </object> | |
163 | <object class="wxDialog" name="my_dlg_alias"> | |
164 | ... <!-- same as in my_dlg --> | |
165 | </object> | |
166 | @endcode | |
167 | ||
168 | Additionally, it is possible to override some parts of the referenced object | |
169 | in the @c \<object_ref\> pointing to it. This is useful for putting repetitive | |
170 | parts of XRC definitions into a template that can be reused and customized in | |
171 | several places. The two parts are merged as follows: | |
172 | ||
173 | -# The referred object is used as the initial content. | |
174 | -# All attributes set on @c \<object_ref\> are added to it. | |
175 | -# All child elements of @c \<object_ref\> are scanned. If an element with | |
176 | the same name (and, if specified, the @c name attribute too) is found | |
177 | in the referred object, they are recursively merged. | |
178 | -# Child elements in @c \<object_ref\> that do not have a match in the referred | |
179 | object are appended to the list of children of the resulting element by | |
180 | default. Optionally, they may have @c insert_at attribute with two possible | |
181 | values, "begin" or "end". When set to "begin", the element is prepended to | |
182 | the list of children instead of appended. | |
183 | ||
184 | For example, "my_dlg" in this snippet: | |
185 | @code | |
186 | <object class="wxDialog" name="template"> | |
187 | <title>Dummy dialog</title> | |
188 | <size>400,400</size> | |
189 | </object> | |
190 | <object_ref ref="template" name="my_dlg"> | |
191 | <title>My dialog</title> | |
192 | <centered>1</centered> | |
193 | </object_ref> | |
194 | @endcode | |
195 | is identical to: | |
196 | @code | |
197 | <object class="wxDialog" name="my_dlg"> | |
198 | <title>My dialog</title> | |
199 | <size>400,400</size> | |
200 | <centered>1</centered> | |
201 | </object> | |
202 | @endcode | |
203 | ||
204 | ||
205 | @section overview_xrcformat_datatypes Data Types | |
206 | ||
207 | There are several property data types that are frequently reused by different | |
208 | properties. Rather than describing their format in the documentation of | |
209 | every property, we list commonly used types in this section and document | |
210 | their format. | |
211 | ||
212 | ||
213 | @subsection overview_xrcformat_type_bool Boolean | |
214 | ||
215 | Boolean values are expressed using either "1" literal (true) or "0" (false). | |
216 | ||
217 | ||
218 | @subsection overview_xrcformat_type_float Floating-point value | |
219 | ||
220 | Floating point values use POSIX (C locale) formatting -- decimal separator | |
221 | is "." regardless of the locale. | |
222 | ||
223 | ||
224 | @subsection overview_xrcformat_type_colour Colour | |
225 | ||
226 | Colour specification can be either any string colour representation accepted | |
227 | by wxColour::Set() or any wxSYS_COLOUR_XXX symbolic name accepted by | |
228 | wxSystemSettings::GetColour(). In particular, the following forms are supported: | |
229 | ||
230 | @li named colours from wxColourDatabase | |
231 | @li HTML-like "#rrggbb" syntax (but not "#rgb") | |
232 | @li CSS-style "rgb(r,g,b)" and "rgba(r,g,b,a)" | |
233 | @li wxSYS_COLOUR_XXX symbolic names | |
234 | ||
235 | Some examples: | |
236 | @code | |
237 | <fg>red</fg> | |
238 | <fg>#ff0000</fg> | |
239 | <fg>rgb(255,0,0)</fg> | |
240 | <fg>wxSYS_COLOUR_HIGHLIGHT</fg> | |
241 | @endcode | |
242 | ||
243 | ||
244 | @subsection overview_xrcformat_type_size Size | |
245 | ||
246 | Sizes and positions have the form of string with two comma-separated integer | |
247 | components, with optional "d" suffix. Semi-formally: | |
248 | ||
249 | size := x "," y ["d"] | |
250 | ||
251 | where x and y are integers. Either of the components (or both) may be "-1" to | |
252 | signify default value. As a shortcut, empty string is equivalent to "-1,-1" | |
253 | (= wxDefaultSize or wxDefaultPosition). | |
254 | ||
255 | When the "d" suffix is used, integer values are interpreted as | |
256 | @ref wxWindow::ConvertDialogToPixels() "dialog units" in the parent window. | |
257 | ||
258 | Examples: | |
259 | @code | |
260 | 42,-1 | |
261 | 100,100 | |
262 | 100,50d | |
263 | @endcode | |
264 | ||
265 | @subsection overview_xrcformat_type_pos Position | |
266 | ||
267 | Same as @ref overview_xrcformat_type_size. | |
268 | ||
269 | ||
270 | @subsection overview_xrcformat_type_dimension Dimension | |
271 | ||
272 | Similarly to @ref overview_xrcformat_type_size "sizes", dimensions are expressed | |
273 | as integers with optional "d" suffix. When "d" suffix is used, the integer | |
274 | preceding it is interpreted as dialog units in the parent window. | |
275 | ||
276 | ||
277 | @subsection overview_xrcformat_type_text Text | |
278 | ||
279 | String properties use several escape sequences that are translated according to | |
280 | the following table: | |
281 | @beginDefList | |
282 | @itemdef{ "_", "&" (used for accelerators in wxWidgets) } | |
283 | @itemdef{ "__", "_" } | |
284 | @itemdef{ "\n", line break } | |
285 | @itemdef{ "\r", carriage return } | |
286 | @itemdef{ "\t", tab } | |
287 | @itemdef{ "\\", "\" } | |
288 | @endDefList | |
289 | ||
290 | By default, the text is translated using wxLocale::GetTranslation() before | |
291 | it is used. This can be disabled either globally by not passing | |
292 | wxXRC_USE_LOCALE to wxXmlResource constructor, or by setting the @c translate | |
293 | attribute on the property node to "0": | |
294 | @code | |
295 | <!-- this is not translated: --> | |
296 | <label translate="0">_Unix</label> | |
297 | <!-- but this is: --> | |
298 | <help>Use Unix-style newlines</help> | |
299 | @endcode | |
300 | ||
301 | @note Even though the "_" character is used instead of "&" for accelerators, | |
302 | it is still possible to use "&". The latter has to be encoded as "&", | |
303 | though, so using "_" is more convenient. | |
304 | ||
305 | @see @ref overview_xrcformat_pre_v2530, @ref overview_xrcformat_pre_v2301 | |
306 | ||
307 | ||
308 | @subsection overview_xrcformat_type_text_notrans Non-Translatable Text | |
309 | ||
310 | Like @ref overview_xrcformat_type_text, but the text is never translated and | |
311 | @c translate attribute cannot be used. | |
312 | ||
313 | ||
314 | @subsection overview_xrcformat_type_string String | |
315 | ||
316 | An unformatted string. Unlike with @ref overview_xrcformat_type_text, no escaping | |
317 | or translations are done. | |
318 | ||
319 | ||
320 | @subsection overview_xrcformat_type_url URL | |
321 | ||
322 | Any URL accepted by wxFileSystem (typically relative to XRC file's location, | |
323 | but can be absolute too). Unlike with @ref overview_xrcformat_type_text, no escaping | |
324 | or translations are done. | |
325 | ||
326 | ||
327 | @subsection overview_xrcformat_type_bitmap Bitmap | |
328 | ||
329 | Bitmap properties contain specification of a single bitmap or icon. In the most | |
330 | basic form, their text value is simply a relative filename (or another | |
331 | wxFileSystem URL) of the bitmap to use. For example: | |
332 | @code | |
333 | <object class="tool" name="wxID_NEW"> | |
334 | <tooltip>New</tooltip> | |
335 | <bitmap>new.png</bitmap> | |
336 | </object> | |
337 | @endcode | |
338 | The value is interpreted as path relative to the location of XRC file where the | |
339 | reference occurs. | |
340 | ||
341 | Alternatively, it is possible to specify the bitmap using wxArtProvider IDs. | |
342 | In this case, the property element has no textual value (filename) and instead | |
343 | has the @c stock_id XML attribute that contains stock art ID as accepted by | |
344 | wxArtProvider::GetBitmap(). This can be either custom value (if the app uses | |
345 | app-specific art provider) or one of the predefined wxART_XXX constants. | |
346 | ||
347 | Optionally, @c stock_client attribute may be specified too and contain one of | |
348 | the predefined wxArtClient values. If it is not specified, the default client | |
349 | ID most appropriate in the context where the bitmap is referenced will be used. | |
350 | In most cases, specifying @c stock_client is not needed. | |
351 | ||
352 | Examples of stock bitmaps usage: | |
353 | @code | |
354 | <bitmap stock_id="fixed-width"/> <!-- custom app-specific art --> | |
355 | <bitmap stock_id="wxART_FILE_OPEN"/> <!-- standard art --> | |
356 | @endcode | |
357 | ||
358 | If both specifications are provided, then @c stock_id is used if it is | |
359 | recognized by wxArtProvider and the provided bitmap file is used as a fallback. | |
360 | ||
361 | ||
362 | @subsection overview_xrcformat_type_style Style | |
363 | ||
364 | Style properties (such as window's style or sizer flags) use syntax similar to | |
365 | C++: the style value is OR-combination of individual flags. Symbolic names | |
366 | identical to those used in C++ code are used for the flags. Flags are separated | |
367 | with "|" (whitespace is allowed but not required around it). | |
368 | ||
369 | The flags that are allowed for a given property are context-dependent. | |
370 | ||
371 | Examples: | |
372 | @code | |
373 | <style>wxCAPTION|wxSYSTEM_MENU | wxRESIZE_BORDER</style> | |
374 | <exstyle>wxDIALOG_EX_CONTEXTHELP</exstyle> | |
375 | @endcode | |
376 | ||
377 | ||
378 | @subsection overview_xrcformat_type_font Font | |
379 | ||
380 | XRC uses similar, but more flexible, abstract description of fonts to that | |
381 | used by wxFont class. A font can be described either in terms of its elementary | |
382 | properties, or it can be derived from one of system fonts or the parent window | |
383 | font. | |
384 | ||
385 | The font property element is a "composite" element: unlike majority of | |
386 | properties, it doesn't have text value but contains several child elements | |
387 | instead. These children are handled in the same way as object properties | |
388 | and can be one of the following "sub-properties": | |
389 | ||
390 | @beginTable | |
391 | @hdr3col{property, type, description} | |
392 | @row3col{size, unsigned integer, | |
393 | Pixel size of the font (default: wxNORMAL_FONT's size or @c sysfont's | |
394 | size if the @c sysfont property is used or the current size of the font | |
395 | of the enclosing control if the @c inherit property is used.} | |
396 | @row3col{style, enum, | |
397 | One of "normal", "italic" or "slant" (default: normal).} | |
398 | @row3col{weight, enum, | |
399 | One of "normal", "bold" or "light" (default: normal).} | |
400 | @row3col{family, enum, | |
401 | One of "roman", "script", "decorative", "swiss", "modern" or "teletype" | |
402 | (default: roman).} | |
403 | @row3col{underlined, @ref overview_xrcformat_type_bool, | |
404 | Whether the font should be underlined (default: 0).} | |
405 | @row3col{face, , | |
406 | Comma-separated list of face names; the first one available is used | |
407 | (default: unspecified).} | |
408 | @row3col{encoding, , | |
409 | Charset of the font, unused in Unicode build), as string | |
410 | (default: unspecified).} | |
411 | @row3col{sysfont, , | |
412 | Symbolic name of system standard font(one of wxSYS_*_FONT constants).} | |
413 | @row3col{inherit, @ref overview_xrcformat_type_bool, | |
414 | If true, the font of the enclosing control is used. If this property and the | |
415 | @c sysfont property are specified the @c sysfont property takes precedence.} | |
416 | @row3col{relativesize, float, | |
417 | Float, font size relative to chosen system font's or inherited font's size; | |
418 | can only be used when 'sysfont' or 'inherit' is used and when 'size' is not | |
419 | used.} | |
420 | @endTable | |
421 | ||
422 | All of them are optional, if they are missing, appropriate wxFont default is | |
423 | used. If the @c sysfont or @c inherit property is used, then the defaults are | |
424 | taken from it instead. | |
425 | ||
426 | Examples: | |
427 | @code | |
428 | <font> | |
429 | <!-- fixed font: Arial if available, fall back to Helvetica --> | |
430 | <face>arial,helvetica</face> | |
431 | <size>12</size> | |
432 | </font> | |
433 | ||
434 | <font> | |
435 | <!-- enlarged, enboldened standard font: --> | |
436 | <sysfont>wxSYS_DEFAULT_GUI_FONT</sysfont> | |
437 | <weight>bold</weight> | |
438 | <relativesize>1.5</relativesize> | |
439 | </font> | |
440 | @endcode | |
441 | ||
442 | @note You cannot use @c inherit for a font that gets used before the enclosing | |
443 | control is created, e.g. if the control gets the font passed as parameter | |
444 | for its constructor, or if the control is not derived from wxWindow. | |
445 | ||
446 | ||
447 | @subsection overview_xrcformat_type_imagelist Image List | |
448 | ||
449 | Defines a wxImageList. | |
450 | ||
451 | The imagelist property element is a "composite" element: unlike majority of | |
452 | properties, it doesn't have text value but contains several child elements | |
453 | instead. These children are handled similarly to object properties | |
454 | and can be one of the following "sub-properties": | |
455 | ||
456 | @beginTable | |
457 | @hdr3col{property, type, description} | |
458 | @row3col{mask, @ref overview_xrcformat_type_bool, | |
459 | If masks should be created for all images (default: 1).} | |
460 | @row3col{size, @ref overview_xrcformat_type_size, | |
461 | The size of the images in the list (default: the size of the first bitmap).} | |
462 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
463 | Adds a new image. Unlike normal object properties, @c bitmap may be used more than once | |
464 | to add multiple images to the list. At least one @c bitmap value is required.} | |
465 | @endTable | |
466 | ||
467 | Example: | |
468 | @code | |
469 | <imagelist> | |
470 | <size>32,32</size> | |
471 | <bitmap stock_id="wxART_QUESTION"/> | |
472 | <bitmap stock_id="wxART_INFORMATION"/> | |
473 | </imagelist> | |
474 | @endcode | |
475 | ||
476 | ||
477 | @section overview_xrcformat_windows Controls and Windows | |
478 | ||
479 | This section describes support wxWindow-derived classes in XRC format. | |
480 | ||
481 | @subsection overview_xrcformat_std_props Standard Properties | |
482 | ||
483 | The following properties are always (unless stated otherwise in | |
484 | control-specific docs) available for @em windows objects. They are omitted | |
485 | from properties lists below. | |
486 | ||
487 | @beginTable | |
488 | @hdr3col{property, type, description} | |
489 | @row3col{pos, @ref overview_xrcformat_type_pos, | |
490 | Initial position of the window (default: wxDefaultPosition).} | |
491 | @row3col{size, @ref overview_xrcformat_type_size, | |
492 | Initial size of the window (default: wxDefaultSize).} | |
493 | @row3col{style, @ref overview_xrcformat_type_style, | |
494 | Window style for this control. The allowed values depend on what | |
495 | window is being created, consult respective class' constructor | |
496 | documentation for details (default: window-dependent default, usually | |
497 | wxFOO_DEFAULT_STYLE if defined for class wxFoo, 0 if not).} | |
498 | @row3col{exstyle, @ref overview_xrcformat_type_style, | |
499 | Extra style for the window, if any. See wxWindow::SetExtraStyle() | |
500 | (default: not set).} | |
501 | @row3col{fg, @ref overview_xrcformat_type_colour, | |
502 | Foreground colour of the window (default: window's default).} | |
503 | @row3col{ownfg, @ref overview_xrcformat_type_colour, | |
504 | Non-inheritable foreground colour of the window, see | |
505 | wxWindow::SetOwnForegroundColour() (default: none).} | |
506 | @row3col{bg, @ref overview_xrcformat_type_colour, | |
507 | Background colour of the window (default: window's default).} | |
508 | @row3col{ownbg, @ref overview_xrcformat_type_colour, | |
509 | Non-inheritable background colour of the window, see | |
510 | wxWindow::SetOwnBackgroundColour() (default: none).} | |
511 | @row3col{enabled, @ref overview_xrcformat_type_bool, | |
512 | If set to 0, the control is disabled (default: 1).} | |
513 | @row3col{focused, @ref overview_xrcformat_type_bool, | |
514 | If set to 1, the control has focus initially (default: 0).} | |
515 | @row3col{hidden, @ref overview_xrcformat_type_bool, | |
516 | If set to 1, the control is created hidden (default: 0).} | |
517 | @row3col{tooltip, @ref overview_xrcformat_type_text, | |
518 | Tooltip to use for the control (default: not set).} | |
519 | @row3col{font, @ref overview_xrcformat_type_font, | |
520 | Font to use for the control (default: window's default).} | |
521 | @row3col{ownfont, @ref overview_xrcformat_type_font, | |
522 | Non-inheritable font to use for the control, see | |
523 | wxWindow::SetOwnFont() (default: none).} | |
524 | @row3col{help, @ref overview_xrcformat_type_text, | |
525 | Context-sensitive help for the control, used by wxHelpProvider | |
526 | (default: not set).} | |
527 | @endTable | |
528 | ||
529 | All of these properties are optional. | |
530 | ||
531 | ||
532 | @subsection overview_xrcformat_controls Supported Controls | |
533 | ||
534 | This section lists all controls supported by default. For each control, its | |
535 | control-specific properties are listed. If the control can have child objects, | |
536 | it is documented there too; unless said otherwise, XRC elements for these | |
537 | controls cannot have children. | |
538 | ||
539 | @subsubsection xrc_wxanimationctrl wxAnimationCtrl | |
540 | ||
541 | @beginTable | |
542 | @hdr3col{property, type, description} | |
543 | @row3col{animation, @ref overview_xrcformat_type_url, | |
544 | Animation file to load into the control (default: none).} | |
545 | @row3col{inactive-bitmap, @ref overview_xrcformat_type_bitmap, | |
546 | Bitmap to use when not playing the animation (default: the default).} | |
547 | @endTable | |
548 | ||
549 | ||
550 | @subsubsection xrc_wxauinotebook wxAuiNotebook | |
551 | ||
552 | A wxAuiNotebook can have one or more child objects of the @c notebookpage | |
553 | pseudo-class. | |
554 | @c notebookpage objects have the following properties: | |
555 | ||
556 | @beginTable | |
557 | @hdr3col{property, type, description} | |
558 | @row3col{label, @ref overview_xrcformat_type_text, | |
559 | Page label (required).} | |
560 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
561 | Bitmap shown alongside the label (default: none).} | |
562 | @row3col{selected, @ref overview_xrcformat_type_bool, | |
563 | Is the page selected initially (only one page can be selected; default: 0)?} | |
564 | @endTable | |
565 | ||
566 | Each @c notebookpage must have exactly one non-toplevel window as its child. | |
567 | ||
568 | Example: | |
569 | @code | |
570 | <object class="wxAuiNotebook"> | |
571 | <style>wxBK_BOTTOM</style> | |
572 | <object class="notebookpage"> | |
573 | <label>Page 1</label> | |
574 | <bitmap>bitmap.png</bitmap> | |
575 | <object class="wxPanel" name="page_1"> | |
576 | ... | |
577 | </object> | |
578 | </object> | |
579 | </object> | |
580 | @endcode | |
581 | ||
582 | Notice that wxAuiNotebook support in XRC is available in wxWidgets 2.9.5 and | |
583 | later only and you need to explicitly register its handler using | |
584 | @code | |
585 | #include <wx/xrc/xh_auinotbk.h> | |
586 | ||
587 | AddHandler(new wxAuiNotebookXmlHandler); | |
588 | @endcode | |
589 | to use it. | |
590 | ||
591 | ||
592 | @subsubsection xrc_wxbannerwindow wxBannerWindow | |
593 | ||
594 | @beginTable | |
595 | @hdr3col{property, type, description} | |
596 | @row3col{direction, @c wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, | |
597 | The side along which the banner will be positioned (default: wxLEFT).} | |
598 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
599 | Bitmap to use as the banner background (default: none).} | |
600 | @row3col{title, @ref overview_xrcformat_type_text, | |
601 | Banner title, should be single line (default: none).} | |
602 | @row3col{message, @ref overview_xrcformat_type_text, | |
603 | Possibly multi-line banner message (default: none).} | |
604 | @row3col{gradient-start, @ref overview_xrcformat_type_colour, | |
605 | Starting colour of the gradient used as banner background. | |
606 | (Optional. Can't be used if a valid bitmap is specified. If used, both gradient values must be set.)} | |
607 | @row3col{gradient-end, @ref overview_xrcformat_type_colour, | |
608 | End colour of the gradient used as banner background. | |
609 | (Optional. Can't be used if a valid bitmap is specified. If used, both gradient values must be set.)} | |
610 | @endTable | |
611 | ||
612 | ||
613 | @subsubsection xrc_wxbitmapbutton wxBitmapButton | |
614 | ||
615 | @beginTable | |
616 | @hdr3col{property, type, description} | |
617 | @row3col{default, @ref overview_xrcformat_type_bool, | |
618 | Should this button be the default button in dialog (default: 0)?} | |
619 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
620 | Bitmap to show on the button (required).} | |
621 | @row3col{selected, @ref overview_xrcformat_type_bitmap, | |
622 | Bitmap to show when the button is selected (default: none, same as @c bitmap).} | |
623 | @row3col{focus, @ref overview_xrcformat_type_bitmap, | |
624 | Bitmap to show when the button has focus (default: none, same as @c bitmap).} | |
625 | @row3col{disabled, @ref overview_xrcformat_type_bitmap, | |
626 | Bitmap to show when the button is disabled (default: none, same as @c bitmap).} | |
627 | @row3col{hover, @ref overview_xrcformat_type_bitmap, | |
628 | Bitmap to show when mouse cursor hovers above the bitmap (default: none, same as @c bitmap).} | |
629 | @endTable | |
630 | ||
631 | ||
632 | @subsubsection xrc_wxbitmapcombobox wxBitmapComboBox | |
633 | ||
634 | @beginTable | |
635 | @hdr3col{property, type, description} | |
636 | @row3col{selection, integer, | |
637 | Index of the initially selected item or -1 for no selection (default: -1).} | |
638 | @row3col{value, @ref overview_xrcformat_type_string, | |
639 | Initial value in the control (doesn't have to be one of @ content values; | |
640 | default: empty).} | |
641 | @endTable | |
642 | ||
643 | If both @c value and @c selection are specified and @c selection is not -1, | |
644 | then @c selection takes precedence. | |
645 | ||
646 | A wxBitmapComboBox can have one or more child objects of the @c ownerdrawnitem | |
647 | pseudo-class. @c ownerdrawnitem objects have the following properties: | |
648 | ||
649 | @beginTable | |
650 | @hdr3col{property, type, description} | |
651 | @row3col{text, @ref overview_xrcformat_type_text, | |
652 | Item's label (required).} | |
653 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
654 | Item's bitmap (default: no bitmap).} | |
655 | @endTable | |
656 | ||
657 | Example: | |
658 | @code | |
659 | <object class="wxBitmapComboBox"> | |
660 | <selection>1</selection> | |
661 | <object class="ownerdrawnitem"> | |
662 | <text>Foo</text> | |
663 | <bitmap>foo.png</bitmap> | |
664 | </object> | |
665 | <object class="ownerdrawnitem"> | |
666 | <text>Bar</text> | |
667 | <bitmap>bar.png</bitmap> | |
668 | </object> | |
669 | </object> | |
670 | @endcode | |
671 | ||
672 | ||
673 | @subsubsection xrc_wxbitmaptogglebutton wxBitmapToggleButton | |
674 | ||
675 | @beginTable | |
676 | @hdr3col{property, type, description} | |
677 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
678 | Label to display on the button (required).} | |
679 | @row3col{checked, @ref overview_xrcformat_type_bool, | |
680 | Should the button be checked/pressed initially (default: 0)?} | |
681 | @endTable | |
682 | ||
683 | ||
684 | @subsubsection xrc_wxbutton wxButton | |
685 | ||
686 | @beginTable | |
687 | @hdr3col{property, type, description} | |
688 | @row3col{label, @ref overview_xrcformat_type_text, | |
689 | Label to display on the button (may be omitted if only the bitmap or stock ID is used).} | |
690 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
691 | Bitmap to display in the button (optional).} | |
692 | @row3col{bitmapposition, @c wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, | |
693 | Position of the bitmap in the button, see wxButton::SetBitmapPosition() (default: wxLEFT).} | |
694 | @row3col{default, @ref overview_xrcformat_type_bool, | |
695 | Should this button be the default button in dialog (default: 0)?} | |
696 | @endTable | |
697 | ||
698 | ||
699 | @subsubsection xrc_wxcalendarctrl wxCalendarCtrl | |
700 | ||
701 | No additional properties. | |
702 | ||
703 | ||
704 | @subsubsection xrc_wxcheckbox wxCheckBox | |
705 | ||
706 | @beginTable | |
707 | @hdr3col{property, type, description} | |
708 | @row3col{label, @ref overview_xrcformat_type_text, | |
709 | Label to use for the checkbox (default: empty).} | |
710 | @row3col{checked, @ref overview_xrcformat_type_bool, | |
711 | Should the checkbox be checked initially (default: 0)?} | |
712 | @endTable | |
713 | ||
714 | ||
715 | @subsubsection xrc_wxchecklistbox wxCheckListBox | |
716 | ||
717 | @beginTable | |
718 | @hdr3col{property, type, description} | |
719 | @row3col{content, items, | |
720 | Content of the control; this property has any number of @c \<item\> XML | |
721 | elements as its children, with the items text as their text values | |
722 | (default: empty).} | |
723 | @endTable | |
724 | ||
725 | The @c \<item\> elements have listbox items' labels as their text values. They | |
726 | can also have optional @c checked XML attribute -- if set to "1", the value is | |
727 | initially checked. | |
728 | ||
729 | Example: | |
730 | @code | |
731 | <object class="wxCheckListBox"> | |
732 | <content> | |
733 | <item checked="1">Download library</item> | |
734 | <item checked="1">Compile samples</item> | |
735 | <item checked="1">Skim docs</item> | |
736 | <item checked="1">Finish project</item> | |
737 | <item>Wash car</item> | |
738 | </content> | |
739 | </object> | |
740 | @endcode | |
741 | ||
742 | ||
743 | @subsubsection xrc_wxchoice wxChoice | |
744 | ||
745 | @beginTable | |
746 | @hdr3col{property, type, description} | |
747 | @row3col{selection, integer, | |
748 | Index of the initially selected item or -1 for no selection (default: -1).} | |
749 | @row3col{content, items, | |
750 | Content of the control; this property has any number of @c \<item\> XML | |
751 | elements as its children, with the items text as their text values | |
752 | (default: empty).} | |
753 | @endTable | |
754 | ||
755 | Example: | |
756 | @code | |
757 | <object class="wxChoice" name="controls_choice"> | |
758 | <content> | |
759 | <item>See</item> | |
760 | <item>Hear</item> | |
761 | <item>Feel</item> | |
762 | <item>Smell</item> | |
763 | <item>Taste</item> | |
764 | <item>The Sixth Sense!</item> | |
765 | </content> | |
766 | </object> | |
767 | @endcode | |
768 | ||
769 | ||
770 | @subsubsection xrc_wxchoicebook wxChoicebook | |
771 | ||
772 | @beginTable | |
773 | @hdr3col{property, type, description} | |
774 | @row3col{imagelist, @ref overview_xrcformat_type_imagelist, | |
775 | Image list to use for the images (default: none, built implicitly).} | |
776 | @endTable | |
777 | ||
778 | Additionally, a choicebook can have one or more child objects of the @c | |
779 | choicebookpage pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and | |
780 | its @c notebookpage). | |
781 | ||
782 | @c choicebookpage objects have the following properties: | |
783 | ||
784 | @beginTable | |
785 | @hdr3col{property, type, description} | |
786 | @row3col{label, @ref overview_xrcformat_type_text, | |
787 | Sheet page's title (required).} | |
788 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
789 | Bitmap shown alongside the label (default: none, mutually exclusive with @c image).} | |
790 | @row3col{image, integer, | |
791 | The zero-based index of the image associated with the item | |
792 | into the image list (default: none, mutually exclusive with @c bitmap, only if imagelist was set).} | |
793 | @row3col{selected, @ref overview_xrcformat_type_bool, | |
794 | Is the page selected initially (only one page can be selected; default: 0)?} | |
795 | @endTable | |
796 | ||
797 | Each @c choicebookpage has exactly one non-toplevel window as its child. | |
798 | ||
799 | ||
800 | @subsubsection xrc_wxcommandlinkbutton wxCommandLinkButton | |
801 | ||
802 | The wxCommandLinkButton contains a main title-like @c label and an optional | |
803 | @c note for longer description. The main @c label and the @c note can be | |
804 | concatenated into a single string using a new line character between them | |
805 | (notice that the @c note part can have more new lines in it). | |
806 | ||
807 | @beginTable | |
808 | @hdr3col{property, type, description} | |
809 | @row3col{label, @ref overview_xrcformat_type_text, | |
810 | First line of text on the button, typically the label of an action that | |
811 | will be made when the button is pressed (required). } | |
812 | @row3col{note, @ref overview_xrcformat_type_text, | |
813 | Second line of text describing the action performed when the button is pressed (default: none). } | |
814 | @endTable | |
815 | ||
816 | ||
817 | @subsubsection xrc_wxcollapsiblepane wxCollapsiblePane | |
818 | ||
819 | @beginTable | |
820 | @hdr3col{property, type, description} | |
821 | @row3col{label, @ref overview_xrcformat_type_text, | |
822 | Label to use for the collapsible section (required).} | |
823 | @row3col{collapsed, @ref overview_xrcformat_type_bool, | |
824 | Should the pane be collapsed initially (default: 0)?} | |
825 | @endTable | |
826 | ||
827 | wxCollapsiblePane may contain single optional child object of the @c panewindow | |
828 | pseudo-class type. @c panewindow itself must contain exactly one child that | |
829 | is a @ref overview_xrcformat_sizers "sizer" or a non-toplevel window | |
830 | object. | |
831 | ||
832 | ||
833 | @subsubsection xrc_wxcolourpickerctrl wxColourPickerCtrl | |
834 | ||
835 | @beginTable | |
836 | @hdr3col{property, type, description} | |
837 | @row3col{value, @ref overview_xrcformat_type_colour, | |
838 | Initial value of the control (default: wxBLACK).} | |
839 | @endTable | |
840 | ||
841 | ||
842 | @subsubsection xrc_wxcombobox wxComboBox | |
843 | ||
844 | @beginTable | |
845 | @hdr3col{property, type, description} | |
846 | @row3col{selection, integer, | |
847 | Index of the initially selected item or -1 for no selection (default: not used).} | |
848 | @row3col{content, items, | |
849 | Content of the control; this property has any number of @c \<item\> XML | |
850 | elements as its children, with the items text as their text values | |
851 | (default: empty).} | |
852 | @row3col{value, @ref overview_xrcformat_type_string, | |
853 | Initial value in the control (doesn't have to be one of @ content values; | |
854 | default: empty).} | |
855 | @endTable | |
856 | ||
857 | If both @c value and @c selection are specified and @c selection is not -1, | |
858 | then @c selection takes precedence. | |
859 | ||
860 | Example: | |
861 | @code | |
862 | <object class="wxComboBox" name="controls_combobox"> | |
863 | <style>wxCB_DROPDOWN</style> | |
864 | <value>nedit</value> | |
865 | <content> | |
866 | <item>vim</item> | |
867 | <item>emacs</item> | |
868 | <item>notepad.exe</item> | |
869 | <item>bbedit</item> | |
870 | </content> | |
871 | </object> | |
872 | @endcode | |
873 | ||
874 | ||
875 | @subsubsection xrc_wxcomboctrl wxComboCtrl | |
876 | ||
877 | @beginTable | |
878 | @hdr3col{property, type, description} | |
879 | @row3col{value, @ref overview_xrcformat_type_string, | |
880 | Initial value in the control (default: empty).} | |
881 | @endTable | |
882 | ||
883 | ||
884 | @subsubsection xrc_wxdatepickerctrl wxDatePickerCtrl | |
885 | ||
886 | No additional properties. | |
887 | ||
888 | ||
889 | @subsubsection xrc_wxdialog wxDialog | |
890 | ||
891 | @beginTable | |
892 | @hdr3col{property, type, description} | |
893 | @row3col{title, @ref overview_xrcformat_type_text, | |
894 | Dialog's title (default: empty).} | |
895 | @row3col{icon, @ref overview_xrcformat_type_bitmap, | |
896 | Dialog's icon (default: not used).} | |
897 | @row3col{centered, @ref overview_xrcformat_type_bool, | |
898 | Whether the dialog should be centered on the screen (default: 0).} | |
899 | @endTable | |
900 | ||
901 | wxDialog may have optional children: either exactly one | |
902 | @ref overview_xrcformat_sizers "sizer" child or any number of non-toplevel window | |
903 | objects. If sizer child is used, it sets | |
904 | @ref wxSizer::SetSizeHints() "size hints" too. | |
905 | ||
906 | ||
907 | @subsubsection xrc_wxdirpickerctrl wxDirPickerCtrl | |
908 | ||
909 | @beginTable | |
910 | @hdr3col{property, type, description} | |
911 | @row3col{value, @ref overview_xrcformat_type_string, | |
912 | Initial value of the control (default: empty).} | |
913 | @row3col{message, @ref overview_xrcformat_type_text, | |
914 | Message shown to the user in wxDirDialog shown by the control (required).} | |
915 | @endTable | |
916 | ||
917 | ||
918 | @subsubsection xrc_wxeditablelistbox wxEditableListBox | |
919 | ||
920 | @beginTable | |
921 | @hdr3col{property, type, description} | |
922 | @row3col{label, @ref overview_xrcformat_type_text, | |
923 | Label shown above the list (default: empty).} | |
924 | @row3col{content, items, | |
925 | Content of the control; this property has any number of @c \<item\> XML | |
926 | elements as its children, with the items text as their text values | |
927 | (default: empty).} | |
928 | @endTable | |
929 | ||
930 | Example: | |
931 | @code | |
932 | <object class="wxEditableListBox" name="controls_listbox"> | |
933 | <size>250,160</size> | |
934 | <label>List of things</label> | |
935 | <content> | |
936 | <item>Milk</item> | |
937 | <item>Pizza</item> | |
938 | <item>Bread</item> | |
939 | <item>Orange juice</item> | |
940 | <item>Paper towels</item> | |
941 | </content> | |
942 | </object> | |
943 | @endcode | |
944 | ||
945 | ||
946 | @subsubsection xrc_wxfilectrl wxFileCtrl | |
947 | ||
948 | @beginTable | |
949 | @hdr3col{property, type, description} | |
950 | @row3col{defaultdirectory, @ref overview_xrcformat_type_string, | |
951 | Sets the current directory displayed in the control. } | |
952 | @row3col{defaultfilename, @ref overview_xrcformat_type_string, | |
953 | Selects a certain file.} | |
954 | @row3col{wildcard, @ref overview_xrcformat_type_string, | |
955 | Sets the wildcard, which can contain multiple file types, for example: | |
956 | "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" | |
957 | (default: all files).} | |
958 | @endTable | |
959 | ||
960 | ||
961 | @subsubsection xrc_wxfilepickerctrl wxFilePickerCtrl | |
962 | ||
963 | @beginTable | |
964 | @hdr3col{property, type, description} | |
965 | @row3col{value, @ref overview_xrcformat_type_string, | |
966 | Initial value of the control (default: empty).} | |
967 | @row3col{message, @ref overview_xrcformat_type_text, | |
968 | Message shown to the user in wxDirDialog shown by the control (required).} | |
969 | @row3col{wildcard, @ref overview_xrcformat_type_string, | |
970 | Sets the wildcard, which can contain multiple file types, for example: | |
971 | "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" | |
972 | (default: all files).} | |
973 | @endTable | |
974 | ||
975 | ||
976 | @subsubsection xrc_wxfontpickerctrl wxFontPickerCtrl | |
977 | ||
978 | @beginTable | |
979 | @hdr3col{property, type, description} | |
980 | @row3col{value, @ref overview_xrcformat_type_font, | |
981 | Initial value of the control (default: wxNORMAL_FONT).} | |
982 | @endTable | |
983 | ||
984 | @subsubsection xrc_wxfrane wxFrame | |
985 | ||
986 | @beginTable | |
987 | @hdr3col{property, type, description} | |
988 | @row3col{title, @ref overview_xrcformat_type_text, | |
989 | Frame's title (default: empty).} | |
990 | @row3col{icon, @ref overview_xrcformat_type_bitmap, | |
991 | Frame's icon (default: not used).} | |
992 | @row3col{centered, @ref overview_xrcformat_type_bool, | |
993 | Whether the frame should be centered on the screen (default: 0).} | |
994 | @endTable | |
995 | ||
996 | wxFrame may have optional children: either exactly one | |
997 | @ref overview_xrcformat_sizers "sizer" child or any number of non-toplevel window | |
998 | objects. If sizer child is used, it sets | |
999 | @ref wxSizer::SetSizeHints() "size hints" too. | |
1000 | ||
1001 | ||
1002 | @subsubsection xrc_wxgauge wxGauge | |
1003 | ||
1004 | @beginTable | |
1005 | @hdr3col{property, type, description} | |
1006 | @row3col{range, integer, | |
1007 | Maximum value of the gauge (default: 100).} | |
1008 | @row3col{value, integer, | |
1009 | Initial value of the control (default: 0).} | |
1010 | @row3col{shadow, @ref overview_xrcformat_type_dimension, | |
1011 | Rendered shadow size (default: none; ignored by most platforms).} | |
1012 | @row3col{bezel, @ref overview_xrcformat_type_dimension, | |
1013 | Rendered bezel size (default: none; ignored by most platforms).} | |
1014 | @endTable | |
1015 | ||
1016 | @subsubsection xrc_wxgenericdirctrl wxGenericDirCtrl | |
1017 | ||
1018 | @beginTable | |
1019 | @hdr3col{property, type, description} | |
1020 | @row3col{defaultfolder, @ref overview_xrcformat_type_string, | |
1021 | Initial folder (default: empty).} | |
1022 | @row3col{filter, @ref overview_xrcformat_type_text, | |
1023 | Filter string, using the same syntax as used by wxFileDialog, e.g. | |
1024 | "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg" (default: empty).} | |
1025 | @row3col{defaultfilter, integer, | |
1026 | Zero-based index of default filter (default: 0).} | |
1027 | @endTable | |
1028 | ||
1029 | @subsubsection xrc_wxgrid wxGrid | |
1030 | ||
1031 | No additional properties. | |
1032 | ||
1033 | ||
1034 | @subsubsection xrc_wxhtmlwindow wxHtmlWindow | |
1035 | ||
1036 | @beginTable | |
1037 | @hdr3col{property, type, description} | |
1038 | @row3col{url, @ref overview_xrcformat_type_url, | |
1039 | Page to display in the window (default: none).} | |
1040 | @row3col{htmlcode, @ref overview_xrcformat_type_text, | |
1041 | HTML markup to display in the window (default: none).} | |
1042 | @row3col{borders, @ref overview_xrcformat_type_dimension, | |
1043 | Border around HTML content (default: 0).} | |
1044 | @endTable | |
1045 | ||
1046 | At most one of @c url and @c htmlcode properties may be specified, they are | |
1047 | mutually exclusive. If neither is set, the window is initialized to show empty | |
1048 | page. | |
1049 | ||
1050 | ||
1051 | @subsubsection xrc_wxhyperlinkctrl wxHyperlinkCtrl | |
1052 | ||
1053 | @beginTable | |
1054 | @hdr3col{property, type, description} | |
1055 | @row3col{label, @ref overview_xrcformat_type_text, | |
1056 | Label to display on the control (required).} | |
1057 | @row3col{url, @ref overview_xrcformat_type_url, | |
1058 | URL to open when the link is clicked (required).} | |
1059 | @endTable | |
1060 | ||
1061 | ||
1062 | @subsubsection xrc_wxlistbox wxListBox | |
1063 | ||
1064 | @beginTable | |
1065 | @hdr3col{property, type, description} | |
1066 | @row3col{selection, integer, | |
1067 | Index of the initially selected item or -1 for no selection (default: -1).} | |
1068 | @row3col{content, items, | |
1069 | Content of the control; this property has any number of @c \<item\> XML | |
1070 | elements as its children, with the items text as their text values | |
1071 | (default: empty).} | |
1072 | @endTable | |
1073 | ||
1074 | Example: | |
1075 | @code | |
1076 | <object class="wxListBox" name="controls_listbox"> | |
1077 | <size>250,160</size> | |
1078 | <style>wxLB_SINGLE</style> | |
1079 | <content> | |
1080 | <item>Milk</item> | |
1081 | <item>Pizza</item> | |
1082 | <item>Bread</item> | |
1083 | <item>Orange juice</item> | |
1084 | <item>Paper towels</item> | |
1085 | </content> | |
1086 | </object> | |
1087 | @endcode | |
1088 | ||
1089 | ||
1090 | @subsubsection xrc_wxlistbook wxListbook | |
1091 | ||
1092 | @beginTable | |
1093 | @hdr3col{property, type, description} | |
1094 | @row3col{imagelist, @ref overview_xrcformat_type_imagelist, | |
1095 | Image list to use for the images (default: none, built implicitly).} | |
1096 | @endTable | |
1097 | ||
1098 | Additionally, a listbook can have one or more child objects of the @c | |
1099 | listbookpage pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and | |
1100 | its @c notebookpage). | |
1101 | ||
1102 | @c listbookpage objects have the following properties: | |
1103 | ||
1104 | @beginTable | |
1105 | @hdr3col{property, type, description} | |
1106 | @row3col{label, @ref overview_xrcformat_type_text, | |
1107 | Sheet page's title (required).} | |
1108 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1109 | Bitmap shown alongside the label (default: none, mutually exclusive with @c image).} | |
1110 | @row3col{image, integer, | |
1111 | The zero-based index of the image associated with the item | |
1112 | into the image list (default: none, mutually exclusive with @c bitmap, only if imagelist was set).} | |
1113 | @row3col{selected, @ref overview_xrcformat_type_bool, | |
1114 | Is the page selected initially (only one page can be selected; default: 0)?} | |
1115 | @endTable | |
1116 | ||
1117 | Each @c listbookpage has exactly one non-toplevel window as its child. | |
1118 | ||
1119 | ||
1120 | @subsubsection xrc_wxlistctrl wxListCtrl | |
1121 | ||
1122 | @beginTable | |
1123 | @hdr3col{property, type, description} | |
1124 | @row3col{imagelist, @ref overview_xrcformat_type_imagelist, | |
1125 | The normal (wxIMAGE_LIST_NORMAL) image list (default: none, built implicitly).} | |
1126 | @row3col{imagelist-small, @ref overview_xrcformat_type_imagelist, | |
1127 | The small (wxIMAGE_LIST_SMALL) image list (default: none, built implicitly).} | |
1128 | @endTable | |
1129 | ||
1130 | A list control can have optional child objects of the @ref xrc_wxlistitem | |
1131 | class. Report mode list controls (i.e. created with @c wxLC_REPORT style) can | |
1132 | in addition have optional @ref xrc_wxlistcol child objects. | |
1133 | ||
1134 | @paragraph xrc_wxlistcol listcol | |
1135 | ||
1136 | The @c listcol class can only be used for wxListCtrl children. It can have the | |
1137 | following properties (all of them optional): | |
1138 | ||
1139 | @beginTable | |
1140 | @hdr3col{property, type, description} | |
1141 | @row3col{align, wxListColumnFormat, | |
1142 | The alignment for the item. | |
1143 | Can be one of @c wxLIST_FORMAT_LEFT, @c wxLIST_FORMAT_RIGHT or | |
1144 | @c wxLIST_FORMAT_CENTRE.} | |
1145 | @row3col{text, @ref overview_xrcformat_type_text, | |
1146 | The title of the column. } | |
1147 | @row3col{width, integer, | |
1148 | The column width. } | |
1149 | @row3col{image, integer, | |
1150 | The zero-based index of the image associated with the item in the 'small' image list. } | |
1151 | @endTable | |
1152 | ||
1153 | The columns are appended to the control in order of their appearance and may be | |
1154 | referenced by 0-based index in the @c col attributes of subsequent @c listitem | |
1155 | objects. | |
1156 | ||
1157 | @paragraph xrc_wxlistitem listitem | |
1158 | ||
1159 | The @c listitem is a child object for the class @ref xrc_wxlistctrl. | |
1160 | It can have the following properties (all of them optional): | |
1161 | ||
1162 | @beginTable | |
1163 | @hdr3col{property, type, description} | |
1164 | @row3col{align, wxListColumnFormat, | |
1165 | The alignment for the item. | |
1166 | Can be one of @c wxLIST_FORMAT_LEFT, @c wxLIST_FORMAT_RIGHT or | |
1167 | @c wxLIST_FORMAT_CENTRE.} | |
1168 | @row3col{bg, @ref overview_xrcformat_type_colour, | |
1169 | The background color for the item.} | |
1170 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1171 | Add a bitmap to the (normal) @ref overview_xrcformat_type_imagelist associated with the | |
1172 | @ref xrc_wxlistctrl parent and associate it with this item. | |
1173 | If the imagelist is not defined it will be created implicitly | |
1174 | (default: none, mutually exclusive with @c image).} | |
1175 | @row3col{bitmap-small, @ref overview_xrcformat_type_bitmap, | |
1176 | Add a bitmap in the 'small' @ref overview_xrcformat_type_imagelist associated with the | |
1177 | @ref xrc_wxlistctrl parent and associate it with this item. | |
1178 | If the 'small' imagelist is not defined it will be created implicitly | |
1179 | (default: none, mutually exclusive with @c image-small).} | |
1180 | @row3col{col, integer, | |
1181 | The zero-based column index.} | |
1182 | @row3col{image, integer, | |
1183 | The zero-based index of the image associated with the item | |
1184 | in the (normal) image list | |
1185 | (default: none, mutually exclusive with @c bitmap, only if imagelist was set).} | |
1186 | @row3col{image-small, integer, | |
1187 | The zero-based index of the image associated with the item | |
1188 | in the 'small' image list | |
1189 | (default: none, mutually exclusive with @c bitmap-small, only if imagelist-small was set).} | |
1190 | @row3col{data, integer, | |
1191 | The client data for the item.} | |
1192 | @row3col{font, @ref overview_xrcformat_type_font, | |
1193 | The font for the item.} | |
1194 | @row3col{state, @ref overview_xrcformat_type_style, | |
1195 | The item state. Can be any combination of the following values: | |
1196 | - @c wxLIST_STATE_FOCUSED: The item has the focus. | |
1197 | - @c wxLIST_STATE_SELECTED: The item is selected.} | |
1198 | @row3col{text, @ref overview_xrcformat_type_text, | |
1199 | The text label for the item. } | |
1200 | @row3col{textcolour, @ref overview_xrcformat_type_colour, | |
1201 | The text colour for the item. } | |
1202 | @endTable | |
1203 | ||
1204 | Notice that the item position can't be specified here, the items are appended | |
1205 | to the list control in order of their appearance. | |
1206 | ||
1207 | ||
1208 | @subsubsection xrc_wxmdiparentframe wxMDIParentFrame | |
1209 | ||
1210 | wxMDIParentFrame supports the same properties that @ref xrc_wxfrane does. | |
1211 | ||
1212 | wxMDIParentFrame may have optional children. When used, the child objects | |
1213 | must be of wxMDIChildFrame type. | |
1214 | ||
1215 | ||
1216 | @subsubsection xrc_wxmdichildframe wxMDIChildFrame | |
1217 | ||
1218 | wxMDIChildFrame supports the same properties that @ref xrc_wxfrane and | |
1219 | @ref xrc_wxmdiparentframe do. | |
1220 | ||
1221 | wxMDIChildFrame can only be used as as immediate child of @ref | |
1222 | xrc_wxmdiparentframe. | |
1223 | ||
1224 | wxMDIChildFrame may have optional children: either exactly one | |
1225 | @ref overview_xrcformat_sizers "sizer" child or any number of non-toplevel window | |
1226 | objects. If sizer child is used, it sets | |
1227 | @ref wxSizer::SetSizeHints() "size hints" too. | |
1228 | ||
1229 | ||
1230 | @subsubsection xrc_wxmenu wxMenu | |
1231 | ||
1232 | @beginTable | |
1233 | @hdr3col{property, type, description} | |
1234 | @row3col{label, @ref overview_xrcformat_type_text, | |
1235 | Menu's label (default: empty, but required for menus other | |
1236 | than popup menus).} | |
1237 | @row3col{style, @ref overview_xrcformat_type_style, | |
1238 | Window style for the menu.} | |
1239 | @row3col{help, @ref overview_xrcformat_type_text, | |
1240 | Help shown in statusbar when the menu is selected (only for submenus | |
1241 | of another wxMenu, default: none).} | |
1242 | @row3col{enabled, @ref overview_xrcformat_type_bool, | |
1243 | Is the submenu item enabled (only for submenus of another wxMenu, | |
1244 | default: 1)?} | |
1245 | @endTable | |
1246 | ||
1247 | Note that unlike most controls, wxMenu does @em not have | |
1248 | @ref overview_xrcformat_std_props, with the exception of @c style. | |
1249 | ||
1250 | A menu object can have one or more child objects of the wxMenuItem or wxMenu | |
1251 | classes or @c break or @c separator pseudo-classes. | |
1252 | ||
1253 | The @c separator pseudo-class is used to insert separators into the menu and | |
1254 | has neither properties nor children. Likewise, @c break inserts a break (see | |
1255 | wxMenu::Break()). | |
1256 | ||
1257 | wxMenuItem objects support the following properties: | |
1258 | ||
1259 | @beginTable | |
1260 | @hdr3col{property, type, description} | |
1261 | @row3col{label, @ref overview_xrcformat_type_text, | |
1262 | Item's label (may be omitted if stock ID is used).} | |
1263 | @row3col{accel, @ref overview_xrcformat_type_text_notrans, | |
1264 | Item's accelerator (default: none).} | |
1265 | @row3col{radio, @ref overview_xrcformat_type_bool, | |
1266 | Item's kind is wxITEM_RADIO (default: 0)?} | |
1267 | @row3col{checkable, @ref overview_xrcformat_type_bool, | |
1268 | Item's kind is wxITEM_CHECK (default: 0)?} | |
1269 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1270 | Bitmap to show with the item (default: none).} | |
1271 | @row3col{bitmap2, @ref overview_xrcformat_type_bitmap, | |
1272 | Bitmap for the checked state (wxMSW, if checkable; default: none).} | |
1273 | @row3col{help, @ref overview_xrcformat_type_text, | |
1274 | Help shown in statusbar when the item is selected (default: none).} | |
1275 | @row3col{enabled, @ref overview_xrcformat_type_bool, | |
1276 | Is the item enabled (default: 1)?} | |
1277 | @row3col{checked, @ref overview_xrcformat_type_bool, | |
1278 | Is the item checked initially (default: 0)?} | |
1279 | @endTable | |
1280 | ||
1281 | Example: | |
1282 | @code | |
1283 | <object class="wxMenu" name="menu_edit"> | |
1284 | <style>wxMENU_TEAROFF</style> | |
1285 | <label>_Edit</label> | |
1286 | <object class="wxMenuItem" name="wxID_FIND"> | |
1287 | <label>_Find...</label> | |
1288 | <accel>Ctrl-F</accel> | |
1289 | </object> | |
1290 | <object class="separator"/> | |
1291 | <object class="wxMenuItem" name="menu_fuzzy"> | |
1292 | <label>Translation is _fuzzy</label> | |
1293 | <checkable>1</checkable> | |
1294 | </object> | |
1295 | <object class="wxMenu" name="submenu"> | |
1296 | <label>A submenu</label> | |
1297 | <object class="wxMenuItem" name="foo">...</object> | |
1298 | ... | |
1299 | </object> | |
1300 | <object class="separator" platform="unix"/> | |
1301 | <object class="wxMenuItem" name="wxID_PREFERENCES" platform="unix"> | |
1302 | <label>_Preferences</label> | |
1303 | </object> | |
1304 | </object> | |
1305 | @endcode | |
1306 | ||
1307 | @subsubsection xrc_wxmenubar wxMenuBar | |
1308 | ||
1309 | @beginTable | |
1310 | @hdr3col{property, type, description} | |
1311 | @row3col{style, @ref overview_xrcformat_type_style, | |
1312 | Window style for the menu bar.} | |
1313 | @endTable | |
1314 | ||
1315 | Note that unlike most controls, wxMenuBar does @em not have | |
1316 | @ref overview_xrcformat_std_props, with the exception of @c style. | |
1317 | ||
1318 | A menubar can have one or more child objects of the @ref xrc_wxmenu "wxMenu" | |
1319 | class. | |
1320 | ||
1321 | ||
1322 | @subsubsection xrc_wxnotebook wxNotebook | |
1323 | ||
1324 | @beginTable | |
1325 | @hdr3col{property, type, description} | |
1326 | @row3col{imagelist, @ref overview_xrcformat_type_imagelist, | |
1327 | Image list to use for the images (default: none, built implicitly).} | |
1328 | @endTable | |
1329 | ||
1330 | A notebook can have one or more child objects of the @c notebookpage | |
1331 | pseudo-class. | |
1332 | ||
1333 | @c notebookpage objects have the following properties: | |
1334 | ||
1335 | @beginTable | |
1336 | @hdr3col{property, type, description} | |
1337 | @row3col{label, @ref overview_xrcformat_type_text, | |
1338 | Page's title (required).} | |
1339 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1340 | Bitmap shown alongside the label | |
1341 | (default: none, mutually exclusive with @c image).} | |
1342 | @row3col{image, integer, | |
1343 | The zero-based index of the image associated with the item | |
1344 | into the image list | |
1345 | (default: none, mutually exclusive with @c bitmap, only if imagelist was set).} | |
1346 | @row3col{selected, @ref overview_xrcformat_type_bool, | |
1347 | Is the page selected initially (only one page can be selected; default: 0)?} | |
1348 | @endTable | |
1349 | ||
1350 | Each @c notebookpage has exactly one non-toplevel window as its child. | |
1351 | ||
1352 | Example: | |
1353 | @code | |
1354 | <object class="wxNotebook"> | |
1355 | <style>wxBK_BOTTOM</style> | |
1356 | <object class="notebookpage"> | |
1357 | <label>Page 1</label> | |
1358 | <object class="wxPanel" name="page_1"> | |
1359 | ... | |
1360 | </object> | |
1361 | </object> | |
1362 | <object class="notebookpage"> | |
1363 | <label>Page 2</label> | |
1364 | <object class="wxPanel" name="page_2"> | |
1365 | ... | |
1366 | </object> | |
1367 | </object> | |
1368 | </object> | |
1369 | @endcode | |
1370 | ||
1371 | ||
1372 | @subsubsection xrc_wxownerdrawncombobox wxOwnerDrawnComboBox | |
1373 | ||
1374 | wxOwnerDrawnComboBox has the same properties as | |
1375 | @ref xrc_wxcombobox "wxComboBox", plus the following additional properties: | |
1376 | ||
1377 | @beginTable | |
1378 | @hdr3col{property, type, description} | |
1379 | @row3col{buttonsize, @ref overview_xrcformat_type_size, | |
1380 | Size of the dropdown button (default: default).} | |
1381 | @endTable | |
1382 | ||
1383 | ||
1384 | @subsubsection xrc_wxpanel wxPanel | |
1385 | ||
1386 | No additional properties. | |
1387 | ||
1388 | wxPanel may have optional children: either exactly one | |
1389 | @ref overview_xrcformat_sizers "sizer" child or any number of non-toplevel window | |
1390 | objects. | |
1391 | ||
1392 | ||
1393 | @subsubsection xrc_wxpropertysheetdialog wxPropertySheetDialog | |
1394 | ||
1395 | @beginTable | |
1396 | @hdr3col{property, type, description} | |
1397 | @row3col{title, @ref overview_xrcformat_type_text, | |
1398 | Dialog's title (default: empty).} | |
1399 | @row3col{icon, @ref overview_xrcformat_type_bitmap, | |
1400 | Dialog's icon (default: not used).} | |
1401 | @row3col{centered, @ref overview_xrcformat_type_bool, | |
1402 | Whether the dialog should be centered on the screen (default: 0).} | |
1403 | @row3col{buttons, @ref overview_xrcformat_type_style, | |
1404 | Buttons to show, combination of flags accepted by | |
1405 | wxPropertySheetDialog::CreateButtons() (default: 0).} | |
1406 | @endTable | |
1407 | ||
1408 | A sheet dialog can have one or more child objects of the @c propertysheetpage | |
1409 | pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its | |
1410 | @c notebookpage). @c propertysheetpage objects have the following properties: | |
1411 | ||
1412 | @beginTable | |
1413 | @hdr3col{property, type, description} | |
1414 | @row3col{label, @ref overview_xrcformat_type_text, | |
1415 | Sheet page's title (required).} | |
1416 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1417 | Bitmap shown alongside the label (default: none).} | |
1418 | @row3col{selected, @ref overview_xrcformat_type_bool, | |
1419 | Is the page selected initially (only one page can be selected; default: 0)?} | |
1420 | @endTable | |
1421 | ||
1422 | Each @c propertysheetpage has exactly one non-toplevel window as its child. | |
1423 | ||
1424 | ||
1425 | @subsubsection xrc_wxradiobutton wxRadioButton | |
1426 | ||
1427 | @beginTable | |
1428 | @hdr3col{property, type, description} | |
1429 | @row3col{label, @ref overview_xrcformat_type_text, | |
1430 | Label shown on the radio button (required).} | |
1431 | @row3col{value, @ref overview_xrcformat_type_bool, | |
1432 | Initial value of the control (default: 0).} | |
1433 | @endTable | |
1434 | ||
1435 | ||
1436 | @subsubsection xrc_wxradiobox wxRadioBox | |
1437 | ||
1438 | @beginTable | |
1439 | @hdr3col{property, type, description} | |
1440 | @row3col{label, @ref overview_xrcformat_type_text, | |
1441 | Label for the whole box (default: empty).} | |
1442 | @row3col{dimension, integer, | |
1443 | Specifies the maximum number of rows (if style contains | |
1444 | @c wxRA_SPECIFY_ROWS) or columns (if style contains @c wxRA_SPECIFY_COLS) | |
1445 | for a two-dimensional radiobox (default: 1).} | |
1446 | @row3col{selection, integer, | |
1447 | Index of the initially selected item or -1 for no selection (default: -1).} | |
1448 | @row3col{content, items, | |
1449 | Content of the control; this property has any number of @c \<item\> XML | |
1450 | elements as its children, with the items text as their text values | |
1451 | (see below; default: empty).} | |
1452 | @endTable | |
1453 | ||
1454 | The @c \<item\> elements have radio buttons' labels as their text values. They | |
1455 | can also have some optional XML @em attributes (not properties!): | |
1456 | ||
1457 | @beginTable | |
1458 | @hdr3col{attribute, type, description} | |
1459 | @row3col{tooltip, @ref overview_xrcformat_type_string, | |
1460 | Tooltip to show over this ratio button (default: none).} | |
1461 | @row3col{helptext, @ref overview_xrcformat_type_string, | |
1462 | Contextual help for this radio button (default: none).} | |
1463 | @row3col{enabled, @ref overview_xrcformat_type_bool, | |
1464 | Is the button enabled (default: 1)?} | |
1465 | @row3col{hidden, @ref overview_xrcformat_type_bool, | |
1466 | Is the button hidden initially (default: 0)?} | |
1467 | @endTable | |
1468 | ||
1469 | Example: | |
1470 | @code | |
1471 | <object class="wxRadioBox" name="controls_radiobox"> | |
1472 | <style>wxRA_SPECIFY_COLS</style> | |
1473 | <label>Radio stations</label> | |
1474 | <dimension>1</dimension> | |
1475 | <selection>0</selection> | |
1476 | <content> | |
1477 | <item tooltip="Powerful radio station" helptext="This station is for amateurs of hard rock and heavy metal">Power 108</item> | |
1478 | <item tooltip="Disabled radio station" enabled="0">Power 0</item> | |
1479 | <item tooltip="">WMMS 100.7</item> | |
1480 | <item tooltip="E=mc^2">Energy 98.3</item> | |
1481 | <item helptext="Favourite chukcha's radio">CHUM FM</item> | |
1482 | <item>92FM</item> | |
1483 | <item hidden="1">Very quit station</item> | |
1484 | </content> | |
1485 | </object> | |
1486 | @endcode | |
1487 | ||
1488 | ||
1489 | @subsubsection xrc_wxribbonbar wxRibbonBar | |
1490 | ||
1491 | @beginTable | |
1492 | @hdr3col{property, type, description} | |
1493 | @row3col{art-provider, @ref overview_xrcformat_type_string, | |
1494 | One of @c default, @c aui or @c msw (default: @c default).} | |
1495 | @endTable | |
1496 | ||
1497 | A wxRibbonBar may have @ref xrc_wxribbonpage child objects. The @c page | |
1498 | pseudo-class may be used instead of @c wxRibbonPage when used as wxRibbonBar | |
1499 | children. | |
1500 | ||
1501 | Example: | |
1502 | @code | |
1503 | <object class="wxRibbonBar" name="ribbonbar"> | |
1504 | <object class="page" name="FilePage"> | |
1505 | <label>First</label> | |
1506 | <object class="panel"> | |
1507 | <label>File</label> | |
1508 | <object class="wxRibbonButtonBar"> | |
1509 | <object class="button" name="Open"> | |
1510 | <bitmap>open.xpm</bitmap> | |
1511 | <label>Open</label> | |
1512 | </object> | |
1513 | </object> | |
1514 | </object> | |
1515 | </object> | |
1516 | <object class="page" name="ViewPage"> | |
1517 | <label>View</label> | |
1518 | <object class="panel"> | |
1519 | <label>Zoom</label> | |
1520 | <object class="wxRibbonGallery"> | |
1521 | <object class="item"> | |
1522 | <bitmap>zoomin.xpm</bitmap> | |
1523 | </object> | |
1524 | <object class="item"> | |
1525 | <bitmap>zoomout.xpm</bitmap> | |
1526 | </object> | |
1527 | </object> | |
1528 | </object> | |
1529 | </object> | |
1530 | </object> | |
1531 | @endcode | |
1532 | ||
1533 | Notice that wxRibbonBar support in XRC is available in wxWidgets 2.9.5 and | |
1534 | later only and you need to explicitly register its handler using | |
1535 | @code | |
1536 | #include <wx/xrc/xh_ribbon.h> | |
1537 | ||
1538 | AddHandler(new wxRibbonXmlHandler); | |
1539 | @endcode | |
1540 | to use it. | |
1541 | ||
1542 | ||
1543 | @subsubsection xrc_wxribbonbuttonbar wxRibbonButtonBar | |
1544 | ||
1545 | No additional properties. | |
1546 | ||
1547 | wxRibbonButtonBar can have child objects of the @c button pseudo-class. @c button | |
1548 | objects have the following properties: | |
1549 | ||
1550 | @beginTable | |
1551 | @hdr3col{property, type, description} | |
1552 | @row3col{hybrid, @ref overview_xrcformat_type_bool, | |
1553 | If true, the @c wxRIBBON_BUTTON_HYBRID kind is used (default: false).} | |
1554 | @row3col{disabled, @ref overview_xrcformat_type_bool, | |
1555 | Whether the button should be disabled (default: false).} | |
1556 | @row3col{label, @ref overview_xrcformat_type_text, | |
1557 | Item's label (required).} | |
1558 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1559 | Item's bitmap (required).} | |
1560 | @row3col{small-bitmap, @ref overview_xrcformat_type_bitmap, | |
1561 | Small bitmap (default: none).} | |
1562 | @row3col{disabled-bitmap, @ref overview_xrcformat_type_bitmap, | |
1563 | Disabled bitmap (default: none).} | |
1564 | @row3col{small-disabled-bitmap, @ref overview_xrcformat_type_bitmap, | |
1565 | Small disabled bitmap (default: none).} | |
1566 | @row3col{help, @ref overview_xrcformat_type_text, | |
1567 | Item's help text (default: none).} | |
1568 | @endTable | |
1569 | ||
1570 | ||
1571 | @subsubsection xrc_wxribboncontrol wxRibbonControl | |
1572 | ||
1573 | No additional properties. | |
1574 | ||
1575 | Objects of this type *must* be subclassed with the @c subclass attribute. | |
1576 | ||
1577 | ||
1578 | @subsubsection xrc_wxribbongallery wxRibbonGallery | |
1579 | ||
1580 | No additional properties. | |
1581 | ||
1582 | wxRibbonGallery can have child objects of the @c item pseudo-class. @c item | |
1583 | objects have the following properties: | |
1584 | ||
1585 | @beginTable | |
1586 | @hdr3col{property, type, description} | |
1587 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1588 | Item's bitmap (default: none).} | |
1589 | @endTable | |
1590 | ||
1591 | ||
1592 | @subsubsection xrc_wxribbonpage wxRibbonPage | |
1593 | ||
1594 | @beginTable | |
1595 | @hdr3col{property, type, description} | |
1596 | @row3col{label, @ref overview_xrcformat_type_text, | |
1597 | Label (default: none).} | |
1598 | @row3col{icon, @ref overview_xrcformat_type_bitmap, | |
1599 | Icon (default: none).} | |
1600 | @endTable | |
1601 | ||
1602 | A wxRibbonPage may have children of any type derived from wxRibbonControl. | |
1603 | Most commontly, wxRibbonPanel is used. As a special case, the @c panel | |
1604 | pseudo-class may be used instead of @c wxRibbonPanel when used as wxRibbonPage | |
1605 | children. | |
1606 | ||
1607 | ||
1608 | @subsubsection xrc_wxribbonpanel wxRibbonPanel | |
1609 | ||
1610 | @beginTable | |
1611 | @hdr3col{property, type, description} | |
1612 | @row3col{label, @ref overview_xrcformat_type_text, | |
1613 | Label (default: none).} | |
1614 | @row3col{icon, @ref overview_xrcformat_type_bitmap, | |
1615 | Icon (default: none).} | |
1616 | @endTable | |
1617 | ||
1618 | A wxRibbonPanel may have children of any type derived from wxRibbonControl or | |
1619 | a single wxSizer child with non-ribbon windows in it. | |
1620 | ||
1621 | ||
1622 | @subsubsection xrc_wxrichtextctrl wxRichTextCtrl | |
1623 | ||
1624 | @beginTable | |
1625 | @hdr3col{property, type, description} | |
1626 | @row3col{value, @ref overview_xrcformat_type_text, | |
1627 | Initial value of the control (default: empty).} | |
1628 | @row3col{maxlength, integer, | |
1629 | Maximum length of the text entered (default: unlimited).} | |
1630 | @endTable | |
1631 | ||
1632 | Notice that wxRichTextCtrl support in XRC is available in wxWidgets 2.9.5 and | |
1633 | later only and you need to explicitly register its handler using | |
1634 | @code | |
1635 | #include <wx/xrc/xh_richtext.h> | |
1636 | ||
1637 | AddHandler(new wxRichTextCtrl); | |
1638 | @endcode | |
1639 | to use it. | |
1640 | ||
1641 | ||
1642 | @subsubsection xrc_wxscrollbar wxScrollBar | |
1643 | ||
1644 | @beginTable | |
1645 | @hdr3col{property, type, description} | |
1646 | @row3col{value, integer, | |
1647 | Initial position of the scrollbar (default: 0).} | |
1648 | @row3col{range, integer, | |
1649 | Maximum value of the gauge (default: 10).} | |
1650 | @row3col{thumbsize, integer, | |
1651 | Size of the thumb (default: 1).} | |
1652 | @row3col{pagesize, integer, | |
1653 | Page size (default: 1).} | |
1654 | @endTable | |
1655 | ||
1656 | @subsubsection xrc_wxscrolledwindow wxScrolledWindow | |
1657 | ||
1658 | @beginTable | |
1659 | @hdr3col{property, type, description} | |
1660 | @row3col{scrollrate, @ref overview_xrcformat_type_size, | |
1661 | Scroll rate in @em x and @em y directions (default: not set; | |
1662 | required if the window has a sizer child).} | |
1663 | @endTable | |
1664 | ||
1665 | wxScrolledWindow may have optional children: either exactly one | |
1666 | @ref overview_xrcformat_sizers "sizer" child or any number of non-toplevel window | |
1667 | objects. If sizer child is used, wxSizer::FitInside() is used (instead of | |
1668 | wxSizer::Fit() as usual) and so the children don't determine scrolled window's | |
1669 | minimal size, they only affect @em virtual size. Usually, both @c scrollrate | |
1670 | and either @c size or @c minsize on containing sizer item should be used | |
1671 | in this case. | |
1672 | ||
1673 | ||
1674 | @subsubsection xrc_wxsimplehtmllistbox wxSimpleHtmlListBox | |
1675 | ||
1676 | wxSimpleHtmlListBox has same properties as @ref xrc_wxlistbox "wxListBox". | |
1677 | The only difference is that the text contained in @c \<item\> elements is | |
1678 | HTML markup. Note that the markup has to be escaped: | |
1679 | ||
1680 | @code | |
1681 | <object class="wxSimpleHtmlListBox"> | |
1682 | <content> | |
1683 | <item><b>Bold</b> Milk</item> | |
1684 | </content> | |
1685 | </object> | |
1686 | @endcode | |
1687 | ||
1688 | (X)HTML markup elements cannot be included directly: | |
1689 | ||
1690 | @code | |
1691 | <object class="wxSimpleHtmlListBox"> | |
1692 | <content> | |
1693 | <!-- This is incorrect, doesn't work! --> | |
1694 | <item><b>Bold</b> Milk</item> | |
1695 | </content> | |
1696 | </object> | |
1697 | @endcode | |
1698 | ||
1699 | ||
1700 | @subsubsection xrc_wxslider wxSlider | |
1701 | ||
1702 | @beginTable | |
1703 | @hdr3col{property, type, description} | |
1704 | @row3col{value, integer, | |
1705 | Initial value of the control (default: 0).} | |
1706 | @row3col{min, integer, | |
1707 | Minimum allowed value (default: 0).} | |
1708 | @row3col{max, integer, | |
1709 | Maximum allowed value (default: 100).} | |
1710 | @row3col{pagesize, integer, | |
1711 | Page size; number of steps the slider moves when the user moves | |
1712 | pages up or down (default: unset).} | |
1713 | @row3col{linesize, integer, | |
1714 | Line size; number of steps the slider moves when the user moves it | |
1715 | up or down a line (default: unset).} | |
1716 | @row3col{tickfreq, integer, | |
1717 | Tick marks frequency (Windows only; default: unset).} | |
1718 | @row3col{tick, integer, | |
1719 | Tick position (Windows only; default: unset).} | |
1720 | @row3col{thumb, integer, | |
1721 | Thumb length (Windows only; default: unset).} | |
1722 | @row3col{selmin, integer, | |
1723 | Selection start position (Windows only; default: unset).} | |
1724 | @row3col{selmax, integer, | |
1725 | Selection end position (Windows only; default: unset).} | |
1726 | @endTable | |
1727 | ||
1728 | ||
1729 | @subsubsection xrc_wxspinbutton wxSpinButton | |
1730 | ||
1731 | @beginTable | |
1732 | @hdr3col{property, type, description} | |
1733 | @row3col{value, integer, | |
1734 | Initial value of the control (default: 0).} | |
1735 | @row3col{min, integer, | |
1736 | Minimum allowed value (default: 0).} | |
1737 | @row3col{max, integer, | |
1738 | Maximum allowed value (default: 100).} | |
1739 | @endTable | |
1740 | ||
1741 | ||
1742 | @subsubsection xrc_wxspinctrl wxSpinCtrl | |
1743 | ||
1744 | wxSpinCtrl supports the same properties as @ref xrc_wxspinbutton and, since | |
1745 | wxWidgets 2.9.5, another one: | |
1746 | @beginTable | |
1747 | @row3col{base, integer, | |
1748 | Numeric base, currently can be only 10 or 16 (default: 10).} | |
1749 | @endTable | |
1750 | ||
1751 | ||
1752 | @subsubsection xrc_wxsplitterwindow wxSplitterWindow | |
1753 | ||
1754 | @beginTable | |
1755 | @hdr3col{property, type, description} | |
1756 | @row3col{orientation, @ref overview_xrcformat_type_string, | |
1757 | Orientation of the splitter, either "vertical" or "horizontal" (default: horizontal).} | |
1758 | @row3col{sashpos, @ref overview_xrcformat_type_dimension, | |
1759 | Initial position of the sash (default: 0).} | |
1760 | @row3col{minsize, @ref overview_xrcformat_type_dimension, | |
1761 | Minimum child size (default: not set).} | |
1762 | @row3col{gravity, @ref overview_xrcformat_type_float, | |
1763 | Sash gravity, see wxSplitterWindow::SetSashGravity() (default: not set).} | |
1764 | @endTable | |
1765 | ||
1766 | wxSplitterWindow must have one or two children that are non-toplevel window | |
1767 | objects. If there's only one child, it is used as wxSplitterWindow's only | |
1768 | visible child. If there are two children, the first one is used for left/top | |
1769 | child and the second one for right/bottom child window. | |
1770 | ||
1771 | ||
1772 | @subsubsection xrc_wxsearchctrl wxSearchCtrl | |
1773 | ||
1774 | @beginTable | |
1775 | @hdr3col{property, type, description} | |
1776 | @row3col{value, @ref overview_xrcformat_type_text, | |
1777 | Initial value of the control (default: empty).} | |
1778 | @endTable | |
1779 | ||
1780 | ||
1781 | @subsubsection xrc_wxstatusbar wxStatusBar | |
1782 | ||
1783 | @beginTable | |
1784 | @hdr3col{property, type, description} | |
1785 | @row3col{fields, integer, | |
1786 | Number of status bar fields (default: 1).} | |
1787 | @row3col{widths, @ref overview_xrcformat_type_string, | |
1788 | Comma-separated list of @em fields integers. Each value specifies width | |
1789 | of one field; the values are interpreted using the same convention used | |
1790 | by wxStatusBar::SetStatusWidths() (default: not set).} | |
1791 | @row3col{styles, @ref overview_xrcformat_type_string, | |
1792 | Comma-separated list of @em fields style values. Each value specifies style | |
1793 | of one field and can be one of @c wxSB_NORMAL, @c wxSB_FLAT, @c wxSB_RAISED or | |
1794 | @c wxSB_SUNKEN (default: not set).} | |
1795 | @endTable | |
1796 | ||
1797 | ||
1798 | ||
1799 | @subsubsection xrc_wxstaticbitmap wxStaticBitmap | |
1800 | ||
1801 | @beginTable | |
1802 | @hdr3col{property, type, description} | |
1803 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1804 | Bitmap to display (required).} | |
1805 | @endTable | |
1806 | ||
1807 | @subsubsection xrc_wxstaticbox wxStaticBox | |
1808 | ||
1809 | @beginTable | |
1810 | @hdr3col{property, type, description} | |
1811 | @row3col{label, @ref overview_xrcformat_type_text, | |
1812 | Static box's label (default: empty).} | |
1813 | @endTable | |
1814 | ||
1815 | ||
1816 | @subsubsection xrc_wxstaticline wxStaticLine | |
1817 | ||
1818 | No additional properties. | |
1819 | ||
1820 | ||
1821 | @subsubsection xrc_wxstatictext wxStaticText | |
1822 | ||
1823 | @beginTable | |
1824 | @hdr3col{property, type, description} | |
1825 | @row3col{label, @ref overview_xrcformat_type_text, | |
1826 | Label to display (default: empty).} | |
1827 | @row3col{wrap, @ref overview_xrcformat_type_dimension, | |
1828 | Wrap the text so that each line is at most the given number of pixels, see | |
1829 | wxStaticText::Wrap() (default: no wrap).} | |
1830 | @endTable | |
1831 | ||
1832 | @subsubsection xrc_wxtextctrl wxTextCtrl | |
1833 | ||
1834 | @beginTable | |
1835 | @hdr3col{property, type, description} | |
1836 | @row3col{value, @ref overview_xrcformat_type_text, | |
1837 | Initial value of the control (default: empty).} | |
1838 | @row3col{maxlength, integer, | |
1839 | Maximum length of the text which can be entered by user (default: unlimited).} | |
1840 | @endTable | |
1841 | ||
1842 | ||
1843 | @subsubsection xrc_wxtimepickerctrl wxTimePickerCtrl | |
1844 | ||
1845 | No additional properties. | |
1846 | ||
1847 | ||
1848 | @subsubsection xrc_wxtogglebutton wxToggleButton | |
1849 | ||
1850 | @beginTable | |
1851 | @hdr3col{property, type, description} | |
1852 | @row3col{label, @ref overview_xrcformat_type_text, | |
1853 | Label to display on the button (required).} | |
1854 | @row3col{checked, @ref overview_xrcformat_type_bool, | |
1855 | Should the button be checked/pressed initially (default: 0)?} | |
1856 | @endTable | |
1857 | ||
1858 | @subsubsection xrc_wxtoolbar wxToolBar | |
1859 | ||
1860 | @beginTable | |
1861 | @hdr3col{property, type, description} | |
1862 | @row3col{bitmapsize, @ref overview_xrcformat_type_size, | |
1863 | Size of toolbar bitmaps (default: not set).} | |
1864 | @row3col{margins, @ref overview_xrcformat_type_size, | |
1865 | Margins (default: platform default).} | |
1866 | @row3col{packing, integer, | |
1867 | Packing, see wxToolBar::SetToolPacking() (default: not set).} | |
1868 | @row3col{separation, integer, | |
1869 | Default separator size, see wxToolBar::SetToolSeparation() (default: not set).} | |
1870 | @row3col{dontattachtoframe, @ref overview_xrcformat_type_bool, | |
1871 | If set to 0 and the toolbar object is child of a wxFrame, | |
1872 | wxFrame::SetToolBar() is called; otherwise, you have to add it to a frame | |
1873 | manually. The toolbar is attached by default, you have to set this property | |
1874 | to 1 to disable this behaviour (default: 0).} | |
1875 | @endTable | |
1876 | ||
1877 | A toolbar can have one or more child objects of any wxControl-derived class or | |
1878 | one of three pseudo-classes: @c separator, @c space or @c tool. | |
1879 | ||
1880 | The @c separator pseudo-class is used to insert separators into the toolbar and | |
1881 | has neither properties nor children. Similarly, the @c space pseudo-class is | |
1882 | used for stretchable spaces (see wxToolBar::AddStretchableSpace(), new since | |
1883 | wxWidgets 2.9.1). | |
1884 | ||
1885 | The @c tool pseudo-class objects specify toolbar buttons and have the following | |
1886 | properties: | |
1887 | ||
1888 | @beginTable | |
1889 | @hdr3col{property, type, description} | |
1890 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1891 | Tool's bitmap (required).} | |
1892 | @row3col{bitmap2, @ref overview_xrcformat_type_bitmap, | |
1893 | Bitmap for disabled tool (default: derived from @c bitmap).} | |
1894 | @row3col{label, @ref overview_xrcformat_type_text, | |
1895 | Label to display on the tool (default: no label).} | |
1896 | @row3col{radio, @ref overview_xrcformat_type_bool, | |
1897 | Item's kind is wxITEM_RADIO (default: 0)?} | |
1898 | @row3col{toggle, @ref overview_xrcformat_type_bool, | |
1899 | Item's kind is wxITEM_CHECK (default: 0)?} | |
1900 | @row3col{dropdown, see below, | |
1901 | Item's kind is wxITEM_DROPDOWN (default: 0)? (only available since wxWidgets 2.9.0)} | |
1902 | @row3col{tooltip, @ref overview_xrcformat_type_text, | |
1903 | Tooltip to use for the tool (default: none).} | |
1904 | @row3col{longhelp, @ref overview_xrcformat_type_text, | |
1905 | Help text shown in statusbar when the mouse is on the tool (default: none).} | |
1906 | @row3col{disabled, @ref overview_xrcformat_type_bool, | |
1907 | Is the tool initially disabled (default: 0)?} | |
1908 | @row3col{checked, @ref overview_xrcformat_type_bool, | |
1909 | Is the tool initially checked (default: 0)? (only available since wxWidgets 2.9.3)} | |
1910 | @endTable | |
1911 | ||
1912 | The presence of a @c dropdown property indicates that the tool is of type | |
1913 | wxITEM_DROPDOWN. It must be either empty or contain exactly one @ref | |
1914 | xrc_wxmenu child object defining the drop-down button associated menu. | |
1915 | ||
1916 | Notice that @c radio, @c toggle and @c dropdown are mutually exclusive. | |
1917 | ||
1918 | Children that are not @c tool, @c space or @c separator must be instances of classes | |
1919 | derived from wxControl and are added to the toolbar using | |
1920 | wxToolBar::AddControl(). | |
1921 | ||
1922 | Example: | |
1923 | @code | |
1924 | <object class="wxToolBar"> | |
1925 | <style>wxTB_FLAT|wxTB_NODIVIDER</style> | |
1926 | <object class="tool" name="foo"> | |
1927 | <bitmap>foo.png</bitmap> | |
1928 | <label>Foo</label> | |
1929 | </object> | |
1930 | <object class="tool" name="bar"> | |
1931 | <bitmap>bar.png</bitmap> | |
1932 | <label>Bar</label> | |
1933 | </object> | |
1934 | <object class="separator"/> | |
1935 | <object class="tool" name="view_auto"> | |
1936 | <bitmap>view.png</bitmap> | |
1937 | <label>View</label> | |
1938 | <dropdown> | |
1939 | <object class="wxMenu"> | |
1940 | <object class="wxMenuItem" name="view_as_text"> | |
1941 | <label>View as text</label> | |
1942 | </object> | |
1943 | <object class="wxMenuItem" name="view_as_hex"> | |
1944 | <label>View as binary</label> | |
1945 | </object> | |
1946 | </object> | |
1947 | </dropdown> | |
1948 | </object> | |
1949 | <object class="space"/> | |
1950 | <object class="wxComboBox"> | |
1951 | <content> | |
1952 | <item>Just</item> | |
1953 | <item>a combobox</item> | |
1954 | <item>in the toolbar</item> | |
1955 | </content> | |
1956 | </object> | |
1957 | </object> | |
1958 | ||
1959 | @endcode | |
1960 | ||
1961 | ||
1962 | @subsubsection xrc_wxtoolbook wxToolbook | |
1963 | ||
1964 | @beginTable | |
1965 | @hdr3col{property, type, description} | |
1966 | @row3col{imagelist, @ref overview_xrcformat_type_imagelist, | |
1967 | Image list to use for the images (default: none, built implicitly).} | |
1968 | @endTable | |
1969 | ||
1970 | A toolbook can have one or more child objects of the @c toolbookpage | |
1971 | pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its | |
1972 | @c notebookpage). | |
1973 | ||
1974 | @c toolbookpage objects have the following properties: | |
1975 | ||
1976 | @beginTable | |
1977 | @hdr3col{property, type, description} | |
1978 | @row3col{label, @ref overview_xrcformat_type_text, | |
1979 | Sheet page's title (required).} | |
1980 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
1981 | Bitmap shown alongside the label | |
1982 | (default: none, mutually exclusive with @c image).} | |
1983 | @row3col{image, integer, | |
1984 | The zero-based index of the image associated with the item | |
1985 | into the image list | |
1986 | (default: none, mutually exclusive with @c bitmap, only if imagelist was set).} | |
1987 | @row3col{selected, @ref overview_xrcformat_type_bool, | |
1988 | Is the page selected initially (only one page can be selected; default: 0)?} | |
1989 | @endTable | |
1990 | ||
1991 | Each @c toolbookpage has exactly one non-toplevel window as its child. | |
1992 | ||
1993 | ||
1994 | @subsubsection xrc_wxtreectrl wxTreeCtrl | |
1995 | ||
1996 | @beginTable | |
1997 | @hdr3col{property, type, description} | |
1998 | @row3col{imagelist, @ref overview_xrcformat_type_imagelist, | |
1999 | Image list to use for the images (default: none).} | |
2000 | @endTable | |
2001 | ||
2002 | ||
2003 | @subsubsection xrc_wxtreebook wxTreebook | |
2004 | ||
2005 | @beginTable | |
2006 | @hdr3col{property, type, description} | |
2007 | @row3col{imagelist, @ref overview_xrcformat_type_imagelist, | |
2008 | Image list to use for the images (default: none, built implicitly).} | |
2009 | @endTable | |
2010 | ||
2011 | A treebook can have one or more child objects of the @c treebookpage | |
2012 | pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its | |
2013 | @c notebookpage). | |
2014 | ||
2015 | @c treebookpage objects have the following properties: | |
2016 | ||
2017 | @beginTable | |
2018 | @hdr3col{property, type, description} | |
2019 | @row3col{depth, integer, | |
2020 | Page's depth in the labels tree (required; see below).} | |
2021 | @row3col{label, @ref overview_xrcformat_type_text, | |
2022 | Sheet page's title (required).} | |
2023 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
2024 | Bitmap shown alongside the label (default: none, mutually exclusive with @c image).} | |
2025 | @row3col{image, integer, | |
2026 | The zero-based index of the image associated with the item | |
2027 | into the image list | |
2028 | (default: none, mutually exclusive with @c bitmap, only if imagelist was set).} | |
2029 | @row3col{selected, @ref overview_xrcformat_type_bool, | |
2030 | Is the page selected initially (only one page can be selected; default: 0)?} | |
2031 | @row3col{expanded, @ref overview_xrcformat_type_bool, | |
2032 | If set to 1, the page is initially expanded. By default all pages are | |
2033 | initially collapsed.} | |
2034 | @endTable | |
2035 | ||
2036 | Each @c treebookpage has exactly one non-toplevel window as its child. | |
2037 | ||
2038 | The tree of labels is not described using nested @c treebookpage objects, but | |
2039 | using the @em depth property. Toplevel pages have depth 0, their child pages | |
2040 | have depth 1 and so on. A @c treebookpage's label is inserted as child of | |
2041 | the latest preceding page with depth equal to @em depth-1. For example, this | |
2042 | XRC markup: | |
2043 | ||
2044 | @code | |
2045 | <object class="wxTreebook"> | |
2046 | ... | |
2047 | <object class="treebookpage"> | |
2048 | <depth>0</depth> | |
2049 | <label>Page 1</label> | |
2050 | <object class="wxPanel">...</object> | |
2051 | </object> | |
2052 | <object class="treebookpage"> | |
2053 | <depth>1</depth> | |
2054 | <label>Subpage 1A</label> | |
2055 | <object class="wxPanel">...</object> | |
2056 | </object> | |
2057 | <object class="treebookpage"> | |
2058 | <depth>2</depth> | |
2059 | <label>Subsubpage 1</label> | |
2060 | <object class="wxPanel">...</object> | |
2061 | </object> | |
2062 | <object class="treebookpage"> | |
2063 | <depth>1</depth> | |
2064 | <label>Subpage 1B</label> | |
2065 | <object class="wxPanel">...</object> | |
2066 | </object> | |
2067 | <object class="treebookpage"> | |
2068 | <depth>2</depth> | |
2069 | <label>Subsubpage 2</label> | |
2070 | <object class="wxPanel">...</object> | |
2071 | </object> | |
2072 | <object class="treebookpage"> | |
2073 | <depth>0</depth> | |
2074 | <label>Page 2</label> | |
2075 | <object class="wxPanel">...</object> | |
2076 | </object> | |
2077 | </object> | |
2078 | @endcode | |
2079 | ||
2080 | corresponds to the following tree of labels: | |
2081 | ||
2082 | - Page 1 | |
2083 | - Subpage 1A | |
2084 | - Subsubpage 1 | |
2085 | - Subpage 1B | |
2086 | - Subsubpage 2 | |
2087 | - Page 2 | |
2088 | ||
2089 | ||
2090 | @subsubsection xrc_wxwizard wxWizard | |
2091 | ||
2092 | @beginTable | |
2093 | @hdr3col{property, type, description} | |
2094 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
2095 | Bitmap to display on the left side of the wizard (default: none).} | |
2096 | @endTable | |
2097 | ||
2098 | A wizard object can have one or more child objects of the wxWizardPage or | |
2099 | wxWizardPageSimple classes. They both support the following properties | |
2100 | (in addition to @ref overview_xrcformat_std_props): | |
2101 | ||
2102 | @beginTable | |
2103 | @hdr3col{property, type, description} | |
2104 | @row3col{title, @ref overview_xrcformat_type_text, | |
2105 | Wizard window's title (default: none).} | |
2106 | @row3col{bitmap, @ref overview_xrcformat_type_bitmap, | |
2107 | Page-specific bitmap (default: none).} | |
2108 | @endTable | |
2109 | ||
2110 | wxWizardPage and wxWizardPageSimple nodes may have optional children: either | |
2111 | exactly one @ref overview_xrcformat_sizers "sizer" child or any number of | |
2112 | non-toplevel window objects. | |
2113 | ||
2114 | wxWizardPageSimple pages are automatically chained together; wxWizardPage pages | |
2115 | transitions must be handled programmatically. | |
2116 | ||
2117 | ||
2118 | @section overview_xrcformat_sizers Sizers | |
2119 | ||
2120 | Sizers are handled slightly differently in XRC resources than they are in | |
2121 | wxWindow hierarchy. wxWindow's sizers hierarchy is parallel to the wxWindow | |
2122 | children hierarchy: child windows are children of their parent window and | |
2123 | the sizer (or sizers) form separate hierarchy attached to the window with | |
2124 | wxWindow::SetSizer(). | |
2125 | ||
2126 | In XRC, the two hierarchies are merged together: sizers are children of other | |
2127 | sizers or windows and they can contain child window objects. | |
2128 | ||
2129 | If a sizer is child of a window object in the resource, it must be the only | |
2130 | child and it will be attached to the parent with wxWindow::SetSizer(). | |
2131 | Additionally, if the window doesn't have its size explicitly set, | |
2132 | wxSizer::Fit() is used to resize the window. If the parent window is | |
2133 | toplevel window, wxSizer::SetSizeHints() is called to set its hints. | |
2134 | ||
2135 | A sizer object can have one or more child objects of one of two pseudo-classes: | |
2136 | @c sizeritem or @c spacer (see @ref overview_xrcformat_wxstddialogbuttonsizer for | |
2137 | an exception). The former specifies an element (another sizer or a window) | |
2138 | to include in the sizer, the latter adds empty space to the sizer. | |
2139 | ||
2140 | @c sizeritem objects have exactly one child object: either another sizer | |
2141 | object, or a window object. @c spacer objects don't have any children, but | |
2142 | they have one property: | |
2143 | ||
2144 | @beginTable | |
2145 | @hdr3col{property, type, description} | |
2146 | @row3col{size, @ref overview_xrcformat_type_size, Size of the empty space (default: @c wxDefaultSize).} | |
2147 | @endTable | |
2148 | ||
2149 | Both @c sizeritem and @c spacer objects can have any of the following | |
2150 | properties: | |
2151 | ||
2152 | @beginTable | |
2153 | @hdr3col{property, type, description} | |
2154 | @row3col{option, integer, | |
2155 | The "option" value for sizers. Used by wxBoxSizer to set proportion of | |
2156 | the item in the growable direction (default: 0).} | |
2157 | @row3col{flag, @ref overview_xrcformat_type_style, | |
2158 | wxSizerItem flags (default: 0).} | |
2159 | @row3col{border, @ref overview_xrcformat_type_dimension, | |
2160 | Size of the border around the item (directions are specified in flags) | |
2161 | (default: 0).} | |
2162 | @row3col{minsize, @ref overview_xrcformat_type_size, | |
2163 | Minimal size of this item (default: no min size).} | |
2164 | @row3col{ratio, @ref overview_xrcformat_type_size, | |
2165 | Item ratio, see wxSizer::SetRatio() (default: no ratio).} | |
2166 | @row3col{cellpos, @ref overview_xrcformat_type_pos, | |
2167 | (wxGridBagSizer only) Position, see wxGBSizerItem::SetPos() (required). } | |
2168 | @row3col{cellspan, @ref overview_xrcformat_type_size, | |
2169 | (wxGridBagSizer only) Span, see wxGBSizerItem::SetSpan() (required). } | |
2170 | @endTable | |
2171 | ||
2172 | Example of sizers XRC code: | |
2173 | @code | |
2174 | <object class="wxDialog" name="derived_dialog"> | |
2175 | <title>Derived Dialog Example</title> | |
2176 | <centered>1</centered> | |
2177 | <!-- this sizer is set to be this dialog's sizer: --> | |
2178 | <object class="wxFlexGridSizer"> | |
2179 | <cols>1</cols> | |
2180 | <rows>0</rows> | |
2181 | <vgap>0</vgap> | |
2182 | <hgap>0</hgap> | |
2183 | <growablecols>0:1</growablecols> | |
2184 | <growablerows>0:1</growablerows> | |
2185 | <object class="sizeritem"> | |
2186 | <flag>wxALIGN_CENTRE|wxALL</flag> | |
2187 | <border>5</border> | |
2188 | <object class="wxButton" name="my_button"> | |
2189 | <label>My Button</label> | |
2190 | </object> | |
2191 | </object> | |
2192 | <object class="sizeritem"> | |
2193 | <flag>wxALIGN_CENTRE|wxALL</flag> | |
2194 | <border>5</border> | |
2195 | <object class="wxBoxSizer"> | |
2196 | <orient>wxHORIZONTAL</orient> | |
2197 | <object class="sizeritem"> | |
2198 | <flag>wxALIGN_CENTRE|wxALL</flag> | |
2199 | <border>5</border> | |
2200 | <object class="wxCheckBox" name="my_checkbox"> | |
2201 | <label>Enable this text control:</label> | |
2202 | </object> | |
2203 | </object> | |
2204 | <object class="sizeritem"> | |
2205 | <flag>wxALIGN_CENTRE|wxALL</flag> | |
2206 | <border>5</border> | |
2207 | <object class="wxTextCtrl" name="my_textctrl"> | |
2208 | <size>80,-1</size> | |
2209 | <value></value> | |
2210 | </object> | |
2211 | </object> | |
2212 | </object> | |
2213 | </object> | |
2214 | ... | |
2215 | </object> | |
2216 | </object> | |
2217 | @endcode | |
2218 | ||
2219 | The sizer classes that can be used are listed below, together with their | |
2220 | class-specific properties. All classes support the following properties: | |
2221 | ||
2222 | @beginTable | |
2223 | @hdr3col{property, type, description} | |
2224 | @row3col{minsize, @ref overview_xrcformat_type_size, | |
2225 | Minimal size that this sizer will have, see wxSizer::SetMinSize() | |
2226 | (default: no min size).} | |
2227 | @endTable | |
2228 | ||
2229 | @subsection overview_xrcformat_wxboxsizer wxBoxSizer | |
2230 | ||
2231 | @beginTable | |
2232 | @hdr3col{property, type, description} | |
2233 | @row3col{orient, @ref overview_xrcformat_type_style, | |
2234 | Sizer orientation, "wxHORIZONTAL" or "wxVERTICAL" (default: wxHORIZONTAL).} | |
2235 | @endTable | |
2236 | ||
2237 | @subsection overview_xrcformat_wxstaticsboxizer wxStaticBoxSizer | |
2238 | ||
2239 | @beginTable | |
2240 | @hdr3col{property, type, description} | |
2241 | @row3col{orient, @ref overview_xrcformat_type_style, | |
2242 | Sizer orientation, "wxHORIZONTAL" or "wxVERTICAL" (default: wxHORIZONTAL).} | |
2243 | @row3col{label, @ref overview_xrcformat_type_text, | |
2244 | Label to be used for the static box around the sizer (default: empty).} | |
2245 | @endTable | |
2246 | ||
2247 | @subsection overview_xrcformat_wxgridsizer wxGridSizer | |
2248 | ||
2249 | @beginTable | |
2250 | @hdr3col{property, type, description} | |
2251 | @row3col{rows, integer, Number of rows in the grid (default: 0 - determine automatically).} | |
2252 | @row3col{cols, integer, Number of columns in the grid (default: 0 - determine automatically).} | |
2253 | @row3col{vgap, @ref overview_xrcformat_type_dimension, Vertical gap between children (default: 0).} | |
2254 | @row3col{hgap, @ref overview_xrcformat_type_dimension, Horizontal gap between children (default: 0).} | |
2255 | @endTable | |
2256 | ||
2257 | @subsection overview_xrcformat_wxflexgridsizer wxFlexGridSizer | |
2258 | ||
2259 | @beginTable | |
2260 | @hdr3col{property, type, description} | |
2261 | @row3col{rows, integer, Number of rows in the grid (default: 0 - determine automatically).} | |
2262 | @row3col{cols, integer, Number of columns in the grid (default: 0 - determine automatically).} | |
2263 | @row3col{vgap, @ref overview_xrcformat_type_dimension, Vertical gap between children (default: 0).} | |
2264 | @row3col{hgap, @ref overview_xrcformat_type_dimension, Horizontal gap between children (default: 0).} | |
2265 | @row3col{flexibledirection, @ref overview_xrcformat_type_style, | |
2266 | Flexible direction, @c wxVERTICAL, @c wxHORIZONTAL or @c wxBOTH (default). | |
2267 | This property is only available since wxWidgets 2.9.5.} | |
2268 | @row3col{nonflexiblegrowmode, @ref overview_xrcformat_type_style, | |
2269 | Grow mode in the non-flexible direction, | |
2270 | @c wxFLEX_GROWMODE_NONE, @c wxFLEX_GROWMODE_SPECIFIED (default) or | |
2271 | @c wxFLEX_GROWMODE_ALL. | |
2272 | This property is only available since wxWidgets 2.9.5.} | |
2273 | @row3col{growablerows, comma-separated integers list, | |
2274 | Comma-separated list of indexes of rows that are growable (none by default). | |
2275 | Since wxWidgets 2.9.5 optional proportion can be appended to each number | |
2276 | after a colon (@c :).} | |
2277 | @row3col{growablecols, comma-separated integers list, | |
2278 | Comma-separated list of indexes of columns that are growable (none by default). | |
2279 | Since wxWidgets 2.9.5 optional proportion can be appended to each number | |
2280 | after a colon (@c :).} | |
2281 | @endTable | |
2282 | ||
2283 | @subsection overview_xrcformat_wxgridbagsizer wxGridBagSizer | |
2284 | ||
2285 | @beginTable | |
2286 | @hdr3col{property, type, description} | |
2287 | @row3col{vgap, @ref overview_xrcformat_type_dimension, Vertical gap between children (default: 0).} | |
2288 | @row3col{hgap, @ref overview_xrcformat_type_dimension, Horizontal gap between children (default: 0).} | |
2289 | @row3col{flexibledirection, @ref overview_xrcformat_type_style, | |
2290 | Flexible direction, @c wxVERTICAL, @c wxHORIZONTAL, @c wxBOTH (default: @c wxBOTH).} | |
2291 | @row3col{nonflexiblegrowmode, @ref overview_xrcformat_type_style, | |
2292 | Grow mode in the non-flexible direction, | |
2293 | @c wxFLEX_GROWMODE_NONE, @c wxFLEX_GROWMODE_SPECIFIED, @c wxFLEX_GROWMODE_ALL | |
2294 | (default: @c wxFLEX_GROWMODE_SPECIFIED).} | |
2295 | @row3col{growablerows, comma-separated integers list, | |
2296 | Comma-separated list of indexes of rows that are growable, | |
2297 | optionally the proportion can be appended after each number | |
2298 | separated by a @c : | |
2299 | (default: none).} | |
2300 | @row3col{growablecols, comma-separated integers list, | |
2301 | Comma-separated list of indexes of columns that are growable, | |
2302 | optionally the proportion can be appended after each number | |
2303 | separated by a @c : | |
2304 | (default: none).} | |
2305 | @endTable | |
2306 | ||
2307 | @subsection overview_xrcformat_wxwrapsizer wxWrapSizer | |
2308 | ||
2309 | @beginTable | |
2310 | @hdr3col{property, type, description} | |
2311 | @row3col{orient, @ref overview_xrcformat_type_style, | |
2312 | Sizer orientation, "wxHORIZONTAL" or "wxVERTICAL" (required).} | |
2313 | @row3col{flag, @ref overview_xrcformat_type_style, wxWrapSizer flags (default: 0).} | |
2314 | @endTable | |
2315 | ||
2316 | @subsection overview_xrcformat_wxstddialogbuttonsizer wxStdDialogButtonSizer | |
2317 | ||
2318 | Unlike other sizers, wxStdDialogButtonSizer has neither @c sizeritem | |
2319 | nor @c spacer children. Instead, it has one or more children of the | |
2320 | @c button pseudo-class. @c button objects have no properties and they must | |
2321 | always have exactly one child of the @c wxButton class or a class derived from | |
2322 | wxButton. | |
2323 | ||
2324 | Example: | |
2325 | @code | |
2326 | <object class="wxStdDialogButtonSizer"> | |
2327 | <object class="button"> | |
2328 | <object class="wxButton" name="wxID_OK"> | |
2329 | <label>OK</label> | |
2330 | </object> | |
2331 | </object> | |
2332 | <object class="button"> | |
2333 | <object class="wxButton" name="wxID_CANCEL"> | |
2334 | <label>Cancel</label> | |
2335 | </object> | |
2336 | </object> | |
2337 | </object> | |
2338 | @endcode | |
2339 | ||
2340 | ||
2341 | ||
2342 | @section overview_xrcformat_other_objects Other Objects | |
2343 | ||
2344 | In addition to describing UI elements, XRC files can contain non-windows | |
2345 | objects such as bitmaps or icons. This is a concession to Windows developers | |
2346 | used to storing them in Win32 resources. | |
2347 | ||
2348 | Note that unlike Win32 resources, bitmaps included in XRC files are @em not | |
2349 | embedded in the XRC file itself. XRC file only contains a reference to another | |
2350 | file with bitmap data. | |
2351 | ||
2352 | @subsection overview_xrcformat_bitmap wxBitmap | |
2353 | ||
2354 | Bitmaps are stored in @c \<object\> element with class set to @c wxBitmap. Such | |
2355 | bitmaps can then be loaded using wxXmlResource::LoadBitmap(). The content of | |
2356 | the element is exactly same as in the case of | |
2357 | @ref overview_xrcformat_type_bitmap "bitmap properties", except that toplevel | |
2358 | @c \<object\> is used. | |
2359 | ||
2360 | For example, instead of: | |
2361 | @code | |
2362 | <bitmap>mybmp.png</bitmap> | |
2363 | <bitmap stock_id="wxART_NEW"/> | |
2364 | @endcode | |
2365 | toplevel wxBitmap resources would look like: | |
2366 | @code | |
2367 | <object class="wxBitmap" name="my_bitmap">mybmp.png</object> | |
2368 | <object class="wxBitmap" name="my_new_bitmap" stock_id="wxART_NEW"/> | |
2369 | @endcode | |
2370 | ||
2371 | ||
2372 | @subsection overview_xrcformat_icon wxIcon | |
2373 | ||
2374 | wxIcon resources are identical to @ref overview_xrcformat_bitmap "wxBitmap ones", | |
2375 | except that the class is @c wxIcon. | |
2376 | ||
2377 | ||
2378 | @section overview_xrcformat_platform Platform Specific Content | |
2379 | ||
2380 | It is possible to conditionally process parts of XRC files on some platforms | |
2381 | only and ignore them on other platforms. @em Any element in XRC file, be it | |
2382 | toplevel or arbitrarily nested one, can have the @c platform attribute. When | |
2383 | used, @c platform contains |-separated list of platforms that this element | |
2384 | should be processed on. It is filtered out and ignored on any other platforms. | |
2385 | ||
2386 | Possible elemental values are: | |
2387 | @beginDefList | |
2388 | @itemdef{ @c win, Windows } | |
2389 | @itemdef{ @c mac, Mac OS X (or Mac Classic in wxWidgets version supporting it) } | |
2390 | @itemdef{ @c unix, Any Unix platform @em except OS X } | |
2391 | @itemdef{ @c os2, OS/2 } | |
2392 | @endDefList | |
2393 | ||
2394 | Examples: | |
2395 | @code | |
2396 | <label platform="win">Windows</label> | |
2397 | <label platform="unix">Unix</label> | |
2398 | <label platform="mac">Mac OS X</label> | |
2399 | <help platform="mac|unix">Not a Windows machine</help> | |
2400 | @endcode | |
2401 | ||
2402 | ||
2403 | ||
2404 | @section overview_xrcformat_idranges ID Ranges | |
2405 | ||
2406 | Usually you won't care what value the XRCID macro returns for the ID of an | |
2407 | object. Sometimes though it is convenient to have a range of IDs that are | |
2408 | guaranteed to be consecutive. An example of this would be connecting a group of | |
2409 | similar controls to the same event handler. | |
2410 | ||
2411 | The following XRC fragment 'declares' an ID range called @em foo and another | |
2412 | called @em bar; each with some items. | |
2413 | ||
2414 | @code | |
2415 | <object class="wxButton" name="foo[start]"> | |
2416 | <object class="wxButton" name="foo[end]"> | |
2417 | <object class="wxButton" name="foo[2]"> | |
2418 | ... | |
2419 | <object class="wxButton" name="bar[0]"> | |
2420 | <object class="wxButton" name="bar[2]"> | |
2421 | <object class="wxButton" name="bar[1]"> | |
2422 | ... | |
2423 | <ids-range name="foo" /> | |
2424 | <ids-range name="bar" size="30" start="10000" /> | |
2425 | @endcode | |
2426 | ||
2427 | For the range foo, no @em size or @em start parameters were given, so the size | |
2428 | will be calculated from the number of range items, and IDs allocated by | |
2429 | wxWindow::NewControlId (so they'll be negative). Range bar asked for a size of | |
2430 | 30, so this will be its minimum size: should it have more items, the range will | |
2431 | automatically expand to fit them. It specified a start ID of 10000, so | |
2432 | XRCID("bar[0]") will be 10000, XRCID("bar[1]") 10001 etc. Note that if you | |
2433 | choose to supply a start value it must be positive, and it's your | |
2434 | responsibility to avoid clashes. | |
2435 | ||
2436 | For every ID range, the first item can be referenced either as | |
2437 | <em>rangename</em>[0] or <em>rangename</em>[start]. Similarly | |
2438 | <em>rangename</em>[end] is the last item. Using [start] and [end] is more | |
2439 | descriptive in e.g. a Bind() event range or a @em for loop, and they don't have | |
2440 | to be altered whenever the number of items changes. | |
2441 | ||
2442 | Whether a range has positive or negative IDs, [start] is always a smaller | |
2443 | number than [end]; so code like this works as expected: | |
2444 | ||
2445 | @code | |
2446 | for (int n=XRCID("foo[start]"); n <= XRCID("foo[end]"); ++n) | |
2447 | ... | |
2448 | @endcode | |
2449 | ||
2450 | ID ranges can be seen in action in the <em>objref</em> dialog section of the | |
2451 | @sample{xrc}. | |
2452 | ||
2453 | @note | |
2454 | @li All the items in an ID range must be contained in the same XRC file. | |
2455 | @li You can't use an ID range in a situation where static initialisation | |
2456 | occurs; in particular, they won't work as expected in an event table. This is | |
2457 | because the event table's IDs are set to their integer values before the XRC | |
2458 | file is loaded, and aren't subsequently altered when the XRCID value changes. | |
2459 | ||
2460 | @since 2.9.2 | |
2461 | ||
2462 | @section overview_xrcformat_extending Extending the XRC Format | |
2463 | ||
2464 | The XRC format is designed to be extensible and allows specifying and loading | |
2465 | custom controls. The three available mechanisms are described in the rest of | |
2466 | this section in the order of increasing complexity. | |
2467 | ||
2468 | @subsection overview_xrcformat_extending_subclass Subclassing | |
2469 | ||
2470 | The simplest way to add custom controls is to set the @c subclass attribute | |
2471 | of @c \<object\> element: | |
2472 | ||
2473 | @code | |
2474 | <object name="my_value" class="wxTextCtrl" subclass="MyTextCtrl"> | |
2475 | <style>wxTE_MULTILINE</style> | |
2476 | ...etc., setup wxTextCtrl as usual... | |
2477 | </object> | |
2478 | @endcode | |
2479 | ||
2480 | In that case, wxXmlResource will create an instance of the specified subclass | |
2481 | (@c MyTextCtrl in the example above) instead of the class (@c wxTextCtrl above) | |
2482 | when loading the resource. However, the rest of the object's loading (calling | |
2483 | its Create() method, setting its properties, loading any children etc.) | |
2484 | will proceed in @em exactly the same way as it would without @c subclass | |
2485 | attribute. In other words, this approach is only sufficient when the custom | |
2486 | class is just a small modification (e.g. overridden methods or customized | |
2487 | events handling) of an already supported classes. | |
2488 | ||
2489 | The subclass must satisfy a number of requirements: | |
2490 | ||
2491 | -# It must be derived from the class specified in @c class attribute. | |
2492 | -# It must be visible in wxWidget's pseudo-RTTI mechanism, i.e. there must be | |
2493 | a DECLARE_DYNAMIC_CLASS() entry for it. | |
2494 | -# It must support two-phase creation. In particular, this means that it has | |
2495 | to have default constructor. | |
2496 | -# It cannot provide custom Create() method and must be constructible using | |
2497 | base @c class' Create() method (this is because XRC will call Create() of | |
2498 | @c class, not @c subclass). In other words, @em creation of the control | |
2499 | must not be customized. | |
2500 | ||
2501 | ||
2502 | @subsection overview_xrcformat_extending_unknown Unknown Objects | |
2503 | ||
2504 | A more flexible solution is to put a @em placeholder in the XRC file and | |
2505 | replace it with custom control after the resource is loaded. This is done by | |
2506 | using the @c unknown pseudo-class: | |
2507 | ||
2508 | @code | |
2509 | <object class="unknown" name="my_placeholder"/> | |
2510 | @endcode | |
2511 | ||
2512 | The placeholder is inserted as dummy wxPanel that will hold custom control in | |
2513 | it. At runtime, after the resource is loaded and a window created from it | |
2514 | (using e.g. wxXmlResource::LoadDialog()), use code must call | |
2515 | wxXmlResource::AttachUnknownControl() to insert the desired control into | |
2516 | placeholder container. | |
2517 | ||
2518 | This method makes it possible to insert controls that are not known to XRC at | |
2519 | all, but it's also impossible to configure the control in XRC description in | |
2520 | any way. The only properties that can be specified are | |
2521 | the @ref overview_xrcformat_std_props "standard window properties". | |
2522 | ||
2523 | @note @c unknown class cannot be combined with @c subclass attribute, | |
2524 | they are mutually exclusive. | |
2525 | ||
2526 | ||
2527 | @subsection overview_xrcformat_extending_custom Adding Custom Classes | |
2528 | ||
2529 | Finally, XRC allows adding completely new classes in addition to the ones | |
2530 | listed in this document. A class for which wxXmlResourceHandler is implemented | |
2531 | can be used as first-class object in XRC simply by passing class name as the | |
2532 | value of @c class attribute: | |
2533 | ||
2534 | @code | |
2535 | <object name="my_ctrl" class="MyWidget"> | |
2536 | <my_prop>foo</my_prop> | |
2537 | ...etc., whatever MyWidget handler accepts... | |
2538 | </object> | |
2539 | @endcode | |
2540 | ||
2541 | The only requirements on the class are that | |
2542 | -# the class must derive from wxObject | |
2543 | -# it must support wxWidget's pseudo-RTTI mechanism | |
2544 | ||
2545 | Child elements of @c \<object\> are handled by the custom handler and there are | |
2546 | no limitations on them imposed by XRC format. | |
2547 | ||
2548 | This is the only mechanism that works for toplevel objects -- custom controls | |
2549 | are accessible using the type-unsafe wxXmlResource::LoadObject() method. | |
2550 | ||
2551 | ||
2552 | ||
2553 | @section overview_xrcformat_packed Packed XRC Files | |
2554 | ||
2555 | In addition to plain XRC files, wxXmlResource supports (if wxFileSystem support | |
2556 | is compiled in) compressed XRC resources. Compressed resources have either | |
2557 | .zip or .xrs extension and are simply ZIP files that contain arbitrary | |
2558 | number of XRC files and their dependencies (bitmaps, icons etc.). | |
2559 | ||
2560 | ||
2561 | ||
2562 | @section overview_xrcformat_oldversions Older Format Versions | |
2563 | ||
2564 | This section describes differences in older revisions of XRC format (i.e. | |
2565 | files with older values of @c version attribute of @c \<resource\>). | |
2566 | ||
2567 | ||
2568 | @subsection overview_xrcformat_pre_v2530 Versions Before 2.5.3.0 | |
2569 | ||
2570 | Version 2.5.3.0 introduced C-like handling of "\\" in text. In older versions, | |
2571 | "\n", "\t" and "\r" escape sequences were replaced with respective characters | |
2572 | in the same matter it's done in C, but "\\" was left intact instead of being | |
2573 | replaced with single "\", as one would expect. Starting with 2.5.3.0, all of | |
2574 | them are handled in C-like manner. | |
2575 | ||
2576 | ||
2577 | @subsection overview_xrcformat_pre_v2301 Versions Before 2.3.0.1 | |
2578 | ||
2579 | Prior to version 2.3.0.1, "$" was used for accelerators instead of "_" | |
2580 | or "&". For example, | |
2581 | @code | |
2582 | <label>$File</label> | |
2583 | @endcode | |
2584 | was used in place of current version's | |
2585 | @code | |
2586 | <label>_File</label> | |
2587 | @endcode | |
2588 | (or "&File"). | |
2589 | ||
2590 | */ |