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