wxRTTI and wxModule initialisation and unloading) Removed serialisation code from wxObject and elsewhere. Added USER_EXPORTED hash and list macros. Added *_PLUGGABLE_CLASS defines for exporting dynamic wxObjects from dlls. ---------------------------------------------------------------------- Modified Files: Makefile.in configure configure.in setup.h.in debian/changelog distrib/msw/tmake/filelist.txt include/wx/defs.h include/wx/docview.h include/wx/dynlib.h include/wx/fileconf.h include/wx/hash.h include/wx/list.h include/wx/module.h include/wx/object.h include/wx/resource.h include/wx/stream.h include/wx/gtk/setup0.h include/wx/msw/setup0.h src/files.lst src/wxBase.dsp src/wxUniv.dsp src/wxWindows.dsp src/common/dynlib.cpp src/common/filename.cpp src/common/module.cpp src/common/object.cpp src/common/stream.cpp src/gtk/files.lst src/mac/files.lst src/mgl/files.lst src/mgl/makefile.wat src/motif/files.lst src/msw/dialup.cpp src/msw/files.lst src/msw/helpchm.cpp src/msw/makefile.b32 src/msw/makefile.bcc src/msw/makefile.dos src/msw/makefile.g95 src/msw/makefile.sc src/msw/makefile.vc src/msw/makefile.wat src/os2/files.lst src/univ/files.lst Added Files: include/wx/dynload.h src/common/dynload.cpp Removed Files: include/wx/objstrm.h include/wx/serbase.h src/common/objstrm.cpp src/common/serbase.cpp utils/serialize/.cvsignore utils/serialize/makefile.b32 utils/serialize/sercore.cpp utils/serialize/sercore.h utils/serialize/serctrl.cpp utils/serialize/serctrl.h utils/serialize/serext.cpp utils/serialize/serext.h utils/serialize/sergdi.cpp utils/serialize/sergdi.h utils/serialize/sermain.cpp utils/serialize/serwnd.cpp utils/serialize/serwnd.h ---------------------------------------------------------------------- git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
107 lines
2.5 KiB
C++
107 lines
2.5 KiB
C++
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: module.cpp
|
|
// Purpose: Modules initialization/destruction
|
|
// Author: Wolfram Gloger/adapted by Guilhem Lavaux
|
|
// Modified by:
|
|
// Created: 04/11/98
|
|
// RCS-ID: $Id$
|
|
// Copyright: (c) Wolfram Gloger and Guilhem Lavaux
|
|
// Licence: wxWindows licence
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation "module.h"
|
|
#endif
|
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
|
#include "wx/wxprec.h"
|
|
|
|
#ifdef __BORLANDC__
|
|
#pragma hdrstop
|
|
#endif
|
|
|
|
#include "wx/module.h"
|
|
#include "wx/hash.h"
|
|
#include "wx/listimpl.cpp"
|
|
|
|
#ifdef __SALFORDC__
|
|
void wxwxModuleListNode::DeleteData()
|
|
{
|
|
delete (_WX_LIST_ITEM_TYPE_wxModuleList *)GetData();
|
|
}
|
|
#else
|
|
WX_DEFINE_LIST(wxModuleList);
|
|
#endif
|
|
|
|
IMPLEMENT_CLASS(wxModule, wxObject)
|
|
|
|
wxModuleList wxModule::m_modules;
|
|
|
|
void wxModule::RegisterModule(wxModule* module)
|
|
{
|
|
m_modules.Append(module);
|
|
}
|
|
|
|
void wxModule::UnregisterModule(wxModule* module)
|
|
{
|
|
m_modules.DeleteObject(module);
|
|
}
|
|
|
|
// Collect up all module-derived classes, create an instance of each,
|
|
// and register them.
|
|
void wxModule::RegisterModules()
|
|
{
|
|
wxNode *node;
|
|
wxClassInfo* classInfo;
|
|
|
|
wxClassInfo::sm_classTable->BeginFind();
|
|
node = wxClassInfo::sm_classTable->Next();
|
|
while (node)
|
|
{
|
|
classInfo = (wxClassInfo *)node->Data();
|
|
if ( classInfo->IsKindOf(CLASSINFO(wxModule)) &&
|
|
(classInfo != (& (wxModule::sm_classwxModule))) )
|
|
{
|
|
wxModule* module = (wxModule *)classInfo->CreateObject();
|
|
RegisterModule(module);
|
|
}
|
|
node = wxClassInfo::sm_classTable->Next();
|
|
}
|
|
}
|
|
|
|
bool wxModule::InitializeModules()
|
|
{
|
|
// Initialize user-defined modules
|
|
wxModuleList::Node *node;
|
|
for ( node = m_modules.GetFirst(); node; node = node->GetNext() )
|
|
{
|
|
if ( !node->GetData()->Init() )
|
|
{
|
|
// clean up already initialized modules - process in reverse order
|
|
wxModuleList::Node *n;
|
|
for ( n = node->GetPrevious(); n; n = n->GetPrevious() )
|
|
{
|
|
n->GetData()->OnExit();
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void wxModule::CleanUpModules()
|
|
{
|
|
// Cleanup user-defined modules
|
|
wxModuleList::Node *node;
|
|
for ( node = m_modules.GetFirst(); node; node = node->GetNext() )
|
|
{
|
|
node->GetData()->Exit();
|
|
}
|
|
|
|
m_modules.DeleteContents(TRUE);
|
|
m_modules.Clear();
|
|
}
|
|
|