1 /* SpiralSound 2 * Copyleft (C) 2002 David Griffiths <dave@pawfal.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 */ 18 19 #include <FL/Fl_Double_Window.H> 20 #include <FL/Fl_Pixmap.H> 21 #include <iostream> 22 #include <vector> 23 #include "Plugins/SpiralPlugin.h" 24 25 struct HostsideInfo 26 { 27 void* Handle; 28 int ID; 29 char **(*GetIcon)(void); 30 SpiralPlugin *(*CreateInstance)(void); 31 int (*GetID)(void); 32 string (*GetGroupName)(void); 33 }; 34 35 ////////////////////////////////////////////////////////// 36 37 typedef int PluginID; 38 #define PluginError -1 39 40 class PluginManager 41 { 42 public: Get()43 static PluginManager *Get() { if(!m_Singleton) m_Singleton=new PluginManager; return m_Singleton; } PackUpAndGoHome()44 static void PackUpAndGoHome() { if(m_Singleton) delete m_Singleton; } 45 46 PluginID LoadPlugin(const char *PluginName); 47 void UnLoadPlugin(PluginID ID); 48 void UnloadAll(); 49 const HostsideInfo* GetPlugin(PluginID ID); 50 bool IsValid(PluginID ID); 51 int GetIdByName(string Name); 52 53 private: 54 55 PluginManager(); 56 ~PluginManager(); 57 HostsideInfo *GetPlugin_i(PluginID ID); 58 59 vector<HostsideInfo*> m_PluginVec; 60 static PluginManager *m_Singleton; 61 }; 62