h_text.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_text.h"
  5. H_Text::H_Text(ScriptObject *o) : H_GuiObject(o) {
  6. inited = 0;
  7. obj = NULL;
  8. H_hook(o);
  9. }
  10. H_Text::H_Text() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void H_Text::H_hook(ScriptObject *o) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = o->vcpu_getController();
  17. obj = controller->cast(o, textGuid);
  18. if (obj != o && obj != NULL)
  19. o = obj;
  20. else
  21. obj = NULL;
  22. addMonitorObject(o, &textGuid);
  23. int iter = WASABI_API_APP->app_getInitCount();
  24. if (!loaded || loaded != iter) {
  25. ontextchanged_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onTextChanged", this);
  26. loaded = 1;
  27. }
  28. inited=1;
  29. }
  30. H_Text::~H_Text() {
  31. if (!inited) return;
  32. WASABI_API_MAKI->maki_remDlfRef(this);
  33. }
  34. ScriptObject *H_Text::getHookedObject() {
  35. if (obj != NULL) return obj;
  36. return H_TEXT_PARENT::getHookedObject();
  37. }
  38. int H_Text::eventCallback(ScriptObject *object, int dlfid, scriptVar **params, int nparams) {
  39. if (object != getHookedObject()) return 0;
  40. if (H_TEXT_PARENT::eventCallback(object, dlfid, params, nparams)) return 1;
  41. if (dlfid == ontextchanged_id) { hook_onTextChanged(GET_SCRIPT_STRING(*params[0])); return 1; }
  42. return 0;
  43. }
  44. int H_Text::ontextchanged_id=0;
  45. int H_Text::loaded=0;