xuimenuso.cpp 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. // ----------------------------------------------------------------------------
  2. // Generated by ScriptObjectFactory [Sun Dec 14 07:21:52 2003]
  3. //
  4. // File : xuimenuso.cpp
  5. // Class : XuiMenuScriptObject
  6. // class layer : Automatic Object Scripting
  7. // ----------------------------------------------------------------------------
  8. #include <precomp.h>
  9. #include "xuimenuso.h"
  10. #include "xuimenu.h"
  11. // ScriptController Instance
  12. static XuiMenuScriptController _xuiMenuScriptController;XuiMenuScriptController *xuiMenuScriptController = &_xuiMenuScriptController;
  13. // Function Descriptor Table
  14. function_descriptor_struct XuiMenuScriptController::exportedFunctions[] = {
  15. {L"setMenuGroup", 1, script_setMenuGroup },
  16. {L"getMenuGroup", 0, script_getMenuGroup },
  17. {L"setMenu", 1, script_setMenu },
  18. {L"getMenu", 0, script_getMenu },
  19. {L"spawnMenu", 1, script_spawnMenu },
  20. {L"cancelMenu", 0, script_cancelMenu },
  21. {L"setNormalId", 1, script_setNormalId },
  22. {L"setDownId", 1, script_setDownId },
  23. {L"setHoverId", 1, script_setHoverId },
  24. {L"onOpenMenu", 0, script_onOpenMenu },
  25. {L"onCloseMenu", 0, script_onCloseMenu },
  26. {L"nextMenu", 0, script_nextMenu },
  27. {L"previousMenu", 0, script_previousMenu },
  28. };
  29. // Script Object Methods
  30. XuiMenuScriptObject::XuiMenuScriptObject() {
  31. if (!getScriptObject()) return;
  32. xuiMenuScriptObject_init();
  33. }
  34. XuiMenuScriptObject::~XuiMenuScriptObject() {
  35. }
  36. void XuiMenuScriptObject::xuiMenuScriptObject_init() {
  37. // Assign the script interface to this instance.
  38. getScriptObject()->vcpu_setInterface(XuiMenuScriptGuid, (void *)static_cast<XuiMenu*>(this));
  39. // Assign the class name to this instance.
  40. getScriptObject()->vcpu_setClassName(L"Menu");
  41. // Assign the controller instance to this script object instance.
  42. getScriptObject()->vcpu_setController(xuiMenuScriptController);
  43. }
  44. // Script Object Methods
  45. void XuiMenuScriptObject::script_onOpenMenu() {
  46. XuiMenuScriptController::script_onOpenMenu(SCRIPT_CALL, getScriptObject());
  47. }
  48. void XuiMenuScriptObject::script_onCloseMenu() {
  49. XuiMenuScriptController::script_onCloseMenu(SCRIPT_CALL, getScriptObject());
  50. }
  51. scriptVar /*void */ XuiMenuScriptController::script_setMenuGroup(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ mg) {
  52. // Begin all script methods with the init block.
  53. SCRIPT_FUNCTION_INIT;
  54. // Find the proper pointer for the "this" object, _pSO.
  55. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  56. if (_pObj) {
  57. // Then properly call the hosted object;
  58. _pObj->setMenuGroup(GET_SCRIPT_STRING(mg));
  59. }
  60. RETURN_SCRIPT_VOID;
  61. }
  62. scriptVar /*const char **/ XuiMenuScriptController::script_getMenuGroup(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  63. // Begin all script methods with the init block.
  64. SCRIPT_FUNCTION_INIT;
  65. // Find the proper pointer for the "this" object, _pSO.
  66. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  67. if (_pObj)
  68. return MAKE_SCRIPT_STRING(_pObj->getMenuGroup());
  69. return MAKE_SCRIPT_STRING(L"");
  70. }
  71. scriptVar /*void */ XuiMenuScriptController::script_setMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ m) {
  72. // Begin all script methods with the init block.
  73. SCRIPT_FUNCTION_INIT;
  74. // Find the proper pointer for the "this" object, _pSO.
  75. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  76. if (_pObj) {
  77. // Then properly call the hosted object;
  78. _pObj->setMenu(GET_SCRIPT_STRING(m));
  79. }
  80. RETURN_SCRIPT_VOID;
  81. }
  82. scriptVar /*const char **/ XuiMenuScriptController::script_getMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  83. // Begin all script methods with the init block.
  84. SCRIPT_FUNCTION_INIT;
  85. // Find the proper pointer for the "this" object, _pSO.
  86. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  87. if (_pObj)
  88. return MAKE_SCRIPT_STRING(_pObj->getMenu());
  89. return MAKE_SCRIPT_STRING(L"");
  90. }
  91. scriptVar /*void */ XuiMenuScriptController::script_spawnMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*int */ monitor) {
  92. // Begin all script methods with the init block.
  93. SCRIPT_FUNCTION_INIT;
  94. // Find the proper pointer for the "this" object, _pSO.
  95. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  96. if (_pObj) {
  97. // Then properly call the hosted object;
  98. _pObj->spawnMenu(GET_SCRIPT_INT(monitor));
  99. }
  100. RETURN_SCRIPT_VOID;
  101. }
  102. scriptVar /*void */ XuiMenuScriptController::script_cancelMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  103. // Begin all script methods with the init block.
  104. SCRIPT_FUNCTION_INIT;
  105. // Find the proper pointer for the "this" object, _pSO.
  106. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  107. if (_pObj) {
  108. // Then properly call the hosted object;
  109. _pObj->cancelMenu();
  110. }
  111. RETURN_SCRIPT_VOID;
  112. }
  113. scriptVar /*void */ XuiMenuScriptController::script_setNormalId(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ id) {
  114. // Begin all script methods with the init block.
  115. SCRIPT_FUNCTION_INIT;
  116. // Find the proper pointer for the "this" object, _pSO.
  117. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  118. if (_pObj)
  119. {
  120. // Then properly call the hosted object;
  121. _pObj->setNormalId(GET_SCRIPT_STRING(id));
  122. }
  123. RETURN_SCRIPT_VOID;
  124. }
  125. scriptVar /*void */ XuiMenuScriptController::script_setDownId(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ id) {
  126. // Begin all script methods with the init block.
  127. SCRIPT_FUNCTION_INIT;
  128. // Find the proper pointer for the "this" object, _pSO.
  129. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  130. if (_pObj) {
  131. // Then properly call the hosted object;
  132. _pObj->setDownId(GET_SCRIPT_STRING(id));
  133. }
  134. RETURN_SCRIPT_VOID;
  135. }
  136. scriptVar /*void */ XuiMenuScriptController::script_setHoverId(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ id) {
  137. // Begin all script methods with the init block.
  138. SCRIPT_FUNCTION_INIT;
  139. // Find the proper pointer for the "this" object, _pSO.
  140. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  141. if (_pObj) {
  142. // Then properly call the hosted object;
  143. _pObj->setHoverId(GET_SCRIPT_STRING(id));
  144. }
  145. RETURN_SCRIPT_VOID;
  146. }
  147. scriptVar /*void */ XuiMenuScriptController::script_onOpenMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  148. // Begin all script methods with the init block
  149. SCRIPT_FUNCTION_INIT;
  150. // Honnor C++ hooks
  151. PROCESS_HOOKS0(_pSO, xuiMenuScriptController);
  152. // If there are no script hooks to execute, we abort here.
  153. SCRIPT_FUNCTION_CHECKABORTEVENT;
  154. // Otherwise we execute the script methods by calling this.
  155. SCRIPT_EXEC_EVENT0(_pSO);
  156. }
  157. scriptVar /*void */ XuiMenuScriptController::script_onCloseMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  158. // Begin all script methods with the init block
  159. SCRIPT_FUNCTION_INIT;
  160. // Honnor C++ hooks
  161. PROCESS_HOOKS0(_pSO, xuiMenuScriptController);
  162. // If there are no script hooks to execute, we abort here.
  163. SCRIPT_FUNCTION_CHECKABORTEVENT;
  164. // Otherwise we execute the script methods by calling this.
  165. SCRIPT_EXEC_EVENT0(_pSO);
  166. }
  167. scriptVar /*void */ XuiMenuScriptController::script_nextMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  168. // Begin all script methods with the init block.
  169. SCRIPT_FUNCTION_INIT;
  170. // Find the proper pointer for the "this" object, _pSO.
  171. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  172. if (_pObj) {
  173. // Then properly call the hosted object;
  174. _pObj->nextMenu();
  175. }
  176. RETURN_SCRIPT_VOID;
  177. }
  178. scriptVar /*void */ XuiMenuScriptController::script_previousMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  179. // Begin all script methods with the init block.
  180. SCRIPT_FUNCTION_INIT;
  181. // Find the proper pointer for the "this" object, _pSO.
  182. XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  183. if (_pObj) {
  184. // Then properly call the hosted object;
  185. _pObj->previousMenu();
  186. }
  187. RETURN_SCRIPT_VOID;
  188. }
  189. // Script Controller
  190. // This method returns the human readable name of the class in script files.
  191. const wchar_t *XuiMenuScriptController::getClassName() {
  192. return L"Menu";
  193. }
  194. // This method returns the human readable name of the parent of this class.
  195. const wchar_t *XuiMenuScriptController::getAncestorClassName() {
  196. return XUIMENU_SCRIPTPARENTCLASS;
  197. }
  198. // This method returns the controller object for the parent class.
  199. ScriptObjectController *XuiMenuScriptController::getAncestorController() {
  200. return WASABI_API_MAKI->maki_getController(guiObjectGuid);
  201. }
  202. // This method returns the number of methods this class publishes.
  203. int XuiMenuScriptController::getNumFunctions() {
  204. return sizeof(exportedFunctions) / sizeof(function_descriptor_struct);
  205. }
  206. // This method returns the block of published function descriptors.
  207. const function_descriptor_struct *XuiMenuScriptController::getExportedFunctions() {
  208. return exportedFunctions;
  209. }
  210. // This method returns the GUID assigned to this script class.
  211. GUID XuiMenuScriptController::getClassGuid() {
  212. return XuiMenuScriptGuid;
  213. }
  214. // This method creates and returns a new script class instance.
  215. ScriptObject *XuiMenuScriptController::instantiate() {
  216. XuiMenu*_pObj = new XuiMenu();
  217. ASSERT(_pObj != NULL);
  218. return _pObj->XuiMenuScriptObject::getScriptObject();
  219. }
  220. // This method deletes a given script class instance.
  221. void XuiMenuScriptController::destroy(ScriptObject *o) {
  222. XuiMenu*_pObj = static_cast<XuiMenu*>(o->vcpu_getInterface(XuiMenuScriptGuid));
  223. ASSERT(_pObj != NULL);
  224. delete _pObj;
  225. }
  226. // This method returns an encapsulated interface for the given instance.
  227. void *XuiMenuScriptController::encapsulate(ScriptObject *o) {
  228. // No automatic encapsulation
  229. return NULL;
  230. }
  231. // This method frees a previously encapsulated interface.
  232. void XuiMenuScriptController::deencapsulate(void *o) {
  233. }