]> git.saurik.com Git - wxWidgets.git/blob - include/wx/module.h
OnGetLineHeight and OnGetLinesHint are virtual, so document them as such. Closes...
[wxWidgets.git] / include / wx / module.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: module.h
3 // Purpose: Modules handling
4 // Author: Wolfram Gloger/adapted by Guilhem Lavaux
5 // Modified by:
6 // Created: 04/11/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Wolfram Gloger and Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MODULE_H_
13 #define _WX_MODULE_H_
14
15 #include "wx/object.h"
16 #include "wx/list.h"
17
18 // declare a linked list of modules
19 class WXDLLIMPEXP_BASE wxModule;
20 WX_DECLARE_USER_EXPORTED_LIST(wxModule, wxModuleList, WXDLLIMPEXP_BASE);
21
22 // declaring a class derived from wxModule will automatically create an
23 // instance of this class on program startup, call its OnInit() method and call
24 // OnExit() on program termination (but only if OnInit() succeeded)
25 class WXDLLIMPEXP_BASE wxModule : public wxObject
26 {
27 public:
28 wxModule() {}
29 virtual ~wxModule() {}
30
31 // if module init routine returns false the application
32 // will fail to startup
33
34 bool Init() { return OnInit(); }
35 void Exit() { OnExit(); }
36
37 // Override both of these
38
39 // called on program startup
40
41 virtual bool OnInit() = 0;
42
43 // called just before program termination, but only if OnInit()
44 // succeeded
45
46 virtual void OnExit() = 0;
47
48 static void RegisterModule(wxModule *module);
49 static void RegisterModules();
50 static bool InitializeModules();
51 static void CleanUpModules();
52
53 // used by wxObjectLoader when unloading shared libs's
54
55 static void UnregisterModule(wxModule *module);
56
57 protected:
58 static wxModuleList m_modules;
59
60 DECLARE_CLASS(wxModule)
61 };
62
63 #endif // _WX_MODULE_H_
64