h_guiobject.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* This file was generated by Maki Compiler, do not edit manually */
  2. #include <precomp.h>
  3. #include <api/script/objcontroller.h>
  4. #include "h_guiobject.h"
  5. #include "../nu/AUtoChar.h"
  6. H_GuiObject::H_GuiObject(ScriptObject *o) : H_RootObject(o) {
  7. inited = 0;
  8. obj = NULL;
  9. H_hook(o);
  10. }
  11. H_GuiObject::H_GuiObject() {
  12. inited = 0;
  13. obj = NULL;
  14. }
  15. void H_GuiObject::H_hook(ScriptObject *o) {
  16. ASSERT(!inited);
  17. ScriptObjectController *controller = o->vcpu_getController();
  18. obj = controller->cast(o, guiObjectGuid);
  19. if (obj != o && obj != NULL)
  20. o = obj;
  21. else
  22. obj = NULL;
  23. addMonitorObject(o, &guiObjectGuid);
  24. int iter = WASABI_API_APP->app_getInitCount();
  25. if (!loaded || loaded != iter) {
  26. onsetvisible_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onSetVisible", this);
  27. onleftbuttonup_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onLeftButtonUp", this);
  28. onleftbuttondown_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onLeftButtonDown", this);
  29. onrightbuttonup_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onRightButtonUp", this);
  30. onrightbuttondown_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onRightButtonDown", this);
  31. onrightbuttondblclk_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onRightButtonDblClk", this);
  32. onleftbuttondblclk_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onLeftButtonDblClk", this);
  33. onmousemove_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onMouseMove", this);
  34. onenterarea_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onEnterArea", this);
  35. onleavearea_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onLeaveArea", this);
  36. onenable_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onEnable", this);
  37. onresize_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onResize", this);
  38. ontargetreached_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onTargetReached", this);
  39. onstartup_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onStartup", this);
  40. onchar_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onChar", this);
  41. onaccelerator_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onAccelerator", this);
  42. onkeydown_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onKeyDown", this);
  43. onkeyup_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onKeyUp", this);
  44. ongetfocus_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onGetFocus", this);
  45. onkillfocus_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onKillFocus", this);
  46. onaction_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onAction", this);
  47. loaded = 1;
  48. }
  49. inited=1;
  50. }
  51. H_GuiObject::~H_GuiObject() {
  52. if (!inited) return;
  53. WASABI_API_MAKI->maki_remDlfRef(this);
  54. }
  55. ScriptObject *H_GuiObject::getHookedObject() {
  56. if (obj != NULL) return obj;
  57. return H_GUIOBJECT_PARENT::getHookedObject();
  58. }
  59. int H_GuiObject::eventCallback(ScriptObject *object, int dlfid, scriptVar **params, int nparams) {
  60. if (object != getHookedObject()) return 0;
  61. if (H_GUIOBJECT_PARENT::eventCallback(object, dlfid, params, nparams)) return 1;
  62. if (dlfid == onsetvisible_id) { hook_onSetVisible(GET_SCRIPT_INT(*params[0])); return 1; }
  63. if (dlfid == onleftbuttonup_id) { hook_onLeftButtonUp(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1])); return 1; }
  64. if (dlfid == onleftbuttondown_id) { hook_onLeftButtonDown(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1])); return 1; }
  65. if (dlfid == onrightbuttonup_id) { hook_onRightButtonUp(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1])); return 1; }
  66. if (dlfid == onrightbuttondown_id) { hook_onRightButtonDown(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1])); return 1; }
  67. if (dlfid == onrightbuttondblclk_id) { hook_onRightButtonDblClk(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1])); return 1; }
  68. if (dlfid == onleftbuttondblclk_id) { hook_onLeftButtonDblClk(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1])); return 1; }
  69. if (dlfid == onmousemove_id) { hook_onMouseMove(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1])); return 1; }
  70. if (dlfid == onenterarea_id) { hook_onEnterArea(); return 1; }
  71. if (dlfid == onleavearea_id) { hook_onLeaveArea(); return 1; }
  72. if (dlfid == onenable_id) { hook_onEnable(GET_SCRIPT_INT(*params[0])); return 1; }
  73. if (dlfid == onresize_id) { hook_onResize(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1]), GET_SCRIPT_INT(*params[2]), GET_SCRIPT_INT(*params[3])); return 1; }
  74. if (dlfid == ontargetreached_id) { hook_onTargetReached(); return 1; }
  75. if (dlfid == onstartup_id) { hook_onStartup(); return 1; }
  76. if (dlfid == onchar_id) { hook_onChar(GET_SCRIPT_STRING(*params[0])); return 1; }
  77. if (dlfid == onaccelerator_id) { hook_onAccelerator(GET_SCRIPT_STRING(*params[0])); return 1; }
  78. if (dlfid == onkeydown_id) { hook_onKeyDown(GET_SCRIPT_INT(*params[0])); return 1; }
  79. if (dlfid == onkeyup_id) { hook_onKeyUp(GET_SCRIPT_INT(*params[0])); return 1; }
  80. if (dlfid == ongetfocus_id) { hook_onGetFocus(); return 1; }
  81. if (dlfid == onkillfocus_id) { hook_onKillFocus(); return 1; }
  82. if (dlfid == onaction_id) { hook_onAction(GET_SCRIPT_STRING(*params[0]), GET_SCRIPT_STRING(*params[1]), GET_SCRIPT_INT(*params[2]), GET_SCRIPT_INT(*params[3]), GET_SCRIPT_INT(*params[4]), GET_SCRIPT_INT(*params[5]), GET_SCRIPT_OBJECT(*params[6])); return 1; }
  83. return 0;
  84. }
  85. int H_GuiObject::onsetvisible_id=0;
  86. int H_GuiObject::onleftbuttonup_id=0;
  87. int H_GuiObject::onleftbuttondown_id=0;
  88. int H_GuiObject::onrightbuttonup_id=0;
  89. int H_GuiObject::onrightbuttondown_id=0;
  90. int H_GuiObject::onrightbuttondblclk_id=0;
  91. int H_GuiObject::onleftbuttondblclk_id=0;
  92. int H_GuiObject::onmousemove_id=0;
  93. int H_GuiObject::onenterarea_id=0;
  94. int H_GuiObject::onleavearea_id=0;
  95. int H_GuiObject::onenable_id=0;
  96. int H_GuiObject::onresize_id=0;
  97. int H_GuiObject::ontargetreached_id=0;
  98. int H_GuiObject::onstartup_id=0;
  99. int H_GuiObject::onchar_id=0;
  100. int H_GuiObject::onaccelerator_id=0;
  101. int H_GuiObject::onkeydown_id=0;
  102. int H_GuiObject::onkeyup_id=0;
  103. int H_GuiObject::ongetfocus_id=0;
  104. int H_GuiObject::onkillfocus_id=0;
  105. int H_GuiObject::onaction_id=0;
  106. int H_GuiObject::loaded=0;