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 one of the docs/doxygen/mainpages/cat_*.h
27 You can generate a first raw version of myclass.h simply taking its
28 "real" header and removing all the private and protected sections and
29 in general removing everything the user "shouldn't know": i.e. all things
30 which are implementation details.
36 First, make sure you have a recent version of Doxygen installed in your system.
40 1) cd wxWidgets/docs/doxygen
41 2) run ./regen.sh [Unix] or regen.bat [Windows]
43 [TODO: istructions for generation of other formats]
46 Important Dos and Don'ts
47 ========================
51 - Doxygen supports both commands in the form \command and @command;
52 all wxWidgets documentation uses the @command form.
53 Follow strictly this rule.
55 - strive to use dedicated Doxygen commands for e.g. notes, lists,
56 sections, etc. The "Special commands" page:
57 http://www.stack.nl/~dimitri/doxygen/commands.html
59 It's also very important to make a consistent use of the ALIASES
60 defined by wxWidgets' Doxyfile. Open that file for more info.
62 - when you write true, false and NULL with their C++ semantic meaning,
63 then use the @true, @false and @NULL commands.
65 - separe different paragraphs with an empty comment line.
66 This is important otherwise Doxygen puts everything in the same
67 paragraph making the result less readable.
69 - leave a blank comment line between a @section, @subsection, @page
70 and the next paragraph.
72 - test your changes, both reading the generated HTML docs and by looking
73 at the "doxygen.log" file produced (which will warn you about any
74 eventual mistake found in the comments).
76 - quote all the following characters prefixing them with a "@" char:
80 unless they appear inside a @code or @verbatim section
81 (you can also use HTML-style escaping, e.g. & rather than @ escaping)
83 - when using a Doxygen alias like @itemdef{}, you need to escape the
84 comma characters which appear on the first argument, otherwise Doxygen
85 will interpret them as the marker of the end of the first argument and
86 the beginning of the second argument's text.
88 E.g. if you want to define the item "wxEVT_MACRO(id, func)" you need to
90 @itemdef{wxEVT_MACRO(id\, func), This is the description of the macro}
92 Also note that you need to escape only the commas of the first argument's text;
93 second argument can have up to 10 commas unescaped (see the Doxyfile for the
94 trick used to implement this).
98 - use jargon, such as 'gonna', or omit the definite article.
99 The manual is intended to be a fluent, English document and
100 not a collection of rough notes.
102 - use non-alphanumeric characters in link anchors.
104 - use Doxygen @b @c @e commands when referring to more than a single word;
105 in that case you need to use the <b>...</b>, <tt>...</tt>, <em>...</em>
106 HTML-style tags instead
108 - use HTML style tags for creation of tables or lists.
109 Use wx aliases instead like @beginTable, @row2col, @row3col, @endTable and
110 @beginDefList, @itemdef, @endDefList, etc.
111 See the Doxyfile for more info.
113 - use # character for linking; use either the @ref command (to refer to topic
114 overviews, for example) or the () suffix (to refer to function members of the
115 same class you're documenting), or the :: operator (to refer to functions
116 of classes different from the one you're documenting).
117 Other entitites like global functions, global instances or class names are
118 auto-linked by Doxygen without the need of any explicit command.
121 Documentation comment for a class
122 =================================
128 * @wxheader{myclass.h}
130 * ...here goes the description...
133 * @event{EVT_SOME_EVENT(id, func)}:
134 * Description for EVT_SOME_EVENT.
138 * @style{wxSOME_STYLE}:
139 * Description for wxSOME_STYLE.
143 * @beginExtraStyleTable
144 * @style{wxSOME_EXTRA_STYLE}:
145 * Description for wxSOME_EXTRA_STYLE.
147 * @endExtraStyleTable
151 * ...here goes the list of predefined instances...
154 * ...here goes the see-also list...
155 * you can make references to topic overviews or other
156 * manual pages using the @ref command
159 Note that the events, styles and extra-styles tables as
160 well as @stdobjects and @seealso lists are optional.
162 Also note that you shouldn't use the Doxygen builtin @sa command
163 for the see-also list but rather the wxWidgets' alias @seealso
167 Documentation comment for a function
168 ====================================
173 * ...here goes the description of the function....
176 * ...here goes the description for the first parameter of this function
178 * ...here goes the description for the second parameter of this function
182 * ...here goes the description of what the function returns...
184 * @note ...here go any eventual notes about this function...
186 * @remarks ...here go any eventual remarks about this function...
188 * @sa ...here goes the see-also list...
191 Note that the @return, @note, @remarks, @sa commands are optional.
193 Also note that unlike for class' description, you should use the doxygen
194 builtin @sa command here for see-also lists.
196 The @param command has an optional attribute specifying the direction of
197 the attribute. Possible values are "in" and "out". E.g.
200 * Copies bytes from a source memory area to a destination memory area,
201 * where both areas may not overlap.
202 * @param[out] dest The memory area to copy to.
203 * @param[in] src The memory area to copy from.
204 * @param[in] n The number of bytes to copy.
205 * @param[in,out] pmisc Used both as input and as output.
207 void func(void *dest, const void *src, size_t n, void *pmisc);
210 Documentation comment for a topic overview
211 ==========================================
213 Topic overviews are stored inside the docs/doxygen/overviews folder
214 and are completely placed inside a single comment block in the form of:
218 @page overview_tname wxSomeStuff overview
220 This page provides an overview of the wxSomeStuff and related classes.
223 @li @ref overview_tname_intro
224 @li @ref overview_tname_details
230 @section overview_tname_intro Introduction
232 ...here goes the introduction to this topic...
235 @section overview_tname_details Details
237 ...here go the details to this topic...
241 Note that there is a convention in the anchor link names.
242 Doxygen in fact requires that for each @page, @section, @subsection, etc tag,
243 there is a corresponding link anchor.
245 The following conventions are used in wxWidgets doxygen comments:
247 1) all "main" pages of the manual (those which are placed in docs/doxygen/mainpages)
248 have link anchors which begin with "page_"
250 2) all topic overviews (those which are placed in docs/doxygen/overviews) have link
251 anchors which begin with "overview_"
253 3) all @section, @subsection, @subsubsection tags should have as link anchor name
254 the name of the parent section plus a specific word separed with an underscore; e.g.:
258 @page overview_tname wxSomeStuff overview
260 @section overview_tname_intro Introduction
261 @subsection overview_tname_intro_firstpart First part
262 @subsection overview_tname_intro_secondpart Second part
263 @subsubsection overview_tname_intro_secondpart_sub Second part subsection
264 @subsection overview_tname_intro_thirdpart Third part
266 @section overview_tname_details Details
274 Author: FM (under the lines of the previous technote about tex2rtf)