c_togglebutton.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* This file was generated by Maki Compiler, do not edit manually */
  2. #include <precomp.h>
  3. #include "c_togglebutton.h"
  4. #include <api/script/objcontroller.h>
  5. C_ToggleButton::C_ToggleButton(ScriptObject *object) : C_Button(object) {
  6. inited = 0;
  7. obj = NULL;
  8. C_hook(object);
  9. }
  10. C_ToggleButton::C_ToggleButton() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void C_ToggleButton::C_hook(ScriptObject *object) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = object->vcpu_getController();
  17. obj = controller->cast(object, toggleButtonGuid);
  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. ontoggle_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onToggle", this);
  26. getcurcfgval_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getCurCfgVal", this);
  27. }
  28. inited = 1;
  29. }
  30. C_ToggleButton::~C_ToggleButton() {
  31. }
  32. ScriptObject *C_ToggleButton::getScriptObject() {
  33. if (obj != NULL) return obj;
  34. return C_TOGGLEBUTTON_PARENT::getScriptObject();
  35. }
  36. void C_ToggleButton::onToggle(int (null)) {
  37. ASSERT(inited);
  38. scriptVar a = MAKE_SCRIPT_INT((null));
  39. scriptVar *params[1] = {&a};
  40. WASABI_API_MAKI->maki_callFunction(getScriptObject(), ontoggle_id, params);
  41. }
  42. int C_ToggleButton::getCurCfgVal() {
  43. ASSERT(inited);
  44. return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getcurcfgval_id, NULL));
  45. }
  46. int C_ToggleButton::loaded=0;
  47. int C_ToggleButton::ontoggle_id=0;
  48. int C_ToggleButton::getcurcfgval_id=0;