]> git.saurik.com Git - wxWidgets.git/blob - include/wx/module.h
compilation warning fixed
[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_MODULEH__
13 #define _WX_MODULEH__
14
15 #ifdef __GNUG__
16 #pragma interface "module.h"
17 #endif
18
19 #include "wx/object.h"
20 #include "wx/list.h"
21
22 // declare a linked list of modules
23 class wxModule;
24 WX_DECLARE_EXPORTED_LIST(wxModule, wxModuleList);
25
26 // declaring a class derived from wxModule will automatically create an
27 // instance of this class on program startup, call its OnInit() method and call
28 // OnExit() on program termination (but only if OnInit() succeeded)
29 class WXDLLEXPORT wxModule : public wxObject
30 {
31 public:
32 wxModule() {}
33 virtual ~wxModule() {}
34
35 // if module init routine returns FALSE application will fail to startup
36 bool Init() { return OnInit(); }
37 void Exit() { OnExit(); }
38
39 // Override both of these
40 // called on program startup
41 virtual bool OnInit() = 0;
42 // called just before program termination, but only if OnInit()
43 // succeeded
44 virtual void OnExit() = 0;
45
46 static void RegisterModule(wxModule* module);
47 static void RegisterModules();
48 static bool InitializeModules();
49 static void CleanUpModules();
50
51 protected:
52 static wxModuleList m_modules;
53
54 DECLARE_CLASS(wxModule)
55 };
56
57 #endif // _WX_MODULEH__
58