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