-
-
-@section overview_xrcformat_overview Overview
+This document describes the format of XRC resource files, as used by
+wxXmlResource.
XRC file is a XML file with all of its elements in the
@c http://www.wxwidgets.org/wxxrc namespace. For backward compatibility,
@@ -65,6 +42,7 @@ Child objects are not directly accessible via wxXmlResource, they can only
be accessed using XRCCTRL().
+
@section overview_xrcformat_root Resource Root Element
The root element is always @c \. It has one optional attribute, @c
@@ -136,7 +114,7 @@ These come in two varieties:
-# Object's properties. A @em property is a value describing part of object's
behaviour, for example the "label" property on wxButton defines its label.
In the most common form, property is a single element with text content
- (""), but they may use nested subelements too (e.g.
+ ("\"), but they may use nested subelements too (e.g.
@ref overview_xrcformat_type_font "font property"). A property can only be
listed once in an object's definition.
-# Child objects. Window childs, sizers, sizer items or notebook pages
@@ -213,11 +191,11 @@ For example, "my_dlg" in this snippet:
My dialog1
-
+
@endcode
is identical to:
@code
-
+
+ view.png
@@ -1605,7 +1786,7 @@ Example:
-
+ Just
@@ -1618,6 +1799,29 @@ Example:
@endcode
+@subsubsection xrc_wxtoolbook wxToolbook
+
+A toolbook can have one or more child objects of the @c toolbookpage
+pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
+@c notebookpage) and one child object of the @ref xrc_wximagelist class.
+@c toolbookpage objects have the following properties:
+
+@beginTable
+@hdr3col{property, type, description}
+@row3col{label, @ref overview_xrcformat_type_text,
+ Sheet page's title (required).}
+@row3col{bitmap, @ref overview_xrcformat_type_bitmap,
+ Bitmap shown alongside the label (default: none).}
+@row3col{image, integer,
+ The zero-based index of the image associated with the item
+ into the image list.}
+@row3col{selected, @ref overview_xrcformat_type_bool,
+ Is the page selected initially (only one page can be selected; default: 0)?}
+@endTable
+
+Each @c toolbookpage has exactly one non-toplevel window as its child.
+
+
@subsubsection xrc_wxtreectrl wxTreeCtrl
A treectrl can have one child object of the @ref xrc_wximagelist class.
@@ -1645,6 +1849,9 @@ pseudo-class (similarly to @ref xrc_wxnotebook "wxNotebook" and its
into the image list.}
@row3col{selected, @ref overview_xrcformat_type_bool,
Is the page selected initially (only one page can be selected; default: 0)?}
+@row3col{expanded, @ref overview_xrcformat_type_bool,
+ If set to 1, the page is initially expanded. By default all pages are
+ initially collapsed.}
@endTable
Each @c treebookpage has exactly one non-toplevel window as its child.
@@ -1720,14 +1927,14 @@ wxWizardPageSimple classes. They both support the following properties
@endTable
wxWizardPageSimple pages are automatically chained together; wxWizardPage pages
-transitions must be handled programatically.
+transitions must be handled programmatically.
@section overview_xrcformat_sizers Sizers
Sizers are handled slightly differently in XRC resources than they are in
wxWindow hierarchy. wxWindow's sizers hierarchy is parallel to the wxWindow
-children hieararchy: child windows are children of their parent window and
+children hierarchy: child windows are children of their parent window and
the sizer (or sizers) form separate hierarchy attached to the window with
wxWindow::SetSizer().
@@ -1788,8 +1995,8 @@ Example of sizers XRC code:
000
- 0
- 0
+ 0:1
+ 0:1wxALIGN_CENTRE|wxALL5
@@ -1870,12 +2077,22 @@ class-specific properties. All classes support the following properties:
@row3col{cols, integer, Number of columns in the grid (default: 0 - determine automatically).}
@row3col{vgap, integer, Vertical gap between children (default: 0).}
@row3col{hgap, integer, Horizontal gap between children (default: 0).}
+@row3col{flexibledirection, @ref overview_xrcformat_type_style,
+ Flexible direction, @c wxVERTICAL, @c wxHORIZONTAL or @c wxBOTH (default).
+ This property is only available since wxWidgets 2.9.5.}
+@row3col{nonflexiblegrowmode, @ref overview_xrcformat_type_style,
+ Grow mode in the non-flexible direction,
+ @c wxFLEX_GROWMODE_NONE, @c wxFLEX_GROWMODE_SPECIFIED (default) or
+ @c wxFLEX_GROWMODE_ALL.
+ This property is only available since wxWidgets 2.9.5.}
@row3col{growablerows, comma-separated integers list,
- Comma-separated list of indexes of rows that are growable
- (default: none).}
+ Comma-separated list of indexes of rows that are growable (none by default).
+ Since wxWidgets 2.9.5 optional proportion can be appended to each number
+ after a colon (@c :).}
@row3col{growablecols, comma-separated integers list,
- Comma-separated list of indexes of columns that are growable
- (default: none).}
+ Comma-separated list of indexes of columns that are growable (none by default).
+ Since wxWidgets 2.9.5 optional proportion can be appended to each number
+ after a colon (@c :).}
@endTable
@subsection overview_xrcformat_wxgridbagsizer wxGridBagSizer
@@ -1884,11 +2101,21 @@ class-specific properties. All classes support the following properties:
@hdr3col{property, type, description}
@row3col{vgap, integer, Vertical gap between children (default: 0).}
@row3col{hgap, integer, Horizontal gap between children (default: 0).}
+@row3col{flexibledirection, @ref overview_xrcformat_type_style,
+ Flexible direction, @c wxVERTICAL, @c wxHORIZONTAL, @c wxBOTH (default: @c wxBOTH).}
+@row3col{nonflexiblegrowmode, @ref overview_xrcformat_type_style,
+ Grow mode in the non-flexible direction,
+ @c wxFLEX_GROWMODE_NONE, @c wxFLEX_GROWMODE_SPECIFIED, @c wxFLEX_GROWMODE_ALL
+ (default: @c wxFLEX_GROWMODE_SPECIFIED).}
@row3col{growablerows, comma-separated integers list,
- Comma-separated list of indexes of rows that are growable
+ Comma-separated list of indexes of rows that are growable,
+ optionally the proportion can be appended after each number
+ separated by a @c :
(default: none).}
@row3col{growablecols, comma-separated integers list,
- Comma-separated list of indexes of columns that are growable
+ Comma-separated list of indexes of columns that are growable,
+ optionally the proportion can be appended after each number
+ separated by a @c :
(default: none).}
@endTable
@@ -1903,7 +2130,7 @@ class-specific properties. All classes support the following properties:
@subsection overview_xrcformat_wxstddialogbuttonsizer wxStdDialogButtonSizer
-Unlike other sizers, wxStdDialogButtonSizer doesn't have neither @c sizeritem
+Unlike other sizers, wxStdDialogButtonSizer has neither @c sizeritem
nor @c spacer children. Instead, it has one or more children of the
@c button pseudo-class. @c button objects have no properties and they must
always have exactly one child of the @c wxButton class or a class derived from
@@ -1974,7 +2201,7 @@ should be processed on. It is filtered out and ignored on any other platforms.
Possible elemental values are:
@beginDefList
@itemdef{ @c win, Windows }
-@itemdef{ @c mac, Mac OS X (or Mac Classic in wxWidgets version supporting it }
+@itemdef{ @c mac, Mac OS X (or Mac Classic in wxWidgets version supporting it) }
@itemdef{ @c unix, Any Unix platform @em except OS X }
@itemdef{ @c os2, OS/2 }
@endDefList
@@ -1989,6 +2216,64 @@ Examples:
+@section overview_xrcformat_idranges ID Ranges
+
+Usually you won't care what value the XRCID macro returns for the ID of an
+object. Sometimes though it is convenient to have a range of IDs that are
+guaranteed to be consecutive. An example of this would be connecting a group of
+similar controls to the same event handler.
+
+The following XRC fragment 'declares' an ID range called @em foo and another
+called @em bar; each with some items.
+
+@code
+
+
+
+ ...
+
+
+
+ ...
+
+
+@endcode
+
+For the range foo, no @em size or @em start parameters were given, so the size
+will be calculated from the number of range items, and IDs allocated by
+wxWindow::NewControlId (so they'll be negative). Range bar asked for a size of
+30, so this will be its minimum size: should it have more items, the range will
+automatically expand to fit them. It specified a start ID of 10000, so
+XRCID("bar[0]") will be 10000, XRCID("bar[1]") 10001 etc. Note that if you
+choose to supply a start value it must be positive, and it's your
+responsibility to avoid clashes.
+
+For every ID range, the first item can be referenced either as
+rangename[0] or rangename[start]. Similarly
+rangename[end] is the last item. Using [start] and [end] is more
+descriptive in e.g. a Bind() event range or a @em for loop, and they don't have
+to be altered whenever the number of items changes.
+
+Whether a range has positive or negative IDs, [start] is always a smaller
+number than [end]; so code like this works as expected:
+
+@code
+for (int n=XRCID("foo[start]"); n <= XRCID("foo[end]"); ++n)
+ ...
+@endcode
+
+ID ranges can be seen in action in the objref dialog section of the
+@sample{xrc}.
+
+@note
+@li All the items in an ID range must be contained in the same XRC file.
+@li You can't use an ID range in a situation where static initialisation
+occurs; in particular, they won't work as expected in an event table. This is
+because the event table's IDs are set to their integer values before the XRC
+file is loaded, and aren't subsequently altered when the XRCID value changes.
+
+@since 2.9.2
+
@section overview_xrcformat_extending Extending the XRC Format
The XRC format is designed to be extensible and allows specifying and loading
@@ -2076,7 +2361,7 @@ Child elements of @c \ are handled by the custom handler and there are
no limitations on them imposed by XRC format.
This is the only mechanism that works for toplevel objects -- custom controls
-are accessible using type-unsafe wxXmlResource::LoadObject() method.
+are accessible using the type-unsafe wxXmlResource::LoadObject() method.