]>
Commit | Line | Data |
---|---|---|
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 |
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. | |
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 |
29 | enum 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 | |
46 | Constructor. | |
d958c9bd | 47 | |
bd330a69 JS |
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).} | |
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 | |
63 | Constructor. | |
d958c9bd | 64 | |
bd330a69 JS |
65 | \docparam{flags}{wxXRC\_USE\_LOCALE: translatable strings will be translated via \_(). |
66 | wxXRC\_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 |
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).} | |
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 | ||
81 | Destructor. | |
82 | ||
60fd818a | 83 | |
d958c9bd JS |
84 | \membersection{wxXmlResource::AddHandler}\label{wxxmlresourceaddhandler} |
85 | ||
86 | \func{void}{AddHandler}{\param{wxXmlResourceHandler* }{handler}} | |
87 | ||
bd330a69 JS |
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 | |
d958c9bd | 90 | wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource compiler |
bd330a69 | 91 | (wxxrc) can create include file that contains initialization code for |
154b6b0f | 92 | all controls used within the resource. Note that this handler should be |
a245fd31 VZ |
93 | allocated 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 | ||
101 | Attaches an unknown control to the given panel/window/dialog. | |
102 | Unknown 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 |
109 | Removes 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 |
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. | |
d958c9bd | 119 | |
60fd818a | 120 | |
d958c9bd JS |
121 | \membersection{wxXmlResource::Get}\label{wxxmlresourceget} |
122 | ||
123 | \func{wxXmlResource*}{Get}{\void} | |
124 | ||
d958c9bd JS |
125 | Gets 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 | ||
132 | Returns 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 | 139 | Returns 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 | 146 | Returns a numeric ID that is equivalent to the string ID used in an XML |
9b2a7469 VZ |
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. | |
60fd818a | 152 | |
d958c9bd JS |
153 | \membersection{wxXmlResource::InitAllHandlers}\label{wxxmlresourceinitallhandlers} |
154 | ||
155 | \func{void}{InitAllHandlers}{\void} | |
156 | ||
bd330a69 | 157 | Initializes handlers for all supported controls/windows. This will |
d958c9bd | 158 | make the executable quite big because it forces linking against |
fc2171bd | 159 | most 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 | ||
166 | Loads resources from XML files that match given filemask. | |
167 | This 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 | ||
174 | Loads 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 | 181 | Loads 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 |
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). | |
d958c9bd | 189 | |
bd330a69 JS |
190 | Example: |
191 | ||
192 | \begin{verbatim} | |
193 | MyDialog dlg; | |
194 | wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog"); | |
195 | dlg->ShowModal(); | |
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 | ||
203 | Loads a frame. | |
204 | ||
60fd818a | 205 | |
d958c9bd JS |
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 | ||
60fd818a | 212 | |
d958c9bd JS |
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 | ||
60fd818a | 219 | |
d958c9bd JS |
220 | \membersection{wxXmlResource::LoadMenuBar}\label{wxxmlresourceloadmenubar} |
221 | ||
222 | \func{wxMenuBar*}{LoadMenuBar}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}} | |
223 | ||
bd330a69 | 224 | Loads a menubar from resource. Returns NULL on failure. |
d958c9bd JS |
225 | |
226 | \func{wxMenuBar*}{LoadMenuBar}{\param{const wxString\& }{name}} | |
227 | ||
bd330a69 | 228 | Loads 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 | 235 | Loads 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 |
239 | Loads a panel. {\it panel} points to parent window (if any). This form |
240 | is 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 | ||
247 | Loads a toolbar. | |
248 | ||
60fd818a | 249 | |
d958c9bd JS |
250 | \membersection{wxXmlResource::Set}\label{wxxmlresourceset} |
251 | ||
252 | \func{wxXmlResource*}{Set}{\param{wxXmlResource* }{res}} | |
253 | ||
254 | Sets 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 | |
261 | Sets 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 | ||
268 | This function unloads a resource previously loaded by | |
269 | \helpref{Load()}{wxxmlresourceload}. | |
270 | ||
271 | Returns \true if the resource was successfully unloaded and \false if it hasn't | |
272 | been found in the list of loaded resources. | |
273 | ||
d4a724d4 RD |
274 | |
275 | ||
276 | \membersection{wxXmlResource::GetDomain}\label{wxxmlresourcegetdomain} | |
277 | ||
278 | \func{wxChar*}{GetDomain}{} | |
279 | ||
280 | Returns the domain (message catalog) that will be used to load | |
281 | translatable strings in the XRC. | |
282 | ||
283 | ||
284 | \membersection{wxXmlResource::SetDomain}\label{wxxmlresourcesetdomain} | |
285 | ||
286 | \func{wxChar*}{SetDomain}{\param{const wxChar* }{domain}} | |
287 | ||
288 | Sets the domain (message catalog) that will be used to load | |
289 | translatable strings in the XRC. | |
b67a86d5 | 290 |