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