wxWidgets/include/wx/dynlib.h
Guilhem Lavaux 7a4b9130e3 * Fixes and new features in wxObject*Stream
* Fixes: wxChoice (GTK), wxCheckBox (GTK)
* Fixes: wxStream
* wxObject calls wx*Serialize::LoadObject/StoreObject in StoreObject/LoadObject
* Added support for dynamic library (Linux only, Windows will follow)
* Added serbase.h (Serialization base defines and base object)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1998-08-04 17:49:26 +00:00

96 lines
2.4 KiB
C++

#ifndef __DYNLIB_H__
#define __DYNLIB_H__
#ifdef __GNUG__
#pragma interface
#endif
#include <wx/string.h>
#include <wx/list.h>
#include <wx/dynarray.h>
// ---------------------------------------------------------------------------
// Some more info on a class
typedef struct {
wxClassInfo *class_info;
wxString path;
} wxClassLibInfo;
// ---------------------------------------------------------------------------
// Useful arrays
WX_DEFINE_ARRAY(wxClassInfo *, wxArrayClassInfo);
WX_DEFINE_ARRAY(wxClassLibInfo *, wxArrayClassLibInfo);
// ---------------------------------------------------------------------------
// wxClassLibrary
class wxClassLibrary {
protected:
wxArrayClassLibInfo m_list;
public:
wxClassLibrary(void);
~wxClassLibrary(void);
// Dynamic (un)register a (new) class in the database
void RegisterClass(wxClassInfo *class_info, const wxString& path);
void UnregisterClass(wxClassInfo *class_info);
// Fetch all infos whose name matches the string (wildcards allowed)
bool FetchInfos(const wxString& path, wxArrayClassLibInfo& infos);
// Create all objects whose name matches the string (wildcards allowed)
bool CreateObjects(const wxString& path, wxArrayClassInfo& objs);
// Create one object using the EXACT name
wxObject *CreateObject(const wxString& path);
};
// ---------------------------------------------------------------------------
// wxLibrary
class wxLibrary: public wxObject {
protected:
wxClassLibrary *m_liblist;
void *m_handle;
public:
wxLibrary(void *handle);
~wxLibrary(void);
// Get a symbol from the dynamic library
void *GetSymbol(const wxString& symbname);
// Create the object whose classname is "name"
wxObject *CreateObject(const wxString& name);
wxClassLibrary *ClassLib() const;
};
// ---------------------------------------------------------------------------
// wxLibraries
class wxLibraries {
protected:
wxList m_loaded;
public:
wxLibraries(void);
~wxLibraries(void);
wxLibrary *LoadLibrary(const wxString& name);
wxObject *CreateObject(const wxString& name);
};
// ---------------------------------------------------------------------------
// Global variables
extern wxLibraries wxTheLibraries;
// ---------------------------------------------------------------------------
// Interesting defines
#define WXDLL_ENTRY_FUNCTION() extern "C" wxClassLibrary *GetClassList()
#define WXDLL_EXIT_FUNCTION(param) extern "C" void FreeClassList(wxClassLibrary *param)
#endif