wxWidgets/include/wx/module.h
Ron Lee 0b9ab0bd82 Added new dynamic loading classes. (which handle proper
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
2001-12-19 07:09:58 +00:00

68 lines
1.7 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: module.h
// Purpose: Modules handling
// 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
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MODULEH__
#define _WX_MODULEH__
#ifdef __GNUG__
#pragma interface "module.h"
#endif
#include "wx/object.h"
#include "wx/list.h"
// declare a linked list of modules
class wxModule;
WX_DECLARE_EXPORTED_LIST(wxModule, wxModuleList);
// declaring a class derived from wxModule will automatically create an
// instance of this class on program startup, call its OnInit() method and call
// OnExit() on program termination (but only if OnInit() succeeded)
class WXDLLEXPORT wxModule : public wxObject
{
public:
wxModule() {}
virtual ~wxModule() {}
// if module init routine returns FALSE application
// will fail to startup
bool Init() { return OnInit(); }
void Exit() { OnExit(); }
// Override both of these
// called on program startup
virtual bool OnInit() = 0;
// called just before program termination, but only if OnInit()
// succeeded
virtual void OnExit() = 0;
static void RegisterModule(wxModule* module);
static void RegisterModules();
static bool InitializeModules();
static void CleanUpModules();
// used by wxObjectLoader when unloading shared libs's
static void UnregisterModule(wxModule* module);
protected:
static wxModuleList m_modules;
DECLARE_CLASS(wxModule)
};
#endif // _WX_MODULEH__