1 Adding wxWidgets class documentation
2 ====================================
4 This note is aimed at people wishing to add documentation for a
5 class to either the main wxWidgets manual, or to their own
8 wxWidgets uses Doxygen to process header input files with embedded
9 documentation in the form of C++ comments and output in HTML, and XML
10 (Doxygen itself can also output Latex, manpages, RTF, PDF etc).
11 See http://www.doxygen.org for more info about Doxygen.
13 If you want to add documentation of a new class/function to the
14 existing manual in docs/doxygen, you need to create a new .h file,
15 e.g. myclass.h, under the interface folder, which contains the public
16 interface of the new class/function in C++ syntax.
17 The documentation can then be added in form of Doxygen comments to
20 You may also want to write a separate topic file,
21 e.g. docs/doxygen/overviews/myclass.h, and add the entry to
22 docs/doxygen/mainpages/topics.h.
24 If applicable, also add an entry to docs/doxygen/mainpages/categories.h.
26 You can generate a first raw version of myclass.h simply taking its
27 "real" header and removing all the private and protected sections and
28 in general removing everything the user "shouldn't know": i.e. all things
29 which are implementation details.
35 First, make sure you have a recent version of Doxygen installed in your system.
39 1) cd wxWidgets/docs/doxygen
40 2) run ./regen.sh [Unix] or regen.bat [Windows]
42 [TODO: istructions for generation of other formats]
45 Important Dos and Don'ts
46 ========================
50 - Doxygen supports both commands in the form \command and @command;
51 all wxWidgets documentation uses the @command form.
53 - strive to use dedicated Doxygen commands for e.g. notes, lists,
54 sections, etc. The "Special commands" page:
55 http://www.stack.nl/~dimitri/doxygen/commands.html
57 It's also very important to make a consistent use of the ALIASES
58 defined by wxWidgets' Doxyfile. Open that file for more info.
60 - when you write true, false and NULL with their C++ semantic meaning,
61 then use the @true, @false and @NULL commands.
63 - separe different paragraphs with an empty comment line.
64 This is important otherwise Doxygen puts everything in the same
65 paragraph making the result less readable.
67 - leave a blank comment line between a @section, @subsection, @page
68 and the next paragraph.
70 - test your changes, both reading the generated HTML docs and by looking
71 at the "doxygen.log" file produced (which will warn you about any
72 eventual mistake found in the comments).
74 - quote all the following characters prefixing them with a "@" char:
78 unless they appear inside a @code or @verbatim section.
80 - when using a Doxygen alias like @itemdef{}, you need to escape the
81 comma characters which appear on the first argument, otherwise Doxygen
82 will interpret them as the marker of the end of the first argument and
83 the beginning of the second argument's text.
85 E.g. if you want to define the item "wxEVT_MACRO(id, func)" you need to
87 @itemdef{wxEVT_MACRO(id\, func), This is the description of the macro}
89 Also note that you need to escape only the commas of the first argument's text;
90 second argument can have up to 10 commas unescaped (see the Doxyfile for the
91 trick used to implement this).
95 - use jargon, such as 'gonna', or omit the definite article.
96 The manual is intended to be a fluent, English document and
97 not a collection of rough notes.
99 - use non-alphanumeric characters in link anchors.
101 - use Doxygen @b @c @e commands when referring to more than a single word;
102 in that case you need to use the <b>...</b>, <tt>...</tt>, <em>...</em>
103 HTML-style tags instead
105 - use HTML style tags for creation of tables or lists.
106 Use wx aliases instead like @beginTable, @row2col, @row3col, @endTable and
107 @beginDefList, @itemdef, @endDefList, etc.
108 See the Doxyfile for more info.
111 Documentation comment for a class
112 =================================
118 * @headerfile wx/myclass.h
120 * ...here goes the description...
123 * @event{EVT_SOME_EVENT(id, func)}:
124 * Description for EVT_SOME_EVENT.
128 * @style{wxSOME_STYLE}:
129 * Description for wxSOME_STYLE.
133 * @beginExtraStyleTable
134 * @style{wxSOME_EXTRA_STYLE}:
135 * Description for wxSOME_EXTRA_STYLE.
137 * @endExtraStyleTable
141 * ...here goes the list of predefined instances...
144 * ...here goes the see-also list...
145 * you can make references to topic overviews or other
146 * manual pages using the @ref command
149 Note that the events, styles and extra-styles tables as
150 well as @stdobjects and @seealso lists are optional.
152 Also note that you shouldn't use the Doxygen builtin @sa command
153 for the see-also list but rather the wxWidgets' alias @seealso
157 Documentation comment for a function
158 ====================================
163 * ...here goes the description of the function....
166 * ...here goes the description for the first parameter of this function
168 * ...here goes the description for the second parameter of this function
172 * ...here goes the description of what the function returns...
174 * @note ...here go any eventual notes about this function...
176 * @remarks ...here go any eventual remarks about this function...
178 * @sa ...here goes the see-also list...
181 Note that the @return, @note, @remarks, @sa commands are optional.
183 Also note that unlike for class' description, you should use the doxygen
184 builtin @sa command here for see-also lists.
186 The @param command has an optional attribute specifying the direction of
187 the attribute. Possible values are "in" and "out". E.g.
190 * Copies bytes from a source memory area to a destination memory area,
191 * where both areas may not overlap.
192 * @param[out] dest The memory area to copy to.
193 * @param[in] src The memory area to copy from.
194 * @param[in] n The number of bytes to copy.
195 * @param[in,out] pmisc Used both as input and as output.
197 void func(void *dest, const void *src, size_t n, void *pmisc);
200 Documentation comment for a topic overview
201 ==========================================
203 Topic overviews are stored inside the docs/doxygen/overviews folder
204 and are completely placed inside a single comment block in the form of:
208 @page overview_tname wxSomeStuff overview
210 This page provides an overview of the wxSomeStuff and related classes.
213 @li @ref overview_tname_intro
214 @li @ref overview_tname_details
220 @section overview_tname_intro Introduction
222 ...here goes the introduction to this topic...
225 @section overview_tname_details Details
227 ...here go the details to this topic...
231 Note that there is a convention in the anchor link names.
232 Doxygen in fact requires that for each @page, @section, @subsection, etc tag,
233 there is a corresponding link anchor.
235 The following conventions are used in wxWidgets doxygen comments:
237 1) all "main" pages of the manual (those which are placed in docs/doxygen/mainpages)
238 have link anchors which begin with "page_"
240 2) all topic overviews (those which are placed in docs/doxygen/overviews) have link
241 anchors which begin with "overview_"
243 3) all @section, @subsection, @subsubsection tags should have as link anchor name
244 the name of the parent section plus a specific word separed with an underscore; e.g.:
248 @page overview_tname wxSomeStuff overview
250 @section overview_tname_intro Introduction
251 @subsection overview_tname_intro_firstpart First part
252 @subsection overview_tname_intro_secondpart Second part
253 @subsubsection overview_tname_intro_secondpart_sub Second part subsection
254 @subsection overview_tname_intro_thirdpart Third part
256 @section overview_tname_details Details
264 Author: FM (under the lines of the previous technote about tex2rtf)