]>
Commit | Line | Data |
---|---|---|
dc28cdf8 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: samples.h | |
3 | // Purpose: Samples page of the Doxygen manual | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id: utilities.h 52634 2008-03-20 13:45:17Z VS $ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | ||
29f86fc1 | 11 | @page page_samples Included Samples |
dc28cdf8 | 12 | |
5d4cca7f | 13 | Probably the best way to learn wxWidgets is by reading the source of some 80+ |
dc28cdf8 FM |
14 | samples provided with it. Many aspects of wxWidgets programming can be learnt |
15 | from them, but sometimes it is not simple to just choose the right sample to | |
16 | look at. This overview aims at describing what each sample does/demonstrates to | |
17 | make it easier to find the relevant one if a simple grep through all sources | |
18 | didn't help. They also provide some notes about using the samples and what | |
19 | features of wxWidgets are they supposed to test. | |
20 | ||
5d4cca7f | 21 | There are currently more than 80 different samples as part of wxWidgets: |
5d9a1f6e FM |
22 | the list in this page is not complete! |
23 | You should start your tour of wxWidgets with the @ref page_samples_minimal | |
24 | which is the wxWidgets version of "Hello, world!". | |
25 | It shows the basic structure of wxWidgets program and is the most commented | |
26 | sample of all - looking at its source code is recommended. | |
27 | ||
28 | The next most useful samples are probably @ref page_samples_widgets and | |
29 | @ref page_samples_controls which show many of wxWidgets native and | |
dc28cdf8 FM |
30 | generic controls, such as buttons, listboxes, checkboxes, comboboxes etc. |
31 | ||
32 | Other, more complicated controls, have their own samples. In this category you | |
33 | may find the following samples showing the corresponding controls: | |
34 | ||
35 | @li wxCalendarCtrl: @ref page_samples_calendar | |
36 | @li wxListCtrl: @ref page_samples_listctrl | |
37 | @li wxTreeCtrl: @ref page_samples_treectrl | |
38 | @li wxGrid: @ref page_samples_grid | |
39 | ||
40 | Finally, it might be helpful to do a search in the entire sample directory if | |
41 | you can't find the sample showing the control you are interested in by | |
42 | name. Most classes contained in wxWidgets occur in at least one of the samples. | |
43 | ||
5d4cca7f BP |
44 | <!-- |
45 | The following sample list is generated by executing command | |
46 | ||
47 | ls | egrep '[a-z]+' | egrep '^[a-z]+$' | sed 's/^/@li @sample\{/' | sed 's/$/\}/' | |
48 | ||
49 | in wxWidgets/samples | |
50 | ||
51 | TODO: Organize them in a more human-readable way. | |
52 | --> | |
53 | ||
dc28cdf8 FM |
54 | @beginInvisibleTable |
55 | <tr><td> | |
5d4cca7f BP |
56 | @li @sample{access} |
57 | @li @sample{animate} | |
58 | @li @sample{artprov} | |
59 | @li @sample{aui} | |
60 | @li @sample{calendar} | |
61 | @li @sample{caret} | |
62 | @li @sample{collpane} | |
63 | @li @sample{combo} | |
64 | @li @sample{config} | |
65 | @li @sample{console} | |
66 | @li @sample{controls} | |
67 | @li @sample{dataview} | |
68 | @li @sample{debugrpt} | |
69 | @li @sample{dialogs} | |
70 | @li @sample{dialup} | |
71 | @li @sample{display} | |
72 | @li @sample{dnd} | |
73 | @li @sample{docview} | |
5d4cca7f BP |
74 | @li @sample{dragimag} |
75 | @li @sample{drawing} | |
76 | @li @sample{editlbox} | |
77 | @li @sample{erase} | |
78 | @li @sample{event} | |
79 | @li @sample{except} | |
80 | @li @sample{exec} | |
81 | @li @sample{font} | |
5d9a1f6e | 82 | </td><td> |
5d4cca7f BP |
83 | @li @sample{grid} |
84 | @li @sample{help} | |
85 | @li @sample{htlbox} | |
86 | @li @sample{html} | |
87 | @li @sample{image} | |
88 | @li @sample{internat} | |
89 | @li @sample{ipc} | |
90 | @li @sample{joytest} | |
91 | @li @sample{keyboard} | |
92 | @li @sample{layout} | |
93 | @li @sample{listctrl} | |
94 | @li @sample{mdi} | |
95 | @li @sample{mediaplayer} | |
96 | @li @sample{memcheck} | |
97 | @li @sample{menu} | |
98 | @li @sample{mfc} | |
99 | @li @sample{minimal} | |
100 | @li @sample{mobile} | |
101 | @li @sample{nativdlg} | |
102 | @li @sample{notebook} | |
103 | @li @sample{oleauto} | |
104 | @li @sample{opengl} | |
105 | @li @sample{ownerdrw} | |
106 | @li @sample{popup} | |
107 | @li @sample{power} | |
108 | @li @sample{printing} | |
1c4293cb | 109 | @li @sample{propgrid} |
5d9a1f6e | 110 | </td><td> |
5d4cca7f BP |
111 | @li @sample{regtest} |
112 | @li @sample{render} | |
113 | @li @sample{richtext} | |
114 | @li @sample{sashtest} | |
115 | @li @sample{scroll} | |
116 | @li @sample{scrollsub} | |
117 | @li @sample{shaped} | |
118 | @li @sample{sockets} | |
119 | @li @sample{sound} | |
120 | @li @sample{splash} | |
121 | @li @sample{splitter} | |
122 | @li @sample{statbar} | |
123 | @li @sample{stc} | |
124 | @li @sample{svg} | |
125 | @li @sample{taborder} | |
126 | @li @sample{taskbar} | |
127 | @li @sample{text} | |
128 | @li @sample{thread} | |
129 | @li @sample{toolbar} | |
130 | @li @sample{treectrl} | |
131 | @li @sample{typetest} | |
132 | @li @sample{validate} | |
133 | @li @sample{vscroll} | |
134 | @li @sample{widgets} | |
135 | @li @sample{wizard} | |
136 | @li @sample{wrapsizer} | |
137 | @li @sample{xrc} | |
dc28cdf8 FM |
138 | </td></tr> |
139 | @endTable | |
140 | ||
5d4cca7f BP |
141 | @todo Write descriptions for the samples who description started with |
142 | "This sample demonstrates", they are semi-auto generated. | |
5d9a1f6e FM |
143 | <hr> |
144 | ||
0c1fe6e9 | 145 | @section page_samples_access Accessibility Sample |
5d9a1f6e | 146 | |
5d4cca7f | 147 | This sample shows how you can use the wxAccessible classes in a |
5d9a1f6e | 148 | simple GUI program. |
dc28cdf8 | 149 | |
5d4cca7f | 150 | @buildwith{wxUSE_ACCESSIBILITY} |
dc28cdf8 | 151 | |
5d4cca7f | 152 | @sampledir{access} |
dc28cdf8 | 153 | |
5d4cca7f BP |
154 | @section page_samples_animate Animation Sample |
155 | ||
156 | This sample shows how you can use wxAnimationCtrl | |
dc28cdf8 FM |
157 | control and shows concept of a platform-dependent animation encapsulated |
158 | in wxAnimation. | |
159 | ||
5d4cca7f | 160 | @sampledir{animate} |
dc28cdf8 | 161 | |
5d4cca7f | 162 | @section page_samples_artprov Art Provider Sample |
dc28cdf8 | 163 | |
5d4cca7f | 164 | This sample shows how you can customize the look of standard |
dc28cdf8 FM |
165 | wxWidgets dialogs by replacing default bitmaps/icons with your own versions. |
166 | It also shows how you can use wxArtProvider to | |
167 | get stock bitmaps for use in your application. | |
168 | ||
5d4cca7f | 169 | @sampledir{artprov} |
dc28cdf8 | 170 | |
5d4cca7f | 171 | @section page_samples_aui Advanced User Interface Sample |
0c1fe6e9 | 172 | |
5d4cca7f | 173 | @sampleabout{@ref overview_aui "AUI classes"} |
0c1fe6e9 | 174 | |
5d4cca7f | 175 | @sampledir{aui} |
0c1fe6e9 BP |
176 | |
177 | @section page_samples_calendar Calendar Sample | |
dc28cdf8 | 178 | |
5d4cca7f | 179 | This sample shows the calendar control in action. It |
dc28cdf8 FM |
180 | shows how to configure the control (see the different options in the calendar |
181 | menu) and also how to process the notifications from it. | |
182 | ||
5d4cca7f BP |
183 | @sampledir{calendar} |
184 | ||
185 | @section page_samples_caret Caret Sample | |
186 | ||
187 | @sampleabout{wxCaret} | |
188 | ||
189 | @sampledir{caret} | |
190 | ||
191 | @section page_samples_collpane Collapsible Pane Sample | |
dc28cdf8 | 192 | |
5d4cca7f BP |
193 | @sampleabout{wxCollapsiblePane} |
194 | ||
195 | @sampledir{collpane} | |
196 | ||
197 | @section page_samples_combo Combo Sample | |
198 | ||
199 | @sampleabout{wxComboBox\, wxComboCtrl and wxOwnerDrawnComboBox etc} | |
200 | ||
201 | @sampledir{combo} | |
202 | ||
203 | @section page_samples_config Configuration Sample | |
dc28cdf8 FM |
204 | |
205 | This sample demonstrates the wxConfig classes in a platform | |
206 | independent way, i.e. it uses text based files to store a given configuration under | |
207 | Unix and uses the Registry under Windows. | |
208 | ||
209 | See @ref overview_config for the descriptions of all features of this class. | |
210 | ||
5d4cca7f BP |
211 | @sampledir{config} |
212 | ||
213 | @section page_samples_console Console Program Sample | |
214 | ||
215 | @sampleabout{a console program} | |
216 | ||
217 | @sampledir{console} | |
dc28cdf8 | 218 | |
0c1fe6e9 | 219 | @section page_samples_controls Controls Sample |
dc28cdf8 FM |
220 | |
221 | The controls sample is the main test program for most simple controls used in | |
222 | wxWidgets. The sample tests their basic functionality, events, placement, | |
223 | modification in terms of colour and font as well as the possibility to change | |
224 | the controls programmatically, such as adding an item to a list box etc. Apart | |
225 | from that, the sample uses a wxNotebook and tests most | |
226 | features of this special control (using bitmap in the tabs, using | |
227 | wxSizer instances and wxLayoutConstraints within notebook pages, advancing pages | |
228 | programmatically and vetoing a page change by intercepting the wxNotebookEvent. | |
229 | ||
230 | The various controls tested are listed here: | |
231 | ||
232 | @li wxButton | |
233 | @li wxBitmapButton | |
234 | @li wxCheckBox | |
235 | @li wxChoice | |
236 | @li wxComboBox | |
237 | @li wxGauge | |
238 | @li wxStaticBox | |
239 | @li wxListBox | |
240 | @li wxSpinCtrl | |
241 | @li wxSpinButton | |
242 | @li wxStaticText | |
243 | @li wxStaticBitmap | |
244 | @li wxRadioBox | |
245 | @li wxRadioButton | |
246 | @li wxSlider | |
247 | ||
5d4cca7f BP |
248 | @sampledir{controls} |
249 | ||
250 | @section page_samples_dataview wxDataViewCtrl Sample | |
251 | ||
252 | @sampleabout{wxDataViewCtrl} | |
dc28cdf8 | 253 | |
5d4cca7f BP |
254 | @sampledir{dataview} |
255 | ||
256 | @section page_samples_debugrpt Debug Reporter Sample | |
dc28cdf8 FM |
257 | |
258 | This sample shows how to use wxDebugReport class to | |
259 | generate a debug report in case of a program crash or otherwise. On start up, | |
260 | it proposes to either crash itself (by dereferencing a NULL pointer) or | |
261 | generate debug report without doing it. Next it initializes the debug report | |
262 | with standard information adding a custom file to it (just a timestamp) and | |
263 | allows to view the information gathered using | |
264 | wxDebugReportPreview. | |
265 | ||
266 | For the report processing part of the sample to work you should make available | |
267 | a Web server accepting form uploads, otherwise | |
268 | wxDebugReportUpload will report an error. | |
269 | ||
5d4cca7f BP |
270 | @buildwith{wxUSE_DEBUGREPORT, wxUSE_ON_FATAL_EXCEPTION} |
271 | ||
272 | @sampledir{debugrpt} | |
dc28cdf8 | 273 | |
0c1fe6e9 | 274 | @section page_samples_dialogs Dialogs Sample |
dc28cdf8 FM |
275 | |
276 | This sample shows how to use the common dialogs available from wxWidgets. These | |
277 | dialogs are described in detail in the @ref overview_cmndlg. | |
278 | ||
5d4cca7f | 279 | @sampledir{dialogs} |
dc28cdf8 | 280 | |
0c1fe6e9 | 281 | @section page_samples_dialup Dialup Sample |
dc28cdf8 FM |
282 | |
283 | This sample shows the wxDialUpManager | |
284 | class. In the status bar, it displays the information gathered through its | |
285 | interface: in particular, the current connection status (online or offline) and | |
286 | whether the connection is permanent (in which case a string `LAN' appears in | |
287 | the third status bar field - but note that you may be on a LAN not | |
288 | connected to the Internet, in which case you will not see this) or not. | |
289 | ||
290 | Using the menu entries, you may also dial or hang up the line if you have a | |
291 | modem attached and (this only makes sense for Windows) list the available | |
292 | connections. | |
293 | ||
5d4cca7f BP |
294 | @sampledir{dialup} |
295 | ||
296 | @section page_samples_display Display Sample | |
297 | ||
298 | @sampleabout{wxDisplay} | |
299 | ||
300 | @sampledir{display} | |
dc28cdf8 | 301 | |
5d4cca7f | 302 | @section page_samples_dnd Drag & Drop Sample |
dc28cdf8 FM |
303 | |
304 | This sample shows both clipboard and drag and drop in action. It is quite non | |
305 | trivial and may be safely used as a basis for implementing the clipboard and | |
306 | drag and drop operations in a real-life program. | |
307 | ||
308 | When you run the sample, its screen is split in several parts. On the top, | |
309 | there are two listboxes which show the standard derivations of | |
310 | wxDropTarget: | |
311 | wxTextDropTarget and | |
312 | wxFileDropTarget. | |
313 | ||
314 | The middle of the sample window is taken by the log window which shows what is | |
315 | going on (of course, this only works in debug builds) and may be helpful to see | |
316 | the sequence of steps of data transfer. | |
317 | ||
318 | Finally, the last part is used for dragging text from it to either one of the | |
319 | listboxes (only one will accept it) or another application. The last | |
320 | functionality available from the main frame is to paste a bitmap from the | |
321 | clipboard (or, in the case of the Windows version, also a metafile) - it will be | |
322 | shown in a new frame. | |
323 | ||
324 | So far, everything we mentioned was implemented with minimal amount of code | |
325 | using standard wxWidgets classes. The more advanced features are demonstrated | |
326 | if you create a shape frame from the main frame menu. A shape is a geometric | |
327 | object which has a position, size and color. It models some | |
328 | application-specific data in this sample. A shape object supports its own | |
329 | private wxDataFormat which means that you may cut and | |
330 | paste it or drag and drop (between one and the same or different shapes) from | |
331 | one sample instance to another (or the same). However, chances are that no | |
332 | other program supports this format and so shapes can also be rendered as | |
333 | bitmaps which allows them to be pasted/dropped in many other applications | |
334 | (and, under Windows, also as metafiles which are supported by most of Windows | |
335 | programs as well - try Write/Wordpad, for example). | |
336 | ||
337 | Take a look at DnDShapeDataObject class to see how you may use | |
338 | wxDataObject to achieve this. | |
339 | ||
5d4cca7f | 340 | @sampledir{dnd} |
dc28cdf8 | 341 | |
0c1fe6e9 BP |
342 | @section page_samples_docview Document/View Sample |
343 | ||
5d4cca7f BP |
344 | @sampleabout{@ref overview_docview} |
345 | ||
346 | @sampledir{docview} | |
347 | ||
2d1df0fc | 348 | @see @sample{mdi} |
0c1fe6e9 | 349 | |
5d4cca7f | 350 | @section page_samples_dragimag Drag Image Sample |
0c1fe6e9 | 351 | |
5d4cca7f | 352 | @sampleabout{wxDragImage} |
0c1fe6e9 | 353 | |
5d4cca7f BP |
354 | @sampledir{dragimag} |
355 | ||
356 | @section page_samples_drawing Drawing Sample | |
357 | ||
358 | @sampleabout{the drawing ability of wxDC} | |
359 | ||
360 | @sampledir{drawing} | |
361 | ||
362 | @section page_samples_editlbox Editable List Box Sample | |
363 | ||
364 | @sampleabout{wxEditableListBox} | |
365 | ||
366 | @sampledir{editlbox} | |
367 | ||
368 | @section page_samples_erase Erase Event Sample | |
369 | ||
370 | @sampleabout{wxEraseEvent} | |
371 | ||
372 | @sampledir{erase} | |
0c1fe6e9 BP |
373 | |
374 | @section page_samples_event Event Sample | |
dc28cdf8 | 375 | |
5d4cca7f BP |
376 | This sample demonstrates various features of the wxWidgets events. It |
377 | shows how to dynamic events and connecting/disconnecting the event handlers | |
378 | during run time by using wxEvtHandler::Connect() and wxEvtHandler::Disconnect(), | |
379 | and also how to use wxWindow::PushEventHandler() and wxWindow::PopEventHandler(). | |
dc28cdf8 | 380 | |
5d4cca7f | 381 | @sampledir{event} |
dc28cdf8 | 382 | |
5d4cca7f | 383 | @section page_samples_except Exception Sample |
dc28cdf8 FM |
384 | |
385 | This very simple sample shows how to use C++ exceptions in wxWidgets programs, | |
386 | i.e. where to catch the exception which may be thrown by the program code. It | |
387 | doesn't do anything very exciting by itself, you need to study its code to | |
388 | understand what goes on. | |
389 | ||
5d4cca7f | 390 | <b>Build Note:</b> |
dc28cdf8 FM |
391 | You need to build the library with @c wxUSE_EXCEPTIONS being set to @c 1 |
392 | and compile your code with C++ exceptions support to be able to build this | |
393 | sample. | |
394 | ||
5d4cca7f | 395 | @sampledir{except} |
dc28cdf8 | 396 | |
5d4cca7f | 397 | @section page_samples_exec External Program Execution Sample |
dc28cdf8 FM |
398 | |
399 | The exec sample demonstrates the wxExecute and | |
400 | wxShell functions. Both of them are used to execute the | |
401 | external programs and the sample shows how to do this synchronously (waiting | |
402 | until the program terminates) or asynchronously (notification will come later). | |
403 | ||
404 | It also shows how to capture the output of the child process in both | |
405 | synchronous and asynchronous cases and how to kill the processes with | |
5d4cca7f BP |
406 | wxProcess::Kill() and test for their existence with |
407 | wxProcess::Exists(). | |
dc28cdf8 | 408 | |
5d4cca7f | 409 | @sampledir{exec} |
dc28cdf8 | 410 | |
0c1fe6e9 | 411 | @section page_samples_font Font Sample |
dc28cdf8 FM |
412 | |
413 | The font sample demonstrates wxFont, | |
414 | wxFontEnumerator and | |
415 | wxFontMapper classes. It allows you to see the fonts | |
416 | available (to wxWidgets) on the computer and shows all characters of the | |
417 | chosen font as well. | |
418 | ||
5d4cca7f | 419 | @sampledir{font} |
dc28cdf8 | 420 | |
0c1fe6e9 | 421 | @section page_samples_grid Grid Sample |
dc28cdf8 | 422 | |
5d4cca7f BP |
423 | @sampleabout{wxGrid} |
424 | ||
425 | @sampledir{grid} | |
426 | ||
427 | @section page_samples_help Help Sample | |
dc28cdf8 | 428 | |
5d4cca7f BP |
429 | @sampleabout{wxHelpController} |
430 | ||
431 | @sampledir{help} | |
dc28cdf8 | 432 | |
0c1fe6e9 | 433 | @section page_samples_html HTML Sample |
dc28cdf8 | 434 | |
5d4cca7f | 435 | Eight HTML samples cover all features of the HTML sub-library. |
dc28cdf8 FM |
436 | |
437 | @li @b Test demonstrates how to create wxHtmlWindow | |
438 | and also shows most supported HTML tags. | |
439 | ||
440 | @li @b Widget shows how you can embed ordinary controls or windows within an | |
441 | HTML page. It also nicely explains how to write new tag handlers and extend | |
442 | the library to work with unsupported tags. | |
443 | ||
444 | @li @b About may give you an idea how to write good-looking About boxes. | |
445 | ||
446 | @li @b Zip demonstrates use of virtual file systems in wxHTML. The zip archives | |
447 | handler (ships with wxWidgets) allows you to access HTML pages stored | |
448 | in a compressed archive as if they were ordinary files. | |
449 | ||
450 | @li @b Virtual is yet another virtual file systems demo. This one generates pages at run-time. | |
451 | You may find it useful if you need to display some reports in your application. | |
452 | ||
453 | @li @b Printing explains use of wxHtmlEasyPrinting | |
454 | class which serves as as-simple-as-possible interface for printing HTML | |
455 | documents without much work. In fact, only few function calls are sufficient. | |
456 | ||
457 | @li @b Help and @b Helpview are variations on displaying HTML help | |
458 | (compatible with MS HTML Help Workshop). @e Help shows how to embed | |
459 | wxHtmlHelpController in your application | |
460 | while @e Helpview is a simple tool that only pops up the help window and | |
461 | displays help books given at command line. | |
462 | ||
5d4cca7f BP |
463 | @sampledir{html} |
464 | ||
465 | @section page_samples_htlbox HTML List Box Sample | |
466 | ||
467 | @sampleabout{wxHtmlListBox} | |
468 | ||
469 | @sampledir{htlbox} | |
dc28cdf8 | 470 | |
0c1fe6e9 | 471 | @section page_samples_image Image Sample |
dc28cdf8 FM |
472 | |
473 | The image sample demonstrates use of the wxImage class | |
474 | and shows how to download images in a variety of formats, currently PNG, GIF, | |
475 | TIFF, JPEG, BMP, PNM and PCX. The top of the sample shows two rectangles, one | |
476 | of which is drawn directly in the window, the other one is drawn into a | |
477 | wxBitmap, converted to a wxImage, saved as a PNG image | |
478 | and then reloaded from the PNG file again so that conversions between wxImage | |
479 | and wxBitmap as well as loading and saving PNG files are tested. | |
480 | ||
481 | At the bottom of the main frame there is a test for using a monochrome bitmap by | |
482 | drawing into a wxMemoryDC. The bitmap is then drawn | |
483 | specifying the foreground and background colours with | |
5d4cca7f BP |
484 | wxDC::SetTextForeground() and |
485 | wxDC::SetTextBackground() (on the left). The | |
dc28cdf8 | 486 | bitmap is then converted to a wxImage and the foreground colour (black) is |
5d4cca7f | 487 | replaced with red using wxImage::Replace(). |
dc28cdf8 FM |
488 | |
489 | This sample also contains the code for testing the image rotation and resizing | |
490 | and using raw bitmap access, see the corresponding menu commands. | |
491 | ||
5d4cca7f | 492 | @sampledir{image} |
dc28cdf8 | 493 | |
5d4cca7f | 494 | @section page_samples_internat Internationalization Sample |
dc28cdf8 FM |
495 | |
496 | The not very clearly named internat sample demonstrates the wxWidgets | |
497 | internationalization (i18n for short from now on) features. To be more | |
498 | precise, it only shows localization support, i.e. support for translating the | |
499 | program messages into another language while true i18n would also involve | |
500 | changing the other aspects of the programs behaviour. | |
501 | ||
502 | More information about this sample can be found in the @c readme.txt file in | |
503 | its directory. Please also see the @ref overview_i18n. | |
504 | ||
5d4cca7f BP |
505 | @sampledir{internat} |
506 | ||
507 | @section page_samples_ipc Connection Sample | |
508 | ||
509 | @sampleabout{wxConnection} | |
510 | ||
511 | @sampledir{ipc} | |
512 | ||
513 | @section page_samples_joytest Joystick Sample | |
514 | ||
515 | @sampleabout{wxJoystick} | |
516 | ||
517 | @sampledir{joytest} | |
518 | ||
519 | @section page_samples_keyboard Key Event Sample | |
520 | ||
521 | @sampleabout{wxKeyEvent} | |
522 | ||
523 | @sampledir{keyboard} | |
dc28cdf8 | 524 | |
0c1fe6e9 | 525 | @section page_samples_layout Layout Sample |
dc28cdf8 FM |
526 | |
527 | The layout sample demonstrates the two different layout systems offered | |
528 | by wxWidgets. When starting the program, you will see a frame with some | |
529 | controls and some graphics. The controls will change their size whenever | |
530 | you resize the entire frame and the exact behaviour of the size changes | |
531 | is determined using the wxLayoutConstraints | |
532 | class. See also the overview and the | |
533 | wxIndividualLayoutConstraint | |
534 | class for further information. | |
535 | ||
536 | The menu in this sample offers two more tests, one showing how to use | |
537 | a wxBoxSizer in a simple dialog and the other one | |
538 | showing how to use sizers in connection with a wxNotebook | |
539 | class. See also wxSizer. | |
540 | ||
5d4cca7f | 541 | @sampledir{layout} |
dc28cdf8 | 542 | |
5d4cca7f | 543 | @section page_samples_listctrl List Control Sample |
dc28cdf8 FM |
544 | |
545 | This sample shows the wxListCtrl control. Different modes | |
546 | supported by the control (list, icons, small icons, report) may be chosen from | |
547 | the menu. | |
548 | ||
549 | The sample also provides some timings for adding/deleting/sorting a lot of | |
550 | (several thousands) items into the control. | |
551 | ||
5d4cca7f BP |
552 | @sampledir{listctrl} |
553 | ||
554 | @section page_samples_mdi MDI Sample | |
555 | ||
556 | @sampleabout{MDI} | |
557 | ||
2d1df0fc | 558 | @see @sample{docview} |
5d4cca7f BP |
559 | |
560 | @sampledir{mdi} | |
dc28cdf8 | 561 | |
0c1fe6e9 | 562 | @section page_samples_mediaplayer Mediaplayer Sample |
dc28cdf8 FM |
563 | |
564 | This sample demonstrates how to use all the features of | |
565 | wxMediaCtrl and play various types of sound, video, | |
566 | and other files. | |
567 | ||
5d4cca7f BP |
568 | It replaces the old @c dynamic sample. |
569 | ||
570 | @sampledir{mediaplayer} | |
571 | ||
572 | @section page_samples_memcheck Memory Checking Sample | |
573 | ||
574 | @sampleabout{memory tracing using wxDebugContext} | |
dc28cdf8 | 575 | |
5d4cca7f BP |
576 | @sampledir{memcheck} |
577 | ||
578 | @buildwith{wxUSE_MEMORY_TRACING, wxUSE_DEBUG_CONTEXT} | |
579 | ||
580 | @section page_samples_menu Menu Sample | |
581 | ||
582 | @sampleabout{wxMenu classes} | |
583 | ||
584 | @sampledir{menu} | |
585 | ||
586 | @section page_samples_mfc MFC Sample | |
587 | ||
588 | @sampleabout{how to mix MFC and wxWidgets code} | |
589 | It pops up an initial wxWidgets frame, with a menu item | |
590 | that allows a new MFC window to be created. | |
591 | ||
592 | For build instructions please read IMPORTANT NOTES in @c mfctest.cpp. | |
593 | ||
594 | @onlyfor{wxmsw} | |
595 | ||
596 | @sampledir{mfc} | |
dc28cdf8 | 597 | |
0c1fe6e9 | 598 | @section page_samples_minimal Minimal Sample |
5d9a1f6e FM |
599 | |
600 | The minimal sample is what most people will know under the term Hello World, | |
601 | i.e. a minimal program that doesn't demonstrate anything apart from what is | |
602 | needed to write a program that will display a "hello" dialog. This is usually | |
603 | a good starting point for learning how to use wxWidgets. | |
604 | ||
5d4cca7f BP |
605 | @sampledir{minimal} |
606 | ||
607 | @section page_samples_mobile Mobile Sample | |
608 | ||
609 | @todo Figure out what this sample is written for, maybe remove it from samples, | |
610 | since it seems to an incomplete test program (for mobile phone?) | |
611 | ||
612 | @sampledir{mobile} | |
613 | ||
614 | @section page_samples_nativdlg Native Windows Dialog Sample | |
615 | ||
616 | @sampleabout{native windows dialog} | |
617 | ||
618 | @onlyfor{wxmsw} | |
619 | ||
620 | @sampledir{nativdlg} | |
5d9a1f6e | 621 | |
0c1fe6e9 | 622 | @section page_samples_notebook Notebook Sample |
dc28cdf8 FM |
623 | |
624 | This samples shows wxBookCtrl family of controls. | |
625 | Although initially it was written to demonstrate wxNotebook | |
626 | only, it can now be also used to see wxListbook, | |
627 | wxChoicebook and wxTreebook in action. | |
628 | Test each of the controls, their orientation, images and pages using | |
629 | commands through menu. | |
630 | ||
5d4cca7f BP |
631 | @sampledir{notebook} |
632 | ||
633 | @section page_samples_oleauto OLE Automation Sample | |
634 | ||
635 | @sampleabout{OLE automation using wxAutomationObject} | |
636 | ||
637 | @onlyfor{wxmsw} | |
638 | ||
639 | @sampledir{oleauto} | |
640 | ||
641 | @section page_samples_opengl OpenGL Sample | |
642 | ||
643 | @sampleabout{wxGLCanvas} | |
644 | ||
645 | @li @b cube Draws only a cube to demonstrate how to write a basic wxWidgets OpenGL program. | |
646 | @li @b isosurf Draws a surface by reading coordinates from a dat file. | |
647 | @li @b penguin Draws a rotatable penguin by reading data from a dxf file. | |
648 | ||
649 | @sampledir{opengl} | |
650 | ||
651 | @section page_samples_ownerdrw Owner-drawn Sample | |
652 | ||
653 | @sampleabout{owner-drawn wxMenuItem\, wxCheckList and wxListBox} | |
654 | ||
655 | <!--It's weird that it doesn't need <wx/ownerdrw.h> and class wxOwnerDrawn!--> | |
656 | ||
657 | @sampledir{ownerdrw} | |
658 | ||
659 | @section page_samples_popup Popup Transient Window Sample | |
660 | ||
661 | @sampleabout{wxPopupTransientWindow} | |
662 | ||
663 | @sampledir{popup} | |
664 | ||
665 | @section page_samples_power Power Management Sample | |
666 | ||
667 | @sampleabout{wxWidgets power management} | |
668 | ||
669 | @see wxPowerEvent | |
670 | ||
671 | @sampledir{power} | |
672 | ||
673 | @section page_samples_printing Printing Sample | |
674 | ||
675 | @sampleabout{printing} | |
676 | ||
677 | @see @ref overview_printing, @ref overview_unixprinting | |
678 | ||
679 | @buildwith{wxUSE_PRINTING_ARCHITECTURE} | |
680 | ||
681 | @sampledir{printing} | |
682 | ||
1c4293cb VZ |
683 | @section page_samples_propgrid wxPropertyGrid Sample |
684 | ||
685 | Sample application has following additional examples of custom properties: | |
686 | - wxFontDataProperty ( edits wxFontData ) | |
687 | - wxPointProperty ( edits wxPoint ) | |
688 | - wxSizeProperty ( edits wxSize ) | |
689 | - wxAdvImageFileProperty ( like wxImageFileProperty, but also has a drop-down | |
690 | for recent image selection ) | |
691 | - wxDirsProperty ( edits a wxArrayString consisting of directory strings) | |
692 | - wxArrayDoubleProperty ( edits wxArrayDouble ) | |
693 | ||
694 | @sampleabout{wxPropertyGrid} | |
695 | ||
696 | @sampledir{propgrid} | |
697 | ||
5d4cca7f BP |
698 | @section page_samples_regtest Registry Sample |
699 | ||
700 | @sampleabout{wxRegKey} | |
701 | ||
702 | <!--Its directory name doesn't seem to be proper.--> | |
703 | ||
704 | @onlyfor{wxmsw} | |
705 | ||
706 | @sampledir{regtest} | |
dc28cdf8 | 707 | |
0c1fe6e9 | 708 | @section page_samples_render Render Sample |
dc28cdf8 FM |
709 | |
710 | This sample shows how to replace the default wxWidgets | |
711 | renderer and also how to write a shared library | |
712 | (DLL) implementing a renderer and load and unload it during the run-time. | |
713 | ||
5d4cca7f BP |
714 | @sampledir{render} |
715 | ||
716 | @section page_samples_richtext wxRichTextCtrl Sample | |
717 | ||
718 | @sampleabout{wxRichTextCtrl} | |
719 | ||
720 | @sampledir{richtext} | |
721 | ||
722 | @section page_samples_sashtest Sash Sample | |
723 | ||
724 | @sampleabout{wxSashWindow classes} | |
725 | ||
726 | @sampledir{sashtest} | |
727 | ||
728 | @section page_samples_scroll Scroll Window Sample | |
729 | ||
730 | @sampleabout{wxScrolledWindow} | |
731 | ||
732 | @see @sample{scrollsub} | |
733 | ||
734 | @sampledir{scroll} | |
dc28cdf8 | 735 | |
0c1fe6e9 | 736 | @section page_samples_scrollsub Scroll Subwindow Sample |
dc28cdf8 | 737 | |
f09b5681 | 738 | This sample demonstrates use of the ::wxScrolledWindow |
dc28cdf8 FM |
739 | class including placing subwindows into it and drawing simple graphics. It uses the |
740 | SetTargetWindow method and thus the effect | |
741 | of scrolling does not show in the scrolled window itself, but in one of its subwindows. | |
742 | ||
743 | Additionally, this samples demonstrates how to optimize drawing operations in wxWidgets, | |
5d4cca7f | 744 | in particular using the wxWindow::IsExposed() method with |
dc28cdf8 FM |
745 | the aim to prevent unnecessary drawing in the window and thus reducing or removing |
746 | flicker on screen. | |
747 | ||
5d4cca7f BP |
748 | @sampledir{scrollsub} |
749 | ||
750 | @section page_samples_shaped Shaped Window Sample | |
751 | ||
752 | @sampleabout{how to implement a shaped or transparent window\, and a window showing/hiding with effect} | |
753 | ||
754 | @see wxTopLevelWindow::SetShape(), wxTopLevelWindow::SetTransparent(), | |
755 | wxWindow::ShowWithEffect(), wxWindow::HideWithEffect() | |
756 | ||
757 | @sampledir{shaped} | |
dc28cdf8 | 758 | |
0c1fe6e9 | 759 | @section page_samples_sockets Sockets Sample |
dc28cdf8 FM |
760 | |
761 | The sockets sample demonstrates how to use the communication facilities | |
762 | provided by wxSocket. There are two different | |
763 | applications in this sample: a server, which is implemented using a | |
764 | wxSocketServer object, and a client, which | |
765 | is implemented as a wxSocketClient. | |
766 | ||
767 | The server binds to the local address, using TCP port number 3000, | |
768 | sets up an event handler to be notified of incoming connection requests | |
769 | (@b wxSOCKET_CONNECTION events), and sits there, waiting for clients | |
770 | (@e listening, in socket parlance). For each accepted connection, | |
771 | a new wxSocketBase object is created. These | |
772 | socket objects are independent from the server that created them, so | |
773 | they set up their own event handler, and then request to be notified | |
774 | of @b wxSOCKET_INPUT (incoming data) or @b wxSOCKET_LOST | |
775 | (connection closed at the remote end) events. In the sample, the event | |
776 | handler is the same for all connections; to find out which socket the | |
777 | event is addressed to, the GetSocket function | |
778 | is used. | |
779 | ||
780 | Although it might take some time to get used to the event-oriented | |
781 | system upon which wxSocket is built, the benefits are many. See, for | |
782 | example, that the server application, while being single-threaded | |
783 | (and of course without using fork() or ugly select() loops) can handle | |
784 | an arbitrary number of connections. | |
785 | ||
786 | The client starts up unconnected, so you can use the Connect... option | |
787 | to specify the address of the server you are going to connect to (the | |
788 | TCP port number is hard-coded as 3000). Once connected, a number of | |
789 | tests are possible. Currently, three tests are implemented. They show | |
790 | how to use the basic IO calls in wxSocketBase, | |
5d4cca7f BP |
791 | such as wxSocketBase::Read(), wxSocketBase::Write(), |
792 | wxSocketBase::ReadMsg() and wxSocketBase::WriteMsg(), | |
dc28cdf8 FM |
793 | and how to set up the correct IO flags depending on what you are going to |
794 | do. See the comments in the code for more information. Note that because | |
795 | both clients and connection objects in the server set up an event handler | |
796 | to catch @b wxSOCKET_LOST events, each one is immediately notified | |
797 | if the other end closes the connection. | |
798 | ||
799 | There is also a URL test which shows how to use | |
800 | the wxURL class to fetch data from a given URL. | |
801 | ||
802 | The sockets sample is work in progress. Some things to do: | |
803 | ||
804 | @li More tests for basic socket functionality. | |
805 | @li More tests for protocol classes (wxProtocol and its descendants). | |
806 | @li Tests for the recently added (and still in alpha stage) datagram sockets. | |
807 | @li New samples which actually do something useful (suggestions accepted). | |
808 | ||
5d4cca7f | 809 | @sampledir{sockets} |
dc28cdf8 | 810 | |
0c1fe6e9 | 811 | @section page_samples_sound Sound Sample |
dc28cdf8 FM |
812 | |
813 | The @c sound sample shows how to use wxSound for simple | |
814 | audio output (e.g. notifications). | |
815 | ||
5d4cca7f BP |
816 | @sampledir{sound} |
817 | ||
818 | @section page_samples_splash Splash Screen Sample | |
819 | ||
820 | @sampleabout{wxSplashScreen} | |
dc28cdf8 | 821 | |
5d4cca7f BP |
822 | @sampledir{splash} |
823 | ||
824 | @section page_samples_splitter Splitter Window Sample | |
825 | ||
826 | @sampleabout{wxSplitterWindow} | |
827 | ||
828 | @sampledir{splitter} | |
829 | ||
830 | @section page_samples_statbar Status Bar Sample | |
dc28cdf8 FM |
831 | |
832 | This sample shows how to create and use wxStatusBar. Although most of the | |
833 | samples have a statusbar, they usually only create a default one and only | |
834 | do it once. | |
835 | ||
836 | Here you can see how to recreate the statusbar (with possibly different number | |
837 | of fields) and how to use it to show icons/bitmaps and/or put arbitrary | |
838 | controls into it. | |
839 | ||
5d4cca7f BP |
840 | @sampledir{statbar} |
841 | ||
842 | @section page_samples_stc wxStyledTextCtrl Sample | |
843 | ||
844 | @sampleabout{wxStyledTextCtrl} | |
845 | ||
846 | @sampledir{stc} | |
847 | ||
848 | @section page_samples_svg SVG Sample | |
849 | ||
850 | @sampleabout{wxSVGFileDC} | |
851 | ||
852 | @sampledir{svg} | |
dc28cdf8 | 853 | |
0c1fe6e9 | 854 | @section page_samples_taborder Tab Order Sample |
dc28cdf8 FM |
855 | |
856 | This sample allows to test keyboard navigation (mostly done using the | |
857 | @c TAB key, hence the sample name) between different controls. | |
858 | It shows the use of wxWindow::MoveBeforeInTabOrder() and | |
859 | MoveAfterInTabOrder() methods to change | |
860 | the default order of the windows in the navigation chain and of | |
861 | wxWindow::Navigate() for moving focus along this | |
862 | chain. | |
863 | ||
5d4cca7f BP |
864 | @sampledir{taborder} |
865 | ||
866 | @section page_samples_taskbar Task Bar Icon Sample | |
867 | ||
868 | @sampleabout{wxTaskBarIcon} | |
869 | ||
870 | @sampledir{taskbar} | |
dc28cdf8 | 871 | |
0c1fe6e9 | 872 | @section page_samples_text Text Sample |
dc28cdf8 FM |
873 | |
874 | This sample demonstrates four features: firstly the use and many variants of | |
875 | the wxTextCtrl class (single line, multi line, read only, | |
876 | password, ignoring TAB, ignoring ENTER). | |
877 | ||
878 | Secondly it shows how to intercept a wxKeyEvent in both | |
879 | the raw form using the @c EVT_KEY_UP and @c EVT_KEY_DOWN macros and the | |
880 | higher level from using the @c EVT_CHAR macro. All characters will be logged | |
881 | in a log window at the bottom of the main window. By pressing some of the function | |
882 | keys, you can test some actions in the text ctrl as well as get statistics on the | |
883 | text ctrls, which is useful for testing if these statistics actually are correct. | |
884 | ||
885 | Thirdly, on platforms which support it, the sample will offer to copy text to the | |
886 | wxClipboard and to paste text from it. The GTK version will | |
887 | use the so called PRIMARY SELECTION, which is the pseudo clipboard under X and | |
888 | best known from pasting text to the XTerm program. | |
889 | ||
890 | Last not least: some of the text controls have tooltips and the sample also shows | |
891 | how tooltips can be centrally disabled and their latency controlled. | |
892 | ||
5d4cca7f | 893 | @sampledir{text} |
dc28cdf8 | 894 | |
0c1fe6e9 | 895 | @section page_samples_thread Thread Sample |
dc28cdf8 FM |
896 | |
897 | This sample demonstrates use of threads in connection with GUI programs. | |
898 | There are two fundamentally different ways to use threads in GUI programs and | |
899 | either way has to take care of the fact that the GUI library itself usually | |
900 | is not multi-threading safe, i.e. that it might crash if two threads try to | |
901 | access the GUI class simultaneously. One way to prevent that is have a normal | |
902 | GUI program in the main thread and some worker threads which work in the | |
903 | background. In order to make communication between the main thread and the | |
904 | worker threads possible, wxWidgets offers the wxPostEvent | |
905 | function and this sample makes use of this function. | |
906 | ||
907 | The other way to use a so called Mutex (such as those offered in the wxMutex | |
908 | class) that prevent threads from accessing the GUI classes as long as any other | |
909 | thread accesses them. For this, wxWidgets has the wxMutexGuiEnter | |
910 | and wxMutexGuiLeave functions, both of which are | |
911 | used and tested in the sample as well. | |
912 | ||
913 | See also @ref overview_thread and wxThread. | |
914 | ||
5d4cca7f | 915 | @sampledir{thread} |
dc28cdf8 | 916 | |
5d4cca7f | 917 | @section page_samples_toolbar Tool Bar Sample |
dc28cdf8 FM |
918 | |
919 | The toolbar sample shows the wxToolBar class in action. | |
920 | ||
921 | The following things are demonstrated: | |
922 | ||
5d4cca7f BP |
923 | @li Creating the toolbar using wxToolBar::AddTool() and wxToolBar::AddControl(): see |
924 | MyApp::InitToolbar() in the sample. | |
dc28cdf8 FM |
925 | @li Using @c EVT_UPDATE_UI handler for automatically enabling/disabling |
926 | toolbar buttons without having to explicitly call EnableTool. This is done | |
5d4cca7f BP |
927 | in MyFrame::OnUpdateCopyAndCut(). |
928 | @li Using wxToolBar::DeleteTool() and wxToolBar::InsertTool() to dynamically update the | |
dc28cdf8 FM |
929 | toolbar. |
930 | ||
931 | Some buttons in the main toolbar are check buttons, i.e. they stay checked when | |
932 | pressed. On the platforms which support it, the sample also adds a combobox | |
933 | to the toolbar showing how you can use arbitrary controls and not only buttons | |
934 | in it. | |
935 | ||
936 | If you toggle another toolbar in the sample (using @c Ctrl-A) you will also | |
937 | see the radio toolbar buttons in action: the first three buttons form a radio | |
938 | group, i.e. checking any of them automatically unchecks the previously | |
939 | checked one. | |
940 | ||
5d4cca7f | 941 | @sampledir{toolbar} |
dc28cdf8 | 942 | |
5d4cca7f | 943 | @section page_samples_treectrl wxTreeCtrl Sample |
dc28cdf8 FM |
944 | |
945 | This sample demonstrates using the wxTreeCtrl class. Here | |
946 | you may see how to process various notification messages sent by this control | |
947 | and also when they occur (by looking at the messages in the text control in | |
948 | the bottom part of the frame). | |
949 | ||
950 | Adding, inserting and deleting items and branches from the tree as well as | |
951 | sorting (in default alphabetical order as well as in custom one) is | |
952 | demonstrated here as well - try the corresponding menu entries. | |
953 | ||
5d4cca7f BP |
954 | @sampledir{treectrl} |
955 | ||
956 | @section page_samples_typetest Types Sample | |
957 | ||
958 | @sampleabout{wxWidgets types} | |
959 | ||
960 | @todo Rewrite its description ASAP. | |
961 | ||
962 | @sampledir{typetest} | |
963 | ||
964 | @section page_samples_validate Validator Sample | |
965 | ||
966 | @sampleabout{wxValidator} | |
967 | ||
968 | @sampledir{validate} | |
969 | ||
970 | @section page_samples_vscroll VScrolled Window Sample | |
971 | ||
972 | @sampleabout{wxVScrolledWindow} | |
973 | ||
974 | @sampledir{vscroll} | |
dc28cdf8 | 975 | |
0c1fe6e9 | 976 | @section page_samples_widgets Widgets Sample |
dc28cdf8 FM |
977 | |
978 | The widgets sample is the main presentation program for most simple and advanced | |
979 | native controls and complex generic widgets provided by wxWidgets. | |
980 | The sample tests their basic functionality, events, placement, modification | |
981 | in terms of colour and font as well as the possibility to change | |
982 | the controls programmatically, such as adding an item to a list box etc. | |
983 | All widgets are categorized for easy browsing. | |
984 | ||
5d4cca7f | 985 | @sampledir{widgets} |
dc28cdf8 | 986 | |
0c1fe6e9 | 987 | @section page_samples_wizard Wizard Sample |
dc28cdf8 FM |
988 | |
989 | This sample shows the so-called wizard dialog (implemented using | |
990 | wxWizard and related classes). It shows almost all | |
991 | features supported: | |
992 | ||
993 | @li Using bitmaps with the wizard and changing them depending on the page | |
994 | shown (notice that wxValidationPage in the sample has a different image from | |
995 | the other ones) | |
996 | @li Using TransferDataFromWindow | |
997 | to verify that the data entered is correct before passing to the next page | |
998 | (done in wxValidationPage which forces the user to check a checkbox before | |
999 | continuing). | |
1000 | @li Using more elaborated techniques to allow returning to the previous | |
1001 | page, but not continuing to the next one or vice versa (in wxRadioboxPage) | |
1002 | @li This (wxRadioboxPage) page also shows how the page may process the | |
1003 | @e Cancel button itself instead of relying on the wizard parent to do it. | |
1004 | @li Normally, the order of the pages in the wizard is known at compile-time, | |
1005 | but sometimes it depends on the user choices: wxCheckboxPage shows how to | |
1006 | dynamically decide which page to display next (see also | |
1007 | wxWizardPage) | |
1008 | ||
5d4cca7f BP |
1009 | @sampledir{wizard} |
1010 | ||
1011 | @section page_samples_wrapsizer wxWrapSizer Sample | |
1012 | ||
1013 | @sampleabout{wxWrapSizer} | |
1014 | ||
1015 | @sampledir{wrapsizer} | |
1016 | ||
1017 | @section page_samples_xrc XRC Sample | |
1018 | ||
1019 | @sampleabout{@ref overview_xrc} | |
1020 | ||
1021 | @sampledir{xrc} | |
1022 | ||
dc28cdf8 | 1023 | */ |
29f86fc1 | 1024 |