timer.h 2.0 KB

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