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