h_layout.cpp 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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_layout.h"
  5. H_Layout::H_Layout(ScriptObject *o) : H_Group(o) {
  6. inited = 0;
  7. obj = NULL;
  8. H_hook(o);
  9. }
  10. H_Layout::H_Layout() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void H_Layout::H_hook(ScriptObject *o) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = o->vcpu_getController();
  17. obj = controller->cast(o, layoutGuid);
  18. if (obj != o && obj != NULL)
  19. o = obj;
  20. else
  21. obj = NULL;
  22. addMonitorObject(o, &layoutGuid);
  23. int iter = WASABI_API_APP->app_getInitCount();
  24. if (!loaded || loaded != iter) {
  25. ondock_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onDock", this);
  26. onundock_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onUndock", this);
  27. onscale_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onScale", this);
  28. onmove_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onMove", this);
  29. onendmove_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onEndMove", this);
  30. onuserresize_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onUserResize", this);
  31. onmouseenterlayout_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onMouseEnterLayout", this);
  32. onmouseleavelayout_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onMouseLeaveLayout", this);
  33. onsnapadjustchanged_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onSnapAdjustChanged", this);
  34. loaded = 1;
  35. }
  36. inited=1;
  37. }
  38. H_Layout::~H_Layout() {
  39. if (!inited) return;
  40. WASABI_API_MAKI->maki_remDlfRef(this);
  41. }
  42. ScriptObject *H_Layout::getHookedObject() {
  43. if (obj != NULL) return obj;
  44. return H_LAYOUT_PARENT::getHookedObject();
  45. }
  46. int H_Layout::eventCallback(ScriptObject *object, int dlfid, scriptVar **params, int nparams) {
  47. if (object != getHookedObject()) return 0;
  48. if (H_LAYOUT_PARENT::eventCallback(object, dlfid, params, nparams)) return 1;
  49. if (dlfid == ondock_id) { hook_onDock(); return 1; }
  50. if (dlfid == onundock_id) { hook_onUndock(); return 1; }
  51. if (dlfid == onscale_id) { hook_onScale(GET_SCRIPT_DOUBLE(*params[0])); return 1; }
  52. if (dlfid == onmove_id) { hook_onMove(); return 1; }
  53. if (dlfid == onendmove_id) { hook_onEndMove(); return 1; }
  54. if (dlfid == onuserresize_id) { hook_onUserResize(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1]), GET_SCRIPT_INT(*params[2]), GET_SCRIPT_INT(*params[3])); return 1; }
  55. if (dlfid == onmouseenterlayout_id) { hook_onMouseEnterLayout(); return 1; }
  56. if (dlfid == onmouseleavelayout_id) { hook_onMouseLeaveLayout(); return 1; }
  57. if (dlfid == onsnapadjustchanged_id) { hook_onSnapAdjustChanged(); return 1; }
  58. return 0;
  59. }
  60. int H_Layout::ondock_id=0;
  61. int H_Layout::onundock_id=0;
  62. int H_Layout::onscale_id=0;
  63. int H_Layout::onmove_id=0;
  64. int H_Layout::onendmove_id=0;
  65. int H_Layout::onuserresize_id=0;
  66. int H_Layout::onmouseenterlayout_id=0;
  67. int H_Layout::onmouseleavelayout_id=0;
  68. int H_Layout::onsnapadjustchanged_id=0;
  69. int H_Layout::loaded=0;