]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/module.tex
added missing brace after wxTB_NO_TOOLTIPS
[wxWidgets.git] / docs / latex / wx / module.tex
... / ...
CommitLineData
1\section{\class{wxModule}}\label{wxmodule}
2
3The module system is a very simple mechanism to allow applications (and parts of wxWidgets itself) to
4define initialization and cleanup functions that are automatically called on wxWidgets
5startup and exit.
6
7To define a new kind of module, derive a class from wxModule, override the OnInit and OnExit functions,
8and add the DECLARE\_DYNAMIC\_CLASS and IMPLEMENT\_DYNAMIC\_CLASS to header and implementation files
9(which can be the same file). On initialization, wxWidgets will find all classes derived from wxModule,
10create an instance of each, and call each OnInit function. On exit, wxWidgets will call the OnExit
11function for each module instance.
12
13Note that your module class does not have to be in a header file.
14
15For example:
16
17\begin{verbatim}
18 // A module to allow DDE initialization/cleanup
19 // without calling these functions from app.cpp or from
20 // the user's application.
21
22 class wxDDEModule: public wxModule
23 {
24 DECLARE_DYNAMIC_CLASS(wxDDEModule)
25 public:
26 wxDDEModule() {}
27 bool OnInit() { wxDDEInitialize(); return true; };
28 void OnExit() { wxDDECleanUp(); };
29 };
30
31 IMPLEMENT_DYNAMIC_CLASS(wxDDEModule, wxModule)
32\end{verbatim}
33
34\wxheading{Derived from}
35
36\helpref{wxObject}{wxobject}
37
38\wxheading{Include files}
39
40<wx/module.h>
41
42\latexignore{\rtfignore{\wxheading{Members}}}
43
44\membersection{wxModule::wxModule}\label{wxmodulector}
45
46\func{}{wxModule}{\void}
47
48Constructs a wxModule object.
49
50\membersection{wxModule::\destruct{wxModule}}\label{wxmoduledtor}
51
52\func{}{\destruct{wxModule}}{\void}
53
54Destructor.
55
56\membersection{wxModule::OnExit}\label{wxmoduleonexit}
57
58\func{virtual void}{OnExit}{\void}
59
60Provide this function with appropriate cleanup for your module.
61
62\membersection{wxModule::OnInit}\label{wxmoduleoninit}
63
64\func{virtual bool}{OnInit}{\void}
65
66Provide this function with appropriate initialization for your module. If the function
67returns false, wxWidgets will exit immediately.
68