1
0

stimer.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //PORTABLE
  2. #ifndef _STIMER_H
  3. #define _STIMER_H
  4. #include <api/script/objects/rootobject.h>
  5. #include <api/script/objects/rootobj.h>
  6. #include <api/timer/timerclient.h>
  7. #define STIMER_PARENT RootObjectInstance
  8. // {5D0C5BB6-7DE1-4b1f-A70F-8D1659941941}
  9. static const GUID timerGuid =
  10. { 0x5d0c5bb6, 0x7de1, 0x4b1f, { 0xa7, 0xf, 0x8d, 0x16, 0x59, 0x94, 0x19, 0x41 } };
  11. class TimerScriptController : public ScriptObjectControllerI {
  12. public:
  13. virtual const wchar_t *getClassName();
  14. virtual const wchar_t *getAncestorClassName();
  15. virtual ScriptObjectController *getAncestorController();
  16. virtual int getNumFunctions();
  17. virtual const function_descriptor_struct *getExportedFunctions();
  18. virtual GUID getClassGuid();
  19. virtual ScriptObject *instantiate();
  20. virtual void destroy(ScriptObject *o);
  21. virtual void *encapsulate(ScriptObject *o);
  22. virtual void deencapsulate(void *o);
  23. private:
  24. static function_descriptor_struct exportedFunction[];
  25. };
  26. extern TimerScriptController *timerController;
  27. #ifndef _NOSTUDIO
  28. #define STIMER_ID 2481
  29. class STimer : public STIMER_PARENT, public TimerClientDI {
  30. public:
  31. STimer();
  32. virtual ~STimer();
  33. void start(void);
  34. void stop(void);
  35. int getDelay(void);
  36. void setDelay(int d);
  37. void onTimer(void);
  38. int isRunning();
  39. void timerclient_timerCallback(int id);
  40. private:
  41. int delay;
  42. int started;
  43. #else
  44. class STimer : public STIMER_SCRIPTPARENT {
  45. #endif
  46. public:
  47. static scriptVar script_onTimer(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  48. static scriptVar script_setDelay(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar d);
  49. static scriptVar script_getDelay(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  50. static scriptVar script_start(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  51. static scriptVar script_stop(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  52. static scriptVar script_isRunning(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  53. static scriptVar script_getSkipped(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  54. };
  55. #endif