]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/module.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Modules handling
4 // Author: Wolfram Gloger/adapted by Guilhem Lavaux
8 // Copyright: (c) Wolfram Gloger and Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "module.h"
19 #include "wx/object.h"
22 // declare a linked list of modules
24 WX_DECLARE_EXPORTED_LIST(wxModule
, wxModuleList
);
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
33 virtual ~wxModule() {}
35 // if module init routine returns FALSE application
36 // will fail to startup
38 bool Init() { return OnInit(); }
39 void Exit() { OnExit(); }
41 // Override both of these
42 // called on program startup
44 virtual bool OnInit() = 0;
46 // called just before program termination, but only if OnInit()
49 virtual void OnExit() = 0;
51 static void RegisterModule(wxModule
* module);
52 static void RegisterModules();
53 static bool InitializeModules();
54 static void CleanUpModules();
56 // used by wxObjectLoader when unloading shared libs's
58 static void UnregisterModule(wxModule
* module);
61 static wxModuleList m_modules
;
63 DECLARE_CLASS(wxModule
)
66 #endif // _WX_MODULEH__