c_menubutton.cpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* This file was generated by Maki Compiler, do not edit manually */
  2. #include <precomp.h>
  3. #include "c_menubutton.h"
  4. #include <api/script/objcontroller.h>
  5. C_MenuButton::C_MenuButton(ScriptObject *object) : C_GuiObject(object) {
  6. inited = 0;
  7. obj = NULL;
  8. C_hook(object);
  9. }
  10. C_MenuButton::C_MenuButton() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void C_MenuButton::C_hook(ScriptObject *object) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = object->vcpu_getController();
  17. obj = controller->cast(object, menuButtonGuid);
  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. onopenmenu_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onOpenMenu", this);
  26. onclosemenu_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onCloseMenu", this);
  27. onselectitem_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onSelectItem", this);
  28. openmenu_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"openMenu", this);
  29. closemenu_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"closeMenu", this);
  30. }
  31. inited = 1;
  32. }
  33. C_MenuButton::~C_MenuButton() {
  34. }
  35. ScriptObject *C_MenuButton::getScriptObject() {
  36. if (obj != NULL) return obj;
  37. return C_MENUBUTTON_PARENT::getScriptObject();
  38. }
  39. void C_MenuButton::onOpenMenu() {
  40. ASSERT(inited);
  41. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onopenmenu_id, NULL);
  42. }
  43. void C_MenuButton::onCloseMenu() {
  44. ASSERT(inited);
  45. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onclosemenu_id, NULL);
  46. }
  47. void C_MenuButton::onSelectItem(const wchar_t *item) {
  48. ASSERT(inited);
  49. scriptVar a = MAKE_SCRIPT_STRING(item);
  50. scriptVar *params[1] = {&a};
  51. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onselectitem_id, params);
  52. }
  53. void C_MenuButton::openMenu() {
  54. ASSERT(inited);
  55. WASABI_API_MAKI->maki_callFunction(getScriptObject(), openmenu_id, NULL);
  56. }
  57. void C_MenuButton::closeMenu() {
  58. ASSERT(inited);
  59. WASABI_API_MAKI->maki_callFunction(getScriptObject(), closemenu_id, NULL);
  60. }
  61. int C_MenuButton::loaded=0;
  62. int C_MenuButton::onopenmenu_id=0;
  63. int C_MenuButton::onclosemenu_id=0;
  64. int C_MenuButton::onselectitem_id=0;
  65. int C_MenuButton::openmenu_id=0;
  66. int C_MenuButton::closemenu_id=0;