]>
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 FM |
12 | |
13 | Probably the best way to learn wxWidgets is by reading the source of some 70+ | |
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 | ||
5d9a1f6e FM |
21 | There are currently more than 70 different samples as part of wxWidgets: |
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 | ||
44 | @beginInvisibleTable | |
45 | <tr><td> | |
5d9a1f6e | 46 | @li @ref page_samples_access |
dc28cdf8 FM |
47 | @li @ref page_samples_animate |
48 | @li @ref page_samples_artprovider | |
5d9a1f6e | 49 | @li @ref page_samples_aui |
dc28cdf8 FM |
50 | @li @ref page_samples_calendar |
51 | @li @ref page_samples_config | |
52 | @li @ref page_samples_controls | |
53 | @li @ref page_samples_debugrpt | |
54 | @li @ref page_samples_dialogs | |
55 | @li @ref page_samples_dialup | |
56 | @li @ref page_samples_dnd | |
0c1fe6e9 BP |
57 | @li @ref page_samples_docview |
58 | @li @ref page_samples_dragimag | |
dc28cdf8 | 59 | @li @ref page_samples_event |
5d9a1f6e | 60 | </td><td> |
dc28cdf8 FM |
61 | @li @ref page_samples_except |
62 | @li @ref page_samples_exec | |
63 | @li @ref page_samples_font | |
64 | @li @ref page_samples_grid | |
65 | @li @ref page_samples_html | |
66 | @li @ref page_samples_image | |
dc28cdf8 FM |
67 | @li @ref page_samples_internat |
68 | @li @ref page_samples_layout | |
69 | @li @ref page_samples_listctrl | |
70 | @li @ref page_samples_mediaplayer | |
5d9a1f6e | 71 | @li @ref page_samples_minimal |
dc28cdf8 FM |
72 | @li @ref page_samples_notebook |
73 | @li @ref page_samples_render | |
5d9a1f6e | 74 | </td><td> |
dc28cdf8 FM |
75 | @li @ref page_samples_scrollsub |
76 | @li @ref page_samples_sockets | |
77 | @li @ref page_samples_sound | |
78 | @li @ref page_samples_statbar | |
79 | @li @ref page_samples_taborder | |
80 | @li @ref page_samples_text | |
81 | @li @ref page_samples_thread | |
82 | @li @ref page_samples_toolbar | |
83 | @li @ref page_samples_treectrl | |
84 | @li @ref page_samples_widgets | |
85 | @li @ref page_samples_wizard | |
86 | </td></tr> | |
87 | @endTable | |
88 | ||
89 | ||
5d9a1f6e FM |
90 | <!-- |
91 | ||
92 | TODO: write descriptions for the samples: | |
93 | ||
5d9a1f6e FM |
94 | caret |
95 | collpane | |
96 | combo | |
97 | console | |
98 | dataview | |
99 | display | |
5d9a1f6e | 100 | docvwmdi |
5d9a1f6e FM |
101 | drawing |
102 | editlbox | |
103 | erase | |
104 | event | |
105 | except | |
106 | help | |
107 | htlbox | |
108 | ipc | |
109 | joytest | |
110 | keyboard | |
111 | mdi | |
112 | memcheck | |
113 | menu | |
114 | mfc | |
115 | mobile | |
116 | nativdlg | |
117 | oleauto | |
118 | opengl | |
119 | ownerdrw | |
120 | popup | |
121 | power | |
122 | printing | |
123 | regtest | |
124 | richtext | |
125 | sashtest | |
126 | scroll | |
127 | shaped | |
128 | splash | |
129 | splitter | |
130 | stc | |
131 | svg | |
132 | taskbar | |
133 | typetest | |
134 | validate | |
135 | vscroll | |
136 | xrc | |
137 | ||
138 | --> | |
dc28cdf8 FM |
139 | |
140 | ||
141 | ||
dc28cdf8 | 142 | |
5d9a1f6e FM |
143 | <hr> |
144 | ||
145 | ||
0c1fe6e9 | 146 | @section page_samples_access Accessibility Sample |
5d9a1f6e FM |
147 | |
148 | The @c access sample shows how you can use the wxAccessible classes in a | |
149 | simple GUI program. | |
dc28cdf8 FM |
150 | |
151 | ||
0c1fe6e9 | 152 | @section page_samples_animate Animate Sample |
dc28cdf8 FM |
153 | |
154 | The @c animate sample shows how you can use wxAnimationCtrl | |
155 | control and shows concept of a platform-dependent animation encapsulated | |
156 | in wxAnimation. | |
157 | ||
158 | ||
0c1fe6e9 | 159 | @section page_samples_artprovider Art Provider Sample |
dc28cdf8 FM |
160 | |
161 | The @c artprov sample shows how you can customize the look of standard | |
162 | wxWidgets dialogs by replacing default bitmaps/icons with your own versions. | |
163 | It also shows how you can use wxArtProvider to | |
164 | get stock bitmaps for use in your application. | |
165 | ||
166 | ||
0c1fe6e9 BP |
167 | @section page_samples_aui wxAUI Sample |
168 | ||
169 | @todo Write sample description. | |
170 | ||
171 | ||
172 | @section page_samples_calendar Calendar Sample | |
dc28cdf8 FM |
173 | |
174 | This font shows the calendar control in action. It | |
175 | shows how to configure the control (see the different options in the calendar | |
176 | menu) and also how to process the notifications from it. | |
177 | ||
178 | ||
0c1fe6e9 | 179 | @section page_samples_config Config Sample |
dc28cdf8 FM |
180 | |
181 | This sample demonstrates the wxConfig classes in a platform | |
182 | independent way, i.e. it uses text based files to store a given configuration under | |
183 | Unix and uses the Registry under Windows. | |
184 | ||
185 | See @ref overview_config for the descriptions of all features of this class. | |
186 | ||
187 | ||
0c1fe6e9 | 188 | @section page_samples_controls Controls Sample |
dc28cdf8 FM |
189 | |
190 | The controls sample is the main test program for most simple controls used in | |
191 | wxWidgets. The sample tests their basic functionality, events, placement, | |
192 | modification in terms of colour and font as well as the possibility to change | |
193 | the controls programmatically, such as adding an item to a list box etc. Apart | |
194 | from that, the sample uses a wxNotebook and tests most | |
195 | features of this special control (using bitmap in the tabs, using | |
196 | wxSizer instances and wxLayoutConstraints within notebook pages, advancing pages | |
197 | programmatically and vetoing a page change by intercepting the wxNotebookEvent. | |
198 | ||
199 | The various controls tested are listed here: | |
200 | ||
201 | @li wxButton | |
202 | @li wxBitmapButton | |
203 | @li wxCheckBox | |
204 | @li wxChoice | |
205 | @li wxComboBox | |
206 | @li wxGauge | |
207 | @li wxStaticBox | |
208 | @li wxListBox | |
209 | @li wxSpinCtrl | |
210 | @li wxSpinButton | |
211 | @li wxStaticText | |
212 | @li wxStaticBitmap | |
213 | @li wxRadioBox | |
214 | @li wxRadioButton | |
215 | @li wxSlider | |
216 | ||
217 | ||
0c1fe6e9 | 218 | @section page_samples_debugrpt DebugRpt Sample |
dc28cdf8 FM |
219 | |
220 | This sample shows how to use wxDebugReport class to | |
221 | generate a debug report in case of a program crash or otherwise. On start up, | |
222 | it proposes to either crash itself (by dereferencing a NULL pointer) or | |
223 | generate debug report without doing it. Next it initializes the debug report | |
224 | with standard information adding a custom file to it (just a timestamp) and | |
225 | allows to view the information gathered using | |
226 | wxDebugReportPreview. | |
227 | ||
228 | For the report processing part of the sample to work you should make available | |
229 | a Web server accepting form uploads, otherwise | |
230 | wxDebugReportUpload will report an error. | |
231 | ||
232 | ||
0c1fe6e9 | 233 | @section page_samples_dialogs Dialogs Sample |
dc28cdf8 FM |
234 | |
235 | This sample shows how to use the common dialogs available from wxWidgets. These | |
236 | dialogs are described in detail in the @ref overview_cmndlg. | |
237 | ||
238 | ||
0c1fe6e9 | 239 | @section page_samples_dialup Dialup Sample |
dc28cdf8 FM |
240 | |
241 | This sample shows the wxDialUpManager | |
242 | class. In the status bar, it displays the information gathered through its | |
243 | interface: in particular, the current connection status (online or offline) and | |
244 | whether the connection is permanent (in which case a string `LAN' appears in | |
245 | the third status bar field - but note that you may be on a LAN not | |
246 | connected to the Internet, in which case you will not see this) or not. | |
247 | ||
248 | Using the menu entries, you may also dial or hang up the line if you have a | |
249 | modem attached and (this only makes sense for Windows) list the available | |
250 | connections. | |
251 | ||
252 | ||
0c1fe6e9 | 253 | @section page_samples_dnd DnD Sample |
dc28cdf8 FM |
254 | |
255 | This sample shows both clipboard and drag and drop in action. It is quite non | |
256 | trivial and may be safely used as a basis for implementing the clipboard and | |
257 | drag and drop operations in a real-life program. | |
258 | ||
259 | When you run the sample, its screen is split in several parts. On the top, | |
260 | there are two listboxes which show the standard derivations of | |
261 | wxDropTarget: | |
262 | wxTextDropTarget and | |
263 | wxFileDropTarget. | |
264 | ||
265 | The middle of the sample window is taken by the log window which shows what is | |
266 | going on (of course, this only works in debug builds) and may be helpful to see | |
267 | the sequence of steps of data transfer. | |
268 | ||
269 | Finally, the last part is used for dragging text from it to either one of the | |
270 | listboxes (only one will accept it) or another application. The last | |
271 | functionality available from the main frame is to paste a bitmap from the | |
272 | clipboard (or, in the case of the Windows version, also a metafile) - it will be | |
273 | shown in a new frame. | |
274 | ||
275 | So far, everything we mentioned was implemented with minimal amount of code | |
276 | using standard wxWidgets classes. The more advanced features are demonstrated | |
277 | if you create a shape frame from the main frame menu. A shape is a geometric | |
278 | object which has a position, size and color. It models some | |
279 | application-specific data in this sample. A shape object supports its own | |
280 | private wxDataFormat which means that you may cut and | |
281 | paste it or drag and drop (between one and the same or different shapes) from | |
282 | one sample instance to another (or the same). However, chances are that no | |
283 | other program supports this format and so shapes can also be rendered as | |
284 | bitmaps which allows them to be pasted/dropped in many other applications | |
285 | (and, under Windows, also as metafiles which are supported by most of Windows | |
286 | programs as well - try Write/Wordpad, for example). | |
287 | ||
288 | Take a look at DnDShapeDataObject class to see how you may use | |
289 | wxDataObject to achieve this. | |
290 | ||
291 | ||
0c1fe6e9 BP |
292 | @section page_samples_docview Document/View Sample |
293 | ||
294 | @todo Write sample description. | |
295 | ||
296 | ||
297 | @section page_samples_dragimag wxDragImage Sample | |
298 | ||
299 | @todo Write sample description. | |
300 | ||
301 | ||
302 | @section page_samples_event Event Sample | |
dc28cdf8 FM |
303 | |
304 | The event sample demonstrates various features of the wxWidgets events. It | |
305 | shows using dynamic events and connecting/disconnecting the event handlers | |
306 | during run time and also using | |
307 | PushEventHandler() and | |
308 | PopEventHandler(). | |
309 | ||
310 | ||
0c1fe6e9 | 311 | @section page_samples_except Except(ions) Sample |
dc28cdf8 FM |
312 | |
313 | This very simple sample shows how to use C++ exceptions in wxWidgets programs, | |
314 | i.e. where to catch the exception which may be thrown by the program code. It | |
315 | doesn't do anything very exciting by itself, you need to study its code to | |
316 | understand what goes on. | |
317 | ||
318 | You need to build the library with @c wxUSE_EXCEPTIONS being set to @c 1 | |
319 | and compile your code with C++ exceptions support to be able to build this | |
320 | sample. | |
321 | ||
322 | ||
0c1fe6e9 | 323 | @section page_samples_exec Exec Sample |
dc28cdf8 FM |
324 | |
325 | The exec sample demonstrates the wxExecute and | |
326 | wxShell functions. Both of them are used to execute the | |
327 | external programs and the sample shows how to do this synchronously (waiting | |
328 | until the program terminates) or asynchronously (notification will come later). | |
329 | ||
330 | It also shows how to capture the output of the child process in both | |
331 | synchronous and asynchronous cases and how to kill the processes with | |
332 | wxProcess::Kill and test for their existence with | |
333 | wxProcess::Exists. | |
334 | ||
335 | ||
0c1fe6e9 | 336 | @section page_samples_font Font Sample |
dc28cdf8 FM |
337 | |
338 | The font sample demonstrates wxFont, | |
339 | wxFontEnumerator and | |
340 | wxFontMapper classes. It allows you to see the fonts | |
341 | available (to wxWidgets) on the computer and shows all characters of the | |
342 | chosen font as well. | |
343 | ||
344 | ||
0c1fe6e9 | 345 | @section page_samples_grid Grid Sample |
dc28cdf8 | 346 | |
0c1fe6e9 | 347 | @todo Write sample description. |
dc28cdf8 FM |
348 | |
349 | ||
0c1fe6e9 | 350 | @section page_samples_html HTML Sample |
dc28cdf8 FM |
351 | |
352 | Eight HTML samples (you can find them in directory @c samples/html) | |
353 | cover all features of the HTML sub-library. | |
354 | ||
355 | @li @b Test demonstrates how to create wxHtmlWindow | |
356 | and also shows most supported HTML tags. | |
357 | ||
358 | @li @b Widget shows how you can embed ordinary controls or windows within an | |
359 | HTML page. It also nicely explains how to write new tag handlers and extend | |
360 | the library to work with unsupported tags. | |
361 | ||
362 | @li @b About may give you an idea how to write good-looking About boxes. | |
363 | ||
364 | @li @b Zip demonstrates use of virtual file systems in wxHTML. The zip archives | |
365 | handler (ships with wxWidgets) allows you to access HTML pages stored | |
366 | in a compressed archive as if they were ordinary files. | |
367 | ||
368 | @li @b Virtual is yet another virtual file systems demo. This one generates pages at run-time. | |
369 | You may find it useful if you need to display some reports in your application. | |
370 | ||
371 | @li @b Printing explains use of wxHtmlEasyPrinting | |
372 | class which serves as as-simple-as-possible interface for printing HTML | |
373 | documents without much work. In fact, only few function calls are sufficient. | |
374 | ||
375 | @li @b Help and @b Helpview are variations on displaying HTML help | |
376 | (compatible with MS HTML Help Workshop). @e Help shows how to embed | |
377 | wxHtmlHelpController in your application | |
378 | while @e Helpview is a simple tool that only pops up the help window and | |
379 | displays help books given at command line. | |
380 | ||
381 | ||
0c1fe6e9 | 382 | @section page_samples_image Image Sample |
dc28cdf8 FM |
383 | |
384 | The image sample demonstrates use of the wxImage class | |
385 | and shows how to download images in a variety of formats, currently PNG, GIF, | |
386 | TIFF, JPEG, BMP, PNM and PCX. The top of the sample shows two rectangles, one | |
387 | of which is drawn directly in the window, the other one is drawn into a | |
388 | wxBitmap, converted to a wxImage, saved as a PNG image | |
389 | and then reloaded from the PNG file again so that conversions between wxImage | |
390 | and wxBitmap as well as loading and saving PNG files are tested. | |
391 | ||
392 | At the bottom of the main frame there is a test for using a monochrome bitmap by | |
393 | drawing into a wxMemoryDC. The bitmap is then drawn | |
394 | specifying the foreground and background colours with | |
395 | wxDC::SetTextForeground and | |
396 | wxDC::SetTextBackground (on the left). The | |
397 | bitmap is then converted to a wxImage and the foreground colour (black) is | |
398 | replaced with red using wxImage::Replace. | |
399 | ||
400 | This sample also contains the code for testing the image rotation and resizing | |
401 | and using raw bitmap access, see the corresponding menu commands. | |
402 | ||
403 | ||
0c1fe6e9 | 404 | @section page_samples_internat Internat(ionalization) Sample |
dc28cdf8 FM |
405 | |
406 | The not very clearly named internat sample demonstrates the wxWidgets | |
407 | internationalization (i18n for short from now on) features. To be more | |
408 | precise, it only shows localization support, i.e. support for translating the | |
409 | program messages into another language while true i18n would also involve | |
410 | changing the other aspects of the programs behaviour. | |
411 | ||
412 | More information about this sample can be found in the @c readme.txt file in | |
413 | its directory. Please also see the @ref overview_i18n. | |
414 | ||
415 | ||
0c1fe6e9 | 416 | @section page_samples_layout Layout Sample |
dc28cdf8 FM |
417 | |
418 | The layout sample demonstrates the two different layout systems offered | |
419 | by wxWidgets. When starting the program, you will see a frame with some | |
420 | controls and some graphics. The controls will change their size whenever | |
421 | you resize the entire frame and the exact behaviour of the size changes | |
422 | is determined using the wxLayoutConstraints | |
423 | class. See also the overview and the | |
424 | wxIndividualLayoutConstraint | |
425 | class for further information. | |
426 | ||
427 | The menu in this sample offers two more tests, one showing how to use | |
428 | a wxBoxSizer in a simple dialog and the other one | |
429 | showing how to use sizers in connection with a wxNotebook | |
430 | class. See also wxSizer. | |
431 | ||
432 | ||
0c1fe6e9 | 433 | @section page_samples_listctrl Listctrl Sample |
dc28cdf8 FM |
434 | |
435 | This sample shows the wxListCtrl control. Different modes | |
436 | supported by the control (list, icons, small icons, report) may be chosen from | |
437 | the menu. | |
438 | ||
439 | The sample also provides some timings for adding/deleting/sorting a lot of | |
440 | (several thousands) items into the control. | |
441 | ||
442 | ||
0c1fe6e9 | 443 | @section page_samples_mediaplayer Mediaplayer Sample |
dc28cdf8 FM |
444 | |
445 | This sample demonstrates how to use all the features of | |
446 | wxMediaCtrl and play various types of sound, video, | |
447 | and other files. | |
448 | ||
449 | It replaces the old dynamic sample. | |
450 | ||
451 | ||
0c1fe6e9 | 452 | @section page_samples_minimal Minimal Sample |
5d9a1f6e FM |
453 | |
454 | The minimal sample is what most people will know under the term Hello World, | |
455 | i.e. a minimal program that doesn't demonstrate anything apart from what is | |
456 | needed to write a program that will display a "hello" dialog. This is usually | |
457 | a good starting point for learning how to use wxWidgets. | |
458 | ||
459 | ||
0c1fe6e9 | 460 | @section page_samples_notebook Notebook Sample |
dc28cdf8 FM |
461 | |
462 | This samples shows wxBookCtrl family of controls. | |
463 | Although initially it was written to demonstrate wxNotebook | |
464 | only, it can now be also used to see wxListbook, | |
465 | wxChoicebook and wxTreebook in action. | |
466 | Test each of the controls, their orientation, images and pages using | |
467 | commands through menu. | |
468 | ||
469 | ||
0c1fe6e9 | 470 | @section page_samples_render Render Sample |
dc28cdf8 FM |
471 | |
472 | This sample shows how to replace the default wxWidgets | |
473 | renderer and also how to write a shared library | |
474 | (DLL) implementing a renderer and load and unload it during the run-time. | |
475 | ||
476 | ||
0c1fe6e9 | 477 | @section page_samples_scrollsub Scroll Subwindow Sample |
dc28cdf8 | 478 | |
f09b5681 | 479 | This sample demonstrates use of the ::wxScrolledWindow |
dc28cdf8 FM |
480 | class including placing subwindows into it and drawing simple graphics. It uses the |
481 | SetTargetWindow method and thus the effect | |
482 | of scrolling does not show in the scrolled window itself, but in one of its subwindows. | |
483 | ||
484 | Additionally, this samples demonstrates how to optimize drawing operations in wxWidgets, | |
485 | in particular using the wxWindow::IsExposed method with | |
486 | the aim to prevent unnecessary drawing in the window and thus reducing or removing | |
487 | flicker on screen. | |
488 | ||
489 | ||
0c1fe6e9 | 490 | @section page_samples_sockets Sockets Sample |
dc28cdf8 FM |
491 | |
492 | The sockets sample demonstrates how to use the communication facilities | |
493 | provided by wxSocket. There are two different | |
494 | applications in this sample: a server, which is implemented using a | |
495 | wxSocketServer object, and a client, which | |
496 | is implemented as a wxSocketClient. | |
497 | ||
498 | The server binds to the local address, using TCP port number 3000, | |
499 | sets up an event handler to be notified of incoming connection requests | |
500 | (@b wxSOCKET_CONNECTION events), and sits there, waiting for clients | |
501 | (@e listening, in socket parlance). For each accepted connection, | |
502 | a new wxSocketBase object is created. These | |
503 | socket objects are independent from the server that created them, so | |
504 | they set up their own event handler, and then request to be notified | |
505 | of @b wxSOCKET_INPUT (incoming data) or @b wxSOCKET_LOST | |
506 | (connection closed at the remote end) events. In the sample, the event | |
507 | handler is the same for all connections; to find out which socket the | |
508 | event is addressed to, the GetSocket function | |
509 | is used. | |
510 | ||
511 | Although it might take some time to get used to the event-oriented | |
512 | system upon which wxSocket is built, the benefits are many. See, for | |
513 | example, that the server application, while being single-threaded | |
514 | (and of course without using fork() or ugly select() loops) can handle | |
515 | an arbitrary number of connections. | |
516 | ||
517 | The client starts up unconnected, so you can use the Connect... option | |
518 | to specify the address of the server you are going to connect to (the | |
519 | TCP port number is hard-coded as 3000). Once connected, a number of | |
520 | tests are possible. Currently, three tests are implemented. They show | |
521 | how to use the basic IO calls in wxSocketBase, | |
522 | such as wxSocketBase::Read, wxSocketBase::Write, | |
523 | wxSocketBase::ReadMsg and wxSocketBase::WriteMsg, | |
524 | and how to set up the correct IO flags depending on what you are going to | |
525 | do. See the comments in the code for more information. Note that because | |
526 | both clients and connection objects in the server set up an event handler | |
527 | to catch @b wxSOCKET_LOST events, each one is immediately notified | |
528 | if the other end closes the connection. | |
529 | ||
530 | There is also a URL test which shows how to use | |
531 | the wxURL class to fetch data from a given URL. | |
532 | ||
533 | The sockets sample is work in progress. Some things to do: | |
534 | ||
535 | @li More tests for basic socket functionality. | |
536 | @li More tests for protocol classes (wxProtocol and its descendants). | |
537 | @li Tests for the recently added (and still in alpha stage) datagram sockets. | |
538 | @li New samples which actually do something useful (suggestions accepted). | |
539 | ||
540 | ||
0c1fe6e9 | 541 | @section page_samples_sound Sound Sample |
dc28cdf8 FM |
542 | |
543 | The @c sound sample shows how to use wxSound for simple | |
544 | audio output (e.g. notifications). | |
545 | ||
546 | ||
0c1fe6e9 | 547 | @section page_samples_statbar Statbar Sample |
dc28cdf8 FM |
548 | |
549 | This sample shows how to create and use wxStatusBar. Although most of the | |
550 | samples have a statusbar, they usually only create a default one and only | |
551 | do it once. | |
552 | ||
553 | Here you can see how to recreate the statusbar (with possibly different number | |
554 | of fields) and how to use it to show icons/bitmaps and/or put arbitrary | |
555 | controls into it. | |
556 | ||
557 | ||
0c1fe6e9 | 558 | @section page_samples_taborder Tab Order Sample |
dc28cdf8 FM |
559 | |
560 | This sample allows to test keyboard navigation (mostly done using the | |
561 | @c TAB key, hence the sample name) between different controls. | |
562 | It shows the use of wxWindow::MoveBeforeInTabOrder() and | |
563 | MoveAfterInTabOrder() methods to change | |
564 | the default order of the windows in the navigation chain and of | |
565 | wxWindow::Navigate() for moving focus along this | |
566 | chain. | |
567 | ||
568 | ||
0c1fe6e9 | 569 | @section page_samples_text Text Sample |
dc28cdf8 FM |
570 | |
571 | This sample demonstrates four features: firstly the use and many variants of | |
572 | the wxTextCtrl class (single line, multi line, read only, | |
573 | password, ignoring TAB, ignoring ENTER). | |
574 | ||
575 | Secondly it shows how to intercept a wxKeyEvent in both | |
576 | the raw form using the @c EVT_KEY_UP and @c EVT_KEY_DOWN macros and the | |
577 | higher level from using the @c EVT_CHAR macro. All characters will be logged | |
578 | in a log window at the bottom of the main window. By pressing some of the function | |
579 | keys, you can test some actions in the text ctrl as well as get statistics on the | |
580 | text ctrls, which is useful for testing if these statistics actually are correct. | |
581 | ||
582 | Thirdly, on platforms which support it, the sample will offer to copy text to the | |
583 | wxClipboard and to paste text from it. The GTK version will | |
584 | use the so called PRIMARY SELECTION, which is the pseudo clipboard under X and | |
585 | best known from pasting text to the XTerm program. | |
586 | ||
587 | Last not least: some of the text controls have tooltips and the sample also shows | |
588 | how tooltips can be centrally disabled and their latency controlled. | |
589 | ||
590 | ||
0c1fe6e9 | 591 | @section page_samples_thread Thread Sample |
dc28cdf8 FM |
592 | |
593 | This sample demonstrates use of threads in connection with GUI programs. | |
594 | There are two fundamentally different ways to use threads in GUI programs and | |
595 | either way has to take care of the fact that the GUI library itself usually | |
596 | is not multi-threading safe, i.e. that it might crash if two threads try to | |
597 | access the GUI class simultaneously. One way to prevent that is have a normal | |
598 | GUI program in the main thread and some worker threads which work in the | |
599 | background. In order to make communication between the main thread and the | |
600 | worker threads possible, wxWidgets offers the wxPostEvent | |
601 | function and this sample makes use of this function. | |
602 | ||
603 | The other way to use a so called Mutex (such as those offered in the wxMutex | |
604 | class) that prevent threads from accessing the GUI classes as long as any other | |
605 | thread accesses them. For this, wxWidgets has the wxMutexGuiEnter | |
606 | and wxMutexGuiLeave functions, both of which are | |
607 | used and tested in the sample as well. | |
608 | ||
609 | See also @ref overview_thread and wxThread. | |
610 | ||
611 | ||
0c1fe6e9 | 612 | @section page_samples_toolbar Toolbar Sample |
dc28cdf8 FM |
613 | |
614 | The toolbar sample shows the wxToolBar class in action. | |
615 | ||
616 | The following things are demonstrated: | |
617 | ||
618 | @li Creating the toolbar using wxToolBar::AddTool and wxToolBar::AddControl: see | |
619 | MyApp::InitToolbar in the sample. | |
620 | @li Using @c EVT_UPDATE_UI handler for automatically enabling/disabling | |
621 | toolbar buttons without having to explicitly call EnableTool. This is done | |
622 | in MyFrame::OnUpdateCopyAndCut. | |
623 | @li Using wxToolBar::DeleteTool and wxToolBar::InsertTool to dynamically update the | |
624 | toolbar. | |
625 | ||
626 | Some buttons in the main toolbar are check buttons, i.e. they stay checked when | |
627 | pressed. On the platforms which support it, the sample also adds a combobox | |
628 | to the toolbar showing how you can use arbitrary controls and not only buttons | |
629 | in it. | |
630 | ||
631 | If you toggle another toolbar in the sample (using @c Ctrl-A) you will also | |
632 | see the radio toolbar buttons in action: the first three buttons form a radio | |
633 | group, i.e. checking any of them automatically unchecks the previously | |
634 | checked one. | |
635 | ||
636 | ||
0c1fe6e9 | 637 | @section page_samples_treectrl Treectrl Sample |
dc28cdf8 FM |
638 | |
639 | This sample demonstrates using the wxTreeCtrl class. Here | |
640 | you may see how to process various notification messages sent by this control | |
641 | and also when they occur (by looking at the messages in the text control in | |
642 | the bottom part of the frame). | |
643 | ||
644 | Adding, inserting and deleting items and branches from the tree as well as | |
645 | sorting (in default alphabetical order as well as in custom one) is | |
646 | demonstrated here as well - try the corresponding menu entries. | |
647 | ||
648 | ||
0c1fe6e9 | 649 | @section page_samples_widgets Widgets Sample |
dc28cdf8 FM |
650 | |
651 | The widgets sample is the main presentation program for most simple and advanced | |
652 | native controls and complex generic widgets provided by wxWidgets. | |
653 | The sample tests their basic functionality, events, placement, modification | |
654 | in terms of colour and font as well as the possibility to change | |
655 | the controls programmatically, such as adding an item to a list box etc. | |
656 | All widgets are categorized for easy browsing. | |
657 | ||
658 | ||
0c1fe6e9 | 659 | @section page_samples_wizard Wizard Sample |
dc28cdf8 FM |
660 | |
661 | This sample shows the so-called wizard dialog (implemented using | |
662 | wxWizard and related classes). It shows almost all | |
663 | features supported: | |
664 | ||
665 | @li Using bitmaps with the wizard and changing them depending on the page | |
666 | shown (notice that wxValidationPage in the sample has a different image from | |
667 | the other ones) | |
668 | @li Using TransferDataFromWindow | |
669 | to verify that the data entered is correct before passing to the next page | |
670 | (done in wxValidationPage which forces the user to check a checkbox before | |
671 | continuing). | |
672 | @li Using more elaborated techniques to allow returning to the previous | |
673 | page, but not continuing to the next one or vice versa (in wxRadioboxPage) | |
674 | @li This (wxRadioboxPage) page also shows how the page may process the | |
675 | @e Cancel button itself instead of relying on the wizard parent to do it. | |
676 | @li Normally, the order of the pages in the wizard is known at compile-time, | |
677 | but sometimes it depends on the user choices: wxCheckboxPage shows how to | |
678 | dynamically decide which page to display next (see also | |
679 | wxWizardPage) | |
680 | ||
681 | */ | |
29f86fc1 | 682 |