@page page_samples Included Samples
-Probably the best way to learn wxWidgets is by reading the source of some 70+
+Probably the best way to learn wxWidgets is by reading the source of some 80+
samples provided with it. Many aspects of wxWidgets programming can be learnt
from them, but sometimes it is not simple to just choose the right sample to
look at. This overview aims at describing what each sample does/demonstrates to
didn't help. They also provide some notes about using the samples and what
features of wxWidgets are they supposed to test.
-There are currently more than 70 different samples as part of wxWidgets:
+There are currently more than 80 different samples as part of wxWidgets:
the list in this page is not complete!
You should start your tour of wxWidgets with the @ref page_samples_minimal
which is the wxWidgets version of "Hello, world!".
you can't find the sample showing the control you are interested in by
name. Most classes contained in wxWidgets occur in at least one of the samples.
+<!--
+The following sample list is generated by executing command
+
+ls | egrep '[a-z]+' | egrep '^[a-z]+$' | sed 's/^/@li @sample\{/' | sed 's/$/\}/'
+
+in wxWidgets/samples
+
+TODO: Organize them in a more human-readable way.
+-->
+
@beginInvisibleTable
<tr><td>
-@li @ref page_samples_access
-@li @ref page_samples_animate
-@li @ref page_samples_artprovider
-@li @ref page_samples_aui
-@li @ref page_samples_calendar
-@li @ref page_samples_config
-@li @ref page_samples_controls
-@li @ref page_samples_debugrpt
-@li @ref page_samples_dialogs
-@li @ref page_samples_dialup
-@li @ref page_samples_dnd
-@li @ref page_samples_docview
-@li @ref page_samples_dragimag
-@li @ref page_samples_event
+@li @sample{access}
+@li @sample{animate}
+@li @sample{artprov}
+@li @sample{aui}
+@li @sample{calendar}
+@li @sample{caret}
+@li @sample{collpane}
+@li @sample{combo}
+@li @sample{config}
+@li @sample{console}
+@li @sample{controls}
+@li @sample{dataview}
+@li @sample{debugrpt}
+@li @sample{dialogs}
+@li @sample{dialup}
+@li @sample{display}
+@li @sample{dnd}
+@li @sample{docview}
+@li @sample{docvwmdi}
+@li @sample{dragimag}
+@li @sample{drawing}
+@li @sample{editlbox}
+@li @sample{erase}
+@li @sample{event}
+@li @sample{except}
+@li @sample{exec}
+@li @sample{font}
</td><td>
-@li @ref page_samples_except
-@li @ref page_samples_exec
-@li @ref page_samples_font
-@li @ref page_samples_grid
-@li @ref page_samples_html
-@li @ref page_samples_image
-@li @ref page_samples_internat
-@li @ref page_samples_layout
-@li @ref page_samples_listctrl
-@li @ref page_samples_mediaplayer
-@li @ref page_samples_minimal
-@li @ref page_samples_notebook
-@li @ref page_samples_render
+@li @sample{grid}
+@li @sample{help}
+@li @sample{htlbox}
+@li @sample{html}
+@li @sample{image}
+@li @sample{internat}
+@li @sample{ipc}
+@li @sample{joytest}
+@li @sample{keyboard}
+@li @sample{layout}
+@li @sample{listctrl}
+@li @sample{mdi}
+@li @sample{mediaplayer}
+@li @sample{memcheck}
+@li @sample{menu}
+@li @sample{mfc}
+@li @sample{minimal}
+@li @sample{mobile}
+@li @sample{nativdlg}
+@li @sample{notebook}
+@li @sample{oleauto}
+@li @sample{opengl}
+@li @sample{ownerdrw}
+@li @sample{popup}
+@li @sample{power}
+@li @sample{printing}
</td><td>
-@li @ref page_samples_scrollsub
-@li @ref page_samples_sockets
-@li @ref page_samples_sound
-@li @ref page_samples_statbar
-@li @ref page_samples_taborder
-@li @ref page_samples_text
-@li @ref page_samples_thread
-@li @ref page_samples_toolbar
-@li @ref page_samples_treectrl
-@li @ref page_samples_widgets
-@li @ref page_samples_wizard
+@li @sample{regtest}
+@li @sample{render}
+@li @sample{richtext}
+@li @sample{sashtest}
+@li @sample{scroll}
+@li @sample{scrollsub}
+@li @sample{shaped}
+@li @sample{sockets}
+@li @sample{sound}
+@li @sample{splash}
+@li @sample{splitter}
+@li @sample{statbar}
+@li @sample{stc}
+@li @sample{svg}
+@li @sample{taborder}
+@li @sample{taskbar}
+@li @sample{text}
+@li @sample{thread}
+@li @sample{toolbar}
+@li @sample{treectrl}
+@li @sample{typetest}
+@li @sample{validate}
+@li @sample{vscroll}
+@li @sample{widgets}
+@li @sample{wizard}
+@li @sample{wrapsizer}
+@li @sample{xrc}
</td></tr>
@endTable
-
-<!--
-
-TODO: write descriptions for the samples:
-
-caret
-collpane
-combo
-console
-dataview
-display
-docvwmdi
-drawing
-editlbox
-erase
-event
-except
-help
-htlbox
-ipc
-joytest
-keyboard
-mdi
-memcheck
-menu
-mfc
-mobile
-nativdlg
-oleauto
-opengl
-ownerdrw
-popup
-power
-printing
-regtest
-richtext
-sashtest
-scroll
-shaped
-splash
-splitter
-stc
-svg
-taskbar
-typetest
-validate
-vscroll
-xrc
-
--->
-
-
-
-
+@todo Write descriptions for the samples who description started with
+ "This sample demonstrates", they are semi-auto generated.
<hr>
-
@section page_samples_access Accessibility Sample
-The @c access sample shows how you can use the wxAccessible classes in a
+This sample shows how you can use the wxAccessible classes in a
simple GUI program.
+@buildwith{wxUSE_ACCESSIBILITY}
-@section page_samples_animate Animate Sample
+@sampledir{access}
-The @c animate sample shows how you can use wxAnimationCtrl
+@section page_samples_animate Animation Sample
+
+This sample shows how you can use wxAnimationCtrl
control and shows concept of a platform-dependent animation encapsulated
in wxAnimation.
+@sampledir{animate}
-@section page_samples_artprovider Art Provider Sample
+@section page_samples_artprov Art Provider Sample
-The @c artprov sample shows how you can customize the look of standard
+This sample shows how you can customize the look of standard
wxWidgets dialogs by replacing default bitmaps/icons with your own versions.
It also shows how you can use wxArtProvider to
get stock bitmaps for use in your application.
+@sampledir{artprov}
-@section page_samples_aui wxAUI Sample
+@section page_samples_aui Advanced User Interface Sample
-@todo Write sample description.
+@sampleabout{@ref overview_aui "AUI classes"}
+@sampledir{aui}
@section page_samples_calendar Calendar Sample
-This font shows the calendar control in action. It
+This sample shows the calendar control in action. It
shows how to configure the control (see the different options in the calendar
menu) and also how to process the notifications from it.
+@sampledir{calendar}
+
+@section page_samples_caret Caret Sample
+
+@sampleabout{wxCaret}
+
+@sampledir{caret}
+
+@section page_samples_collpane Collapsible Pane Sample
-@section page_samples_config Config Sample
+@sampleabout{wxCollapsiblePane}
+
+@sampledir{collpane}
+
+@section page_samples_combo Combo Sample
+
+@sampleabout{wxComboBox\, wxComboCtrl and wxOwnerDrawnComboBox etc}
+
+@sampledir{combo}
+
+@section page_samples_config Configuration Sample
This sample demonstrates the wxConfig classes in a platform
independent way, i.e. it uses text based files to store a given configuration under
See @ref overview_config for the descriptions of all features of this class.
+@sampledir{config}
+
+@section page_samples_console Console Program Sample
+
+@sampleabout{a console program}
+
+@sampledir{console}
@section page_samples_controls Controls Sample
@li wxRadioButton
@li wxSlider
+@sampledir{controls}
+
+@section page_samples_dataview wxDataViewCtrl Sample
+
+@sampleabout{wxDataViewCtrl}
-@section page_samples_debugrpt DebugRpt Sample
+@sampledir{dataview}
+
+@section page_samples_debugrpt Debug Reporter Sample
This sample shows how to use wxDebugReport class to
generate a debug report in case of a program crash or otherwise. On start up,
a Web server accepting form uploads, otherwise
wxDebugReportUpload will report an error.
+@buildwith{wxUSE_DEBUGREPORT, wxUSE_ON_FATAL_EXCEPTION}
+
+@sampledir{debugrpt}
@section page_samples_dialogs Dialogs Sample
This sample shows how to use the common dialogs available from wxWidgets. These
dialogs are described in detail in the @ref overview_cmndlg.
+@sampledir{dialogs}
@section page_samples_dialup Dialup Sample
modem attached and (this only makes sense for Windows) list the available
connections.
+@sampledir{dialup}
+
+@section page_samples_display Display Sample
+
+@sampleabout{wxDisplay}
+
+@sampledir{display}
-@section page_samples_dnd DnD Sample
+@section page_samples_dnd Drag & Drop Sample
This sample shows both clipboard and drag and drop in action. It is quite non
trivial and may be safely used as a basis for implementing the clipboard and
Take a look at DnDShapeDataObject class to see how you may use
wxDataObject to achieve this.
+@sampledir{dnd}
@section page_samples_docview Document/View Sample
-@todo Write sample description.
+@sampleabout{@ref overview_docview}
+
+@sampledir{docview}
+
+@see @sample{docvwmdi}, @sample{mdi}
+
+@section page_samples_docvwmdi Document/View MDI Sample
+
+@sampleabout{@ref overview_docview in MDI}
+
+@see @sample{docview}, @sample{mdi}
+@sampledir{docvwmdi}
-@section page_samples_dragimag wxDragImage Sample
+@section page_samples_dragimag Drag Image Sample
-@todo Write sample description.
+@sampleabout{wxDragImage}
+@sampledir{dragimag}
+
+@section page_samples_drawing Drawing Sample
+
+@sampleabout{the drawing ability of wxDC}
+
+@sampledir{drawing}
+
+@section page_samples_editlbox Editable List Box Sample
+
+@sampleabout{wxEditableListBox}
+
+@sampledir{editlbox}
+
+@section page_samples_erase Erase Event Sample
+
+@sampleabout{wxEraseEvent}
+
+@sampledir{erase}
@section page_samples_event Event Sample
-The event sample demonstrates various features of the wxWidgets events. It
-shows using dynamic events and connecting/disconnecting the event handlers
-during run time and also using
-PushEventHandler() and
-PopEventHandler().
+This sample demonstrates various features of the wxWidgets events. It
+shows how to dynamic events and connecting/disconnecting the event handlers
+during run time by using wxEvtHandler::Connect() and wxEvtHandler::Disconnect(),
+and also how to use wxWindow::PushEventHandler() and wxWindow::PopEventHandler().
+@sampledir{event}
-@section page_samples_except Except(ions) Sample
+@section page_samples_except Exception Sample
This very simple sample shows how to use C++ exceptions in wxWidgets programs,
i.e. where to catch the exception which may be thrown by the program code. It
doesn't do anything very exciting by itself, you need to study its code to
understand what goes on.
+<b>Build Note:</b>
You need to build the library with @c wxUSE_EXCEPTIONS being set to @c 1
and compile your code with C++ exceptions support to be able to build this
sample.
+@sampledir{except}
-@section page_samples_exec Exec Sample
+@section page_samples_exec External Program Execution Sample
The exec sample demonstrates the wxExecute and
wxShell functions. Both of them are used to execute the
It also shows how to capture the output of the child process in both
synchronous and asynchronous cases and how to kill the processes with
-wxProcess::Kill and test for their existence with
-wxProcess::Exists.
+wxProcess::Kill() and test for their existence with
+wxProcess::Exists().
+@sampledir{exec}
@section page_samples_font Font Sample
available (to wxWidgets) on the computer and shows all characters of the
chosen font as well.
+@sampledir{font}
@section page_samples_grid Grid Sample
-@todo Write sample description.
+@sampleabout{wxGrid}
+
+@sampledir{grid}
+
+@section page_samples_help Help Sample
+@sampleabout{wxHelpController}
+
+@sampledir{help}
@section page_samples_html HTML Sample
-Eight HTML samples (you can find them in directory @c samples/html)
-cover all features of the HTML sub-library.
+Eight HTML samples cover all features of the HTML sub-library.
@li @b Test demonstrates how to create wxHtmlWindow
and also shows most supported HTML tags.
while @e Helpview is a simple tool that only pops up the help window and
displays help books given at command line.
+@sampledir{html}
+
+@section page_samples_htlbox HTML List Box Sample
+
+@sampleabout{wxHtmlListBox}
+
+@sampledir{htlbox}
@section page_samples_image Image Sample
At the bottom of the main frame there is a test for using a monochrome bitmap by
drawing into a wxMemoryDC. The bitmap is then drawn
specifying the foreground and background colours with
-wxDC::SetTextForeground and
-wxDC::SetTextBackground (on the left). The
+wxDC::SetTextForeground() and
+wxDC::SetTextBackground() (on the left). The
bitmap is then converted to a wxImage and the foreground colour (black) is
-replaced with red using wxImage::Replace.
+replaced with red using wxImage::Replace().
This sample also contains the code for testing the image rotation and resizing
and using raw bitmap access, see the corresponding menu commands.
+@sampledir{image}
-@section page_samples_internat Internat(ionalization) Sample
+@section page_samples_internat Internationalization Sample
The not very clearly named internat sample demonstrates the wxWidgets
internationalization (i18n for short from now on) features. To be more
More information about this sample can be found in the @c readme.txt file in
its directory. Please also see the @ref overview_i18n.
+@sampledir{internat}
+
+@section page_samples_ipc Connection Sample
+
+@sampleabout{wxConnection}
+
+@sampledir{ipc}
+
+@section page_samples_joytest Joystick Sample
+
+@sampleabout{wxJoystick}
+
+@sampledir{joytest}
+
+@section page_samples_keyboard Key Event Sample
+
+@sampleabout{wxKeyEvent}
+
+@sampledir{keyboard}
@section page_samples_layout Layout Sample
showing how to use sizers in connection with a wxNotebook
class. See also wxSizer.
+@sampledir{layout}
-@section page_samples_listctrl Listctrl Sample
+@section page_samples_listctrl List Control Sample
This sample shows the wxListCtrl control. Different modes
supported by the control (list, icons, small icons, report) may be chosen from
The sample also provides some timings for adding/deleting/sorting a lot of
(several thousands) items into the control.
+@sampledir{listctrl}
+
+@section page_samples_mdi MDI Sample
+
+@sampleabout{MDI}
+
+@see @sample{docview}, @sample{docvwmdi}
+
+@sampledir{mdi}
@section page_samples_mediaplayer Mediaplayer Sample
wxMediaCtrl and play various types of sound, video,
and other files.
-It replaces the old dynamic sample.
+It replaces the old @c dynamic sample.
+
+@sampledir{mediaplayer}
+
+@section page_samples_memcheck Memory Checking Sample
+
+@sampleabout{memory tracing using wxDebugContext}
+@sampledir{memcheck}
+
+@buildwith{wxUSE_MEMORY_TRACING, wxUSE_DEBUG_CONTEXT}
+
+@section page_samples_menu Menu Sample
+
+@sampleabout{wxMenu classes}
+
+@sampledir{menu}
+
+@section page_samples_mfc MFC Sample
+
+@sampleabout{how to mix MFC and wxWidgets code}
+It pops up an initial wxWidgets frame, with a menu item
+that allows a new MFC window to be created.
+
+For build instructions please read IMPORTANT NOTES in @c mfctest.cpp.
+
+@onlyfor{wxmsw}
+
+@sampledir{mfc}
@section page_samples_minimal Minimal Sample
needed to write a program that will display a "hello" dialog. This is usually
a good starting point for learning how to use wxWidgets.
+@sampledir{minimal}
+
+@section page_samples_mobile Mobile Sample
+
+@todo Figure out what this sample is written for, maybe remove it from samples,
+since it seems to an incomplete test program (for mobile phone?)
+
+@sampledir{mobile}
+
+@section page_samples_nativdlg Native Windows Dialog Sample
+
+@sampleabout{native windows dialog}
+
+@onlyfor{wxmsw}
+
+@sampledir{nativdlg}
@section page_samples_notebook Notebook Sample
Test each of the controls, their orientation, images and pages using
commands through menu.
+@sampledir{notebook}
+
+@section page_samples_oleauto OLE Automation Sample
+
+@sampleabout{OLE automation using wxAutomationObject}
+
+@onlyfor{wxmsw}
+
+@sampledir{oleauto}
+
+@section page_samples_opengl OpenGL Sample
+
+@sampleabout{wxGLCanvas}
+
+@li @b cube Draws only a cube to demonstrate how to write a basic wxWidgets OpenGL program.
+@li @b isosurf Draws a surface by reading coordinates from a dat file.
+@li @b penguin Draws a rotatable penguin by reading data from a dxf file.
+
+@sampledir{opengl}
+
+@section page_samples_ownerdrw Owner-drawn Sample
+
+@sampleabout{owner-drawn wxMenuItem\, wxCheckList and wxListBox}
+
+<!--It's weird that it doesn't need <wx/ownerdrw.h> and class wxOwnerDrawn!-->
+
+@sampledir{ownerdrw}
+
+@section page_samples_popup Popup Transient Window Sample
+
+@sampleabout{wxPopupTransientWindow}
+
+@sampledir{popup}
+
+@section page_samples_power Power Management Sample
+
+@sampleabout{wxWidgets power management}
+
+@see wxPowerEvent
+
+@sampledir{power}
+
+@section page_samples_printing Printing Sample
+
+@sampleabout{printing}
+
+@see @ref overview_printing, @ref overview_unixprinting
+
+@buildwith{wxUSE_PRINTING_ARCHITECTURE}
+
+@sampledir{printing}
+
+@section page_samples_regtest Registry Sample
+
+@sampleabout{wxRegKey}
+
+<!--Its directory name doesn't seem to be proper.-->
+
+@onlyfor{wxmsw}
+
+@sampledir{regtest}
@section page_samples_render Render Sample
renderer and also how to write a shared library
(DLL) implementing a renderer and load and unload it during the run-time.
+@sampledir{render}
+
+@section page_samples_richtext wxRichTextCtrl Sample
+
+@sampleabout{wxRichTextCtrl}
+
+@sampledir{richtext}
+
+@section page_samples_sashtest Sash Sample
+
+@sampleabout{wxSashWindow classes}
+
+@sampledir{sashtest}
+
+@section page_samples_scroll Scroll Window Sample
+
+@sampleabout{wxScrolledWindow}
+
+@see @sample{scrollsub}
+
+@sampledir{scroll}
@section page_samples_scrollsub Scroll Subwindow Sample
of scrolling does not show in the scrolled window itself, but in one of its subwindows.
Additionally, this samples demonstrates how to optimize drawing operations in wxWidgets,
-in particular using the wxWindow::IsExposed method with
+in particular using the wxWindow::IsExposed() method with
the aim to prevent unnecessary drawing in the window and thus reducing or removing
flicker on screen.
+@sampledir{scrollsub}
+
+@section page_samples_shaped Shaped Window Sample
+
+@sampleabout{how to implement a shaped or transparent window\, and a window showing/hiding with effect}
+
+@see wxTopLevelWindow::SetShape(), wxTopLevelWindow::SetTransparent(),
+wxWindow::ShowWithEffect(), wxWindow::HideWithEffect()
+
+@sampledir{shaped}
@section page_samples_sockets Sockets Sample
TCP port number is hard-coded as 3000). Once connected, a number of
tests are possible. Currently, three tests are implemented. They show
how to use the basic IO calls in wxSocketBase,
-such as wxSocketBase::Read, wxSocketBase::Write,
-wxSocketBase::ReadMsg and wxSocketBase::WriteMsg,
+such as wxSocketBase::Read(), wxSocketBase::Write(),
+wxSocketBase::ReadMsg() and wxSocketBase::WriteMsg(),
and how to set up the correct IO flags depending on what you are going to
do. See the comments in the code for more information. Note that because
both clients and connection objects in the server set up an event handler
@li Tests for the recently added (and still in alpha stage) datagram sockets.
@li New samples which actually do something useful (suggestions accepted).
+@sampledir{sockets}
@section page_samples_sound Sound Sample
The @c sound sample shows how to use wxSound for simple
audio output (e.g. notifications).
+@sampledir{sound}
+
+@section page_samples_splash Splash Screen Sample
+
+@sampleabout{wxSplashScreen}
-@section page_samples_statbar Statbar Sample
+@sampledir{splash}
+
+@section page_samples_splitter Splitter Window Sample
+
+@sampleabout{wxSplitterWindow}
+
+@sampledir{splitter}
+
+@section page_samples_statbar Status Bar Sample
This sample shows how to create and use wxStatusBar. Although most of the
samples have a statusbar, they usually only create a default one and only
of fields) and how to use it to show icons/bitmaps and/or put arbitrary
controls into it.
+@sampledir{statbar}
+
+@section page_samples_stc wxStyledTextCtrl Sample
+
+@sampleabout{wxStyledTextCtrl}
+
+@sampledir{stc}
+
+@section page_samples_svg SVG Sample
+
+@sampleabout{wxSVGFileDC}
+
+@sampledir{svg}
@section page_samples_taborder Tab Order Sample
wxWindow::Navigate() for moving focus along this
chain.
+@sampledir{taborder}
+
+@section page_samples_taskbar Task Bar Icon Sample
+
+@sampleabout{wxTaskBarIcon}
+
+@sampledir{taskbar}
@section page_samples_text Text Sample
Last not least: some of the text controls have tooltips and the sample also shows
how tooltips can be centrally disabled and their latency controlled.
+@sampledir{text}
@section page_samples_thread Thread Sample
See also @ref overview_thread and wxThread.
+@sampledir{thread}
-@section page_samples_toolbar Toolbar Sample
+@section page_samples_toolbar Tool Bar Sample
The toolbar sample shows the wxToolBar class in action.
The following things are demonstrated:
-@li Creating the toolbar using wxToolBar::AddTool and wxToolBar::AddControl: see
- MyApp::InitToolbar in the sample.
+@li Creating the toolbar using wxToolBar::AddTool() and wxToolBar::AddControl(): see
+ MyApp::InitToolbar() in the sample.
@li Using @c EVT_UPDATE_UI handler for automatically enabling/disabling
toolbar buttons without having to explicitly call EnableTool. This is done
- in MyFrame::OnUpdateCopyAndCut.
-@li Using wxToolBar::DeleteTool and wxToolBar::InsertTool to dynamically update the
+ in MyFrame::OnUpdateCopyAndCut().
+@li Using wxToolBar::DeleteTool() and wxToolBar::InsertTool() to dynamically update the
toolbar.
Some buttons in the main toolbar are check buttons, i.e. they stay checked when
group, i.e. checking any of them automatically unchecks the previously
checked one.
+@sampledir{toolbar}
-@section page_samples_treectrl Treectrl Sample
+@section page_samples_treectrl wxTreeCtrl Sample
This sample demonstrates using the wxTreeCtrl class. Here
you may see how to process various notification messages sent by this control
sorting (in default alphabetical order as well as in custom one) is
demonstrated here as well - try the corresponding menu entries.
+@sampledir{treectrl}
+
+@section page_samples_typetest Types Sample
+
+@sampleabout{wxWidgets types}
+
+@todo Rewrite its description ASAP.
+
+@sampledir{typetest}
+
+@section page_samples_validate Validator Sample
+
+@sampleabout{wxValidator}
+
+@sampledir{validate}
+
+@section page_samples_vscroll VScrolled Window Sample
+
+@sampleabout{wxVScrolledWindow}
+
+@sampledir{vscroll}
@section page_samples_widgets Widgets Sample
the controls programmatically, such as adding an item to a list box etc.
All widgets are categorized for easy browsing.
+@sampledir{widgets}
@section page_samples_wizard Wizard Sample
dynamically decide which page to display next (see also
wxWizardPage)
+@sampledir{wizard}
+
+@section page_samples_wrapsizer wxWrapSizer Sample
+
+@sampleabout{wxWrapSizer}
+
+@sampledir{wrapsizer}
+
+@section page_samples_xrc XRC Sample
+
+@sampleabout{@ref overview_xrc}
+
+@sampledir{xrc}
+
*/