aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/skin/widgets/xuimenuso.cpp
blob: 8c48f2103baa29638b7ab84c722814aa58274a12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
// ----------------------------------------------------------------------------
// Generated by ScriptObjectFactory [Sun Dec 14 07:21:52 2003]
// 
// File        : xuimenuso.cpp
// Class       : XuiMenuScriptObject
// class layer : Automatic Object Scripting
// ----------------------------------------------------------------------------
#include <precomp.h>

#include "xuimenuso.h"
#include "xuimenu.h"

// ScriptController Instance
static XuiMenuScriptController _xuiMenuScriptController;XuiMenuScriptController *xuiMenuScriptController = &_xuiMenuScriptController;

// Function Descriptor Table
function_descriptor_struct XuiMenuScriptController::exportedFunctions[] =  {
  {L"setMenuGroup", 1, script_setMenuGroup },
  {L"getMenuGroup", 0, script_getMenuGroup },
  {L"setMenu", 1, script_setMenu },
  {L"getMenu", 0, script_getMenu },
  {L"spawnMenu", 1, script_spawnMenu },
  {L"cancelMenu", 0, script_cancelMenu },
  {L"setNormalId", 1, script_setNormalId },
  {L"setDownId", 1, script_setDownId },
  {L"setHoverId", 1, script_setHoverId },
  {L"onOpenMenu", 0, script_onOpenMenu },
  {L"onCloseMenu", 0, script_onCloseMenu },
  {L"nextMenu", 0, script_nextMenu },
  {L"previousMenu", 0, script_previousMenu },
};

// Script Object Methods
XuiMenuScriptObject::XuiMenuScriptObject()  {
  if (!getScriptObject()) return;
  xuiMenuScriptObject_init();
}

XuiMenuScriptObject::~XuiMenuScriptObject() {
}

void XuiMenuScriptObject::xuiMenuScriptObject_init()  {
  // Assign the script interface to this instance.
  getScriptObject()->vcpu_setInterface(XuiMenuScriptGuid, (void *)static_cast<XuiMenu*>(this));
  // Assign the class name to this instance.
  getScriptObject()->vcpu_setClassName(L"Menu");
  // Assign the controller instance to this script object instance.
  getScriptObject()->vcpu_setController(xuiMenuScriptController);
}

// Script Object Methods

void XuiMenuScriptObject::script_onOpenMenu() {
  XuiMenuScriptController::script_onOpenMenu(SCRIPT_CALL, getScriptObject());
}

void XuiMenuScriptObject::script_onCloseMenu() {
  XuiMenuScriptController::script_onCloseMenu(SCRIPT_CALL, getScriptObject());
}

scriptVar /*void */ XuiMenuScriptController::script_setMenuGroup(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ mg) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) {
    // Then properly call the hosted object;
    _pObj->setMenuGroup(GET_SCRIPT_STRING(mg));
  }
  RETURN_SCRIPT_VOID;
}

scriptVar /*const char **/ XuiMenuScriptController::script_getMenuGroup(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));

  if (_pObj) 
    return MAKE_SCRIPT_STRING(_pObj->getMenuGroup());

  return MAKE_SCRIPT_STRING(L"");
}

scriptVar /*void */ XuiMenuScriptController::script_setMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ m) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) {
    // Then properly call the hosted object;
    _pObj->setMenu(GET_SCRIPT_STRING(m));
  }
  RETURN_SCRIPT_VOID;
}

scriptVar /*const char **/ XuiMenuScriptController::script_getMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));

  if (_pObj) 
    return MAKE_SCRIPT_STRING(_pObj->getMenu());

  return MAKE_SCRIPT_STRING(L"");
}

scriptVar /*void */ XuiMenuScriptController::script_spawnMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*int */ monitor) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) {
    // Then properly call the hosted object;
    _pObj->spawnMenu(GET_SCRIPT_INT(monitor));
  }
  RETURN_SCRIPT_VOID;
}

scriptVar /*void */ XuiMenuScriptController::script_cancelMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) {
    // Then properly call the hosted object;
    _pObj->cancelMenu();
  }
  RETURN_SCRIPT_VOID;
}

scriptVar /*void */ XuiMenuScriptController::script_setNormalId(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ id) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) 
	{
    // Then properly call the hosted object;
    _pObj->setNormalId(GET_SCRIPT_STRING(id));
  }
  RETURN_SCRIPT_VOID;
}

scriptVar /*void */ XuiMenuScriptController::script_setDownId(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ id) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) {
    // Then properly call the hosted object;
    _pObj->setDownId(GET_SCRIPT_STRING(id));
  }
  RETURN_SCRIPT_VOID;
}

scriptVar /*void */ XuiMenuScriptController::script_setHoverId(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO, scriptVar /*const char **/ id) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) {
    // Then properly call the hosted object;
    _pObj->setHoverId(GET_SCRIPT_STRING(id));
  }
  RETURN_SCRIPT_VOID;
}

scriptVar /*void */ XuiMenuScriptController::script_onOpenMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  // Begin all script methods with the init block
  SCRIPT_FUNCTION_INIT;
  // Honnor C++ hooks
  PROCESS_HOOKS0(_pSO, xuiMenuScriptController);
  // If there are no script hooks to execute, we abort here.
  SCRIPT_FUNCTION_CHECKABORTEVENT;
  // Otherwise we execute the script methods by calling this.
  SCRIPT_EXEC_EVENT0(_pSO);
}

scriptVar /*void */ XuiMenuScriptController::script_onCloseMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  // Begin all script methods with the init block
  SCRIPT_FUNCTION_INIT;
  // Honnor C++ hooks
  PROCESS_HOOKS0(_pSO, xuiMenuScriptController);
  // If there are no script hooks to execute, we abort here.
  SCRIPT_FUNCTION_CHECKABORTEVENT;
  // Otherwise we execute the script methods by calling this.
  SCRIPT_EXEC_EVENT0(_pSO);
}

scriptVar /*void */ XuiMenuScriptController::script_nextMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) {
    // Then properly call the hosted object;
    _pObj->nextMenu();
  }
  RETURN_SCRIPT_VOID;
}

scriptVar /*void */ XuiMenuScriptController::script_previousMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *_pSO) {
  // Begin all script methods with the init block.
  SCRIPT_FUNCTION_INIT;
  // Find the proper pointer for the "this" object, _pSO.
  XuiMenu*_pObj = static_cast<XuiMenu*>(_pSO->vcpu_getInterface(XuiMenuScriptGuid));
  if (_pObj) {
    // Then properly call the hosted object;
    _pObj->previousMenu();
  }
  RETURN_SCRIPT_VOID;
}

// Script Controller 

// This method returns the human readable name of the class in script files.
const wchar_t *XuiMenuScriptController::getClassName() {
  return L"Menu";
}

// This method returns the human readable name of the parent of this class.
const wchar_t *XuiMenuScriptController::getAncestorClassName() {
  return XUIMENU_SCRIPTPARENTCLASS;
}

// This method returns the controller object for the parent class.
ScriptObjectController *XuiMenuScriptController::getAncestorController() {
  return WASABI_API_MAKI->maki_getController(guiObjectGuid);
}

// This method returns the number of methods this class publishes.
int XuiMenuScriptController::getNumFunctions() {
  return sizeof(exportedFunctions) / sizeof(function_descriptor_struct);
}

// This method returns the block of published function descriptors.
const function_descriptor_struct *XuiMenuScriptController::getExportedFunctions() {
  return exportedFunctions;
}

// This method returns the GUID assigned to this script class.
GUID XuiMenuScriptController::getClassGuid() {
  return XuiMenuScriptGuid;
}

// This method creates and returns a new script class instance.
ScriptObject *XuiMenuScriptController::instantiate() {
  XuiMenu*_pObj = new XuiMenu();
  ASSERT(_pObj != NULL);
  return _pObj->XuiMenuScriptObject::getScriptObject();
}

// This method deletes a given script class instance.
void XuiMenuScriptController::destroy(ScriptObject *o) {
  XuiMenu*_pObj = static_cast<XuiMenu*>(o->vcpu_getInterface(XuiMenuScriptGuid));
  ASSERT(_pObj != NULL);
  delete _pObj;
}

// This method returns an encapsulated interface for the given instance.
void *XuiMenuScriptController::encapsulate(ScriptObject *o) {
  // No automatic encapsulation
  return NULL;
}

// This method frees a previously encapsulated interface.
void XuiMenuScriptController::deencapsulate(void *o) {
}