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