]> git.saurik.com Git - wxWidgets.git/blob - samples/xrc/rc/objref.xrc
Fix double deletion bug in wxGTK wxDVC dnd code.
[wxWidgets.git] / samples / xrc / rc / objref.xrc
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <resource version="2.3.0.1" xmlns="http://www.wxwidgets.org/wxxrc">
3 <object class="wxDialog" name="objref_dialog">
4 <object class="wxFlexGridSizer">
5 <object class="sizeritem">
6 <object class="wxNotebook" name="objref_notebook">
7 <object class="notebookpage">
8 <object class="wxPanel" name="page1">
9 <object class="wxFlexGridSizer">
10 <object class="sizeritem">
11 <object class="wxTextCtrl" name="description_text">
12 <value>This dialog demonstrates the use of object references and ID arrays.\n\nAs you turn the pages of the notebook, you will notice that each has an identical section at the bottom. Instead of writing that section's xml several times, this is done just once, as a wxPanel named 'bottom__panel'. The panel is then added to each page's sizer by the single line: &lt;object__ref ref=&quot;bottom__panel&quot;/&gt;</value>
13 <style>wxTE_MULTILINE|wxTE_READONLY</style>
14 </object>
15 <option>1</option>
16 <flag>wxALL|wxEXPAND</flag>
17 <border>5</border>
18 </object>
19 <object class="sizeritem">
20 <object_ref ref="bottom_panel"/>
21 <flag>wxEXPAND</flag>
22 </object>
23 <cols>1</cols>
24 <rows>0</rows>
25 <vgap>0</vgap>
26 <hgap>10</hgap>
27 <growablecols>0</growablecols>
28 <growablerows>0</growablerows>
29 <growablerows>1</growablerows>
30 </object>
31 </object>
32 <label>Page 1</label>
33 </object>
34 <object class="notebookpage">
35 <object_ref ref="page1"/>
36 <label>Page 1 copy</label>
37 </object>
38 <object class="notebookpage">
39 <object class="wxPanel" name="page2">
40 <object class="wxFlexGridSizer">
41 <object class="sizeritem">
42 <object class="wxTextCtrl" name="description_text">
43 <value>ID ranges are a way to simplify the management of several similar controls, especially their event-handling.\nAn ID range is declared by putting something like this into the XRC file:\n &lt;ids-range name=&quot;check&quot; size=&quot;3&quot; start=&quot;10000&quot; /&gt;\n'size' and 'start' being optional.\n\nIf you then give an item the name 'check[2]', it will be allocated that ID in the range.\n\nBy default the IDs in a range are negative, being assigned by wxWindow::NewControlId. If you wish, you can specify the start of the range; if so, the IDs *must* be positive (and it's your responsibility to avoid clashes, so start above wxID__HIGHEST).</value>
44 <style>wxTE_MULTILINE|wxTE_READONLY</style>
45 </object>
46 <option>1</option>
47 <flag>wxALL|wxEXPAND</flag>
48 <border>5</border>
49 </object>
50 <object class="sizeritem">
51 <object class="wxBoxSizer">
52 <object class="spacer">
53 <option>1</option>
54 <flag>wxLEFT</flag>
55 <border>100</border>
56 </object>
57 <object class="sizeritem">
58 <object class="wxBoxSizer">
59 <object class="sizeritem">
60 <object class="wxStaticText">
61 <label>Uncheck to disable a row</label>
62 </object>
63 </object>
64 <object class="sizeritem">
65 <object_ref ref="checkboxes"/>
66 <flag>wxALIGN_CENTRE</flag>
67 </object>
68 <orient>wxVERTICAL</orient>
69 </object>
70 <flag>wxALIGN_CENTRE_VERTICAL</flag>
71 </object>
72 <orient>wxHORIZONTAL</orient>
73 <object class="spacer">
74 <size>50,-1</size>
75 </object>
76 <object class="sizeritem">
77 <object class="wxStaticBoxSizer">
78 <object class="sizeritem">
79 <object class="wxGridSizer">
80 <object class="sizeritem">
81 <object class="wxStaticBitmap" name="first_row[0]">
82 <bitmap>update.gif</bitmap>
83 </object>
84 </object>
85 <object class="sizeritem">
86 <object class="wxStaticBitmap" name="first_row[1]">
87 <bitmap>basicdlg.xpm</bitmap>
88 </object>
89 </object>
90 <object class="sizeritem">
91 <object class="wxStaticBitmap" name="first_row[2]">
92 <bitmap>controls.xpm</bitmap>
93 </object>
94 </object>
95 <object class="sizeritem">
96 <object class="wxStaticBitmap" name="second_row[0]">
97 <bitmap>custclas.xpm</bitmap>
98 </object>
99 </object>
100 <object class="sizeritem">
101 <object class="wxStaticBitmap" name="second_row[1]">
102 <bitmap>derivdlg.xpm</bitmap>
103 </object>
104 </object>
105 <object class="sizeritem">
106 <object class="wxStaticBitmap" name="second_row[2]">
107 <bitmap>platform.xpm</bitmap>
108 </object>
109 </object>
110 <object class="sizeritem">
111 <object class="wxStaticBitmap" name="third_row[0]">
112 <bitmap>objrefdlg.xpm</bitmap>
113 </object>
114 </object>
115 <object class="sizeritem">
116 <object class="wxStaticBitmap" name="third_row[1]">
117 <bitmap>uncenter.xpm</bitmap>
118 </object>
119 </object>
120 <object class="sizeritem">
121 <object class="wxStaticBitmap" name="third_row[2]">
122 <bitmap>variable.xpm</bitmap>
123 </object>
124 </object>
125 <rows>3</rows>
126 <vgap>7</vgap>
127 <hgap>7</hgap>
128 </object>
129 <flag>wxALL</flag>
130 <border>3</border>
131 </object>
132 <label>Icons</label>
133 <orient>wxVERTICAL</orient>
134 </object>
135 <flag>wxALIGN_CENTRE_VERTICAL</flag>
136 </object>
137 <object class="spacer">
138 <option>1</option>
139 <flag>wxLEFT</flag>
140 <border>100</border>
141 </object>
142 </object>
143 <flag>wxTOP|wxBOTTOM|wxEXPAND</flag>
144 <border>15</border>
145 </object>
146 <object class="sizeritem">
147 <object_ref ref="bottom_panel"/>
148 <option>1</option>
149 <flag>wxEXPAND</flag>
150 </object>
151 <cols>1</cols>
152 <rows>0</rows>
153 <vgap>0</vgap>
154 <hgap>10</hgap>
155 <growablecols>0</growablecols>
156 <growablerows>0</growablerows>
157 <growablerows>2</growablerows>
158 </object>
159 </object>
160 <label>Icons</label>
161 </object>
162 <object class="notebookpage">
163 <object class="wxPanel" name="page3">
164 <object class="wxFlexGridSizer">
165 <object class="sizeritem">
166 <object class="wxTextCtrl" name="description_text">
167 <value>This not very useful calculator demonstrates some features of ID ranges. One range is defined for the number keys, and another for the operators.\n\nIf you look at the .xrc file, you'll see that I wrote:\n &lt;ids-range name=&quot;digits&quot; size=&quot;8&quot;/&gt;\ncreating that range with a size of 8 (I must have forgotten to count my thumbs). The code will still work, though: the actual number of range items is counted when the file is loaded, and the range extended if necessary to accommodate them. However if the size is too big, it isn't truncated.\n\nAn ID range always has the special items defined: &lt;rangename&gt;[start] and &lt;rangename&gt;[end]. So, for the range 'digits', digits[start] == digits[0], and digits[end] == digits[9]. [end] will always refer to the end of the range, even if there's no object with that ID.\n\nThe digits of the calculator are named 'digits[0]' to 'digits[9]'. Adjacent range items are guaranteed to be assigned consecutive IDs, so code such as this will work as expected:\n for (int n=XRCID(&quot;digits[start]&quot;); n &lt; XRCID(&quot;digits[end]&quot;); ++n) { DoFoo(n); }\nor\n int index = event.GetId() - XRCID(&quot;digits[0]&quot;);</value>
168 <style>wxTE_MULTILINE|wxTE_READONLY</style>
169 </object>
170 <option>1</option>
171 <flag>wxALL|wxEXPAND</flag>
172 <border>5</border>
173 </object>
174 <object class="sizeritem">
175 <object class="wxStaticBoxSizer">
176 <object class="sizeritem">
177 <object class="wxGridBagSizer">
178 <object class="sizeritem">
179 <object class="wxButton" name="digits[7]">
180 <label>7</label>
181 <style>wxBU_EXACTFIT</style>
182 </object>
183 <flag>wxEXPAND</flag>
184 <cellpos>0,0</cellpos>
185 </object>
186 <object class="sizeritem">
187 <object class="wxButton" name="digits[8]">
188 <label>8</label>
189 <style>wxBU_EXACTFIT</style>
190 </object>
191 <flag>wxEXPAND</flag>
192 <cellpos>0,1</cellpos>
193 </object>
194 <object class="sizeritem">
195 <object class="wxButton" name="digits[9]">
196 <label>9</label>
197 <style>wxBU_EXACTFIT</style>
198 </object>
199 <flag>wxEXPAND</flag>
200 <cellpos>0,2</cellpos>
201 </object>
202 <object class="sizeritem">
203 <object class="wxButton" name="operators[3]">
204 <label>/</label>
205 <style>wxBU_EXACTFIT</style>
206 </object>
207 <flag>wxEXPAND</flag>
208 <cellpos>0,3</cellpos>
209 </object>
210 <object class="sizeritem">
211 <object class="wxButton" name="digits[4]">
212 <label>4</label>
213 <style>wxBU_EXACTFIT</style>
214 </object>
215 <flag>wxEXPAND</flag>
216 <cellpos>1,0</cellpos>
217 </object>
218 <object class="sizeritem">
219 <object class="wxButton" name="digits[5]">
220 <label>5</label>
221 <style>wxBU_EXACTFIT</style>
222 </object>
223 <flag>wxEXPAND</flag>
224 <cellpos>1,1</cellpos>
225 </object>
226 <object class="sizeritem">
227 <object class="wxButton" name="digits[6]">
228 <label>6</label>
229 <style>wxBU_EXACTFIT</style>
230 </object>
231 <flag>wxEXPAND</flag>
232 <cellpos>1,2</cellpos>
233 </object>
234 <object class="sizeritem">
235 <object class="wxButton" name="operators[2]">
236 <label>X</label>
237 <style>wxBU_EXACTFIT</style>
238 </object>
239 <flag>wxEXPAND</flag>
240 <cellpos>1,3</cellpos>
241 </object>
242 <object class="sizeritem">
243 <object class="wxButton" name="digits[1]">
244 <label>1</label>
245 <style>wxBU_EXACTFIT</style>
246 </object>
247 <flag>wxEXPAND</flag>
248 <cellpos>2,0</cellpos>
249 </object>
250 <object class="sizeritem">
251 <object class="wxButton" name="digits[2]">
252 <label>2</label>
253 <style>wxBU_EXACTFIT</style>
254 </object>
255 <flag>wxEXPAND</flag>
256 <cellpos>2,1</cellpos>
257 </object>
258 <object class="sizeritem">
259 <object class="wxButton" name="digits[3]">
260 <label>3</label>
261 <style>wxBU_EXACTFIT</style>
262 </object>
263 <flag>wxEXPAND</flag>
264 <cellpos>2,2</cellpos>
265 </object>
266 <object class="sizeritem">
267 <object class="wxButton" name="operators[1]">
268 <label>-</label>
269 <style>wxBU_EXACTFIT</style>
270 </object>
271 <flag>wxEXPAND</flag>
272 <cellpos>2,3</cellpos>
273 </object>
274 <object class="sizeritem">
275 <object class="wxButton" name="digits[0]">
276 <label>0</label>
277 <style>wxBU_EXACTFIT</style>
278 </object>
279 <flag>wxEXPAND</flag>
280 <cellpos>3,0</cellpos>
281 </object>
282 <object class="sizeritem">
283 <object class="wxButton" name="operators[4]">
284 <label>=</label>
285 <style>wxBU_EXACTFIT</style>
286 </object>
287 <flag>wxEXPAND</flag>
288 <cellpos>3,1</cellpos>
289 </object>
290 <object class="sizeritem">
291 <object class="wxButton" name="operators[end]">
292 <label>Cl</label>
293 <style>wxBU_EXACTFIT</style>
294 </object>
295 <flag>wxEXPAND</flag>
296 <cellpos>3,2</cellpos>
297 </object>
298 <object class="sizeritem">
299 <object class="wxButton" name="operators[0]">
300 <label>+</label>
301 <style>wxBU_EXACTFIT</style>
302 </object>
303 <flag>wxEXPAND</flag>
304 <cellpos>3,3</cellpos>
305 </object>
306 <object class="sizeritem">
307 <object class="wxTextCtrl" name="result"/>
308 <flag>wxEXPAND</flag>
309 <cellpos>4,0</cellpos>
310 <cellspan>1,4</cellspan>
311 </object>
312 <vgap>5</vgap>
313 <hgap>5</hgap>
314 </object>
315 <flag>wxALL</flag>
316 <border>5</border>
317 </object>
318 <label>Calculator</label>
319 <orient>wxVERTICAL</orient>
320 </object>
321 <flag>wxTOP|wxALIGN_CENTRE_HORIZONTAL</flag>
322 <border>10</border>
323 </object>
324 <object class="sizeritem">
325 <object_ref ref="bottom_panel"/>
326 <option>1</option>
327 <flag>wxEXPAND</flag>
328 </object>
329 <cols>1</cols>
330 <rows>0</rows>
331 <vgap>0</vgap>
332 <hgap>10</hgap>
333 <growablecols>0</growablecols>
334 <growablerows>0</growablerows>
335 <growablerows>2</growablerows>
336 </object>
337 </object>
338 <label>Calc</label>
339 </object>
340 </object>
341 <option>1</option>
342 <flag>wxGROW|wxALIGN_CENTER_VERTICAL|wxALL</flag>
343 <border>5</border>
344 </object>
345 <object class="sizeritem">
346 <object class="wxButton" name="wxID_OK">
347 <label>OK</label>
348 <default>1</default>
349 </object>
350 <flag>wxTOP|wxBOTTOM|wxALIGN_CENTRE</flag>
351 <border>20</border>
352 </object>
353 <cols>1</cols>
354 <rows>0</rows>
355 <vgap>0</vgap>
356 <hgap>0</hgap>
357 <growablecols>0</growablecols>
358 <growablerows>0</growablerows>
359 </object>
360 <title>Object References and ID Ranges Example</title>
361 <centered>1</centered>
362 <style>wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER</style>
363 <exstyle>wxDIALOG_EX_CONTEXTHELP</exstyle>
364 </object>
365 <object class="wxPanel" name="bottom_panel">
366 <object class="wxBoxSizer">
367 <orient>wxVERTICAL</orient>
368 <object class="sizeritem">
369 <object class="wxStaticLine">
370 <style>wxLI_HORIZONTAL</style>
371 </object>
372 <flag>wxTOP|wxEXPAND</flag>
373 <border>20</border>
374 </object>
375 <object class="sizeritem">
376 <object class="wxStaticText">
377 <label>Log window:</label>
378 </object>
379 <flag>wxTOP</flag>
380 <border>5</border>
381 </object>
382 <object class="sizeritem">
383 <object class="wxTextCtrl" name="log_text">
384 <size>-1,100</size>
385 <style>wxTE_MULTILINE</style>
386 </object>
387 <option>1</option>
388 <flag>wxEXPAND</flag>
389 </object>
390 </object>
391 </object>
392 <object class="wxPanel" name="checkboxes">
393 <object class="wxBoxSizer">
394 <orient>wxVERTICAL</orient>
395 <object class="sizeritem">
396 <object class="wxCheckBox" name="check[0]">
397 <checked>1</checked>
398 </object>
399 </object>
400 <object class="sizeritem">
401 <object class="wxCheckBox" name="check[1]">
402 <checked>1</checked>
403 </object>
404 </object>
405 <object class="sizeritem">
406 <object class="wxCheckBox" name="check[2]">
407 <checked>1</checked>
408 </object>
409 </object>
410 </object>
411 </object>
412 <ids-range name="check" size="3" start="10000"/>
413 <ids-range name="first_row"/>
414 <ids-range name="second_row"/>
415 <ids-range name="third_row"/>
416 <ids-range name="digits" size="8"/>
417 <ids-range name="operators"/>
418 </resource>