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