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