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