68#define XK_BackSpace 0xFF08
70#define XK_Linefeed 0xFF0A
71#define XK_Clear 0xFF0B
72#define XK_Return 0xFF0D
73#define XK_Pause 0xFF13
74#define XK_Scroll_Lock 0xFF14
75#define XK_Sys_Req 0xFF15
76#define XK_Escape 0xFF1B
77#define XK_Delete 0xFFFF
79#define XK_Multi_key 0xFF20
86#define XK_Right 0xFF53
88#define XK_Prior 0xFF55
89#define XK_Page_Up 0xFF55
91#define XK_Page_Down 0xFF56
93#define XK_Begin 0xFF58
98#define XK_Select 0xFF60
99#define XK_Print 0xFF61
100#define XK_Execute 0xFF62
101#define XK_Insert 0xFF63
102#define XK_Undo 0xFF65
103#define XK_Redo 0xFF66
104#define XK_Menu 0xFF67
105#define XK_Find 0xFF68
106#define XK_Cancel 0xFF69
107#define XK_Help 0xFF6A
108#define XK_Break 0xFF6B
109#define XK_Mode_switch 0xFF7E
110#define XK_script_switch 0xFF7E
111#define XK_Num_Lock 0xFF7F
115#define XK_KP_Space 0xFF80
116#define XK_KP_Tab 0xFF89
117#define XK_KP_Enter 0xFF8D
118#define XK_KP_F1 0xFF91
119#define XK_KP_F2 0xFF92
120#define XK_KP_F3 0xFF93
121#define XK_KP_F4 0xFF94
122#define XK_KP_Home 0xFF95
123#define XK_KP_Left 0xFF96
124#define XK_KP_Up 0xFF97
125#define XK_KP_Right 0xFF98
126#define XK_KP_Down 0xFF99
127#define XK_KP_Prior 0xFF9A
128#define XK_KP_Page_Up 0xFF9A
129#define XK_KP_Next 0xFF9B
130#define XK_KP_Page_Down 0xFF9B
131#define XK_KP_End 0xFF9C
132#define XK_KP_Begin 0xFF9D
133#define XK_KP_Insert 0xFF9E
134#define XK_KP_Delete 0xFF9F
135#define XK_KP_Equal 0xFFBD
136#define XK_KP_Multiply 0xFFAA
137#define XK_KP_Add 0xFFAB
138#define XK_KP_Separator 0xFFAC
139#define XK_KP_Subtract 0xFFAD
140#define XK_KP_Decimal 0xFFAE
141#define XK_KP_Divide 0xFFAF
143#define XK_KP_0 0xFFB0
144#define XK_KP_1 0xFFB1
145#define XK_KP_2 0xFFB2
146#define XK_KP_3 0xFFB3
147#define XK_KP_4 0xFFB4
148#define XK_KP_5 0xFFB5
149#define XK_KP_6 0xFFB6
150#define XK_KP_7 0xFFB7
151#define XK_KP_8 0xFFB8
152#define XK_KP_9 0xFFB9
216#define XK_Shift_L 0xFFE1
217#define XK_Shift_R 0xFFE2
218#define XK_Control_L 0xFFE3
219#define XK_Control_R 0xFFE4
220#define XK_Caps_Lock 0xFFE5
221#define XK_Shift_Lock 0xFFE6
223#define XK_Meta_L 0xFFE7
224#define XK_Meta_R 0xFFE8
225#define XK_Alt_L 0xFFE9
226#define XK_Alt_R 0xFFEA
227#define XK_Super_L 0xFFEB
228#define XK_Super_R 0xFFEC
229#define XK_Hyper_L 0xFFED
230#define XK_Hyper_R 0xFFEE
234 0, 0, 0, 0, 0, 0, 0, 0,
235 0, 0, 0, 0, 0, 0, 0, 0,
236 0, 0, 0, XK_Pause, XK_Caps_Lock, 0, 0, 0,
237 0, 0, 0, XK_Escape, 0, 0, 0, 0,
238 0, XK_Prior, XK_Next, XK_End, XK_Home, XK_Left, XK_Up, XK_Right,
239 XK_Down, 0, 0, 0, XK_Sys_Req, XK_Insert, XK_Delete, 0,
240 0, 0, 0, 0, 0, 0, 0, 0,
241 0, 0, 0, 0, 0, 0, 0, 0,
242 0, 0, 0, 0, 0, 0, 0, 0,
243 0, 0, 0, 0, 0, 0, 0, 0,
244 0, 0, 0, 0, 0, 0, 0, 0,
245 0, 0, 0, 0, 0, 0, 0, 0,
246 0, 0, 0, 0, 0, 0, 0, 0,
247 0, 0, 0, 0, 0, 0, 0, 0,
248 XK_F1, XK_F2, XK_F3, XK_F4, XK_F5, XK_F6, XK_F7, XK_F8,
249 XK_F9, XK_F10, XK_F11, XK_F12, XK_F13, XK_F14, XK_F15, XK_F16,
250 0, 0, 0, 0, 0, 0, 0, 0,
251 0, 0, 0, 0, 0, 0, 0, 0,
252 XK_Num_Lock, XK_Scroll_Lock, 0, 0, 0, 0, 0, 0,
253 0, 0, 0, 0, 0, 0, 0, 0
258 if ((c < 0) || (c >= 160))
return 0;
265class ScolMessageParameterKeyboard
269 ScolWindowHandle hwnd;
276 ScolMessageParameterKeyboard(
const UINT paramMsg,
const ScolWindowHandle paramHwnd,
const UINT paramWParam,
const LONG paramLParam)
278 msg = (
UINT)paramMsg;
279 hwnd = (ScolWindowHandle)paramHwnd;
280 wParam = (
UINT)paramWParam;
281 lParam = (
LONG)paramLParam;
288 ScolMessageParameterKeyboard()
296class ScolWidgetEventsListener :
public SWidgetListener
305 ScolWidgetEventsListener()
311 virtual void OnEnter(SWidget* targetWidget)
318 virtual void OnExit(SWidget* targetWidget)
325 virtual void OnInside(SWidget* targetWidget)
332 virtual void OnMouseMove(SWidget* targetWidget,
const int& mousePosX,
const int& mousePosY,
const MouseButtonId& mouseButton,
const int&
id)
334 MMOUSE* mouseParams =
new MMOUSE(mousePosX, mousePosY, mouseButton,
id);
337 mouseParams =
new MMOUSE(mousePosX, mousePosY, mouseButton,
id);
343 virtual void OnMouseDown(SWidget* targetWidget,
const int& mousePosX,
const int& mousePosY,
const MouseButtonId& mouseButton,
const int&
id)
345 MMOUSE* mouseParams =
new MMOUSE(mousePosX, mousePosY, mouseButton,
id);
348 mouseParams =
new MMOUSE(mousePosX, mousePosY, mouseButton,
id);
354 virtual void OnMouseUp(SWidget* targetWidget,
const int& mousePosX,
const int& mousePosY,
const MouseButtonId& mouseButton,
const int&
id)
356 MMOUSE* mouseParams =
new MMOUSE(mousePosX, mousePosY, mouseButton,
id);
359 mouseParams =
new MMOUSE(mousePosX, mousePosY, mouseButton,
id);
365 virtual void OnMouseWheel(SWidget* targetWidget,
const int& mousePosX,
const int& mousePosY,
const int& relativeScroll,
const int&
id)
367 MMOUSE* mouseParams =
new MMOUSE(mousePosX, mousePosY, 0,
id, relativeScroll);
370 mouseParams =
new MMOUSE(mousePosX, mousePosY, 0,
id, relativeScroll);
376 virtual void OnTouchAdd(SWidget* targetWidget,
const int& mousePosX,
const int& mousePosY,
const int& touchid)
378 MMOUSE* mouseParams =
new MMOUSE(mousePosX, mousePosY, 0, touchid);
384 virtual void OnTouchRemove(SWidget* targetWidget,
const int& mousePosX,
const int& mousePosY,
const int& touchid)
386 MMOUSE* mouseParams =
new MMOUSE(mousePosX, mousePosY, 0, touchid);
392 virtual void OnTouchUpdate(SWidget* targetWidget,
const int& mousePosX,
const int& mousePosY,
const int& vx,
const int& vy,
const int& touchid)
394 MMOUSE* mouseParams =
new MMOUSE(mousePosX, mousePosY, 0, touchid, 0, 0, 0, vx, vy);
400 virtual void OnKey(SWidget* targetWidget,
const UINT& msg,
const ScolWindowHandle& hwnd,
const UINT& wParam,
const LONG& lParam)
402 ScolMessageParameterKeyboard* messageParameterFull =
new ScolMessageParameterKeyboard(msg, hwnd, wParam, lParam);
403 OBJpostEvent(
WIDGET_KEY_EVENT, SCOL_PTR targetWidget, SCOL_PTR messageParameterFull);
405 ScolMessageParameterKeyboard* messageParameter =
new ScolMessageParameterKeyboard(msg, hwnd, wParam, (lParam >> 16) & 0x1ff);
406 if ((msg == WM_KEYDOWN) || (msg == WM_IME_KEYDOWN) || (msg == WM_SYSKEYDOWN) || (msg == WM_CHAR))
413 messageParameter->wParam = c;
415 else if ((
int)wParam == XK_Escape)
420 else if ((msg == WM_KEYUP) || (msg == WM_IME_KEYUP) || (msg == WM_SYSKEYUP))
426 virtual void OnScriptCall(SWidget* targetWidget,
const SScriptFunction& functionCalled)
429 SScriptFunction* scriptFunction =
new SScriptFunction(functionCalled);
435 virtual void OnFocus(SWidget* targetWidget,
const bool& focused)
442 virtual void OnLoadStart(SWidget* targetWidget)
449 virtual void OnLoadEnd(SWidget* targetWidget)
456 virtual void OnLoadError(SWidget* targetWidget,
const int& errorCode,
const std::string& failedUrl)
478 MMechostr(MSKDEBUG,
"getWidgetCallbackOnScriptCallback\n");
487 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_SCRIPT_EVENT)))
490 Mpushstrbloc(m, (
char*)(functionCalled->
function.c_str()));
493 for (
unsigned int i = 0; i < functionCalled->
arguments.size(); i++)
495 if (k = Mpushstrbloc(m, (
char*)(functionCalled->
arguments.at(i).c_str())))
502 for (
unsigned int i = 0; i < functionCalled->
arguments.size(); i++)
504 if (MMpush(m, 2 * 2))
510 res = OBJcallreflex(m, 2);
513 delete(functionCalled);
532 MMechostr(MSKDEBUG,
"getWidgetCallbackOnEnterEvent\n");
538 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_ENTER_EVENT)))
539 res = OBJcallreflex(m, 0);
559 MMechostr(MSKDEBUG,
"getWidgetCallbackOnExitEvent\n");
565 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_EXIT_EVENT)))
566 res = OBJcallreflex(m, 0);
586 MMechostr(MSKDEBUG,
"getWidgetCallbackMouseMoveEvent\n");
591 MMOUSE* result = (MMOUSE*)
param;
593 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_MOUSE_MOVE_EVENT)))
595 MMpush(m, ITOM(result->x));
596 MMpush(m, ITOM(result->y));
597 MMpush(m, ITOM(result->btn));
599 res = OBJcallreflex(m, 3);
621 MMechostr(MSKDEBUG,
"getWidgetCallbackMouseDownEvent\n");
626 MMOUSE* result = (MMOUSE*)
param;
628 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_MOUSE_DOWN_EVENT)))
630 MMpush(m, ITOM(result->x));
631 MMpush(m, ITOM(result->y));
632 MMpush(m, ITOM(result->btn));
634 res = OBJcallreflex(m, 3);
656 MMechostr(MSKDEBUG,
"getWidgetCallbackMouseUpEvent\n");
661 MMOUSE* result = (MMOUSE*)
param;
663 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_MOUSE_UP_EVENT)))
665 MMpush(m, ITOM(result->x));
666 MMpush(m, ITOM(result->y));
667 MMpush(m, ITOM(result->btn));
669 res = OBJcallreflex(m, 3);
691 MMechostr(MSKDEBUG,
"getWidgetCallbackMouseWheelEvent\n");
696 MMOUSE* result = (MMOUSE*)
param;
698 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_MOUSEWHEEL_EVENT)))
700 MMpush(m, ITOM(result->x));
701 MMpush(m, ITOM(result->y));
702 MMpush(m, ITOM(result->scroll));
704 res = OBJcallreflex(m, 3);
726 MMechostr(MSKDEBUG,
"getWidgetCallbackTouchAddEvent\n");
731 MMOUSE* result = (MMOUSE*)
param;
733 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_TOUCH_ADD_EVENT)))
735 MMpush(m, ITOM(result->index));
736 MMpush(m, ITOM(result->x));
737 MMpush(m, ITOM(result->y));
739 res = OBJcallreflex(m, 3);
761 MMechostr(MSKDEBUG,
"getWidgetCallbackTouchRemoveEvent\n");
766 MMOUSE* result = (MMOUSE*)
param;
768 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_TOUCH_REMOVE_EVENT)))
770 MMpush(m, ITOM(result->index));
771 MMpush(m, ITOM(result->x));
772 MMpush(m, ITOM(result->y));
774 res = OBJcallreflex(m, 3);
796 MMechostr(MSKDEBUG,
"getWidgetCallbackTouchUpdateEvent\n");
801 MMOUSE* result = (MMOUSE*)
param;
803 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_TOUCH_UPDATE_EVENT)))
805 MMpush(m, ITOM(result->index));
806 MMpush(m, ITOM(result->x));
807 MMpush(m, ITOM(result->y));
808 MMpush(m, ITOM(result->vx));
809 MMpush(m, ITOM(result->vy));
811 res = OBJcallreflex(m, 5);
833 MMechostr(MSKDEBUG,
"getWidgetCallbackInputDownEvent\n");
838 MMOUSE* result = (MMOUSE*)
param;
840 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_INPUT_DOWN_EVENT)))
842 MMpush(m, ITOM(result->index));
843 MMpush(m, ITOM(result->x));
844 MMpush(m, ITOM(result->y));
845 MMpush(m, ITOM(result->btn));
847 res = OBJcallreflex(m, 4);
869 MMechostr(MSKDEBUG,
"getWidgetCallbackInputUpEvent\n");
874 MMOUSE* result = (MMOUSE*)
param;
876 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_INPUT_UP_EVENT)))
878 MMpush(m, ITOM(result->index));
879 MMpush(m, ITOM(result->x));
880 MMpush(m, ITOM(result->y));
881 MMpush(m, ITOM(result->btn));
883 res = OBJcallreflex(m, 4);
905 MMechostr(MSKDEBUG,
"getWidgetCallbackInputUpdateEvent\n");
910 MMOUSE* result = (MMOUSE*)
param;
912 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_INPUT_UPDATE_EVENT)))
914 MMpush(m, ITOM(result->index));
915 MMpush(m, ITOM(result->x));
916 MMpush(m, ITOM(result->y));
917 MMpush(m, ITOM(result->btn));
919 res = OBJcallreflex(m, 4);
941 MMechostr(MSKDEBUG,
"getWidgetCallbackInputWheelEvent\n");
946 MMOUSE* result = (MMOUSE*)
param;
948 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_INPUT_WHEEL_EVENT)))
950 MMpush(m, ITOM(result->index));
951 MMpush(m, ITOM(result->x));
952 MMpush(m, ITOM(result->y));
953 MMpush(m, ITOM(result->scroll));
955 res = OBJcallreflex(m, 4);
977 MMechostr(MSKDEBUG,
"getWidgetCallbackKeyDownEvent\n");
982 ScolMessageParameterKeyboard* result = (ScolMessageParameterKeyboard*)
param;
984 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_KEY_DOWN_EVENT)))
986 MMpush(m, ITOM(result->lParam));
987 MMpush(m, ITOM(result->wParam));
988 res = OBJcallreflex(m, 2);
1010 MMechostr(MSKDEBUG,
"getWidgetCallbackKeyUpEvent\n");
1015 ScolMessageParameterKeyboard* result = (ScolMessageParameterKeyboard*)
param;
1017 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_KEY_UP_EVENT)))
1019 MMpush(m, ITOM(result->lParam));
1020 res = OBJcallreflex(m, 1);
1042 MMechostr(MSKDEBUG,
"getWidgetCallbackKeyEvent\n");
1047 ScolMessageParameterKeyboard* result = (ScolMessageParameterKeyboard*)
param;
1049 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_KEY_EVENT)))
1051 MMpush(m, ITOM(result->msg));
1052 MMpush(m, ITOM(result->lParam));
1053 MMpush(m, ITOM(result->wParam));
1054 res = OBJcallreflex(m, 3);
1076 MMechostr(MSKDEBUG,
"getWidgetCallbackFocusEvent\n");
1081 int result = (int)
param;
1083 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_FOCUS_EVENT)))
1085 MMpush(m, ITOM(result));
1086 res = OBJcallreflex(m, 1);
1105 MMechostr(MSKDEBUG,
"getWidgetCallbackOnLoadStartEvent\n");
1111 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_ON_LOAD_START_EVENT)))
1113 res = OBJcallreflex(m, 0);
1132 MMechostr(MSKDEBUG,
"getWidgetCallbackOnLoadEndEvent\n");
1136#if SO3_WEB_NAVIGATOR_BUILD == 1
1139 SWidget* sWidget = (SWidget*)
id;
1140 SWebNavigatorWidget* targetWidget =
static_cast<SWebNavigatorWidget*
>(sWidget);
1141 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_ON_LOAD_END_EVENT)))
1144 if (targetWidget && targetWidget->GetUpdateOnFocusOnly() && !targetWidget->HasFocus())
1145 targetWidget->Update(
true);
1147 res = OBJcallreflex(m, 0);
1167 MMechostr(MSKDEBUG,
"getWidgetCallbackOnLoadErrorEvent\n");
1171#if SO3_WEB_NAVIGATOR_BUILD == 1
1174 SWidget* sWidget = (SWidget*)
id;
1175 SWebNavigatorWidget* targetWidget =
static_cast<SWebNavigatorWidget*
>(sWidget);
1177 if (!(k = OBJbeginreflex(m,
SO3WIDGET,
id, SO3_WIDGET_ON_LOAD_ERROR_EVENT)))
1180 if (targetWidget && targetWidget->GetUpdateOnFocusOnly() && !targetWidget->HasFocus())
1181 targetWidget->Update(
true);
1183 Mpushstrbloc(m, (
char*)
param);
1184 res = OBJcallreflex(m, 1);
1202 MMechostr(MSKDEBUG,
"SO3WidgetLoadFile\n");
1206 int fc = MMget(m, 0);
1207 if ((fc == NIL) || (ff == NIL))
1213 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1216 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1221 char* file = MMstartstr(m, MTOP(ff));
1229 if (!strcmp(
"", file))
1238 widget->LoadFile(std::string(file));
1240 catch (
const Ogre::Exception& e)
1242 MMechostr(MSKDEBUG,
"An error occurs while trying to load a file named \"%s\" on a widget: %s\n", file, e.what());
1246 MMset(m, 0, ITOM(1));
1263 MMechostr(MSKDEBUG,
"SO3WidgetLoadUrl\n");
1267 int fc = MMget(m, 0);
1268 if ((fc == NIL) || (u == NIL))
1274 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1277 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1282 const char* url = MMstartstr(m, MTOP(u));
1290 if (!strcmp(
"", url))
1299 widget->LoadURL(std::string(url));
1301 catch (
const Ogre::Exception& e)
1303 MMechostr(MSKDEBUG,
"An error occurs while trying to load an URL to \"%s\"on a widget: %s\n", url, e.what());
1307 MMset(m, 0, ITOM(1));
1323 MMechostr(MSKDEBUG,
"SO3WidgetDestroy\n");
1326 int fc = MMget(m, 0);
1333 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1336 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1344 MMechostr(MSKDEBUG,
"SO3WidgetDestroy : OK !\n");
1347 MMset(m, 0, ITOM(1));
1364 MMechostr(MSKDEBUG,
"SO3WidgetSetZOrder\n");
1368 int fc = MMget(m, 0);
1369 if ((fc == NIL) || (z == NIL))
1375 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1378 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1384 widget->SetZOrder((
unsigned short)val);
1386 MMset(m, 0, ITOM(1));
1403 MMechostr(MSKDEBUG,
"SO3WidgetSetForeground\n");
1407 int fc = MMget(m, 0);
1408 if ((fc == NIL) || (b == NIL))
1414 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1417 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1422 bool enable =
false;
1426 widget->SetForeground(enable);
1427 MMset(m, 0, ITOM(1));
1443 MMechostr(MSKDEBUG,
"SO3WidgetGetForeground\n");
1446 int fc = MMget(m, 0);
1453 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1456 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1462 if (widget->GetForeground())
1465 MMset(m, 0, ITOM(val));
1482 MMechostr(MSKDEBUG,
"SO3WidgetSetTopOnFocus\n");
1486 int fc = MMget(m, 0);
1487 if ((fc == NIL) || (b == NIL))
1493 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1496 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1501 bool enable =
false;
1505 widget->SetTopOnFocus(enable);
1507 MMset(m, 0, ITOM(1));
1523 MMechostr(MSKDEBUG,
"SO3WidgetGetTopOnFocus\n");
1526 int fc = MMget(m, 0);
1533 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1536 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1542 if (widget->GetTopOnFocus())
1545 MMset(m, 0, ITOM(val));
1563 MMechostr(MSKDEBUG,
"SO3WidgetSetIgnoreTransparentPixels\n");
1568 int fc = MMget(m, 0);
1569 if ((fc == NIL) || (b == NIL) || (t == NIL))
1575 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1578 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1583 bool ignore =
false;
1587 widget->SetIgnoreTransparentPixels(ignore, MTOF(t));
1588 MMset(m, 0, ITOM(1));
1604 MMechostr(MSKDEBUG,
"SO3WidgetGetIgnoreTransparentPixels\n");
1607 int fc = MMget(m, 0);
1614 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1617 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1622 float valT = widget->GetIgnoreTransparentPixelsTreshold();
1624 if (widget->GetIgnoreTransparentPixels())
1628 int tuple = MMmalloc(m, 2, TYPETAB);
1635 MMstore(m, tuple, 0, ITOM((
int)(valI)));
1636 MMstore(m, tuple, 1, FTOM((
float)(valT)));
1637 MMset(m, 0, PTOM(tuple));
1653 MMechostr(MSKDEBUG,
"SO3WidgetSetFocus\n");
1656 int fc = MMget(m, 0);
1663 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1666 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1671 widget->TakeFocus();
1672 MMset(m, 0, ITOM(1));
1687 MMechostr(MSKDEBUG,
"SO3WidgetSetFocus\n");
1690 int fc = MMget(m, 0);
1697 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1700 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1705 widget->ReleaseFocus();
1706 MMset(m, 0, ITOM(1));
1721 MMechostr(MSKDEBUG,
"SO3WidgetGetZOrder\n");
1724 int fc = MMget(m, 0);
1731 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1734 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1739 MMset(m, 0, ITOM(
static_cast<int> (widget->GetZOrder())));
1757 MMechostr(MSKDEBUG,
"SO3WidgetSetPosition\n");
1760 int y = MTOI(MMpull(m));
1761 int x = MTOI(MMpull(m));
1762 int fc = MMget(m, 0);
1769 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1772 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1777 widget->SetPosition(SPoint<int>(x, y));
1778 MMset(m, 0, ITOM(1));
1794 MMechostr(MSKDEBUG,
"SO3WidgetGetPosition\n");
1797 int fc = MMget(m, 0);
1804 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1807 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1812 int tuple = MMmalloc(m, 2, TYPETAB);
1819 SPoint<int> currentPosition = widget->GetPosition();
1820 MMstore(m, tuple, 0, ITOM(currentPosition.x));
1821 MMstore(m, tuple, 1, ITOM(currentPosition.y));
1822 MMset(m, 0, PTOM(tuple));
1838 MMechostr(MSKDEBUG,
"SO3WidgetSetTextureRatio\n");
1841 int scolScale = MMpull(m);
1842 int scolWidget = MMget(m, 0);
1843 if ((scolWidget == NIL) || (scolScale == NIL))
1849 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1852 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1857 float scale = MTOF(scolScale);
1858 if ((scale <= 0.0f) || (scale > 1.0f))
1860 MMechostr(MSKDEBUG,
"Invalid texture ratio provided!\n");
1865 widget->SetTextureRatio(scale);
1866 MMset(m, 0, ITOM(1));
1881 MMechostr(MSKDEBUG,
"SO3WidgetGetTextureRatio\n");
1884 int scolWidget = MMget(m, 0);
1885 if (scolWidget == NIL)
1891 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1894 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1899 MMset(m, 0, FTOM(widget->GetTextureRatio()));
1914 MMechostr(MSKDEBUG,
"SO3WidgetGetSize\n");
1917 int fc = MMget(m, 0);
1924 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1927 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1932 int tuple = MMmalloc(m, 2, TYPETAB);
1939 MMstore(m, tuple, 0, ITOM((
int)(widget->GetWidth())));
1940 MMstore(m, tuple, 1, ITOM((
int)(widget->GetHeight())));
1941 MMset(m, 0, PTOM(tuple));
1959 MMechostr(MSKDEBUG,
"SO3WidgetSetSize\n");
1962 int h = MTOI(MMpull(m));
1963 int w = MTOI(MMpull(m));
1964 int fc = MMget(m, 0);
1971 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
1974 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
1981 widget->SetSize(abs(
w), abs(h));
1983 catch (Ogre::Exception &e)
1985 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
1990 MMset(m, 0, ITOM(1));
2006 MMechostr(MSKDEBUG,
"SO3WidgetGetName\n");
2009 int fc = MMget(m, 0);
2016 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2019 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2025 return Mpushstrbloc(m, (
char*)(widget->GetName().c_str()));
2040 MMechostr(MSKDEBUG,
"SO3WidgetGetType\n");
2043 int fc = MMget(m, 0);
2050 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2053 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2059 return Mpushstrbloc(m, (
char*)(widget->GetType().c_str()));
2074 MMechostr(MSKDEBUG,
"SO3WidgetGetMode\n");
2077 int fc = MMget(m, 0);
2084 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2087 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2093 if (widget->GetIsOverlayed())
2095 else if (widget->GetIs2DRect())
2098 MMset(m, 0, ITOM(mode));
2115 MMechostr(MSKDEBUG,
"SO3WidgetSetStereo\n");
2119 int fc = MMget(m, 0);
2126 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2129 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2134 SWidget::StereoMode state = (st == NIL) ? SWidget::StereoMode::MONO : (SWidget::StereoMode)MTOI(st);
2135 widget->SetStereo(state);
2152 MMechostr(MSKDEBUG,
"SO3WidgetGetStereo\n");
2155 int fc = MMget(m, 0);
2162 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2165 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2170 int state = widget->GetIsStereo() ? 1 : 0;
2172 MMset(m, 0, ITOM(state));
2189 MMechostr(MSKDEBUG,
"SO3WidgetSetStereoEye\n");
2193 int fc = MMget(m, 0);
2200 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2203 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2208 bool left = (MTOI(ey) > 0) ?
false :
true;
2209 widget->SetStereoEye(left);
2227 MMechostr(MSKDEBUG,
"SO3WidgetSetVisibility\n");
2230 int b = MTOI(MMpull(m));
2231 int fc = MMget(m, 0);
2238 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2241 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2251 MMset(m, 0, ITOM(1));
2267 MMechostr(MSKDEBUG,
"SO3WidgetGetVisibility\n");
2269 int fc = MMget(m, 0);
2276 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2279 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2285 if (widget->GetVisible())
2288 MMset(m, 0, ITOM(val));
2305 MMechostr(MSKDEBUG,
"SO3WidgetSetKeyboardEnable\n");
2307 int enab = MTOI(MMpull(m));
2308 int fc = MMget(m, 0);
2315 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2318 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2323 bool enable =
false;
2327 widget->SetKeyboardEnable(enable);
2328 MMset(m, 0, ITOM(1));
2344 MMechostr(MSKDEBUG,
"SO3WidgetGetKeyboardEnable\n");
2346 int fc = MMget(m, 0);
2353 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2356 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2362 if (widget->GetKeyboardEnable())
2365 MMset(m, 0, ITOM(val));
2382 MMechostr(MSKDEBUG,
"SO3WidgetSetMouseEnable\n");
2384 int enab = MTOI(MMpull(m));
2385 int fc = MMget(m, 0);
2392 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2395 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2400 bool enable =
false;
2404 widget->SetMouseEnable(enable);
2405 MMset(m, 0, ITOM(1));
2421 MMechostr(MSKDEBUG,
"SO3WidgetGetMouseEnable\n");
2423 int fc = MMget(m, 0);
2430 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2433 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2439 if (widget->GetMouseEnable())
2442 MMset(m, 0, ITOM(val));
2458 MMechostr(MSKDEBUG,
"SO3WidgetIsMouseOver\n");
2461 int fc = MMget(m, 0);
2468 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2471 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2477 if (widget->GetMouseOver())
2480 MMset(m, 0, ITOM(val));
2497 MMechostr(MSKDEBUG,
"SO3WidgetSetTransparency\n");
2501 int fc = MMget(m, 0);
2502 if ((fc == NIL) || (b == NIL))
2508 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2511 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2520 widget->SetTransparency(val);
2521 MMset(m, 0, ITOM(1));
2537 MMechostr(MSKDEBUG,
"SO3WidgetGetTransparency\n");
2540 int fc = MMget(m, 0);
2547 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2550 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2556 if (widget->GetTransparency())
2559 MMset(m, 0, ITOM(val));
2576 MMechostr(MSKDEBUG,
"SO3WidgetSetOpacity\n");
2579 int opacity = MMpull(m);
2580 int fc = MMget(m, 0);
2581 if ((fc == NIL) || (opacity == NIL))
2587 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2590 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2595 widget->SetOpacity(MTOF(opacity));
2596 MMset(m, 0, ITOM(1));
2612 MMechostr(MSKDEBUG,
"SO3WidgetGetOpacity\n");
2615 int fc = MMget(m, 0);
2622 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2625 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2630 MMset(m, 0, FTOM(widget->GetOpacity()));
2646 MMechostr(MSKDEBUG,
"SO3WidgetHasFocus\n");
2649 int fc = MMget(m, 0);
2656 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2659 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2665 if (widget->HasFocus())
2668 MMset(m, 0, ITOM(val));
2687 MMechostr(MSKDEBUG,
"SO3WidgetCallFunction\n");
2690 int list = MTOP(MMpull(m));
2692 int fc = MMget(m, 0);
2693 if ((fc == NIL) || (f == NIL))
2699 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(fc));
2702 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2708 std::string asFunc(MMstartstr(m, MTOP(f)));
2711 std::vector<std::string> argVec;
2715 curPointer = MTOP(MMfetch(m, list, 0));
2716 if (curPointer != NIL)
2718 std::string argumentStr(MMstartstr(m, curPointer));
2719 argVec.push_back(argumentStr);
2720 list = MTOP(MMfetch(m, list, 1));
2727 widget->RunScriptFunction(asFunc, argVec);
2729 catch (Ogre::Exception &e)
2731 MMechostr(MSKRUNTIME,
"An exception has occurred: %s\n", e.what());
2736 MMset(m, 0, ITOM(1));
2751 MMechostr(MSKDEBUG,
"SO3WidgetGetUpdateOnFocusOnly\n");
2754 int scolWidget = MMget(m, 0);
2755 if (scolWidget == NIL)
2761 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
2764 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2769 if (widget->GetUpdateOnFocusOnly())
2770 MMset(m, 0, ITOM(1));
2772 MMset(m, 0, ITOM(0));
2788 MMechostr(MSKDEBUG,
"SO3WidgetSetUpdateOnFocusOnly\n");
2791 int scolActivateOnFocusOnly = MMpull(m);
2792 int scolWidget = MMget(m, 0);
2793 if ((scolWidget == NIL) || (scolActivateOnFocusOnly == NIL))
2799 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
2802 MMechostr(MSKDEBUG,
"widget instance is NULL \n");
2807 bool activateOnFocusOnly =
false;
2808 if (MTOI(scolActivateOnFocusOnly) == 1)
2809 activateOnFocusOnly =
true;
2811 widget->SetUpdateOnFocusOnly(activateOnFocusOnly);
2828 MMechostr(MSKDEBUG,
"SO3WidgetEnterEventCb\n");
2831 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_ENTER_EVENT);
2848 MMechostr(MSKDEBUG,
"SO3WidgetExitEventCb\n");
2851 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_EXIT_EVENT);
2872 MMechostr(MSKDEBUG,
"SO3WidgetMouseMoveEventCb\n");
2875 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_MOUSE_MOVE_EVENT);
2896 MMechostr(MSKDEBUG,
"SO3WidgetMouseDownEventCb\n");
2899 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_MOUSE_DOWN_EVENT);
2920 MMechostr(MSKDEBUG,
"SO3WidgetMouseUpEventCb\n");
2923 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_MOUSE_UP_EVENT);
2944 MMechostr(MSKDEBUG,
"SO3WidgetMouseWheelEventCb\n");
2947 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_MOUSEWHEEL_EVENT);
2968 MMechostr(MSKDEBUG,
"SO3WidgetTouchAddEventCb\n");
2971 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_TOUCH_ADD_EVENT);
2992 MMechostr(MSKDEBUG,
"SO3WidgetTouchRemoveEventCb\n");
2995 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_TOUCH_REMOVE_EVENT);
3018 MMechostr(MSKDEBUG,
"SO3WidgetTouchUpdateEventCb\n");
3021 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_TOUCH_UPDATE_EVENT);
3043 MMechostr(MSKDEBUG,
"SO3WidgetInputDownEventCb\n");
3046 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_INPUT_DOWN_EVENT);
3068 MMechostr(MSKDEBUG,
"SO3WidgetInputUpEventCb\n");
3071 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_INPUT_UP_EVENT);
3093 MMechostr(MSKDEBUG,
"SO3WidgetInputUpdateEventCb\n");
3096 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_INPUT_UPDATE_EVENT);
3118 MMechostr(MSKDEBUG,
"SO3WidgetInputWheelEventCb\n");
3121 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_INPUT_WHEEL_EVENT);
3141 MMechostr(MSKDEBUG,
"SO3WidgetKeyDownEventCb\n");
3144 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_KEY_DOWN_EVENT);
3164 MMechostr(MSKDEBUG,
"SO3WidgetKeyUpEventCb\n");
3167 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_KEY_UP_EVENT);
3188 MMechostr(MSKDEBUG,
"SO3WidgetKeyEventCb\n");
3191 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_KEY_EVENT);
3209 MMechostr(MSKDEBUG,
"SO3WidgetFocusEventCb\n");
3212 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_FOCUS_EVENT);
3232 MMechostr(MSKDEBUG,
"SO3WidgetOnScriptEventCb\n");
3235 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_SCRIPT_EVENT);
3252 MMechostr(MSKDEBUG,
"SO3WidgetOnLoadStartEventCb\n");
3255 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_ON_LOAD_START_EVENT);
3272 MMechostr(MSKDEBUG,
"SO3WidgetOnLoadEndEventCb\n");
3275 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_ON_LOAD_END_EVENT);
3292 MMechostr(MSKDEBUG,
"SO3WidgetOnLoadErrorEventCb\n");
3295 return OBJaddreflex(m,
SO3WIDGET, SO3_WIDGET_ON_LOAD_ERROR_EVENT);
3340 {
"SO3WidgetEnterEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0] u1 u0] SO3_WIDGET",
SO3WidgetEnterEventCb },
3341 {
"SO3WidgetExitEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0] u1 u0] SO3_WIDGET",
SO3WidgetExitEventCb },
3342 {
"SO3WidgetMouseMoveEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I] u1 u0] SO3_WIDGET",
SO3WidgetMouseMoveEventCb },
3343 {
"SO3WidgetMouseDownEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I] u1 u0] SO3_WIDGET",
SO3WidgetMouseDownEventCb },
3344 {
"SO3WidgetMouseUpEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I] u1 u0] SO3_WIDGET",
SO3WidgetMouseUpEventCb },
3345 {
"SO3WidgetMouseWheelEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I] u1 u0] SO3_WIDGET",
SO3WidgetMouseWheelEventCb },
3346 {
"SO3WidgetTouchAddEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I] u1 u0] SO3_WIDGET",
SO3WidgetTouchAddEventCb },
3348 {
"SO3WidgetTouchUpdateEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I I I] u1 u0] SO3_WIDGET",
SO3WidgetTouchUpdateEventCb },
3349 {
"SO3WidgetInputDownEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I I] u1 u0] SO3_WIDGET",
SO3WidgetInputDownEventCb },
3350 {
"SO3WidgetInputUpEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I I] u1 u0] SO3_WIDGET",
SO3WidgetInputUpEventCb },
3351 {
"SO3WidgetInputUpdateEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I I] u1 u0] SO3_WIDGET",
SO3WidgetInputUpdateEventCb },
3352 {
"SO3WidgetInputWheelEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I I] u1 u0] SO3_WIDGET",
SO3WidgetInputWheelEventCb },
3353 {
"SO3WidgetKeyDownEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I] u1 u0] SO3_WIDGET",
SO3WidgetKeyDownEventCb },
3354 {
"SO3WidgetKeyUpEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I] u1 u0] SO3_WIDGET",
SO3WidgetKeyUpEventCb },
3355 {
"SO3WidgetKeyEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I I I] u1 u0] SO3_WIDGET",
SO3WidgetKeyEventCb },
3356 {
"SO3WidgetFocusEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 I] u1 u0] SO3_WIDGET",
SO3WidgetFocusEventCb },
3357 {
"SO3WidgetOnScriptEventCb", 3,
"fun [SO3_WIDGET fun [SO3_WIDGET u0 S [S r1]] u1 u0] SO3_WIDGET",
SO3WidgetOnScriptEventCb },
3461 catch(Ogre::Exception &)
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
SCOL_EXPORT void SCOL_PTR_TYPE param
std::vector< std::string > arguments
int SO3WidgetSetUpdateOnFocusOnly(mmachine m)
SO3WidgetSetUpdateOnFocusOnly : Set if the widget will be updated only when he have focus.
int SO3WidgetGetUpdateOnFocusOnly(mmachine m)
SO3WidgetGetUpdateOnFocusOnly : Return if the widget is updated only when he have focus.
int SO3WidgetCallFunction(mmachine m)
SO3WidgetCallFunction : Call script function of a widgets. Script type may depend of widget type,...
int SO3WidgetOnScriptEventCb(mmachine m)
SO3WidgetOnScriptEventCb : Define the callback scol had to call when there is a script event on a wid...