1 Adding wxWindows class documentation
2 ====================================
4 This note is aimed at people wishing to add documentation for a
5 class to either the main wxWindows manual, or to their own
8 wxWindows uses Tex2RTF to process Latex-like input files (.tex)
9 and output in HTML, WinHelp RTF and Word RTF. Tex2RTF is provided
10 in the wxWindows distribution and in the CVS archive, under
11 utils/tex2rtf. Please start by perusing the Tex2RTF manual.
13 If adding to the existing manual in docs/latex/wx, you need to
14 create a new .tex file, e.g. myclass.tex, and add it to the
15 list of classes in classes.tex (in strict alphabetical order).
16 You may also want to write a separate topic file, e.g. tmyclass.tex,
17 and add the entry to topics.tex. Also, if applicable, and an entry
20 If compiling a separate manual, copy an existing set of files from the
21 wxWindows manual or a contribution. Contribution documentation
22 normally goes in the contrib/docs hierarchy, with the source
23 going in a latex/mycontrib subdirectory.
25 You can generate a first pass at the myclass.tex file by
26 compiling and running HelpGen (utils/helpgen).
31 See the Tex2RTF documentation, but here are some forms:
35 tex2rtf manual.tex manual.htm -html -twice
37 Use of -twice allows Tex2RTF to resolve references. Note that
38 if both filenames are given (first two parameters on the command
39 line) then Tex2RTF will run in non-interactive mode.
43 tex2rtf manual.tex manual.rtf -winhelp -twice
47 tex2rtf manual.tex manual.rtf -rtf -twice
49 If you wish to have a GUI display show the status of what is happening
50 as the conversion is happening, use the '-interactive' command line
51 parameter, and then choose FILE|GO from the menu. For example:
53 tex2rtf manual.tex manual.rtf -rtf -twice -interactive
55 NOTE: You must be using the latest tex2rtf which was released with
56 v2.2.0 of wxWindows to use the -interactive switch
58 If you wish to generate documentation for wxHTML Help Viewer
59 (or Windows HTML Help), set htmlWorkshopFiles to true in your
60 tex2rtf.ini file. See also the wxHTML Notes section in the
61 wxWindows manual. To futher speed-up HTML help books loading
62 in your application, you may use hhp2cached (utils/hhp2cached).
64 src/msw/makefile.vc contains targets for generating various
65 formats of documentation. You may like to do something similar if
66 writing your own manual.
68 Important Dos and Don'ts
69 ========================
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:
77 See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr}\rtfsp
78 for a list of possible values.
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.
83 - leave a blank line between a heading and the next paragraph.
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.
89 - quote all '_' characters with a '\' character (e.g. "MY\_PROGRAM"
90 unless the '_' is inside a comment or a \begin{verbatim} ...
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
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.
106 - use non-alphanumeric characters in labels.
108 - use incompatible Latex syntax, such as {\it \bf word} (use a pair
109 of braces for each formatting command).
111 - leave multiple consecutive blank lines, or blank lines between
114 - use \verb$....$ syntax. Instead use \tt{....} syntax
116 - add the following tokens anywhere except on a line by themselves:
134 Please see the troubleshooting section in the Tex2RTF manual, but
135 here is one important tip:
137 If you get a "Macro not found: \end{document}" error,
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.
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.
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
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).
165 Elements in a class file
166 ========================
170 \section{\class{wxMyClass}}\label{wxmyclass}
172 (note that labels can only go on sections such as \chapter,
173 \section, \subsection, \membersection, but not on \wxheading, for
176 Describe the class briefly.
178 Then there are several \wxheading sections:
180 \wxheading{Derived from}
182 List the base classes, with line breaks following each one (\\)
185 \wxheading{Include files}
187 List the relevant include files, for example:
191 \wxheading{Predefined objects}
193 List any predefined objects, such as:
199 List any relevant classes or topics, using \helpref.
201 \latexignore{\rtfignore{\wxheading{Members}}}
203 This generates the required heading for the member definitions.
204 Put the constructors first, then in alphabetical order, the other
207 Here's an example of documentation for a member function:
209 --------------------:x-----------------------
211 \membersection{wxBitmap::Create}\label{wxbitmapcreate}
213 \func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height},
214 \param{int}{ depth = -1}}
216 Creates a fresh bitmap. If the final argument is omitted, the display depth of
219 \func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type},
220 \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
222 Creates a bitmap from the given data, which can be of arbitrary type.
224 \wxheading{Parameters}
226 \docparam{width}{The width of the bitmap in pixels.}
228 \docparam{height}{The height of the bitmap in pixels.}
230 \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.}
232 \docparam{data}{Data whose type depends on the value of {\it type}.}
234 \docparam{type}{A bitmap type identifier - see \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for a list
237 \wxheading{Return value}
239 TRUE if the call succeeded, FALSE otherwise.
243 The first form works on all platforms. The portability of the second form depends on the
248 \helpref{wxBitmap::wxBitmap}{wxbitmapconstr}
250 --------------------:x-----------------------
252 Note the use of \docparam to document parameters; and the fact
253 that several overloaded forms of the same member function are
254 documented within the same \membersection.