]> git.saurik.com Git - wxWidgets.git/blame - include/wx/module.h
attempt to fix endian problems when doing cross-compiles for universal binaries from...
[wxWidgets.git] / include / wx / module.h
CommitLineData
c801d85f
KB
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
65571936 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
9945c703
DS
12#ifndef _WX_MODULE_H_
13#define _WX_MODULE_H_
c801d85f 14
c801d85f
KB
15#include "wx/object.h"
16#include "wx/list.h"
c801d85f 17
8aa4edd2 18// declare a linked list of modules
446e5259 19class WXDLLIMPEXP_BASE wxModule;
4460b6c4 20WX_DECLARE_USER_EXPORTED_LIST(wxModule, wxModuleList, WXDLLIMPEXP_BASE);
8aa4edd2
VZ
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)
bddd7a8d 25class WXDLLIMPEXP_BASE wxModule : public wxObject
c801d85f
KB
26{
27public:
8aa4edd2
VZ
28 wxModule() {}
29 virtual ~wxModule() {}
c801d85f 30
9945c703
DS
31 // if module init routine returns false the application
32 // will fail to startup
0b9ab0bd 33
8aa4edd2
VZ
34 bool Init() { return OnInit(); }
35 void Exit() { OnExit(); }
c801d85f 36
9945c703
DS
37 // Override both of these
38
8aa4edd2 39 // called on program startup
0b9ab0bd 40
8aa4edd2 41 virtual bool OnInit() = 0;
0b9ab0bd 42
9945c703 43 // called just before program termination, but only if OnInit()
8aa4edd2 44 // succeeded
9945c703 45
8aa4edd2 46 virtual void OnExit() = 0;
c801d85f 47
9945c703 48 static void RegisterModule(wxModule *module);
8aa4edd2
VZ
49 static void RegisterModules();
50 static bool InitializeModules();
51 static void CleanUpModules();
c801d85f 52
9945c703 53 // used by wxObjectLoader when unloading shared libs's
0b9ab0bd 54
9945c703 55 static void UnregisterModule(wxModule *module);
0b9ab0bd 56
c801d85f 57protected:
8aa4edd2 58 static wxModuleList m_modules;
c801d85f 59
8aa4edd2 60 DECLARE_CLASS(wxModule)
c801d85f
KB
61};
62
9945c703 63#endif // _WX_MODULE_H_
c801d85f 64