]>
Commit | Line | Data |
---|---|---|
4b123bb9 HH |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wxsplbase.h | |
3 | // Purpose: General interfaces for all plug-ins in wxStudio | |
4 | // Author: Aleksandras Gluchovas | |
5 | // Modified by: | |
6 | // Created: 11/04/1999 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Aleskandars Gluchovas | |
9 | // Licence: GNU General Public License wxWindows licence v2.0 | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __PLUGIN_G__ | |
13 | #define __PLUGIN_G__ | |
14 | ||
15 | #include "wxstldefs.h" | |
16 | #include "wxsdefs.h" | |
17 | ||
18 | class wxsPluginBase; | |
19 | typedef wxsPluginBase* wxsPluginBasePtrT; | |
20 | #ifdef wxUSE_TEMPLATE_STL | |
21 | typedef vector<wxsPluginBasePtrT> wxsPluginListT; | |
22 | #else | |
23 | typedef WXSTL_VECTOR_SHALLOW_COPY(wxsPluginBasePtrT) wxsPluginListT; | |
24 | #endif | |
25 | ||
26 | ||
27 | class wxsPluginManager : public wxObject | |
28 | { | |
29 | public: | |
30 | ||
31 | wxsPluginListT& GetPlugins(); | |
32 | ||
33 | // allows to present plugin-specific features | |
34 | // as items in the menu-bar | |
35 | ||
36 | void RegisterMenuCommand( const string& itemName, | |
37 | const string& menuName, | |
38 | int id, | |
39 | wxsPluginBase* forPlugin ); | |
40 | ||
41 | // should be called by plugin, when it's being destroyed | |
42 | ||
43 | void UnregisterPlugin( wxsPluginBase* plugin ); | |
44 | }; | |
45 | ||
46 | ||
47 | ||
48 | // Used by create settings panel: | |
49 | enum { | |
50 | WXS_SETTINGS_GLOBAL, | |
51 | WXS_SETTINGS_PROJECT | |
52 | }; | |
53 | ||
54 | ||
55 | class wxsPluginBase : public wxObject | |
56 | { | |
57 | protected: | |
58 | wxsPluginManager* mpPluginMgr; | |
59 | ||
60 | public: | |
61 | ||
62 | wxsPluginBase(); | |
63 | virtual ~wxsPluginBase(); | |
64 | ||
65 | virtual void InitPlugin() {} | |
66 | ||
67 | // utilities | |
68 | ||
69 | wxsPluginManager& GetPluginManager(); | |
70 | void SetPluginManager( wxsPluginManager* mgr ); | |
71 | ||
72 | // overridables | |
73 | ||
74 | // Current Types = UNKNOWN,EDITOR,CLASSBROWSER,FILEBROWSER,CLASSINFO,TOOL | |
75 | virtual WXS_PLUGIN_TYPE GetType() = 0; | |
76 | virtual string GetCategory() = 0; | |
77 | ||
78 | virtual string GetName() = 0; | |
79 | // will return a help panel | |
80 | virtual wxWindow* CreateSettingsPanel(wxWindow *parent, int type) {return NULL;} | |
81 | virtual wxsPluginBase* Clone() = 0; | |
82 | ||
83 | virtual string Command( const string& name, const string& args ) | |
84 | ||
85 | { return "NO_SUPPORTED"; } | |
86 | }; | |
87 | ||
88 | // base clas for all plugins which are presented as windows | |
89 | ||
90 | class wxsComponent : public wxsPluginBase | |
91 | { | |
92 | public: | |
93 | virtual void Create( wxWindow* parent, wxWindowID id ) = 0; | |
94 | virtual wxWindow* GetWindow() = 0; | |
95 | }; | |
96 | ||
97 | #endif | |
98 | // __PLUGIN_G__ |