h_treeitem.cpp 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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_treeitem.h"
  5. H_TreeItem::H_TreeItem(ScriptObject *o) : H_RootObject(o) {
  6. inited = 0;
  7. obj = NULL;
  8. H_hook(o);
  9. }
  10. H_TreeItem::H_TreeItem() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void H_TreeItem::H_hook(ScriptObject *o) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = o->vcpu_getController();
  17. obj = controller->cast(o, treeItemGuid);
  18. if (obj != o && obj != NULL)
  19. o = obj;
  20. else
  21. obj = NULL;
  22. addMonitorObject(o, &treeItemGuid);
  23. int iter = WASABI_API_APP->app_getInitCount();
  24. if (!loaded || loaded != iter) {
  25. ontreeadd_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onTreeAdd", this);
  26. ontreeremove_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onTreeRemove", this);
  27. onselect_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onSelect", this);
  28. ondeselect_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onDeselect", this);
  29. onleftdoubleclick_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onLeftDoubleClick", this);
  30. onrightdoubleclick_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onRightDoubleClick", this);
  31. onchar_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onChar", this);
  32. onexpand_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onExpand", this);
  33. oncollapse_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onCollapse", this);
  34. onbeginlabeledit_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onBeginLabelEdit", this);
  35. onendlabeledit_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onEndLabelEdit", this);
  36. oncontextmenu_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onContextMenu", this);
  37. loaded = 1;
  38. }
  39. inited=1;
  40. }
  41. H_TreeItem::~H_TreeItem() {
  42. if (!inited) return;
  43. WASABI_API_MAKI->maki_remDlfRef(this);
  44. }
  45. ScriptObject *H_TreeItem::getHookedObject() {
  46. if (obj != NULL) return obj;
  47. return H_TREEITEM_PARENT::getHookedObject();
  48. }
  49. int H_TreeItem::eventCallback(ScriptObject *object, int dlfid, scriptVar **params, int nparams) {
  50. if (object != getHookedObject()) return 0;
  51. if (H_TREEITEM_PARENT::eventCallback(object, dlfid, params, nparams)) return 1;
  52. if (dlfid == ontreeadd_id) { hook_onTreeAdd(); return 1; }
  53. if (dlfid == ontreeremove_id) { hook_onTreeRemove(); return 1; }
  54. if (dlfid == onselect_id) { hook_onSelect(); return 1; }
  55. if (dlfid == ondeselect_id) { hook_onDeselect(); return 1; }
  56. if (dlfid == onleftdoubleclick_id) { hook_onLeftDoubleClick(); return 1; }
  57. if (dlfid == onrightdoubleclick_id) { hook_onRightDoubleClick(); return 1; }
  58. if (dlfid == onchar_id) { hook_onChar(GET_SCRIPT_INT(*params[0])); return 1; }
  59. if (dlfid == onexpand_id) { hook_onExpand(); return 1; }
  60. if (dlfid == oncollapse_id) { hook_onCollapse(); return 1; }
  61. if (dlfid == onbeginlabeledit_id) { hook_onBeginLabelEdit(); return 1; }
  62. if (dlfid == onendlabeledit_id) { hook_onEndLabelEdit(GET_SCRIPT_STRING(*params[0])); return 1; }
  63. if (dlfid == oncontextmenu_id) { hook_onContextMenu(GET_SCRIPT_INT(*params[0]), GET_SCRIPT_INT(*params[1])); return 1; }
  64. return 0;
  65. }
  66. int H_TreeItem::ontreeadd_id=0;
  67. int H_TreeItem::ontreeremove_id=0;
  68. int H_TreeItem::onselect_id=0;
  69. int H_TreeItem::ondeselect_id=0;
  70. int H_TreeItem::onleftdoubleclick_id=0;
  71. int H_TreeItem::onrightdoubleclick_id=0;
  72. int H_TreeItem::onchar_id=0;
  73. int H_TreeItem::onexpand_id=0;
  74. int H_TreeItem::oncollapse_id=0;
  75. int H_TreeItem::onbeginlabeledit_id=0;
  76. int H_TreeItem::onendlabeledit_id=0;
  77. int H_TreeItem::oncontextmenu_id=0;
  78. int H_TreeItem::loaded=0;