]>
Commit | Line | Data |
---|---|---|
eb91c0be VZ |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: tsamples.tex | |
3 | %% Purpose: Samples description | |
4 | %% Author: Vadim Zeitlin | |
5 | %% Modified by: | |
6 | %% Created: 02.11.99 | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) wxWindows team | |
9 | %% Licence: wxWindows licence | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | ||
12 | \section{wxWindows samples}\label{samples} | |
13 | ||
14 | Probably the best way to learn wxWindows is by reading the source of some 50+ | |
15 | samples provided with it. Many aspects of wxWindows programming can be learnt | |
16 | from them, but sometimes it is not simple to just choose the right sample to | |
17 | look at. This overview aims at describing what each sample does/demonstrates to | |
18 | make it easier to find the relevant one if a simple grep through all sources | |
19 | didn't help. They also provide some notes about using the samples and what | |
20 | features of wxWindows are they supposed to test. | |
21 | ||
775a998e VZ |
22 | \subsection{Font sample}\label{samplefont} |
23 | ||
24 | The font sample demonstrates \helpref{wxFont}{wxfont}, | |
25 | \helpref{wxFontEnumerator}{wxfontenumerator} and | |
26 | \helpref{wxFontMapper}{wxfontmapper} classes. It allows you to see the fonts | |
27 | available (to wxWindows) on the computer and shows all characters of the | |
28 | chosen font as well. | |
29 | ||
c03648c2 | 30 | \subsection{DnD sample}\label{samplednd} |
eb91c0be VZ |
31 | |
32 | This sample shows both clipboard and drag and drop in action. It is quite non | |
33 | trivial and may be safely used as a basis for implementing the clipboard and | |
34 | drag and drop operations in a real-life program. | |
35 | ||
36 | When you run the sample, its screen is split in several parts. On the top, | |
37 | there are two listboxes which show the standard derivations of | |
38 | \helpref{wxDropTarget}{wxdroptarget}: | |
39 | \helpref{wxTextDropTarget}{wxtextdroptarget} and | |
40 | \helpref{wxFileDropTarget}{wxfiledroptarget}. | |
41 | ||
42 | The middle of the sample window is taken by the log window which shows what is | |
43 | going on (of course, this only works in debug builds) and may be helpful to see | |
44 | the sequence of steps of data transfer. | |
45 | ||
46 | Finally, the last part is used for two things: you can drag text from it to | |
47 | either one of the listboxes (only one will accept it) or another application | |
48 | and, also, bitmap pasted from clipboard will be shown there. | |
49 | ||
50 | So far, everything we mentioned was implemented with minimal amount of code | |
51 | using standard wxWindows classes. The more advanced features are demonstrated | |
52 | if you create a shape frame from the main frame menu. A shape is a geometric | |
53 | object which has a position, size and color. It models some | |
54 | application-specific data in this sample. A shape object supports its own | |
55 | private \helpref{wxDataFormat}{wxdataformat} which means that you may cut and | |
56 | paste it or drag and drop (between one and the same or different shapes) from | |
57 | one sample instance to another (or the same). However, chances are that no | |
58 | other program supports this format and so shapes can also be rendered as | |
59 | bitmaps which allows them to be pasted/dropped in many other applications. | |
60 | ||
61 | Take a look at DnDShapeDataObject class to see how you may use | |
62 | \helpref{wxDataObject}{wxdataobject} to achieve this. | |
cd77c085 | 63 | |
61eff74f VS |
64 | |
65 | \subsection{HTML samples}\label{samplehtml} | |
66 | ||
67 | Eight HTML samples (you can find them in directory {\tt samples/html}) | |
68 | cover all features of HTML sub-library. | |
69 | ||
70 | {\bf Test} demonstrates how to create \helpref{wxHtmlWindow}{wxhtmlwindow} | |
71 | and also shows most of supported HTML tags. | |
72 | ||
73 | {\bf Widget} shows how you can embed ordinary controls or windows within | |
74 | HTML page. It also nicely explains how to write new tag handlers and extend | |
75 | the library to work with unsupported tags. | |
76 | ||
77 | {\bf About} may give you an idea how to write good-looking about boxes. | |
78 | ||
79 | {\bf Zip} demonstrates use of virtual file systems in wxHTML. The zip archives | |
80 | handler (ships with wxWindows) allows you to access HTML pages stored | |
81 | in compressed archive as if they were ordinary files. | |
82 | ||
83 | {\bf Virtual} is yet another VFS demo. This one generates pages at run-time. | |
84 | You may find it useful if you need to display some reports in your application. | |
85 | ||
86 | {\bf Printing} explains use of \helpref{wxHtmlEasyPrinting}{wxhtmleasyprinting} | |
87 | class which serves as as-simple-as-possible interface for printing HTML | |
88 | documents without much work. In fact, only few function calls are sufficient. | |
89 | ||
90 | {\bf Help} and {\bf Helpview} are variations on displaying HTML help | |
91 | (compatible with MS HTML Help Workshop). {\it Help} shows how to embed | |
92 | \helpref{wxHtmlHelpController}{wxhtmlhelpcontroller} in your application | |
93 | while {\it Helpview} is simple tool that only pops up help window and | |
94 | displays help books given at command line. | |
95 |