h_slider.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_slider.h"
  5. H_Slider::H_Slider(ScriptObject *o) : H_GuiObject(o) {
  6. inited = 0;
  7. obj = NULL;
  8. H_hook(o);
  9. }
  10. H_Slider::H_Slider() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void H_Slider::H_hook(ScriptObject *o) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = o->vcpu_getController();
  17. obj = controller->cast(o, sliderGuid);
  18. if (obj != o && obj != NULL)
  19. o = obj;
  20. else
  21. obj = NULL;
  22. addMonitorObject(o, &sliderGuid);
  23. int iter = WASABI_API_APP->app_getInitCount();
  24. if (!loaded || loaded != iter) {
  25. onsetposition_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onSetPosition", this);
  26. onpostedposition_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onPostedPosition", this);
  27. onsetfinalposition_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onSetFinalPosition", this);
  28. loaded = 1;
  29. }
  30. inited=1;
  31. }
  32. H_Slider::~H_Slider() {
  33. if (!inited) return;
  34. WASABI_API_MAKI->maki_remDlfRef(this);
  35. }
  36. ScriptObject *H_Slider::getHookedObject() {
  37. if (obj != NULL) return obj;
  38. return H_SLIDER_PARENT::getHookedObject();
  39. }
  40. int H_Slider::eventCallback(ScriptObject *object, int dlfid, scriptVar **params, int nparams) {
  41. if (object != getHookedObject()) return 0;
  42. if (H_SLIDER_PARENT::eventCallback(object, dlfid, params, nparams)) return 1;
  43. if (dlfid == onsetposition_id) { hook_onSetPosition(GET_SCRIPT_INT(*params[0])); return 1; }
  44. if (dlfid == onpostedposition_id) { hook_onPostedPosition(GET_SCRIPT_INT(*params[0])); return 1; }
  45. if (dlfid == onsetfinalposition_id) { hook_onSetFinalPosition(GET_SCRIPT_INT(*params[0])); return 1; }
  46. return 0;
  47. }
  48. int H_Slider::onsetposition_id=0;
  49. int H_Slider::onpostedposition_id=0;
  50. int H_Slider::onsetfinalposition_id=0;
  51. int H_Slider::loaded=0;