h_edit.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_edit.h"
  5. H_Edit::H_Edit(ScriptObject *o) : H_GuiObject(o) {
  6. inited = 0;
  7. obj = NULL;
  8. H_hook(o);
  9. }
  10. H_Edit::H_Edit() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void H_Edit::H_hook(ScriptObject *o) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = o->vcpu_getController();
  17. obj = controller->cast(o, editGuid);
  18. if (obj != o && obj != NULL)
  19. o = obj;
  20. else
  21. obj = NULL;
  22. addMonitorObject(o, &editGuid);
  23. int iter = WASABI_API_APP->app_getInitCount();
  24. if (!loaded || loaded != iter) {
  25. onenter_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onEnter", this);
  26. onabort_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onAbort", this);
  27. onidleeditupdate_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onIdleEditUpdate", this);
  28. oneditupdate_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onEditUpdate", this);
  29. loaded = 1;
  30. }
  31. inited=1;
  32. }
  33. H_Edit::~H_Edit() {
  34. if (!inited) return;
  35. WASABI_API_MAKI->maki_remDlfRef(this);
  36. }
  37. ScriptObject *H_Edit::getHookedObject() {
  38. if (obj != NULL) return obj;
  39. return H_EDIT_PARENT::getHookedObject();
  40. }
  41. int H_Edit::eventCallback(ScriptObject *object, int dlfid, scriptVar **params, int nparams) {
  42. if (object != getHookedObject()) return 0;
  43. if (H_EDIT_PARENT::eventCallback(object, dlfid, params, nparams)) return 1;
  44. if (dlfid == onenter_id) { hook_onEnter(); return 1; }
  45. if (dlfid == onabort_id) { hook_onAbort(); return 1; }
  46. if (dlfid == onidleeditupdate_id) { hook_onIdleEditUpdate(); return 1; }
  47. if (dlfid == oneditupdate_id) { hook_onEditUpdate(); return 1; }
  48. return 0;
  49. }
  50. int H_Edit::onenter_id=0;
  51. int H_Edit::onabort_id=0;
  52. int H_Edit::onidleeditupdate_id=0;
  53. int H_Edit::oneditupdate_id=0;
  54. int H_Edit::loaded=0;