mouseredir.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //PORTABLE
  2. #ifndef _MOUSEREDIR_H
  3. #define _MOUSEREDIR_H
  4. #include <api/script/script.h>
  5. #include <api/script/objects/guiobj.h>
  6. #include <bfc/string/StringW.h>
  7. #include <api/wnd/wndclass/guiobjwnd.h>
  8. #define MOUSEREDIR_PARENT GuiObjectWnd
  9. // {9B2E341B-6C98-40fa-8B85-0C1B6EE89405}
  10. static const GUID mouseredirGuid =
  11. { 0x9b2e341b, 0x6c98, 0x40fa, { 0x8b, 0x85, 0xc, 0x1b, 0x6e, 0xe8, 0x94, 0x5 } };
  12. class SMap;
  13. class SRegion;
  14. class MouseRedirScriptController : public GuiObjectScriptController {
  15. public:
  16. virtual const wchar_t *getClassName();
  17. virtual const wchar_t *getAncestorClassName();
  18. virtual ScriptObjectController *getAncestorController() { return guiController; }
  19. virtual int getNumFunctions();
  20. virtual const function_descriptor_struct *getExportedFunctions();
  21. virtual GUID getClassGuid();
  22. virtual ScriptObject *instantiate();
  23. virtual void *encapsulate(ScriptObject *o);
  24. virtual void destroy(ScriptObject *o);
  25. virtual void deencapsulate(void *o);
  26. private:
  27. static function_descriptor_struct exportedFunction[];
  28. };
  29. extern MouseRedirScriptController *mouseredirController;
  30. class MouseRedir : public MOUSEREDIR_PARENT {
  31. public:
  32. MouseRedir();
  33. virtual ~MouseRedir();
  34. virtual int onInit();
  35. void setTarget(const wchar_t *id);
  36. void setRedirection(GuiObject *o);
  37. GuiObject *getRedirection();
  38. void setRegionFromMap(SMap *map, int byte, int inversed);
  39. void setRegion(SRegion *reg);
  40. virtual int mouseInRegion(int x, int y);
  41. virtual ifc_window *getForwardWnd();
  42. virtual int setXuiParam(int _xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value);
  43. protected:
  44. /*static */void CreateXMLParameters(int master_handle);
  45. enum {
  46. MOUSEREDIR_TARGET=0,
  47. };
  48. private:
  49. GuiObject *redirobject;
  50. StringW deferedredirobjectid;
  51. int xuihandle;
  52. static XMLParamPair params[];
  53. void doSetTarget(const wchar_t *id);
  54. RegionI *rgn;
  55. public:
  56. static scriptVar script_vcpu_setRedirection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar obj);
  57. static scriptVar script_vcpu_getRedirection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  58. static scriptVar script_vcpu_setRegionFromMap(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar map, scriptVar byte, scriptVar inv);
  59. static scriptVar script_vcpu_setRegion(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar reg);
  60. };
  61. extern const wchar_t mouseRedirXuiObjectStr[];
  62. extern char mouseRedirXuiSvcName[];
  63. class MouseRedirXuiSvc : public XuiObjectSvc<MouseRedir, mouseRedirXuiObjectStr, mouseRedirXuiSvcName> {};
  64. #endif