c_slider.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* This file was generated by Maki Compiler, do not edit manually */
  2. #include <precomp.h>
  3. #include "c_slider.h"
  4. #include <api/script/objcontroller.h>
  5. C_Slider::C_Slider(ScriptObject *object) : C_GuiObject(object) {
  6. inited = 0;
  7. obj = NULL;
  8. C_hook(object);
  9. }
  10. C_Slider::C_Slider() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void C_Slider::C_hook(ScriptObject *object) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = object->vcpu_getController();
  17. obj = controller->cast(object, sliderGuid);
  18. if (obj != object && obj != NULL)
  19. controller = obj->vcpu_getController();
  20. else
  21. obj = NULL;
  22. int iter = WASABI_API_APP->app_getInitCount();
  23. if (!loaded || loaded != iter) {
  24. loaded = iter;
  25. onsetposition_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onSetPosition", this);
  26. onpostedposition_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onPostedPosition", this);
  27. onsetfinalposition_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onSetFinalPosition", this);
  28. setposition_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setPosition", this);
  29. getposition_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getPosition", this);
  30. lock_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"lock", this);
  31. unlock_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"unlock", this);
  32. }
  33. inited = 1;
  34. }
  35. C_Slider::~C_Slider() {
  36. }
  37. ScriptObject *C_Slider::getScriptObject() {
  38. if (obj != NULL) return obj;
  39. return C_SLIDER_PARENT::getScriptObject();
  40. }
  41. void C_Slider::onSetPosition(int newpos) {
  42. ASSERT(inited);
  43. scriptVar a = MAKE_SCRIPT_INT(newpos);
  44. scriptVar *params[1] = {&a};
  45. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onsetposition_id, params);
  46. }
  47. void C_Slider::onPostedPosition(int newpos) {
  48. ASSERT(inited);
  49. scriptVar a = MAKE_SCRIPT_INT(newpos);
  50. scriptVar *params[1] = {&a};
  51. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onpostedposition_id, params);
  52. }
  53. void C_Slider::onSetFinalPosition(int pos) {
  54. ASSERT(inited);
  55. scriptVar a = MAKE_SCRIPT_INT(pos);
  56. scriptVar *params[1] = {&a};
  57. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onsetfinalposition_id, params);
  58. }
  59. void C_Slider::setPosition(int pos) {
  60. ASSERT(inited);
  61. scriptVar a = MAKE_SCRIPT_INT(pos);
  62. scriptVar *params[1] = {&a};
  63. WASABI_API_MAKI->maki_callFunction(getScriptObject(), setposition_id, params);
  64. }
  65. int C_Slider::getPosition() {
  66. ASSERT(inited);
  67. return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getposition_id, NULL));
  68. }
  69. void C_Slider::lock() {
  70. ASSERT(inited);
  71. WASABI_API_MAKI->maki_callFunction(getScriptObject(), lock_id, NULL);
  72. }
  73. void C_Slider::unlock() {
  74. ASSERT(inited);
  75. WASABI_API_MAKI->maki_callFunction(getScriptObject(), unlock_id, NULL);
  76. }
  77. int C_Slider::loaded=0;
  78. int C_Slider::onsetposition_id=0;
  79. int C_Slider::onpostedposition_id=0;
  80. int C_Slider::onsetfinalposition_id=0;
  81. int C_Slider::setposition_id=0;
  82. int C_Slider::getposition_id=0;
  83. int C_Slider::lock_id=0;
  84. int C_Slider::unlock_id=0;