samples.h 33 KB

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