Doc fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7516 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -684,7 +684,7 @@ If on (default is off) all default values are written back to the config file.
|
|||||||
This allows the user to see what config options may be changed and is probably
|
This allows the user to see what config options may be changed and is probably
|
||||||
useful only for wxFileConfig.
|
useful only for wxFileConfig.
|
||||||
|
|
||||||
\membersection{wxFileConfig::SetUmask}\label{wxfileconfigsetumask}
|
\membersection{wxConfigBase::SetUmask}\label{wxfileconfigsetumask}
|
||||||
|
|
||||||
\func{void}{SetUmask}{\param{int }{mode}}
|
\func{void}{SetUmask}{\param{int }{mode}}
|
||||||
|
|
||||||
|
@@ -22,7 +22,10 @@ like a frame in that program flow continues, and input on other windows is still
|
|||||||
You specify the type of dialog with the {\bf wxDIALOG\_MODAL} and {\bf wxDIALOG\_MODELESS} window
|
You specify the type of dialog with the {\bf wxDIALOG\_MODAL} and {\bf wxDIALOG\_MODELESS} window
|
||||||
styles.
|
styles.
|
||||||
|
|
||||||
A dialog may be loaded from a wxWindows resource file (extension {\tt wxr}).
|
A dialog may be loaded from a wxWindows resource file (extension {\tt wxr}), which may itself
|
||||||
|
be created by Dialog Editor. For details,
|
||||||
|
see \helpref{The wxWindows resource system}{resourceformats}, \helpref{wxWindows resource functions}{resourcefuncs} and
|
||||||
|
the resource sample.
|
||||||
|
|
||||||
An application can define an \helpref{OnCloseWindow}{wxwindowonclosewindow} handler for the
|
An application can define an \helpref{OnCloseWindow}{wxwindowonclosewindow} handler for the
|
||||||
dialog to respond to system close events.
|
dialog to respond to system close events.
|
||||||
|
@@ -2362,8 +2362,6 @@ as wxWriteResource and wxGetResource. It is just an unfortunate clash of termino
|
|||||||
See also \helpref{wxWindow::LoadFromResource}{wxwindowloadfromresource} for
|
See also \helpref{wxWindow::LoadFromResource}{wxwindowloadfromresource} for
|
||||||
loading from resource data.
|
loading from resource data.
|
||||||
|
|
||||||
{\bf Warning:} this needs updating for wxWindows 2.
|
|
||||||
|
|
||||||
\membersection{::wxResourceAddIdentifier}\label{wxresourceaddidentifier}
|
\membersection{::wxResourceAddIdentifier}\label{wxresourceaddidentifier}
|
||||||
|
|
||||||
\func{bool}{wxResourceAddIdentifier}{\param{const wxString\& }{name}, \param{int }{value}}
|
\func{bool}{wxResourceAddIdentifier}{\param{const wxString\& }{name}, \param{int }{value}}
|
||||||
@@ -2387,15 +2385,15 @@ wxWindows bitmap resource identifier. For example, if the .WXR file contains
|
|||||||
the following:
|
the following:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
static const wxString\& aiai_resource = "bitmap(name = 'aiai_resource',\
|
static const wxString\& project_resource = "bitmap(name = 'project_resource',\
|
||||||
bitmap = ['aiai', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\
|
bitmap = ['project', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\
|
||||||
bitmap = ['aiai.xpm', wxBITMAP_TYPE_XPM, 'X']).";
|
bitmap = ['project.xpm', wxBITMAP_TYPE_XPM, 'X']).";
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
then this function can be called as follows:
|
then this function can be called as follows:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
wxBitmap *bitmap = wxResourceCreateBitmap("aiai_resource");
|
wxBitmap *bitmap = wxResourceCreateBitmap("project_resource");
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
\membersection{::wxResourceCreateIcon}
|
\membersection{::wxResourceCreateIcon}
|
||||||
@@ -2407,15 +2405,15 @@ wxWindows icon resource identifier. For example, if the .WXR file contains
|
|||||||
the following:
|
the following:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
static const wxString\& aiai_resource = "icon(name = 'aiai_resource',\
|
static const wxString\& project_resource = "icon(name = 'project_resource',\
|
||||||
icon = ['aiai', wxBITMAP_TYPE_ICO_RESOURCE, 'WINDOWS'],\
|
icon = ['project', wxBITMAP_TYPE_ICO_RESOURCE, 'WINDOWS'],\
|
||||||
icon = ['aiai', wxBITMAP_TYPE_XBM_DATA, 'X']).";
|
icon = ['project', wxBITMAP_TYPE_XBM_DATA, 'X']).";
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
then this function can be called as follows:
|
then this function can be called as follows:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
wxIcon *icon = wxResourceCreateIcon("aiai_resource");
|
wxIcon *icon = wxResourceCreateIcon("project_resource");
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
\membersection{::wxResourceCreateMenuBar}
|
\membersection{::wxResourceCreateMenuBar}
|
||||||
@@ -2474,9 +2472,9 @@ dialog(name = 'dialog1',
|
|||||||
title = 'Test dialog box',
|
title = 'Test dialog box',
|
||||||
x = 312, y = 234, width = 400, height = 300,
|
x = 312, y = 234, width = 400, height = 300,
|
||||||
modal = 0,
|
modal = 0,
|
||||||
control = [wxGroupBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,
|
control = [1000, wxStaticBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,
|
||||||
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],
|
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],
|
||||||
control = [wxMultiText, 'Multitext', 'wxVERTICAL_LABEL', 'multitext3',
|
control = [1001, wxTextCtrl, '', 'wxTE_MULTILINE', 'text3',
|
||||||
156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',
|
156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',
|
||||||
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],
|
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],
|
||||||
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]).
|
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]).
|
||||||
@@ -2502,7 +2500,7 @@ wxWindows resource data.
|
|||||||
|
|
||||||
\membersection{::wxResourceParseString}\label{wxresourceparsestring}
|
\membersection{::wxResourceParseString}\label{wxresourceparsestring}
|
||||||
|
|
||||||
\func{bool}{wxResourceParseString}{\param{const wxString\& }{resource}, \param{wxResourceTable *}{table = NULL}}
|
\func{bool}{wxResourceParseString}{\param{char*}{ s}, \param{wxResourceTable *}{table = NULL}}
|
||||||
|
|
||||||
Parses a string containing one or more wxWindows resource objects. If
|
Parses a string containing one or more wxWindows resource objects. If
|
||||||
the resource objects are global static data that are included into the
|
the resource objects are global static data that are included into the
|
||||||
@@ -2512,17 +2510,17 @@ containing the resource data, to make it known to wxWindows.
|
|||||||
{\it resource} should contain data with the following form:
|
{\it resource} should contain data with the following form:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
static const wxString\& dialog1 = "dialog(name = 'dialog1',\
|
dialog(name = 'dialog1',
|
||||||
style = 'wxCAPTION | wxDEFAULT_DIALOG_STYLE',\
|
style = 'wxCAPTION | wxDEFAULT_DIALOG_STYLE',
|
||||||
title = 'Test dialog box',\
|
title = 'Test dialog box',
|
||||||
x = 312, y = 234, width = 400, height = 300,\
|
x = 312, y = 234, width = 400, height = 300,
|
||||||
modal = 0,\
|
modal = 0,
|
||||||
control = [wxGroupBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,\
|
control = [1000, wxStaticBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,
|
||||||
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],\
|
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],
|
||||||
control = [wxMultiText, 'Multitext', 'wxVERTICAL_LABEL', 'multitext3',\
|
control = [1001, wxTextCtrl, '', 'wxTE_MULTILINE', 'text3',
|
||||||
156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',\
|
156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',
|
||||||
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],\
|
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],
|
||||||
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]).";
|
[11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]).
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
This function will typically be used after calling \helpref{wxLoadUserResource}{wxloaduserresource} to
|
This function will typically be used after calling \helpref{wxLoadUserResource}{wxloaduserresource} to
|
||||||
@@ -2530,10 +2528,10 @@ load an entire {\tt .wxr file} into a string.
|
|||||||
|
|
||||||
\membersection{::wxResourceRegisterBitmapData}\label{registerbitmapdata}
|
\membersection{::wxResourceRegisterBitmapData}\label{registerbitmapdata}
|
||||||
|
|
||||||
\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{const wxString\& }{xbm\_data}, \param{int }{width},
|
\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{char* }{xbm\_data}, \param{int }{width},
|
||||||
\param{int }{height}, \param{wxResourceTable *}{table = NULL}}
|
\param{int }{height}, \param{wxResourceTable *}{table = NULL}}
|
||||||
|
|
||||||
\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{const wxString\& *}{xpm\_data}}
|
\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{char** }{xpm\_data}}
|
||||||
|
|
||||||
Makes \verb$#$included XBM or XPM bitmap data known to the wxWindows resource system.
|
Makes \verb$#$included XBM or XPM bitmap data known to the wxWindows resource system.
|
||||||
This is required if other resources will use the bitmap data, since otherwise there
|
This is required if other resources will use the bitmap data, since otherwise there
|
||||||
|
@@ -60,7 +60,7 @@ of the parameters is described here:
|
|||||||
|
|
||||||
\docparam{window}{The window to be added to the sizer. Its initial size (either set explicitly by the
|
\docparam{window}{The window to be added to the sizer. Its initial size (either set explicitly by the
|
||||||
user or calculated internally when using wxDefaultSize) is interpreted as the minimal and in many
|
user or calculated internally when using wxDefaultSize) is interpreted as the minimal and in many
|
||||||
cases also the initial size. This is particularly useful in connection with \helpref{SetSizeHint}{wxsizersetsizehints}.}
|
cases also the initial size. This is particularly useful in connection with \helpref{SetSizeHints}{wxsizersetsizehints}.}
|
||||||
|
|
||||||
\docparam{sizer}{The (child-)sizer to be added to the sizer. This allows placing a child sizer in a
|
\docparam{sizer}{The (child-)sizer to be added to the sizer. This allows placing a child sizer in a
|
||||||
sizer and thus to create hierarchies of sizers (typically a vertical box as the top sizer and several
|
sizer and thus to create hierarchies of sizers (typically a vertical box as the top sizer and several
|
||||||
@@ -75,21 +75,21 @@ the dialog.}
|
|||||||
|
|
||||||
\docparam{option}{Although the meaning of this parameter is undefined in wxSizer, it is used in wxBoxSizer
|
\docparam{option}{Although the meaning of this parameter is undefined in wxSizer, it is used in wxBoxSizer
|
||||||
to indicate if a child of a sizer can change its size in the main orientation of the wxBoxSizer - where
|
to indicate if a child of a sizer can change its size in the main orientation of the wxBoxSizer - where
|
||||||
0 stands for not changable and a value of more than zero in interpreted relative to the value of other
|
0 stands for not changable and a value of more than zero is interpreted relative to the value of other
|
||||||
children of the same wxBoxSizer. You might, e.g., have a horizontal wxBoxSizer with three children, two
|
children of the same wxBoxSizer. For example, you might have a horizontal wxBoxSizer with three children, two
|
||||||
of which are supposed to change their size with the sizer, then the two stretchable windows would get a
|
of which are supposed to change their size with the sizer. Then the two stretchable windows would get a
|
||||||
value of 1 each to make them grow and shrink equally with the sizer's horizontal dimension.}
|
value of 1 each to make them grow and shrink equally with the sizer's horizontal dimension.}
|
||||||
|
|
||||||
\docparam{flag}{This parameter can be used to set a number of flags which can be combined using
|
\docparam{flag}{This parameter can be used to set a number of flags which can be combined using
|
||||||
the binary OR operator |. Two main behaviours are defined using these flags: One is the border
|
the binary OR operator |. Two main behaviours are defined using these flags. One is the border
|
||||||
around a window: the {\it border} parameter determines the border width whereas the flags given here
|
around a window: the {\it border} parameter determines the border width whereas the flags given here
|
||||||
determine where the border may be (wxTOP, wxBOTTOM, wxLEFT, wxRIGHT or wxALL). The other flags
|
determine where the border may be (wxTOP, wxBOTTOM, wxLEFT, wxRIGHT or wxALL). The other flags
|
||||||
determine the child window's behaviour if the size of the sizer changes, but - in contrast to
|
determine the child window's behaviour if the size of the sizer changes. However this is not - in contrast to
|
||||||
the {\it option} flag - not in the main orientation, but the respectively other orientation. So
|
the {\it option} flag - in the main orientation, but in the respectively other orientation. So
|
||||||
if you created a wxBoxSizer with the wxVERTICAL option, these flags will be relevant if the
|
if you created a wxBoxSizer with the wxVERTICAL option, these flags will be relevant if the
|
||||||
sizer changes its horizontal size. A child may get resized to completely fill out the new size (using
|
sizer changes its horizontal size. A child may get resized to completely fill out the new size (using
|
||||||
either wxGROW or wxEXPAND), may get proportionally resized (wxSHAPED), may get centered (wxALIGN\_CENTER
|
either wxGROW or wxEXPAND), it may get proportionally resized (wxSHAPED), it may get centered (wxALIGN\_CENTER
|
||||||
or wxALIGN\_CENTRE) or may get aligned to either side (wxALIGN\_LEFT and wxALIGN\_TOP are set to 0
|
or wxALIGN\_CENTRE) or it may get aligned to either side (wxALIGN\_LEFT and wxALIGN\_TOP are set to 0
|
||||||
and thus represent the default, wxALIGN\_RIGHT and wxALIGN\_BOTTOM have their obvious meaning).
|
and thus represent the default, wxALIGN\_RIGHT and wxALIGN\_BOTTOM have their obvious meaning).
|
||||||
With proportional resize, a child may also be centered in the main orientation using
|
With proportional resize, a child may also be centered in the main orientation using
|
||||||
wxALIGN\_CENTER\_VERTICAL (same as wxALIGN\_CENTRE\_VERTICAL) and wxALIGN\_CENTER\_HORIZONTAL
|
wxALIGN\_CENTER\_VERTICAL (same as wxALIGN\_CENTRE\_VERTICAL) and wxALIGN\_CENTER\_HORIZONTAL
|
||||||
@@ -99,7 +99,7 @@ wxALIGN\_CENTER\_VERTICAL (same as wxALIGN\_CENTRE\_VERTICAL) and wxALIGN\_CENTE
|
|||||||
|
|
||||||
\docparam{userData}{Allows an extra object to be attached to the sizer
|
\docparam{userData}{Allows an extra object to be attached to the sizer
|
||||||
item, for use in derived classes when sizing information is more
|
item, for use in derived classes when sizing information is more
|
||||||
complex than what {\it option} and {\it flag} will allow for.}
|
complex than the {\it option} and {\it flag} will allow for.}
|
||||||
|
|
||||||
\membersection{wxSizer::CalcMin}\label{wxsizercalcmin}
|
\membersection{wxSizer::CalcMin}\label{wxsizercalcmin}
|
||||||
|
|
||||||
@@ -134,13 +134,13 @@ Returns the current position of the sizer.
|
|||||||
|
|
||||||
Returns the minimal size of the sizer. This is either the combined minimal
|
Returns the minimal size of the sizer. This is either the combined minimal
|
||||||
size of all the children and their borders or the minimal size set by
|
size of all the children and their borders or the minimal size set by
|
||||||
\helpref{SetMinSize}{wxsizersetminsize}, depending on what is bigger.
|
\helpref{SetMinSize}{wxsizersetminsize}, depending on which is bigger.
|
||||||
|
|
||||||
\membersection{wxSizer::Layout}\label{wxsizerlayout}
|
\membersection{wxSizer::Layout}\label{wxsizerlayout}
|
||||||
|
|
||||||
\func{void}{Layout}{\void}
|
\func{void}{Layout}{\void}
|
||||||
|
|
||||||
Call this to force laying out the children anew, e.g. after having added a child
|
Call this to force layout of the children anew, e.g. after having added a child
|
||||||
to or removed a child (window, other sizer or space) from the sizer while keeping
|
to or removed a child (window, other sizer or space) from the sizer while keeping
|
||||||
the current dimension.
|
the current dimension.
|
||||||
|
|
||||||
@@ -171,10 +171,10 @@ and sizes.
|
|||||||
|
|
||||||
\func{bool}{Remove}{\param{int }{nth}}
|
\func{bool}{Remove}{\param{int }{nth}}
|
||||||
|
|
||||||
Removes a child from the sizer. {\it window} is the window to be removed, {\it sizer} the
|
Removes a child from the sizer. {\it window} is the window to be removed, {\it sizer} is the
|
||||||
equivalent sizer and {\it nth} is the position of the child in the sizer, typically 0 for
|
equivalent sizer and {\it nth} is the position of the child in the sizer, typically 0 for
|
||||||
the first item. This method does not cause any layout or resizing to take place and does
|
the first item. This method does not cause any layout or resizing to take place and does
|
||||||
not delete the window itself. Call \helpref{wxSizer::Layout}{wxsizerlayout} for updating
|
not delete the window itself. Call \helpref{wxSizer::Layout}{wxsizerlayout} to update
|
||||||
the layout "on screen" after removing a child fom the sizer.
|
the layout "on screen" after removing a child fom the sizer.
|
||||||
|
|
||||||
Returns TRUE if the child item was found and removed, FALSE otherwise.
|
Returns TRUE if the child item was found and removed, FALSE otherwise.
|
||||||
@@ -196,7 +196,7 @@ by the sizer to resize themselves according to the rules defined by the paramate
|
|||||||
Call this to give the sizer a minimal size. Normally, the sizer will calculate its
|
Call this to give the sizer a minimal size. Normally, the sizer will calculate its
|
||||||
minimal size based purely on how much space its children need. After calling this
|
minimal size based purely on how much space its children need. After calling this
|
||||||
method \helpref{GetMinSize}{wxsizergetminsize} will return either the minimal size
|
method \helpref{GetMinSize}{wxsizergetminsize} will return either the minimal size
|
||||||
as requested by its children or the minimal size set here, depending on what is
|
as requested by its children or the minimal size set here, depending on which is
|
||||||
bigger.
|
bigger.
|
||||||
|
|
||||||
\membersection{wxSizer::SetItemMinSize}\label{wxsizersetitemminsize}
|
\membersection{wxSizer::SetItemMinSize}\label{wxsizersetitemminsize}
|
||||||
@@ -217,6 +217,6 @@ after initial creation.
|
|||||||
|
|
||||||
Tell the sizer to set the minimal size of the {\it window} to match the sizer's minimal size.
|
Tell the sizer to set the minimal size of the {\it window} to match the sizer's minimal size.
|
||||||
This is commonly done in the constructor of the window itself, see sample in the description
|
This is commonly done in the constructor of the window itself, see sample in the description
|
||||||
of \helpref{wxBoxSizer}{wxboxsizer} if the window is resizable (as many dialogs under Unix and
|
of \helpref{wxBoxSizer}{wxboxsizer} if the window is resizable (as are many dialogs under Unix and
|
||||||
frames on probably all platforms).
|
frames on probably all platforms).
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
\section{The wxWindows resource system}\label{resourceformats}
|
\section{The wxWindows resource system}\label{resourceformats}
|
||||||
|
|
||||||
From version 1.61, wxWindows has an optional {\it resource file} facility,
|
wxWindows has an optional {\it resource file} facility,
|
||||||
which allows separation of dialog, menu, bitmap and icon specifications
|
which allows separation of dialog, menu, bitmap and icon specifications
|
||||||
from the application code.
|
from the application code.
|
||||||
|
|
||||||
@@ -11,49 +11,35 @@ the .WXR file does not {\it replace} the native Windows resource file,
|
|||||||
it merely supplements it. There is no existing native resource format in X
|
it merely supplements it. There is no existing native resource format in X
|
||||||
(except for the defaults file, which has limited expressive power).
|
(except for the defaults file, which has limited expressive power).
|
||||||
|
|
||||||
Using wxWindows resources for panels and dialogs has an effect on how
|
|
||||||
you deal with panel item callbacks: you can't specify a callback function in
|
|
||||||
a resource file, so how do you achieve the same effect as with programmatic
|
|
||||||
panel construction? The solution is similar to that adopted by Windows, which
|
|
||||||
is to use the {\it parent} panel or dialog to intercept user events.
|
|
||||||
|
|
||||||
From 1.61, wxWindows routes panel item events that do not have a callback
|
|
||||||
to the \helpref{OnCommand}{wxwindowoncommand} member of the panel (or dialog). So, to use
|
|
||||||
panel or dialog resources, you need to derive a new class and override the
|
|
||||||
default (empty) OnCommand member. The first argument is a reference
|
|
||||||
to a wxWindow, and the second is a reference to a wxCommandEvent. Check the
|
|
||||||
name of the panel item that's generating an event by using the \helpref{wxWindow::GetName}{wxwindowgetname}\rtfsp
|
|
||||||
function and a string comparison function such as \helpref{wxStringEq}{wxstringeq}.
|
|
||||||
You may need to cast the reference to an appropriate specific type to perform
|
|
||||||
some operations.
|
|
||||||
|
|
||||||
To obtain a pointer to a panel item when you only have the name (for example,
|
|
||||||
when you need to set a value of a text item from outside of the {\bf OnCommand} function),
|
|
||||||
use the function \helpref{wxFindWindowByName}{wxfindwindowbyname}.
|
|
||||||
|
|
||||||
For details of functions for manipulating resource files and loading
|
For details of functions for manipulating resource files and loading
|
||||||
user interface elements, see \helpref{wxWindows resource functions}{resourcefuncs}.
|
user interface elements, see \helpref{wxWindows resource functions}{resourcefuncs}.
|
||||||
|
|
||||||
|
You can use Dialog Editor to create resource files. Unfortunately neither
|
||||||
|
Dialog Editor nor the .WXR format currently cover all wxWindows controls;
|
||||||
|
some are missing, such as wxSpinCtrl, wxSpinButton, wxListCtrl, wxTreeCtrl and others.
|
||||||
|
|
||||||
|
Note that in later versions of wxWindows, this resource format will be replaced
|
||||||
|
by XML specifications that also can include sizers.
|
||||||
|
|
||||||
\subsection{The format of a .WXR file}
|
\subsection{The format of a .WXR file}
|
||||||
|
|
||||||
A wxWindows resource file may look a little odd at first. It is C++
|
A wxWindows resource file may look a little odd at first. It is C++
|
||||||
compatible, comprising mostly of static string variable declarations with
|
compatible, comprising mostly of static string variable declarations with
|
||||||
PrologIO syntax within the string.
|
wxExpr syntax within the string.
|
||||||
|
|
||||||
Here's a sample .WXR file:
|
Here's a sample .WXR file:
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
/*
|
/*
|
||||||
* wxWindows Resource File
|
* wxWindows Resource File
|
||||||
* Written by wxBuilder
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "noname.ids"
|
#include "noname.ids"
|
||||||
|
|
||||||
static char *aiai_resource = "bitmap(name = 'aiai_resource',\
|
static char *my_resource = "bitmap(name = 'my_resource',\
|
||||||
bitmap = ['aiai', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\
|
bitmap = ['myproject', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\
|
||||||
bitmap = ['aiai.xpm', wxBITMAP_TYPE_XPM, 'X']).";
|
bitmap = ['myproject.xpm', wxBITMAP_TYPE_XPM, 'X']).";
|
||||||
|
|
||||||
static char *menuBar11 = "menu(name = 'menuBar11',\
|
static char *menuBar11 = "menu(name = 'menuBar11',\
|
||||||
menu = \
|
menu = \
|
||||||
@@ -79,9 +65,9 @@ static char *panel3 = "dialog(name = 'panel3',\
|
|||||||
button_font = [14, 'wxSWISS', 'wxNORMAL', 'wxBOLD', 0],\
|
button_font = [14, 'wxSWISS', 'wxNORMAL', 'wxBOLD', 0],\
|
||||||
label_font = [10, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],\
|
label_font = [10, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],\
|
||||||
x = 0, y = 37, width = 292, height = 164,\
|
x = 0, y = 37, width = 292, height = 164,\
|
||||||
control = [wxButton, 'OK', '', 'button5', 23, 34, -1, -1, 'aiai_resource'],\
|
control = [1000, wxButton, 'OK', '', 'button5', 23, 34, -1, -1, 'my_resource'],\
|
||||||
control = [wxMessage, 'A Label', '', 'message7', 166, 61, -1, -1, 'aiai_resource'],\
|
control = [1001, wxStaticText, 'A Label', '', 'message7', 166, 61, -1, -1, 'my_resource'],\
|
||||||
control = [wxText, 'Text', 'wxVERTICAL_LABEL', 'text8', 24, 110, -1, -1]).";
|
control = [1002, wxTextCtrl, 'Text', 'wxTE_MULTITEXT', 'text8', 24, 110, -1, -1]).";
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
As you can see, C++-style comments are allowed, and apparently include files
|
As you can see, C++-style comments are allowed, and apparently include files
|
||||||
@@ -89,7 +75,7 @@ are supported too: but this is a special case, where the included file
|
|||||||
is a file of defines shared by the C++ application code and resource file
|
is a file of defines shared by the C++ application code and resource file
|
||||||
to relate identifiers (such as FILE\_OPEN) to integers.
|
to relate identifiers (such as FILE\_OPEN) to integers.
|
||||||
|
|
||||||
Each {\it resource object} is of standard PrologIO syntax, that is,
|
Each {\it resource object} is of standard \helpref{wxExpr}{wxexpr} syntax, that is,
|
||||||
an object name such as {\bf dialog} or {\bf icon}, then an open
|
an object name such as {\bf dialog} or {\bf icon}, then an open
|
||||||
parenthesis, a list of comma-delimited attribute/value pairs, a closing
|
parenthesis, a list of comma-delimited attribute/value pairs, a closing
|
||||||
parenthesis, and a full stop. Backslashes are required to escape newlines,
|
parenthesis, and a full stop. Backslashes are required to escape newlines,
|
||||||
@@ -97,7 +83,7 @@ for the benefit of C++ syntax. If double quotation marks are used to
|
|||||||
delimit strings, they need to be escaped with backslash within a C++ string
|
delimit strings, they need to be escaped with backslash within a C++ string
|
||||||
(so it is easier to use single quotation marks instead).
|
(so it is easier to use single quotation marks instead).
|
||||||
|
|
||||||
\normalbox{{\it A note on PrologIO string syntax:} A string that begins with
|
\normalbox{{\it A note on string syntax:} A string that begins with
|
||||||
an alphabetic character, and contains only alphanumeric characters,
|
an alphabetic character, and contains only alphanumeric characters,
|
||||||
hyphens and underscores, need not be quoted at all. Single quotes and double
|
hyphens and underscores, need not be quoted at all. Single quotes and double
|
||||||
quotes may be used to delimit more complex strings. In fact, single-quoted
|
quotes may be used to delimit more complex strings. In fact, single-quoted
|
||||||
@@ -107,8 +93,8 @@ as strings for the purpose of the resource system.}
|
|||||||
A resource file like this is typically included in the application main file,
|
A resource file like this is typically included in the application main file,
|
||||||
as if it were a normal C++ file. This eliminates the need for a separate
|
as if it were a normal C++ file. This eliminates the need for a separate
|
||||||
resource file to be distributed alongside the executable. However, the
|
resource file to be distributed alongside the executable. However, the
|
||||||
resource file can be dynamically loaded if desired (for example by a non-C++
|
resource file can be dynamically loaded if desired (useful for non-C++
|
||||||
language such as CLIPS, Prolog or Python).
|
languages such as Python).
|
||||||
|
|
||||||
Once included, the resources need to be `parsed' (interpreted), because
|
Once included, the resources need to be `parsed' (interpreted), because
|
||||||
so far the data is just a number of static string variables. The function\rtfsp
|
so far the data is just a number of static string variables. The function\rtfsp
|
||||||
@@ -122,8 +108,8 @@ get all your resources into one variable if you want to.
|
|||||||
by functions such as {\bf ::wxResourceCreateBitmap} and {\bf wxPanel::LoadFromResource}.
|
by functions such as {\bf ::wxResourceCreateBitmap} and {\bf wxPanel::LoadFromResource}.
|
||||||
|
|
||||||
If a wxWindows resource object (such as a bitmap resource) refers to a
|
If a wxWindows resource object (such as a bitmap resource) refers to a
|
||||||
C++ data structure, such as static XBM or XPM data, a further call ({\bf
|
C++ data structure, such as static XPM data, a further call ({\bf ::wxResourceRegisterBitmapData}) needs
|
||||||
::wxResourceRegisterBitmapData}) needs to be made on initialization to tell
|
to be made on initialization to tell
|
||||||
wxWindows about this data. The wxWindows resource object will refer to a
|
wxWindows about this data. The wxWindows resource object will refer to a
|
||||||
string identifier, such as `project\_data' in the example file above.
|
string identifier, such as `project\_data' in the example file above.
|
||||||
This identifier will be looked up in a table to get the C++ static data
|
This identifier will be looked up in a table to get the C++ static data
|
||||||
@@ -137,37 +123,52 @@ use.
|
|||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
/*
|
/*
|
||||||
* File: noname.cc
|
* File: project.cpp
|
||||||
* Purpose: main application module, generated by wxBuilder.
|
* Purpose: main application module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "wx.h"
|
#include "wx/wx.h"
|
||||||
#include "wx_help.h"
|
#include "project.h"
|
||||||
#include "noname.h"
|
|
||||||
|
|
||||||
// Includes the dialog, menu etc. resources
|
// Includes the dialog, menu etc. resources
|
||||||
#include "noname.wxr"
|
#include "project.wxr"
|
||||||
|
|
||||||
// Includes XBM data
|
// Includes XPM data
|
||||||
#include "project.xbm"
|
#include "project.xpm"
|
||||||
|
|
||||||
// Declare an instance of the application: allows the program to start
|
IMPLEMENT_APP(AppClass)
|
||||||
AppClass theApp;
|
|
||||||
|
|
||||||
// Called to initialize the program
|
// Called to initialize the program
|
||||||
wxFrame *AppClass::OnInit(void)
|
bool AppClass::OnInit()
|
||||||
{
|
{
|
||||||
#ifdef wx_x
|
|
||||||
wxResourceRegisterBitmapData("project_data", project_bits, project_width, project_height);
|
wxResourceRegisterBitmapData("project_data", project_bits, project_width, project_height);
|
||||||
#endif
|
|
||||||
wxResourceParseData(menuBar11);
|
wxResourceParseData(menuBar11);
|
||||||
wxResourceParseData(aiai_resource);
|
wxResourceParseData(my_resource);
|
||||||
wxResourceParseData(project_resource);
|
wxResourceParseData(project_resource);
|
||||||
wxResourceParseData(panel3);
|
wxResourceParseData(panel3);
|
||||||
...
|
...
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
|
The following code shows a dialog:
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
// project.wxr contains dialog1
|
||||||
|
MyDialog *dialog = new MyDialog;
|
||||||
|
if (dialog->LoadFromResource(this, "dialog1"))
|
||||||
|
{
|
||||||
|
wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName("text3", dialog);
|
||||||
|
if (text)
|
||||||
|
text->SetValue("wxWindows resource demo");
|
||||||
|
dialog->ShowModal();
|
||||||
|
}
|
||||||
|
dialog->Destroy();
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
Please see also the resource sample.
|
||||||
|
|
||||||
\subsection{Dialog resource format}
|
\subsection{Dialog resource format}
|
||||||
|
|
||||||
@@ -177,52 +178,52 @@ is a list consisting of point size, family, style, weight, underlined, optional
|
|||||||
|
|
||||||
\begin{twocollist}\itemsep=0pt
|
\begin{twocollist}\itemsep=0pt
|
||||||
\twocolitemruled{Attribute}{Value}
|
\twocolitemruled{Attribute}{Value}
|
||||||
|
\twocolitem{id}{The integer identifier of the resource.}
|
||||||
\twocolitem{name}{The name of the resource.}
|
\twocolitem{name}{The name of the resource.}
|
||||||
\twocolitem{style}{Optional dialog box or panel window style.}
|
\twocolitem{style}{Optional dialog box or panel window style.}
|
||||||
\twocolitem{title}{The title of the dialog box (unused if a panel).}.
|
\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{modal}{Whether modal: 1 if modal, 0 if modeless, absent if a panel resource.}
|
||||||
|
\twocolitem{use_dialog_units}{If 1, use dialog units (dependent on the dialog font size) for control sizes and positions.}
|
||||||
|
\twocolitem{use_system_defaults}{If 1, override colours and fonts to use system settings instead.}
|
||||||
\twocolitem{button\_font}{The font used for control buttons: a list comprising point size (integer),
|
\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).}
|
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),
|
\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).}
|
family (string), font style (string), font weight (string) and underlining (0 or 1). Now obsolete; use button\_font instead.}
|
||||||
\twocolitem{x}{The x position of the dialog or panel.}
|
\twocolitem{x}{The x position of the dialog or panel.}
|
||||||
\twocolitem{y}{The y 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{width}{The width of the dialog or panel.}
|
||||||
\twocolitem{height}{The height 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{background\_colour}{The background colour of the dialog or panel.}
|
||||||
\twocolitem{label\_colour}{The default label colour for the children 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. Now obsolete; use button\_colour instead.}
|
||||||
\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{button\_colour}{The default button text colour for the children of the dialog or panel.}
|
||||||
\twocolitem{label\_font}{Font spec}
|
|
||||||
\twocolitem{button\_font}{Font spec}
|
|
||||||
\end{twocollist}
|
\end{twocollist}
|
||||||
|
|
||||||
Then comes zero or more attributes named `control' for each control
|
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
|
(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
|
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
|
the first element of the value list, and the second column details the
|
||||||
remaining elements of the list.
|
remaining elements of the list. Note that titles for some controls are obsolete
|
||||||
|
(they don't have titles), but the syntax is retained for backward compatibility.
|
||||||
|
|
||||||
\begin{twocollist}\itemsep=0pt
|
\begin{twocollist}\itemsep=0pt
|
||||||
\twocolitemruled{Control}{Values}
|
\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{wxButton}{id (integer), 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{wxCheckBox}{id (integer), 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{wxChoice}{id (integer), 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{wxComboBox}{id (integer), 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{wxGauge}{id (integer), 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{wxStaticBox}{id (integer), 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),
|
\twocolitem{wxListBox}{id (integer), 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}
|
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{wxStaticText}{id (integer), 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),
|
\twocolitem{wxRadioBox}{id (integer), 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}
|
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,
|
\twocolitem{wxRadioButton}{id (integer), title (string), window style (string), name (string), x, y, width, height, default value (optional integer, 1 or 0), label font spec}
|
||||||
label font spec, button font spec}
|
\twocolitem{wxScrollBar}{id (integer), title (string), window style (string), name (string), x, y, width, height, value (optional integer),
|
||||||
\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),
|
|
||||||
page length (optional integer), object length (optional integer), view length (optional integer)}
|
page length (optional integer), object length (optional integer), view length (optional integer)}
|
||||||
\twocolitem{wxSlider}{title (string), window style (string), name (string), x, y, width, height, value (optional integer), minimum (optional integer), maximum (optional integer),
|
\twocolitem{wxSlider}{id (integer), 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}
|
label font spec, button font spec}
|
||||||
\twocolitem{wxText}{title (string), window style (string), name (string), x, y, width, height, default value (optional string),
|
\twocolitem{wxTextCtrl}{id (integer), title (string), window style (string), name (string), x, y, width, height, default value (optional string),
|
||||||
label font spec, button font spec}
|
label font spec, button font spec}
|
||||||
\end{twocollist}
|
\end{twocollist}
|
||||||
|
|
||||||
@@ -292,7 +293,6 @@ a full list).
|
|||||||
\item Y resolution (optional).
|
\item Y resolution (optional).
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
|
|
||||||
\subsection{Resource format design issues}
|
\subsection{Resource format design issues}
|
||||||
|
|
||||||
The .WXR file format is a recent addition and subject to change.
|
The .WXR file format is a recent addition and subject to change.
|
||||||
@@ -309,8 +309,8 @@ for non-C++ programs that use wxWindows.
|
|||||||
parser and a binary format).
|
parser and a binary format).
|
||||||
\item It would be difficult to append a binary resource component onto an executable
|
\item It would be difficult to append a binary resource component onto an executable
|
||||||
in a portable way.
|
in a portable way.
|
||||||
\item The file format is essentially the PrologIO object format, for which
|
\item The file format is essentially the \helpref{wxExpr}{wxexpr} object format, for which
|
||||||
a parser already exists, so parsing is easy. For those programs that use PrologIO
|
a parser already exists, so parsing is easy. For those programs that use wxExpr
|
||||||
anyway, the size overhead of the parser is minimal.
|
anyway, the size overhead of the parser is minimal.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
@@ -329,5 +329,4 @@ object, in addition to providing \verb$#$defines for application code convenienc
|
|||||||
\subsection{Compiling the resource system}
|
\subsection{Compiling the resource system}
|
||||||
|
|
||||||
To enable the resource system, set {\bf wxUSE\_WX\_RESOURCES} to 1 in setup.h.
|
To enable the resource system, set {\bf wxUSE\_WX\_RESOURCES} to 1 in setup.h.
|
||||||
If your wxWindows makefile supports it, set the same name in the makefile to 1.
|
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
[OPTIONS]
|
[OPTIONS]
|
||||||
;BMROOT=L:\wxWindows\docs\latex\wx ; Assume that bitmaps are where the source is
|
BMROOT=d:\wx2\wxWindows\docs\latex\wx ; Assume that bitmaps are where the source is
|
||||||
TITLE=wxWindows Manual
|
TITLE=wxWindows Manual
|
||||||
CONTENTS=Contents
|
CONTENTS=Contents
|
||||||
COMPRESS=HIGH
|
COMPRESS=HIGH
|
||||||
|
|
||||||
[FILES]
|
[FILES]
|
||||||
Wx.rtf
|
wx.rtf
|
||||||
|
|
||||||
[CONFIG]
|
[CONFIG]
|
||||||
CreateButton("Up", "&Up", "JumpId(`Wx.hlp', `Contents')")
|
CreateButton("Up", "&Up", "JumpId(`wx.hlp', `Contents')")
|
||||||
BrowseButtons()
|
BrowseButtons()
|
||||||
|
|
||||||
[MAP]
|
[MAP]
|
||||||
|
@@ -310,24 +310,9 @@ Borland C++Builder compilation
|
|||||||
above. (C++ Builder includes a stand-alone C++ compiler. For example,
|
above. (C++ Builder includes a stand-alone C++ compiler. For example,
|
||||||
C++ Builder 4.0 comes with C++ 5.4.)
|
C++ Builder 4.0 comes with C++ 5.4.)
|
||||||
|
|
||||||
2. Create a template .bpr (project) file for new Borland/wxWindows,
|
2. You can build samples using the makefiles as per the
|
||||||
being sure to make the following settings:
|
instructions for BC++ above, or you can follow the instructions
|
||||||
|
in docs/tech/tn0004.htm to use the IDE.
|
||||||
a) 32 bit compiler
|
|
||||||
b) Defines: __WXMSW__;__WIN95__
|
|
||||||
c) Data alignment=byte
|
|
||||||
d) Include path: \libs\wx2\include
|
|
||||||
|
|
||||||
To use this template project file, just add the wxWindows libraries to
|
|
||||||
the project along with your own source files. If you need to run one or
|
|
||||||
two wx source files in the debugger, include them explicitly in your BCB
|
|
||||||
project and they will get linked in in preference to any files in the
|
|
||||||
lib; just make sure that your include path finds all the wx include
|
|
||||||
files.
|
|
||||||
|
|
||||||
NOTE: these instructions are a work in progress. For alternative
|
|
||||||
and more detailed instructions on using the C++Builder
|
|
||||||
IDE with wxWindows, see the file docs/tech/tn0004.txt.
|
|
||||||
|
|
||||||
Watcom C++ 10.6/11 compilation
|
Watcom C++ 10.6/11 compilation
|
||||||
---------------------------
|
---------------------------
|
||||||
|
Reference in New Issue
Block a user