]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dynlib.h
DP: native wxTreeCtrl for GTK.
[wxWidgets.git] / include / wx / dynlib.h
CommitLineData
7a4b9130
GL
1#ifndef __DYNLIB_H__
2#define __DYNLIB_H__
3
4#ifdef __GNUG__
5#pragma interface
6#endif
7
8#include <wx/string.h>
9#include <wx/list.h>
10#include <wx/dynarray.h>
11
12// ---------------------------------------------------------------------------
13// Some more info on a class
14
15typedef struct {
16 wxClassInfo *class_info;
17 wxString path;
18} wxClassLibInfo;
19
20// ---------------------------------------------------------------------------
21// Useful arrays
22
23WX_DEFINE_ARRAY(wxClassInfo *, wxArrayClassInfo);
24WX_DEFINE_ARRAY(wxClassLibInfo *, wxArrayClassLibInfo);
25
26// ---------------------------------------------------------------------------
27// wxClassLibrary
28
29class wxClassLibrary {
30protected:
31 wxArrayClassLibInfo m_list;
32public:
33 wxClassLibrary(void);
34 ~wxClassLibrary(void);
35
36 // Dynamic (un)register a (new) class in the database
37 void RegisterClass(wxClassInfo *class_info, const wxString& path);
38 void UnregisterClass(wxClassInfo *class_info);
39
40 // Fetch all infos whose name matches the string (wildcards allowed)
41 bool FetchInfos(const wxString& path, wxArrayClassLibInfo& infos);
42
43 // Create all objects whose name matches the string (wildcards allowed)
44 bool CreateObjects(const wxString& path, wxArrayClassInfo& objs);
45
46 // Create one object using the EXACT name
47 wxObject *CreateObject(const wxString& path);
48};
49
50// ---------------------------------------------------------------------------
51// wxLibrary
52
53class wxLibrary: public wxObject {
54protected:
55 wxClassLibrary *m_liblist;
56 void *m_handle;
57public:
58 wxLibrary(void *handle);
59 ~wxLibrary(void);
60
61 // Get a symbol from the dynamic library
62 void *GetSymbol(const wxString& symbname);
63
64 // Create the object whose classname is "name"
65 wxObject *CreateObject(const wxString& name);
66
67 wxClassLibrary *ClassLib() const;
68};
69
70// ---------------------------------------------------------------------------
71// wxLibraries
72
73class wxLibraries {
74protected:
75 wxList m_loaded;
76public:
77 wxLibraries(void);
78 ~wxLibraries(void);
79
80 wxLibrary *LoadLibrary(const wxString& name);
81 wxObject *CreateObject(const wxString& name);
82};
83
84// ---------------------------------------------------------------------------
85// Global variables
86
87extern wxLibraries wxTheLibraries;
88
89// ---------------------------------------------------------------------------
90// Interesting defines
91
92#define WXDLL_ENTRY_FUNCTION() extern "C" wxClassLibrary *GetClassList()
93#define WXDLL_EXIT_FUNCTION(param) extern "C" void FreeClassList(wxClassLibrary *param)
94
95#endif