]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/xmlres.tex
silence gcc warnings about values not handled in switch
[wxWidgets.git] / docs / latex / wx / xmlres.tex
CommitLineData
d958c9bd
JS
1%
2% automatically generated by HelpGen $Revision$ from
3% xmlres.h at 22/Jan/02 23:08:28
4%
5
d958c9bd
JS
6\section{\class{wxXmlResource}}\label{wxxmlresource}
7
bd330a69
JS
8This is the main class for interacting with the XML-based resource system.
9
10The class holds XML resources from one or more .xml files, binary files or zip archive files.
11
12See \helpref{XML-based resource system overview}{xrcoverview} for details.
d958c9bd 13
d958c9bd
JS
14\wxheading{Derived from}
15
16\helpref{wxObject}{wxobject}
17
18\wxheading{Include files}
19
bd330a69 20<wx/xrc/xmlres.h>
d958c9bd 21
cd900c59 22\wxheading{Constants}
d958c9bd 23
7af3ca16 24\begin{verbatim}
bd330a69
JS
25enum wxXmlResourceFlags
26{
e98a0358 27 wxXRC_USE_LOCALE = 1,
cd900c59
VZ
28 wxXRC_NO_SUBCLASSING = 2,
29 wxXRC_NO_RELOADING = 4
bd330a69 30};
7af3ca16 31\end{verbatim}
d958c9bd 32
bd330a69 33\latexignore{\rtfignore{\wxheading{Members}}}
d958c9bd 34
60fd818a 35
6d06e061 36\membersection{wxXmlResource::wxXmlResource}\label{wxxmlresourcector}
d958c9bd
JS
37
38\func{}{wxXmlResource}{\param{const wxString\& }{filemask}, \param{int }{flags = wxXRC\_USE\_LOCALE}}
39
40Constructor.
d958c9bd 41
bd330a69
JS
42\docparam{filemask}{The XRC file, archive file, or wildcard specification that will be used to
43load all resource files inside a zip archive.}
44
45\docparam{flags}{wxXRC\_USE\_LOCALE: translatable strings will be translated via \_().
46wxXRC\_NO\_SUBCLASSING: subclass property of object nodes will be ignored
47(useful for previews in XRC editors).}
d958c9bd
JS
48
49\func{}{wxXmlResource}{\param{int }{flags = wxXRC\_USE\_LOCALE}}
50
51Constructor.
d958c9bd 52
bd330a69
JS
53\docparam{flags}{wxXRC\_USE\_LOCALE: translatable strings will be translated via \_().
54wxXRC\_NO\_SUBCLASSING: subclass property of object nodes will be ignored
cd900c59
VZ
55(useful for previews in XRC editors). wxXRC\_NO\_RELOADING will prevent the
56XRC files from being reloaded from disk in case they have been modified there
57since being last loaded (may slightly speed up loading them).}
d958c9bd 58
60fd818a 59
d958c9bd
JS
60\membersection{wxXmlResource::\destruct{wxXmlResource}}\label{wxxmlresourcedtor}
61
62\func{}{\destruct{wxXmlResource}}{\void}
63
64Destructor.
65
60fd818a 66
d958c9bd
JS
67\membersection{wxXmlResource::AddHandler}\label{wxxmlresourceaddhandler}
68
69\func{void}{AddHandler}{\param{wxXmlResourceHandler* }{handler}}
70
bd330a69
JS
71Initializes only a specific handler (or custom handler). Convention says
72that the handler name is equal to the control's name plus 'XmlHandler', for example
d958c9bd 73wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource compiler
bd330a69 74(wxxrc) can create include file that contains initialization code for
154b6b0f 75all controls used within the resource. Note that this handler should be
a245fd31
VZ
76allocated on the heap, since it will be delete by
77\helpref{ClearHandlers}{wxxmlresourceclearhandlers} later.
d958c9bd 78
60fd818a 79
d958c9bd
JS
80\membersection{wxXmlResource::AttachUnknownControl}\label{wxxmlresourceattachunknowncontrol}
81
82\func{bool}{AttachUnknownControl}{\param{const wxString\& }{name}, \param{wxWindow* }{control}, \param{wxWindow* }{parent = NULL}}
83
84Attaches an unknown control to the given panel/window/dialog.
85Unknown controls are used in conjunction with <object class="unknown">.
86
60fd818a 87
d958c9bd
JS
88\membersection{wxXmlResource::ClearHandlers}\label{wxxmlresourceclearhandlers}
89
90\func{void}{ClearHandlers}{\void}
91
a245fd31
VZ
92Removes all handlers and deletes them (this means that any handlers added using
93\helpref{AddHandler}{wxxmlresourceaddhandler} must be allocated on the heap).
d958c9bd 94
60fd818a 95
d958c9bd
JS
96\membersection{wxXmlResource::CompareVersion}\label{wxxmlresourcecompareversion}
97
98\constfunc{int}{CompareVersion}{\param{int }{major}, \param{int }{minor}, \param{int }{release}, \param{int }{revision}}
99
bd330a69
JS
100Compares the XRC version to the argument. Returns -1 if the XRC version
101is less than the argument, +1 if greater, and 0 if they equal.
d958c9bd 102
60fd818a 103
d958c9bd
JS
104\membersection{wxXmlResource::Get}\label{wxxmlresourceget}
105
106\func{wxXmlResource*}{Get}{\void}
107
d958c9bd
JS
108Gets the global resources object or creates one if none exists.
109
60fd818a 110
d958c9bd
JS
111\membersection{wxXmlResource::GetFlags}\label{wxxmlresourcegetflags}
112
113\func{int}{GetFlags}{\void}
114
115Returns flags, which may be a bitlist of wxXRC\_USE\_LOCALE and wxXRC\_NO\_SUBCLASSING.
116
60fd818a 117
d958c9bd
JS
118\membersection{wxXmlResource::GetVersion}\label{wxxmlresourcegetversion}
119
120\constfunc{long}{GetVersion}{\void}
121
7af3ca16 122Returns version information (a.b.c.d = d+ 256*c + 256\textasciicircum2*b + 256\textasciitilde3*a).
d958c9bd 123
60fd818a 124
094eb71a 125\membersection{wxXmlResource::GetXRCID}\label{wxxmlresourcegetxmlid}
d958c9bd 126
9b2a7469 127\func{int}{GetXRCID}{\param{const wxChar* }{str\_id}, \param{int }{value\_if\_not\_found = -2}}
d958c9bd 128
bd330a69 129Returns a numeric ID that is equivalent to the string ID used in an XML
9b2a7469
VZ
130resource. If an unknown \arg{str\_id} is requested (i.e. other than wxID\_XXX
131or integer), a new record is created which associates the given string with
132a number. If \arg{value\_if\_not\_found} is \texttt{wxID\_NONE}, the number is obtained via
133\helpref{wxNewId()}{wxnewid}. Otherwise \arg{value\_if\_not\_found} is used.
134Macro {\tt XRCID(name)} is provided for convenient use in event tables.
60fd818a 135
d958c9bd
JS
136\membersection{wxXmlResource::InitAllHandlers}\label{wxxmlresourceinitallhandlers}
137
138\func{void}{InitAllHandlers}{\void}
139
bd330a69 140Initializes handlers for all supported controls/windows. This will
d958c9bd 141make the executable quite big because it forces linking against
fc2171bd 142most of the wxWidgets library.
d958c9bd 143
60fd818a 144
d958c9bd
JS
145\membersection{wxXmlResource::Load}\label{wxxmlresourceload}
146
147\func{bool}{Load}{\param{const wxString\& }{filemask}}
148
149Loads resources from XML files that match given filemask.
150This method understands VFS (see filesys.h).
151
60fd818a 152
d958c9bd
JS
153\membersection{wxXmlResource::LoadBitmap}\label{wxxmlresourceloadbitmap}
154
155\func{wxBitmap}{LoadBitmap}{\param{const wxString\& }{name}}
156
157Loads a bitmap resource from a file.
158
60fd818a 159
d958c9bd
JS
160\membersection{wxXmlResource::LoadDialog}\label{wxxmlresourceloaddialog}
161
162\func{wxDialog*}{LoadDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}}
163
bd330a69 164Loads a dialog. {\it dlg} points to a parent window (if any).
d958c9bd
JS
165
166\func{bool}{LoadDialog}{\param{wxDialog* }{dlg}, \param{wxWindow* }{parent}, \param{const wxString\& }{name}}
167
bd330a69
JS
168Loads a dialog. {\it dlg} points to parent window (if any).
169
170This form is used to finish creation of an already existing instance (the main reason
171for this is that you may want to use derived class with a new event table).
d958c9bd 172
bd330a69
JS
173Example:
174
175\begin{verbatim}
176 MyDialog dlg;
177 wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
178 dlg->ShowModal();
179\end{verbatim}
d958c9bd 180
60fd818a 181
d958c9bd
JS
182\membersection{wxXmlResource::LoadFrame}\label{wxxmlresourceloadframe}
183
184\func{bool}{LoadFrame}{\param{wxFrame* }{frame}, \param{wxWindow* }{parent}, \param{const wxString\& }{name}}
185
186Loads a frame.
187
60fd818a 188
d958c9bd
JS
189\membersection{wxXmlResource::LoadIcon}\label{wxxmlresourceloadicon}
190
191\func{wxIcon}{LoadIcon}{\param{const wxString\& }{name}}
192
193Loads an icon resource from a file.
194
60fd818a 195
d958c9bd
JS
196\membersection{wxXmlResource::LoadMenu}\label{wxxmlresourceloadmenu}
197
198\func{wxMenu*}{LoadMenu}{\param{const wxString\& }{name}}
199
200Loads menu from resource. Returns NULL on failure.
201
60fd818a 202
d958c9bd
JS
203\membersection{wxXmlResource::LoadMenuBar}\label{wxxmlresourceloadmenubar}
204
205\func{wxMenuBar*}{LoadMenuBar}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}}
206
bd330a69 207Loads a menubar from resource. Returns NULL on failure.
d958c9bd
JS
208
209\func{wxMenuBar*}{LoadMenuBar}{\param{const wxString\& }{name}}
210
bd330a69 211Loads a menubar from resource. Returns NULL on failure.
d958c9bd 212
60fd818a 213
d958c9bd
JS
214\membersection{wxXmlResource::LoadPanel}\label{wxxmlresourceloadpanel}
215
216\func{wxPanel*}{LoadPanel}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}}
217
bd330a69 218Loads a panel. {\it panel} points to parent window (if any).
d958c9bd
JS
219
220\func{bool}{LoadPanel}{\param{wxPanel* }{panel}, \param{wxWindow* }{parent}, \param{const wxString\& }{name}}
221
bd330a69
JS
222Loads a panel. {\it panel} points to parent window (if any). This form
223is used to finish creation of an already existing instance.
d958c9bd 224
60fd818a 225
d958c9bd
JS
226\membersection{wxXmlResource::LoadToolBar}\label{wxxmlresourceloadtoolbar}
227
228\func{wxToolBar*}{LoadToolBar}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}}
229
230Loads a toolbar.
231
60fd818a 232
d958c9bd
JS
233\membersection{wxXmlResource::Set}\label{wxxmlresourceset}
234
235\func{wxXmlResource*}{Set}{\param{wxXmlResource* }{res}}
236
237Sets the global resources object and returns a pointer to the previous one (may be NULL).
238
60fd818a 239
2b5f62a0
VZ
240\membersection{wxXmlResource::SetFlags}\label{wxxmlresourcesetflags}
241
9a75ba66 242\func{void}{SetFlags}{\param{int }{flags}}
2b5f62a0
VZ
243
244Sets flags (bitlist of wxXRC\_USE\_LOCALE and wxXRC\_NO\_SUBCLASSING).
245
60fd818a
VZ
246
247\membersection{wxXmlResource::Unload}\label{wxxmlresourceunload}
248
249\func{bool}{Unload}{\param{const wxString\& }{filename}}
250
251This function unloads a resource previously loaded by
252\helpref{Load()}{wxxmlresourceload}.
253
254Returns \true if the resource was successfully unloaded and \false if it hasn't
255been found in the list of loaded resources.
256