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.
12 See http://www.wxwindows.org/tex2rtf/index.htm for a browseable
13 manual and binaries for specific platforms.
15 If adding to the existing manual in docs/latex/wx, you need to
16 create a new .tex file, e.g. myclass.tex, and add it to the
17 list of classes in classes.tex (in strict alphabetical order).
18 You may also want to write a separate topic file, e.g. tmyclass.tex,
19 and add the entry to topics.tex. If applicable, also add an entry
22 If compiling a separate manual, copy an existing set of files from the
23 wxWindows manual or a contribution. Contribution documentation
24 normally goes in the contrib/docs hierarchy, with the source
25 going in a latex/mycontrib subdirectory.
27 You can generate a first pass at the myclass.tex file by
28 compiling and running HelpGen (utils/helpgen).
33 See the Tex2RTF documentation, but here are some forms:
37 tex2rtf manual.tex manual.htm -html -twice
39 Use of -twice allows Tex2RTF to resolve references. Note that
40 if both filenames are given (first two parameters on the command
41 line) then Tex2RTF will run in non-interactive mode.
45 tex2rtf manual.tex manual.rtf -winhelp -twice
49 tex2rtf manual.tex manual.rtf -rtf -twice
51 If you wish to have a GUI display show the status of what is happening
52 as the conversion is happening, use the '-interactive' command line
53 parameter, and then choose FILE|GO from the menu. For example:
55 tex2rtf manual.tex manual.rtf -rtf -twice -interactive
57 NOTE: You must be using the latest tex2rtf which was released with
58 v2.2.0 of wxWindows to use the -interactive switch
60 If you wish to generate documentation for wxHTML Help Viewer
61 (or Windows HTML Help), set htmlWorkshopFiles to true in your
62 tex2rtf.ini file. See also the wxHTML Notes section in the
63 wxWindows manual. To further speed-up HTML help books loading
64 in your application, you may use hhp2cached (utils/hhp2cached).
66 src/msw/makefile.vc contains targets for generating various
67 formats of documentation. You may like to do something similar if
68 writing your own manual.
70 Important Dos and Don'ts
71 ========================
75 - put a space (or \rtfsp) at the end of a line or start of a line where
76 a command ends or starts the line. Otherwise, spaces will be
77 omitted in Word or WinHelp RTF. For example:
79 See \helpref{wxBitmap::wxBitmap}{wxbitmapconstr}\rtfsp
80 for a list of possible values.
82 - leave a blank line at the end of the class file. This is
83 important, or the Word RTF table of contents will be messed up.
85 - leave a blank line between a heading and the next paragraph.
87 - test your changes, preferably converting the manual to WinHelp
88 format and running through the Windows help compiler to check
89 for missing labels, etc.
91 - quote all '_' characters with a '\' character (e.g. "MY\_PROGRAM"
92 unless the '_' is inside a comment or a \begin{verbatim} ...
95 - check that your changes/additions to any TEX documentation
96 compiles before checking it in! Use the '-checkcurleybraces'
97 and '-checksyntax' commandline parameters (or the OPTIONS menu
98 if running in GUI mode) to check for some of the more common
99 mistakes. See TROUBLESHOOTING below for more details
104 - use jargon, such as 'gonna', or omit the definite article.
105 The manual is intended to be a fluent, English document and
106 not a collection of rough notes.
108 - use non-alphanumeric characters in labels.
110 - use incompatible Latex syntax, such as {\it \bf word} (use a pair
111 of braces for each formatting command).
113 - leave multiple consecutive blank lines, or blank lines between
116 - use \verb$....$ syntax. Instead use \tt{....} syntax
118 - add the following tokens anywhere except on a line by themselves:
136 Please see the troubleshooting section in the Tex2RTF manual, but
137 here is one important tip:
139 If you get a "Macro not found: \end{document}" error,
140 this is a spurious side-effect of an earlier error, usually an
141 incorrect number of arguments to a command. The location of the
142 true error is then anywhere in the document.
144 To home in on the error, try putting \begin{comment}...\end{comment}
145 around much of the document, and then move the \begin{comment}
146 line down until the error manifests itself again. Note that
147 you can abort Tex2RTF after the syntax error stage by clicking
148 on the close button, so you don't have to wait while the whole
149 document is processed.
151 Before looking at a file in detail, you can comment out the
152 \input{myclass.tex} line in classes.tex using the single
153 line comment character (%) to see whether it was that file that
156 When making changes/additions to the documentation, always use
157 the '-checkcurleybraces' and '-checksyntax' commandline parameters
158 (or turn these options on in the GUI version via the OPTIONS menu
159 choice), BEFORE checking in your changes. These two debugging
160 options will catch many of the more common mistakes that are made
161 while writing documents, plus they will catch some of the uses
162 of TeX that are correct syntax-wise, but that tex2rtf cannot
163 handle properly, and report the problems (usually along with
164 a filename and line number that they occur in!) in the programs
165 output window (GUI mode).
167 Elements in a class file
168 ========================
172 \section{\class{wxMyClass}}\label{wxmyclass}
174 (note that labels can only go on sections such as \chapter,
175 \section, \subsection, \membersection, but not on \wxheading, for
178 Describe the class briefly.
180 Then there are several \wxheading sections:
182 \wxheading{Derived from}
184 List the base classes, with line breaks following each one (\\)
187 \wxheading{Include files}
189 List the relevant include files, for example:
193 \wxheading{Predefined objects}
195 List any predefined objects, such as:
201 List any relevant classes or topics, using \helpref.
203 \latexignore{\rtfignore{\wxheading{Members}}}
205 This generates the required heading for the member definitions.
206 Put the constructors first, then in alphabetical order, the other
209 Here's an example of documentation for a member function:
211 --------------------:x-----------------------
213 \membersection{wxBitmap::Create}\label{wxbitmapcreate}
215 \func{virtual bool}{Create}{\param{int}{ width}, \param{int}{ height},
216 \param{int}{ depth = -1}}
218 Creates a fresh bitmap. If the final argument is omitted, the display depth of
221 \func{virtual bool}{Create}{\param{void*}{ data}, \param{int}{ type},
222 \param{int}{ width}, \param{int}{ height}, \param{int}{ depth = -1}}
224 Creates a bitmap from the given data, which can be of arbitrary type.
226 \wxheading{Parameters}
228 \docparam{width}{The width of the bitmap in pixels.}
230 \docparam{height}{The height of the bitmap in pixels.}
232 \docparam{depth}{The depth of the bitmap in pixels. If this is -1, the screen depth is used.}
234 \docparam{data}{Data whose type depends on the value of {\it type}.}
236 \docparam{type}{A bitmap type identifier - see \helpref{wxBitmap::wxBitmap}{wxbitmapconstr} for a list
239 \wxheading{Return value}
241 {\tt true} if the call succeeded, {\tt false} otherwise.
245 The first form works on all platforms. The portability of the second form depends on the
250 \helpref{wxBitmap::wxBitmap}{wxbitmapconstr}
252 --------------------:x-----------------------
254 Note the use of \docparam to document parameters; and the fact
255 that several overloaded forms of the same member function are
256 documented within the same \membersection.
261 - for a const member function use \constfunc{} instead of \const
263 - for a function without parameters use \func{...}{Function}{\void}
265 - but do NOT use \void for functions without return value, just "void"
267 - for a virtual/static member function use \func{virtual/static ...}
269 - omit the return type for constructors: \func{}{MyClass}{...}
271 - use \destruct macro for the destructors \func{}{\destruct{MyClass}}{\void}