c_container.cpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /* This file was generated by Maki Compiler, do not edit manually */
  2. #include <precomp.h>
  3. #include "c_container.h"
  4. #include <api/script/objcontroller.h>
  5. C_Container::C_Container(ScriptObject *object) : C_RootObject(object) {
  6. inited = 0;
  7. obj = NULL;
  8. C_hook(object);
  9. }
  10. C_Container::C_Container() {
  11. inited = 0;
  12. obj = NULL;
  13. }
  14. void C_Container::C_hook(ScriptObject *object) {
  15. ASSERT(!inited);
  16. ScriptObjectController *controller = object->vcpu_getController();
  17. obj = controller->cast(object, containerGuid);
  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. onswitchtolayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onSwitchToLayout", this);
  26. onbeforeswitchtolayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onBeforeSwitchToLayout", this);
  27. setxmlparam_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setXmlParam", this);
  28. onhidelayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onHideLayout", this);
  29. onshowlayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onShowLayout", this);
  30. getlayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getLayout", this);
  31. getnumlayouts_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getNumLayouts", this);
  32. enumlayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"enumLayout", this);
  33. switchtolayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"switchToLayout", this);
  34. show_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"show", this);
  35. hide_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"hide", this);
  36. close_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"close", this);
  37. toggle_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"toggle", this);
  38. isdynamic_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"isDynamic", this);
  39. setname_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setName", this);
  40. getcurlayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getCurLayout", this);
  41. }
  42. inited = 1;
  43. }
  44. C_Container::~C_Container() {
  45. }
  46. ScriptObject *C_Container::getScriptObject() {
  47. if (obj != NULL) return obj;
  48. return C_CONTAINER_PARENT::getScriptObject();
  49. }
  50. void C_Container::onSwitchToLayout(ScriptObject *newlayout) {
  51. ASSERT(inited);
  52. scriptVar a = MAKE_SCRIPT_OBJECT(newlayout);
  53. scriptVar *params[1] = {&a};
  54. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onswitchtolayout_id, params);
  55. }
  56. void C_Container::onBeforeSwitchToLayout(ScriptObject *oldlayout, ScriptObject *newlayout) {
  57. ASSERT(inited);
  58. scriptVar a = MAKE_SCRIPT_OBJECT(oldlayout);
  59. scriptVar b = MAKE_SCRIPT_OBJECT(newlayout);
  60. scriptVar *params[2] = {&a, &b};
  61. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onbeforeswitchtolayout_id, params);
  62. }
  63. void C_Container::setXmlParam(const wchar_t *param, const wchar_t *value)
  64. {
  65. ASSERT(inited);
  66. scriptVar a = MAKE_SCRIPT_STRING(param);
  67. scriptVar b = MAKE_SCRIPT_STRING(value);
  68. scriptVar *params[2] = {&a, &b};
  69. WASABI_API_MAKI->maki_callFunction(getScriptObject(), setxmlparam_id, params);
  70. }
  71. void C_Container::onHideLayout(ScriptObject *_layout) {
  72. ASSERT(inited);
  73. scriptVar a = MAKE_SCRIPT_OBJECT(_layout);
  74. scriptVar *params[1] = {&a};
  75. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onhidelayout_id, params);
  76. }
  77. void C_Container::onShowLayout(ScriptObject *_layout) {
  78. ASSERT(inited);
  79. scriptVar a = MAKE_SCRIPT_OBJECT(_layout);
  80. scriptVar *params[1] = {&a};
  81. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onshowlayout_id, params);
  82. }
  83. ScriptObject *C_Container::getLayout(const wchar_t *layout_id)
  84. {
  85. ASSERT(inited);
  86. scriptVar a = MAKE_SCRIPT_STRING(layout_id);
  87. scriptVar *params[1] = {&a};
  88. return GET_SCRIPT_OBJECT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getlayout_id, params));
  89. }
  90. int C_Container::getNumLayouts() {
  91. ASSERT(inited);
  92. return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getnumlayouts_id, NULL));
  93. }
  94. ScriptObject *C_Container::enumLayout(int num) {
  95. ASSERT(inited);
  96. scriptVar a = MAKE_SCRIPT_INT(num);
  97. scriptVar *params[1] = {&a};
  98. return GET_SCRIPT_OBJECT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), enumlayout_id, params));
  99. }
  100. void C_Container::switchToLayout(const wchar_t *layout_id)
  101. {
  102. ASSERT(inited);
  103. scriptVar a = MAKE_SCRIPT_STRING(layout_id);
  104. scriptVar *params[1] = {&a};
  105. WASABI_API_MAKI->maki_callFunction(getScriptObject(), switchtolayout_id, params);
  106. }
  107. void C_Container::show() {
  108. ASSERT(inited);
  109. WASABI_API_MAKI->maki_callFunction(getScriptObject(), show_id, NULL);
  110. }
  111. void C_Container::hide() {
  112. ASSERT(inited);
  113. WASABI_API_MAKI->maki_callFunction(getScriptObject(), hide_id, NULL);
  114. }
  115. void C_Container::close() {
  116. ASSERT(inited);
  117. WASABI_API_MAKI->maki_callFunction(getScriptObject(), close_id, NULL);
  118. }
  119. void C_Container::toggle() {
  120. ASSERT(inited);
  121. WASABI_API_MAKI->maki_callFunction(getScriptObject(), toggle_id, NULL);
  122. }
  123. int C_Container::isDynamic() {
  124. ASSERT(inited);
  125. return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), isdynamic_id, NULL));
  126. }
  127. void C_Container::setName(const wchar_t *name)
  128. {
  129. ASSERT(inited);
  130. scriptVar a = MAKE_SCRIPT_STRING(name);
  131. scriptVar *params[1] = {&a};
  132. WASABI_API_MAKI->maki_callFunction(getScriptObject(), setname_id, params);
  133. }
  134. ScriptObject *C_Container::getCurLayout() {
  135. ASSERT(inited);
  136. return GET_SCRIPT_OBJECT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getcurlayout_id, NULL));
  137. }
  138. int C_Container::loaded=0;
  139. int C_Container::onswitchtolayout_id=0;
  140. int C_Container::onbeforeswitchtolayout_id=0;
  141. int C_Container::setxmlparam_id=0;
  142. int C_Container::onhidelayout_id=0;
  143. int C_Container::onshowlayout_id=0;
  144. int C_Container::getlayout_id=0;
  145. int C_Container::getnumlayouts_id=0;
  146. int C_Container::enumlayout_id=0;
  147. int C_Container::switchtolayout_id=0;
  148. int C_Container::show_id=0;
  149. int C_Container::hide_id=0;
  150. int C_Container::close_id=0;
  151. int C_Container::toggle_id=0;
  152. int C_Container::isdynamic_id=0;
  153. int C_Container::setname_id=0;
  154. int C_Container::getcurlayout_id=0;