c_checkbox.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* This file was generated by Maki Compiler, do not edit manually */
  2. #include <precomp.h>
  3. #include "c_checkbox.h"
  4. #include <api/script/objcontroller.h>
  5. C_CheckBox::C_CheckBox(ScriptObject *object) : C_GuiObject(object) {
  6. inited = 0;
  7. C_hook(object);
  8. }
  9. C_CheckBox::C_CheckBox() {
  10. inited = 0;
  11. obj = NULL;
  12. }
  13. void C_CheckBox::C_hook(ScriptObject *object) {
  14. ASSERT(!inited);
  15. ScriptObjectController *controller = object->vcpu_getController();
  16. obj = controller->cast(object, checkBoxGuid);
  17. if (obj != object && obj != NULL)
  18. controller = obj->vcpu_getController();
  19. else
  20. obj = NULL;
  21. int iter = WASABI_API_APP->app_getInitCount();
  22. if (!loaded || loaded != iter) {
  23. loaded = iter;
  24. ontoggle_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onToggle", this);
  25. setchecked_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setChecked", this);
  26. ischecked_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"isChecked", this);
  27. settext_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setText", this);
  28. gettext_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getText", this);
  29. }
  30. inited = 1;
  31. }
  32. C_CheckBox::~C_CheckBox() {
  33. }
  34. ScriptObject *C_CheckBox::getScriptObject() {
  35. if (obj != NULL) return obj;
  36. return C_CHECKBOX_PARENT::getScriptObject();
  37. }
  38. void C_CheckBox::onToggle(int newstate) {
  39. ASSERT(inited);
  40. scriptVar a = MAKE_SCRIPT_INT(newstate);
  41. scriptVar *params[1] = {&a};
  42. WASABI_API_MAKI->maki_callFunction(getScriptObject(), ontoggle_id, params);
  43. }
  44. void C_CheckBox::setChecked(int checked) {
  45. ASSERT(inited);
  46. scriptVar a = MAKE_SCRIPT_INT(checked);
  47. scriptVar *params[1] = {&a};
  48. WASABI_API_MAKI->maki_callFunction(getScriptObject(), setchecked_id, params);
  49. }
  50. int C_CheckBox::isChecked() {
  51. ASSERT(inited);
  52. return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), ischecked_id, NULL));
  53. }
  54. void C_CheckBox::setText(const wchar_t *txt)
  55. {
  56. ASSERT(inited);
  57. scriptVar a = MAKE_SCRIPT_STRING(txt);
  58. scriptVar *params[1] = {&a};
  59. WASABI_API_MAKI->maki_callFunction(getScriptObject(), settext_id, params);
  60. }
  61. const wchar_t *C_CheckBox::getText() {
  62. ASSERT(inited);
  63. return GET_SCRIPT_STRING(WASABI_API_MAKI->maki_callFunction(getScriptObject(), gettext_id, NULL));
  64. }
  65. int C_CheckBox::loaded=0;
  66. int C_CheckBox::ontoggle_id=0;
  67. int C_CheckBox::setchecked_id=0;
  68. int C_CheckBox::ischecked_id=0;
  69. int C_CheckBox::settext_id=0;
  70. int C_CheckBox::gettext_id=0;