]> git.saurik.com Git - wxWidgets.git/blame - docs/tech/tn0003.txt
Added context help stuff to wxPython
[wxWidgets.git] / docs / tech / tn0003.txt
CommitLineData
12646a5a
JS
1 Adding wxWindows class documentation
2 ====================================
3
4This note is aimed at people wishing to add documentation for a
5class to either the main wxWindows manual, or to their own
6manual.
7
8wxWindows uses Tex2RTF to process Latex-like input files (.tex)
9and output in HTML, WinHelp RTF and Word RTF. Tex2RTF is provided
10in the wxWindows distribution and in the CVS archive, under
11utils/tex2rtf. Please start by perusing the Tex2RTF manual.
12
13If adding to the existing manual in docs/latex/wx, you need to
14create a new .tex file, e.g. myclass.tex, and add it to the
15list of classes in classes.tex (in strict alphabetical order).
16You may also want to write a separate topic file, e.g. tmyclass.tex,
b74d0665
GT
17and add the entry to topics.tex. Also, if applicable, and an entry
18to category.tex.
12646a5a
JS
19
20If compiling a separate manual, copy an existing set of files from the
21wxWindows manual or a contribution. Contribution documentation
22normally goes in the contrib/docs hierarchy, with the source
23going in a latex/mycontrib subdirectory.
24
25You can generate a first pass at the myclass.tex file by
26compiling and running HelpGen (utils/helpgen).
27
28Running Tex2RTF
29===============
30
31See the Tex2RTF documentation, but here are some forms:
32
33For HTML:
34
35 tex2rtf manual.tex manual.htm -html -twice
36
37Use of -twice allows Tex2RTF to resolve references. Note that
38if both filenames are given (first two parameters on the command
39line) then Tex2RTF will run in non-interactive mode.
40
41For WinHelp RTF:
42
43 tex2rtf manual.tex manual.rtf -winhelp -twice
44
45For Word RTF:
46
47 tex2rtf manual.tex manual.rtf -rtf -twice
48
3ca6a5f0
BP
49If you wish to have a GUI display show the status of what is happening
50as the conversion is happening, use the '-interactive' command line
51parameter, and then choose FILE|GO from the menu. For example:
52
53 tex2rtf manual.tex manual.rtf -rtf -twice -interactive
54
55NOTE: You must be using the latest tex2rtf which was released with
b74d0665 56v2.2.0 of wxWindows to use the -interactive switch
3ca6a5f0 57
12646a5a
JS
58If you wish to generate documentation for wxHTML Help Viewer
59(or Windows HTML Help), set htmlWorkshopFiles to true in your
60tex2rtf.ini file. See also the wxHTML Notes section in the
23d38b36
VS
61wxWindows manual. To futher speed-up HTML help books loading
62in your application, you may use hhp2cached (utils/hhp2cached).
12646a5a
JS
63
64src/msw/makefile.vc contains targets for generating various
65formats of documentation. You may like to do something similar if
66writing your own manual.
67
68Important Dos and Don'ts
69========================
70
71DO:
72
73- put a space (or \rtfsp) at the end of a line or start of a line where
74 a command ends or starts the line. Otherwise, spaces will be
75 omitted in Word or WinHelp RTF. For example:
76
77 See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr}\rtfsp
78 for a list of possible values.
79
80- leave a blank line at the end of the class file. This is
81 important, or the Word RTF table of contents will be messed up.
82
83- leave a blank line between a heading and the next paragraph.
84
85- test your changes, preferably converting the manual to WinHelp
86 format and running through the Windows help compiler to check
87 for missing labels, etc.
88
b74d0665
GT
89- quote all '_' characters with a '\' character (e.g. "MY\_PROGRAM"
90 unless the '_' is inside a comment or a \begin{verbatim} ...
91 \end{verbatim} block
92
93- check that your changes/additions to any TEX documentation
94 compiles before checking it in! Use the '-checkcurleybrace'
95 and '-checksyntax' commandline parameters (or the OPTIONS menu
96 if running in GUI mode) to check for some of the more common
97 mistakes. See TROUBLESHOOTING below for more details
98
99
12646a5a
JS
100DON'T:
101
102- use jargon, such as 'gonna', or omit the definite article.
103 The manual is intended to be a fluent, English document and
104 not a collection of rough notes.
105
106- use non-alphanumeric characters in labels.
107
108- use incompatible Latex syntax, such as {\it \bf word} (use a pair
109 of braces for each formatting command).
110
111- leave multiple consecutive blank lines, or blank lines between
112 \items in a list.
113
b74d0665
GT
114- use \verb$....$ syntax. Instead use \tt{....} syntax
115
116- add the following tokens anywhere except on a line by themselves:
117 \begin{verbatim}
118 \begin{toocomplex}
119 \end{verbatim}
120 \end{toocomplex}
121 \verb
122 \begin{comment}
123 \end{comment}
124 \verbatiminput
125 \par
126 \input
127 \helpinput
128 \include
129
130
12646a5a
JS
131Troubleshooting
132===============
133
134Please see the troubleshooting section in the Tex2RTF manual, but
135here is one important tip:
136
b74d0665 137 If you get a "Macro not found: \end{document}" error,
12646a5a
JS
138 this is a spurious side-effect of an earlier error, usually an
139 incorrect number of arguments to a command. The location of the
140 true error is then anywhere in the document.
141
142 To home in on the error, try putting \begin{comment}...\end{comment}
143 around much of the document, and then move the \begin{comment}
144 line down until the error manifests itself again. Note that
145 you can abort Tex2RTF after the syntax error stage by clicking
146 on the close button, so you don't have to wait while the whole
147 document is processed.
148
149 Before looking at a file in detail, you can comment out the
150 \input{myclass.tex} line in classes.tex using the single
151 line comment character (%) to see whether it was that file that
152 caused the problem.
153
b74d0665
GT
154 When making changes/additions to the documentation, always use
155 the '-checkcurleybraces' and '-checksyntax' commandline parameters
156 (or turn these options on in the GUI version via the OPTIONS menu
157 choice), BEFORE checking in your changes. These two debugging
158 options will catch many of the more common mistakes that are made
159 while writing documents, plus they will catch some of the uses
160 of TeX that are correct syntax-wise, but that tex2rtf cannot
161 handle properly, and report the problems (usually along with
162 a filename and line number that they occur in!) in the programs
163 output window (GUI mode).
164
12646a5a
JS
165Elements in a class file
166========================
167
168Start off with:
169
170\section{\class{wxMyClass}}\label{wxmyclass}
171
172(note that labels can only go on sections such as \chapter,
173\section, \subsection, \membersection, but not on \wxheading, for
174example.)
175
176Describe the class briefly.
177
178Then there are several \wxheading sections:
179
180\wxheading{Derived from}
181
182List the base classes, with line breaks following each one (\\)
183except the last.
184
185\wxheading{Include files}
186
187List the relevant include files, for example:
188
189<wx/myclass.h>
190
191\wxheading{Predefined objects}
192
193List any predefined objects, such as:
194
195{\bf wxNullMyClass}
196
197\wxheading{See also}
198
199List any relevant classes or topics, using \helpref.
200
201\latexignore{\rtfignore{\wxheading{Members}}}
202
203This generates the required heading for the member definitions.
204Put the constructors first, then in alphabetical order, the other
205members.
206
207Here's an example of documentation for a member function:
208
209 --------------------:x-----------------------
210
211\membersection{wxBitmap::Create}\label{wxbitmapcreate}
212
213\func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height},
214 \param{int}{ depth = -1}}
215
216Creates a fresh bitmap. If the final argument is omitted, the display depth of
217the screen is used.
218
219\func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type},
220 \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
221
222Creates a bitmap from the given data, which can be of arbitrary type.
223
224\wxheading{Parameters}
225
226\docparam{width}{The width of the bitmap in pixels.}
227
228\docparam{height}{The height of the bitmap in pixels.}
229
230\docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.}
231
232\docparam{data}{Data whose type depends on the value of {\it type}.}
233
234\docparam{type}{A bitmap type identifier - see \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for a list
235of possible values.}
236
237\wxheading{Return value}
238
239TRUE if the call succeeded, FALSE otherwise.
240
241\wxheading{Remarks}
242
243The first form works on all platforms. The portability of the second form depends on the
244type of data.
245
246\wxheading{See also}
247
248\helpref{wxBitmap::wxBitmap}{wxbitmapconstr}
249
250 --------------------:x-----------------------
251
252Note the use of \docparam to document parameters; and the fact
253that several overloaded forms of the same member function are
254documented within the same \membersection.
255