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