]>
git.saurik.com Git - wxWidgets.git/blob - src/common/module.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Modules initialization/destruction
4 // Author: Wolfram Gloger/adapted by Guilhem Lavaux
8 // Copyright: (c) Wolfram Gloger and Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "module.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
23 #include "wx/module.h"
25 IMPLEMENT_CLASS(wxModule
, wxObject
)
27 wxList
wxModule::m_modules
;
29 void wxModule::RegisterModule(wxModule
* module)
31 m_modules
.Append(module);
34 // Collect up all module-derived classes, create an instance of each,
36 bool wxModule::RegisterModules(void)
38 wxClassInfo
* classInfo
= wxClassInfo::first
;
41 if ((classInfo
!= (& (wxModule::classwxModule
))) &&
42 classInfo
->IsKindOf(CLASSINFO(wxModule
)))
44 wxModule
* module = (wxModule
*) classInfo
->CreateObject();
45 RegisterModule(module);
47 classInfo
= classInfo
->next
;
52 bool wxModule::InitializeModules(void)
54 // Initialize user-defined modules
55 for (wxNode
*node
= m_modules
.First(); node
; node
= node
->Next())
57 if (!((wxModule
*)(node
->Data()))->Init())
63 void wxModule::CleanUpModules(void)
65 // Cleanup user-defined modules
66 for(wxNode
* node
= m_modules
.Last(); node
; node
= node
->Previous())
68 ((wxModule
*)(node
->Data()))->Exit();
69 delete (wxModule
*)(node
->Data());