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.

71 lines
2.2KB

  1. /* MousePlugin
  2. * Copyleft (C) 2002 Dan Bethell <dan@pawfal.org>
  3. * Dave Griffiths <dave@pawfal.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. #ifndef MousePlugin_H
  20. #define MousePlugin_H
  21. #include "../SpiralPlugin.h"
  22. #include "scratch.h"
  23. class MousePluginSingleton {
  24. public:
  25. static MousePluginSingleton *Get() {
  26. if (!m_Singleton) m_Singleton = new MousePluginSingleton;
  27. return m_Singleton;
  28. }
  29. static void PackUpAndGoHome() {
  30. if (m_Singleton) {
  31. delete m_Singleton;
  32. m_Singleton=NULL;
  33. }
  34. }
  35. ~MousePluginSingleton();
  36. scratch *getScr() { return scr; }
  37. private:
  38. MousePluginSingleton();
  39. scratch *scr;
  40. static MousePluginSingleton* m_Singleton;
  41. int count;
  42. };
  43. class MousePlugin : public SpiralPlugin {
  44. public:
  45. MousePlugin();
  46. virtual ~MousePlugin();
  47. virtual PluginInfo& Initialise (const HostInfo *Host);
  48. virtual SpiralGUIType* CreateGUI();
  49. char GetPort (void) { return m_Port; }
  50. virtual void Execute();
  51. virtual void ExecuteCommands();
  52. virtual void StreamOut (ostream &s);
  53. virtual void StreamIn (istream &s);
  54. enum GUICommands {NONE, SETPORT};
  55. private:
  56. static int m_RefCount;
  57. char m_Port;
  58. float m_Data;
  59. friend istream &operator>> (istream &s, MousePlugin &o);
  60. friend ostream &operator<< (ostream &s, MousePlugin &o);
  61. };
  62. istream &operator>> (istream &s, MousePlugin &o);
  63. ostream &operator<< (ostream &s, MousePlugin &o);
  64. #endif