A dialog resource object may be used for either panels or dialog boxes, and
consists of the following attributes. In the following, a {\it font specification}\rtfsp
is a list consisting of point size, family, style, weight, underlined, optional facename.
\begin{twocollist}\itemsep=0pt
\twocolitemruled{Attribute}{Value}
\twocolitem{name}{The name of the resource.}
\twocolitem{style}{Optional dialog box or panel window style.}
\twocolitem{title}{The title of the dialog box (unused if a panel).}.
\twocolitem{modal}{Whether modal: 1 if modal, 0 if modeless, absent if a panel resource.}
\twocolitem{button\_font}{The font used for control buttons: a list comprising point size (integer),
family (string), font style (string), font weight (string) and underlining (0 or 1).}
\twocolitem{label\_font}{The font used for control labels: a list comprising point size (integer),
family (string), font style (string), font weight (string) and underlining (0 or 1).}
\twocolitem{x}{The x position of the dialog or panel.}
\twocolitem{y}{The y position of the dialog or panel.}
\twocolitem{width}{The width of the dialog or panel.}
\twocolitem{height}{The height of the dialog or panel.}
\twocolitem{background\_colour}{The background colour of the dialog or panel. Only valid if the style includes wxUSER\_COLOURS.}
\twocolitem{label\_colour}{The default label colour for the children of the dialog or panel. Only valid if the style includes wxUSER\_COLOURS.}
\twocolitem{button\_colour}{The default button text colour for the children of the dialog or panel. Only valid if the style includes wxUSER\_COLOURS.}
\twocolitem{label\_font}{Font spec}
\twocolitem{button\_font}{Font spec}
\end{twocollist}
Then comes zero or more attributes named `control' for each control
(panel item) on the dialog or panel. The value is a list of further
elements. In the table below, the names in the first column correspond to
the first element of the value list, and the second column details the
remaining elements of the list.
\begin{twocollist}\itemsep=0pt
\twocolitemruled{Control}{Values}
\twocolitem{wxButton}{title (string), window style (string), name (string), x, y, width, height, button bitmap resource (optional string), button font spec}
\twocolitem{wxCheckBox}{title (string), window style (string), name (string), x, y, width, height, default value (optional integer, 1 or 0), label font spec}
\twocolitem{wxChoice}{title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), label font spec, button font spec}
\twocolitem{wxComboBox}{title (string), window style (string), name (string), x, y, width, height, default text value, values (optional list of strings), label font spec, button font spec}
\twocolitem{wxGauge}{title (string), window style (string), name (string), x, y, width, height, value (optional integer), range (optional integer), label font spec, button font spec}
\twocolitem{wxGroupBox}{title (string), window style (string), name (string), x, y, width, height, label font spec}
\twocolitem{wxListBox}{title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), multiple (optional string, wxSINGLE or wxMULTIPLE),
label font spec, button font spec}
\twocolitem{wxMessage}{title (string), window style (string), name (string), x, y, width, height, message bitmap resource (optional string), label font spec}
\twocolitem{wxMultiText}{title (string), window style (string), name (string), x, y, width, height, default value (optional string),
label font spec, button font spec}
\twocolitem{wxRadioBox}{title (string), window style (string), name (string), x, y, width, height, values (optional list of strings), number of rows or cols,
label font spec, button font spec}
\twocolitem{wxRadioButton}{title (string), window style (string), name (string), x, y, width, height, default value (optional integer, 1 or 0), label font spec}
\twocolitem{wxScrollBar}{title (string), window style (string), name (string), x, y, width, height, value (optional integer),
\twocolitem{wxSlider}{title (string), window style (string), name (string), x, y, width, height, value (optional integer), minimum (optional integer), maximum (optional integer),
label font spec, button font spec}
\twocolitem{wxText}{title (string), window style (string), name (string), x, y, width, height, default value (optional string),
label font spec, button font spec}
\end{twocollist}
\subsection{Menubar resource format}
A menubar resource object consists of the following attributes.
\begin{twocollist}\itemsep=0pt
\twocolitemruled{Attribute}{Value}
\twocolitem{name}{The name of the menubar resource.}
\twocolitem{menu}{A list containing all the menus, as detailed below.}
\end{twocollist}
The value of the {\bf menu} attribute is a list of menu item specifications, where each menu
item specification is itself a list comprising:
\begin{itemize}\itemsep=0pt
\item title (a string)
\item menu item identifier (a string or non-zero integer, see below)
\item help string (optional)
\item 0 or 1 for the `checkable' parameter (optional)
\item optionally, further menu item specifications if this item is a pulldown menu.
\end{itemize}
If the menu item specification is the empty list ([]), this is interpreted as a menu separator.
If further (optional) information is associated with each menu item in a future release of wxWindows,
it will be placed after the help string and before the optional pulldown menu specifications.
Note that the menu item identifier must be an integer if the resource is being
included as C++ code and then parsed on initialisation. Unfortunately,\rtfsp
\verb$#$define substitution is not performed inside strings, and
therefore the program cannot know the mapping. However, if the .WXR file
is being loaded dynamically, wxWindows will attempt to replace string
identifiers with \verb$#$defined integers, because it is able to parse
the included \verb$#$defines.
\subsection{Bitmap resource format}
A bitmap resource object consists of a name attribute, and one or more {\bf bitmap} attributes.
There can be more than one of these to allow specification of bitmaps that are optimum for the
platform and display.
\begin{itemize}\itemsep=0pt
\item Bitmap name or filename.
\item Type of bitmap; for example, wxBITMAP\_TYPE\_BMP\_RESOURCE. See class reference under {\bf wxBitmap} for
a full list).
\item Platform this bitmap is valid for; one of WINDOWS, X, MAC and ANY.
\item Number of colours (optional).
\item X resolution (optional).
\item Y resolution (optional).
\end{itemize}
\subsection{Icon resource format}
An icon resource object consists of a name attribute, and one or more {\bf icon} attributes.
There can be more than one of these to allow specification of icons that are optimum for the
platform and display.
\begin{itemize}\itemsep=0pt
\item Icon name or filename.
\item Type of icon; for example, wxBITMAP\_TYPE\_ICO\_RESOURCE. See class reference under {\bf wxBitmap} for
a full list).
\item Platform this bitmap is valid for; one of WINDOWS, X, MAC and ANY.
\item Number of colours (optional).
\item X resolution (optional).
\item Y resolution (optional).
\end{itemize}
\subsection{Resource format design issues}
The .WXR file format is a recent addition and subject to change.
The use of an ASCII resource file format may seem rather inefficient, but this
choice has a number of advantages:
\begin{itemize}\itemsep=0pt
\item Since it is C++ compatible, it can be included into an application's source code,
eliminating the problems associated with distributing a separate resource file
with the executable. However, it can also be loaded dynamically from a file, which will be required
for non-C++ programs that use wxWindows.
\item No extra binary file format and separate converter need be maintained for the wxWindows project
(although others are welcome to add the equivalent of the Windows `rc' resource
parser and a binary format).
\item It would be difficult to append a binary resource component onto an executable
in a portable way.
\item The file format is essentially the PrologIO object format, for which
a parser already exists, so parsing is easy. For those programs that use PrologIO
anyway, the size overhead of the parser is minimal.
\end{itemize}
The disadvantages of the approach include:
\begin{itemize}\itemsep=0pt
\item Parsing adds a small execution overhead to program initialization.
\item Under 16-bit Windows especially, global data is at a premium.
Using a .RC resource table for some wxWindows resource data may be a partial solution,
although .RC strings are limited to 255 characters.
\item Without a resource preprocessor, it is not possible to substitute integers
for identifiers (so menu identifiers have to be written as integers in the resource
object, in addition to providing \verb$#$defines for application code convenience).