You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8KB

  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. #include <FL/Fl_Double_Window.h>
  19. #include <FL/Fl_Pixmap.h>
  20. #include <iostream>
  21. #include <vector>
  22. #include "Plugins/SpiralPlugin.h"
  23. struct HostsideInfo
  24. {
  25. void* Handle;
  26. int ID;
  27. char **(*GetIcon)(void);
  28. SpiralPlugin *(*CreateInstance)(void);
  29. int (*GetID)(void);
  30. };
  31. //////////////////////////////////////////////////////////
  32. typedef int PluginID;
  33. #define PluginError -1
  34. class PluginManager
  35. {
  36. public:
  37. static PluginManager *Get() { if(!m_Singleton) m_Singleton=new PluginManager; return m_Singleton; }
  38. static void PackUpAndGoHome() { if(m_Singleton) delete m_Singleton; }
  39. PluginID LoadPlugin(const char *PluginName);
  40. void UnLoadPlugin(PluginID ID);
  41. void UnloadAll();
  42. const HostsideInfo* GetPlugin(PluginID ID);
  43. bool IsValid(PluginID ID);
  44. int GetIdByName(string Name);
  45. private:
  46. PluginManager();
  47. ~PluginManager();
  48. HostsideInfo *GetPlugin_i(PluginID ID);
  49. vector<HostsideInfo*> m_PluginVec;
  50. static PluginManager *m_Singleton;
  51. };