]> git.saurik.com Git - wxWidgets.git/blame - src/common/module.cpp
added an error message if a bitmap can't be addedto the image list
[wxWidgets.git] / src / common / module.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: module.cpp
3// Purpose: Modules initialization/destruction
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#ifdef __GNUG__
13#pragma implementation "module.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#include "wx/module.h"
f4a8c29f 24#include "wx/hash.h"
c801d85f
KB
25
26IMPLEMENT_CLASS(wxModule, wxObject)
27
28wxList wxModule::m_modules;
29
30void wxModule::RegisterModule(wxModule* module)
31{
32 m_modules.Append(module);
33}
34
35// Collect up all module-derived classes, create an instance of each,
36// and register them.
37bool wxModule::RegisterModules(void)
38{
f4a8c29f
GL
39 wxNode *node;
40 wxClassInfo* classInfo;
41
0c32066b
JS
42 wxClassInfo::sm_classTable->BeginFind();
43 node = wxClassInfo::sm_classTable->Next();
f4a8c29f 44 while (node)
c801d85f 45 {
f4a8c29f 46 classInfo = (wxClassInfo *)node->Data();
0c32066b 47 if ((classInfo != (& (wxModule::sm_classwxModule))) &&
c801d85f
KB
48 classInfo->IsKindOf(CLASSINFO(wxModule)))
49 {
50 wxModule* module = (wxModule*) classInfo->CreateObject();
51 RegisterModule(module);
52 }
0c32066b 53 node = wxClassInfo::sm_classTable->Next();
c801d85f
KB
54 }
55 return TRUE;
56}
57
58bool wxModule::InitializeModules(void)
59{
60 // Initialize user-defined modules
61 for (wxNode *node = m_modules.First(); node; node = node->Next())
62 {
63 if (!((wxModule*)(node->Data()))->Init())
64 return FALSE;
65 }
66 return TRUE;
67}
68
69void wxModule::CleanUpModules(void)
70{
71 // Cleanup user-defined modules
72 for(wxNode* node = m_modules.Last(); node; node = node->Previous())
73 {
74 ((wxModule*)(node->Data()))->Exit();
75 delete (wxModule*)(node->Data());
76 }
77 m_modules.Clear();
78}
79