00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00035
00036 #include "SO3SCOL.h"
00037
00038
00039 #include "../SO3Renderer/SO3Widget.h"
00040 #include "../SO3Renderer/SO3WidgetListener.h"
00041 #include "../SO3Renderer/SO3WidgetManager.h"
00042 #include "../SO3Renderer/SO3Root.h"
00043
00044
00045 #include "../SO3SceneGraph/SO3Scene.h"
00046
00048 int WIDGET_IS_INSIDE_EVENT;
00049 int WIDGET_ENTER_EVENT;
00050 int WIDGET_EXIT_EVENT;
00051 int WIDGET_MOUSEDOWN_EVENT;
00052 int WIDGET_MOUSEUP_EVENT;
00053 int WIDGET_MOUSEWHEEL_EVENT;
00054 int WIDGET_SCRIPT_EVENT;
00055
00056
00057 extern WindowHandle hwndScol;
00058
00062 class ScolWidgetEventsListener : public SWidgetListener
00063 {
00064 public:
00065 protected:
00066 private:
00067 WindowHandle windowHandleScol;
00068
00069 public:
00072 ScolWidgetEventsListener(WindowHandle windowHandle)
00073 {
00074 windowHandleScol = windowHandle;
00075 };
00076
00079 virtual void OnEnter(SWidget* targetWidget)
00080 {
00081 SendMessage(windowHandleScol, WIDGET_ENTER_EVENT, (int)targetWidget, 0);
00082 };
00083
00086 virtual void OnExit(SWidget* targetWidget)
00087 {
00088 SendMessage(windowHandleScol, WIDGET_EXIT_EVENT, (int)targetWidget, 0);
00089 };
00090
00093 virtual void OnInside(SWidget* targetWidget)
00094 {
00095 SendMessage(windowHandleScol, WIDGET_IS_INSIDE_EVENT, (int)targetWidget, 0);
00096 };
00097
00100 virtual void OnMouseDown(SWidget* targetWidget, int mousePosX, int mousePosY, MouseButtonId mouseButton)
00101 {
00102 MMOUSE* mouseParams = new MMOUSE(mousePosX, mousePosY, mouseButton);
00103 SendMessage(windowHandleScol, WIDGET_MOUSEDOWN_EVENT, (int)targetWidget, (LPARAM)mouseParams);
00104 };
00105
00108 virtual void OnMouseUp(SWidget* targetWidget, int mousePosX, int mousePosY, MouseButtonId mouseButton)
00109 {
00110 MMOUSE* mouseParams = new MMOUSE(mousePosX, mousePosY, mouseButton);
00111 SendMessage(windowHandleScol, WIDGET_MOUSEUP_EVENT, (int)targetWidget, (LPARAM)mouseParams);
00112 };
00113
00116 virtual void OnMouseWheel(SWidget* targetWidget, int relativeScroll)
00117 {
00118 MMOUSE* mouseParams = new MMOUSE(0, 0, 0, relativeScroll);
00119 SendMessage(windowHandleScol, WIDGET_MOUSEWHEEL_EVENT, (int)targetWidget, (LPARAM)mouseParams);
00120 };
00121
00124 virtual void OnScriptCall(SWidget* targetWidget, SWidget::WidgetScriptFunction functionCalled)
00125 {
00126 SendMessage(windowHandleScol, WIDGET_SCRIPT_EVENT, (int)targetWidget, (LPARAM)&functionCalled);
00127 };
00128 protected:
00129 private:
00133 ScolWidgetEventsListener()
00134 {
00135 };
00136 };
00137
00138
00150 int getWidgetCallbackOnScriptCallback(mmachine m, WindowHandle h, unsigned msg, UINT id, LONG param, int* ret)
00151 {
00152 #ifdef SO3_DEBUG
00153 MMechostr(MSKDEBUG, "getWidgetCallbackOnScriptCallback\n");
00154 #endif
00155
00156 int k;
00157 int res = 0;
00158 if(!(k = OBJbeginreflex(m, SO3WIDGET, id, SO3_WIDGET_SCRIPT_EVENT)))
00159 {
00160
00161 SWidget::WidgetScriptFunction result = *((SWidget::WidgetScriptFunction*)param);
00162
00163
00164 Mpushstrbloc(m, (char*)(result.function.c_str()));
00165
00166
00167 for(unsigned int i=0; i<result.arguments.size(); i++)
00168 {
00169 if(k=Mpushstrbloc(m, (char*)(result.arguments.at(i).c_str())))
00170 return k;
00171 }
00172
00173 if(MMpush(m, NIL))
00174 return MERRMEM;
00175
00176 for(unsigned int i=0; i<result.arguments.size(); i++)
00177 {
00178 if(MMpush(m, 2*2))
00179 return MERRMEM;
00180
00181 if(k=MBdeftab(m))
00182 return k;
00183 }
00184 res = OBJcallreflex(m, 2);
00185 }
00186 return res;
00187 }
00188
00189
00201 int getWidgetCallbackIsInside(mmachine m, WindowHandle h, unsigned msg, UINT id, LONG param, int* ret)
00202 {
00203 #ifdef SO3_DEBUG
00204 MMechostr(MSKDEBUG, "getWidgetCallbackIsInside\n");
00205 #endif
00206
00207 int k , res;
00208 res = 0;
00209 if(!(k = OBJbeginreflex(m, SO3WIDGET, id, SO3_WIDGET_IS_INSIDE_EVENT)))
00210 {
00211 MMOUSE* result;
00212 result = (MMOUSE*)param;
00213
00214 int tuple = MMmalloc(m, 2, TYPETAB);
00215 if(tuple==NIL)
00216 {
00217 MMset(m, 0, NIL);
00218 return MERRMEM;
00219 }
00220
00221 MMstore(m, tuple, 0, ITOM((result->x)));
00222 MMstore(m, tuple, 1, ITOM((result->y)));
00223 MMpush(m, PTOM(tuple));
00224 res = OBJcallreflex(m, 1);
00225 }
00226 return res;
00227 }
00228
00229
00241 int getWidgetCallbackOnEnterEvent(mmachine m, WindowHandle h, unsigned msg, UINT id, LONG param, int* ret)
00242 {
00243 #ifdef SO3_DEBUG
00244 MMechostr(MSKDEBUG, "getWidgetCallbackOnEnterEvent\n");
00245 #endif
00246
00247 int k;
00248 int res = 0;
00249
00250 if(!(k = OBJbeginreflex(m, SO3WIDGET, id, SO3_WIDGET_ENTER_EVENT)))
00251 res = OBJcallreflex(m, 0);
00252
00253 return res;
00254 }
00255
00256
00268 int getWidgetCallbackOnExitEvent(mmachine m, WindowHandle h, unsigned msg, UINT id, LONG param, int* ret)
00269 {
00270 #ifdef SO3_DEBUG
00271 MMechostr(MSKDEBUG, "getWidgetCallbackOnExitEvent\n");
00272 #endif
00273
00274 int k;
00275 int res = 0;
00276
00277 if(!(k = OBJbeginreflex(m, SO3WIDGET, id, SO3_WIDGET_EXIT_EVENT)))
00278 res = OBJcallreflex(m, 0);
00279
00280 return res;
00281 }
00282
00283
00295 int getWidgetCallbackMouseDownEvent(mmachine m, WindowHandle h, unsigned msg, UINT id, LONG param, int* ret)
00296 {
00297 #ifdef SO3_DEBUG
00298 MMechostr(MSKDEBUG, "getWidgetCallbackMouseDownEvent\n");
00299 #endif
00300
00301 int k;
00302 int res = 0;
00303 MMOUSE* result = (MMOUSE*)param;
00304
00305 if(!(k = OBJbeginreflex(m, SO3WIDGET, id, SO3_WIDGET_MOUSE_DOWN_EVENT)))
00306 {
00307 MMpush(m, ITOM(result->index));
00308
00309 int tuple = MMmalloc(m, 2, TYPETAB);
00310 if(tuple==NIL)
00311 {
00312 MMset(m, 0, NIL);
00313 return MERRMEM;
00314 }
00315
00316 MMstore(m, tuple, 0, ITOM((result->x)));
00317 MMstore(m, tuple, 1, ITOM((result->y)));
00318 MMpush(m, PTOM(tuple));
00319 res = OBJcallreflex(m, 2);
00320 }
00321
00322 delete(result);
00323 return res;
00324 }
00325
00326
00338 int getWidgetCallbackMouseUpEvent(mmachine m, WindowHandle h, unsigned msg, UINT id, LONG param, int* ret)
00339 {
00340 #ifdef SO3_DEBUG
00341 MMechostr(MSKDEBUG, "getWidgetCallbackMouseUpEvent\n");
00342 #endif
00343
00344 int k;
00345 int res = 0;
00346 MMOUSE* result = (MMOUSE*)param;
00347
00348 if(!(k = OBJbeginreflex(m, SO3WIDGET, id, SO3_WIDGET_MOUSE_UP_EVENT)))
00349 {
00350 MMpush(m, ITOM(result->index));
00351
00352 int tuple = MMmalloc(m, 2, TYPETAB);
00353 if(tuple==NIL)
00354 {
00355 MMset(m, 0, NIL);
00356 return MERRMEM;
00357 }
00358
00359 MMstore(m, tuple, 0, ITOM((result->x)));
00360 MMstore(m, tuple, 1, ITOM((result->y)));
00361 MMpush(m, PTOM(tuple));
00362 res = OBJcallreflex(m,2);
00363 }
00364
00365 delete(result);
00366 return res;
00367 }
00368
00369
00381 int getWidgetCallbackMouseWheelEvent(mmachine m, WindowHandle h, unsigned msg, UINT id, LONG param, int* ret)
00382 {
00383 #ifdef SO3_DEBUG
00384 MMechostr(MSKDEBUG, "getWidgetCallbackMouseWheelEvent\n");
00385 #endif
00386
00387 int k;
00388 int res = 0;
00389 MMOUSE* result = (MMOUSE*)param;
00390
00391 if(!(k = OBJbeginreflex(m, SO3WIDGET, id, SO3_WIDGET_MOUSEWHEEL_EVENT)))
00392 {
00393 MMpush(m, ITOM(result->scroll));
00394
00395 res = OBJcallreflex(m, 1);
00396 }
00397
00398 delete(result);
00399 return res;
00400 }
00401
00402
00412 int SO3WidgetLoadFile(mmachine m)
00413 {
00414 #ifdef SO3_DEBUG
00415 MMechostr(MSKDEBUG, "SO3WidgetLoadFile\n");
00416 #endif
00417
00418 int ff = MMpull(m);
00419 int fc = MMget(m, 0);
00420 if((fc==NIL)||(ff==NIL))
00421 {
00422 MMset(m, 0, NIL);
00423 return 0;
00424 }
00425
00426 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00427 if(widget==0)
00428 {
00429 MMechostr(MSKDEBUG,"widget instance is NULL \n");
00430 MMset(m, 0, NIL);
00431 return 0;
00432 }
00433
00434 char* file = MMstartstr(m, MTOP(ff));
00435 if(file==0)
00436 {
00437 MMechostr(MSKDEBUG,"file is NULL \n");
00438 MMset(m, 0, NIL);
00439 return 0;
00440 }
00441
00442 if(!strcmp("", file))
00443 {
00444 MMechostr(MSKDEBUG, "file is NULL \n");
00445 MMset(m, 0, NIL);
00446 return 0;
00447 }
00448
00449 try
00450 {
00451 widget->LoadFile(std::string(file));
00452 }
00453 catch(const Ogre::Exception& e)
00454 {
00455 MMechostr(MSKDEBUG, "An error occurs while trying to load a file named \"%s\" on a widget: %s\n", file, e.what());
00456 MMset(m, 0, NIL);
00457 return 0;
00458 }
00459 MMset(m, 0, ITOM(1));
00460 return 0;
00461 }
00462
00463
00473 int SO3WidgetLoadUrl(mmachine m)
00474 {
00475 #ifdef SO3_DEBUG
00476 MMechostr(MSKDEBUG, "SO3WidgetLoadUrl\n");
00477 #endif
00478
00479 int u = MMpull(m);
00480 int fc = MMget(m, 0);
00481 if((fc==NIL)||(u==NIL))
00482 {
00483 MMset(m, 0, NIL);
00484 return 0;
00485 }
00486
00487 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00488 if(widget==0)
00489 {
00490 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00491 MMset(m, 0, NIL);
00492 return 0;
00493 }
00494
00495 const char* url = MMstartstr(m, MTOP(u));
00496 if(url==0)
00497 {
00498 MMechostr(MSKDEBUG, "url is NULL \n");
00499 MMset(m, 0, NIL);
00500 return 0;
00501 }
00502
00503 if(!strcmp("", url))
00504 {
00505 MMechostr(MSKDEBUG, "url is NULL \n");
00506 MMset(m, 0, NIL);
00507 return 0;
00508 }
00509
00510 try
00511 {
00512 widget->LoadURL(std::string(url));
00513 }
00514 catch(const Ogre::Exception& e)
00515 {
00516 MMechostr(MSKDEBUG, "An error occurs while trying to load an URL to \"%s\"on a widget: %s\n", url, e.what());
00517 MMset(m, 0, NIL);
00518 return 0;
00519 }
00520 MMset(m, 0, ITOM(1));
00521 return 0;
00522 }
00523
00524
00533 int SO3WidgetDestroy(mmachine m)
00534 {
00535 #ifdef SO3_DEBUG
00536 MMechostr(MSKDEBUG, "SO3WidgetDestroy\n");
00537 #endif
00538
00539 int fc = MMget(m, 0);
00540 if(fc==NIL)
00541 {
00542 MMset(m, 0, NIL);
00543 return 0;
00544 }
00545
00546 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00547 if(widget==0)
00548 {
00549 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00550 MMset(m, 0, NIL);
00551 return 0;
00552 }
00553
00554 OBJdelTM(m, SO3WIDGET, fc);
00555
00556 #ifdef SO3_DEBUG
00557 MMechostr(MSKDEBUG, "SO3WidgetDestroy : OK !\n");
00558 #endif
00559
00560 MMset(m, 0, ITOM(1));
00561 return 0;
00562 }
00563
00564
00574 int SO3WidgetSetZOrder(mmachine m)
00575 {
00576 #ifdef SO3_DEBUG
00577 MMechostr(MSKDEBUG, "SO3WidgetSetZOrder\n");
00578 #endif
00579
00580 int z = MMpull(m);
00581 int fc = MMget(m, 0);
00582 if((fc==NIL)||(z==NIL))
00583 {
00584 MMset(m, 0, NIL);
00585 return 0;
00586 }
00587
00588 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00589 if(widget==NULL)
00590 {
00591 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00592 MMset(m, 0, NIL);
00593 return 0;
00594 }
00595
00596 int val = MTOI(z);
00597 widget->SetZOrder((unsigned short)val);
00598
00599 MMset(m, 0, ITOM(1));
00600 return 0;
00601 }
00602
00603
00613 int SO3WidgetSetForeground(mmachine m)
00614 {
00615 #ifdef SO3_DEBUG
00616 MMechostr(MSKDEBUG, "SO3WidgetSetForeground\n");
00617 #endif
00618
00619 int b = MMpull(m);
00620 int fc = MMget(m, 0);
00621 if((fc==NIL)||(b==NIL))
00622 {
00623 MMset(m, 0, NIL);
00624 return 0;
00625 }
00626
00627 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00628 if(widget==NULL)
00629 {
00630 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00631 MMset(m, 0, NIL);
00632 return 0;
00633 }
00634
00635 bool enable = false;
00636 if(MTOI(b)==1)
00637 enable = true;
00638
00639 widget->SetForeground(enable);
00640 MMset(m, 0, ITOM(1));
00641 return 0;
00642 }
00643
00644
00653 int SO3WidgetGetForeground(mmachine m)
00654 {
00655 #ifdef SO3_DEBUG
00656 MMechostr(MSKDEBUG, "SO3WidgetGetForeground\n");
00657 #endif
00658
00659 int fc = MMget(m, 0);
00660 if(fc==NIL)
00661 {
00662 MMset(m, 0, NIL);
00663 return 0;
00664 }
00665
00666 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00667 if(widget==NULL)
00668 {
00669 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00670 MMset(m, 0, NIL);
00671 return 0;
00672 }
00673
00674 int val = 0;
00675 if(widget->GetForeground())
00676 val = 1;
00677
00678 MMset(m, 0, ITOM(val));
00679 return 0;
00680 }
00681
00682
00692 int SO3WidgetSetTopOnFocus(mmachine m)
00693 {
00694 #ifdef SO3_DEBUG
00695 MMechostr(MSKDEBUG, "SO3WidgetSetTopOnFocus\n");
00696 #endif
00697
00698 int b = MMpull(m);
00699 int fc = MMget(m, 0);
00700 if((fc==NIL)||(b==NIL))
00701 {
00702 MMset(m, 0, NIL);
00703 return 0;
00704 }
00705
00706 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00707 if(widget==NULL)
00708 {
00709 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00710 MMset(m, 0, NIL);
00711 return 0;
00712 }
00713
00714 bool enable = false;
00715 if(MTOI(b)==1)
00716 enable = true;
00717
00718 widget->SetTopOnFocus(enable);
00719
00720 MMset(m, 0, ITOM(1));
00721 return 0;
00722 }
00723
00724
00733 int SO3WidgetGetTopOnFocus(mmachine m)
00734 {
00735 #ifdef SO3_DEBUG
00736 MMechostr(MSKDEBUG, "SO3WidgetGetTopOnFocus\n");
00737 #endif
00738
00739 int fc = MMget(m, 0);
00740 if(fc==NIL)
00741 {
00742 MMset(m,0,NIL);
00743 return 0;
00744 }
00745
00746 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00747 if(widget==NULL)
00748 {
00749 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00750 MMset(m, 0, NIL);
00751 return 0;
00752 }
00753
00754 int val = 0;
00755 if(widget->GetTopOnFocus())
00756 val = 1;
00757
00758 MMset(m, 0, ITOM(val));
00759 return 0;
00760 }
00761
00762
00773 int SO3WidgetSetIgnoreTransparentPixels(mmachine m)
00774 {
00775 #ifdef SO3_DEBUG
00776 MMechostr(MSKDEBUG, "SO3WidgetSetIgnoreTransparentPixels\n");
00777 #endif
00778
00779 int t = MMpull(m);
00780 int b = MMpull(m);
00781 int fc = MMget(m,0);
00782 if((fc==NIL)||(b==NIL)||(t==NIL))
00783 {
00784 MMset(m, 0, NIL);
00785 return 0;
00786 }
00787
00788 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00789 if(widget==NULL)
00790 {
00791 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00792 MMset(m, 0, NIL);
00793 return 0;
00794 }
00795
00796 bool ignore = false;
00797 if(MTOI(b) == 1)
00798 ignore = true;
00799
00800 widget->SetIgnoreTransparentPixels(ignore, MTOF(t));
00801 MMset(m,0, ITOM(1));
00802 return 0;
00803 }
00804
00805
00814 int SO3WidgetGetIgnoreTransparentPixels(mmachine m)
00815 {
00816 #ifdef SO3_DEBUG
00817 MMechostr(MSKDEBUG, "SO3WidgetGetIgnoreTransparentPixels\n");
00818 #endif
00819
00820 int fc = MMget(m, 0);
00821 if(fc==NIL)
00822 {
00823 MMset(m, 0, NIL);
00824 return 0;
00825 }
00826
00827 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00828 if(widget==NULL)
00829 {
00830 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00831 MMset(m,0,NIL);
00832 return 0;
00833 }
00834
00835 float valT = widget->GetIgnoreTransparentPixelsTreshold();
00836 int valI = 0;
00837 if(widget->GetIgnoreTransparentPixels())
00838 valI = 1;
00839
00840
00841 int tuple = MMmalloc(m, 2, TYPETAB);
00842 if(tuple==NIL)
00843 {
00844 MMset(m, 0, NIL);
00845 return MERRMEM;
00846 }
00847
00848 MMstore(m, tuple, 0, ITOM((int)(valI)));
00849 MMstore(m, tuple, 1, FTOM((float)(valT)));
00850 MMset(m, 0, PTOM(tuple));
00851 return 0;
00852 }
00853
00854
00863 int SO3WidgetSetFocus(mmachine m)
00864 {
00865 #ifdef SO3_DEBUG
00866 MMechostr(MSKDEBUG, "SO3WidgetSetFocus\n");
00867 #endif
00868
00869 int fc = MTOP(MMget(m, 0));
00870 if(fc==NIL)
00871 {
00872 MMset(m, 0, NIL);
00873 return 0;
00874 }
00875
00876 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
00877 if(widget==NULL)
00878 {
00879 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00880 MMset(m, 0, NIL);
00881 return 0;
00882 }
00883
00884 widget->TakeFocus();
00885 MMset(m, 0, ITOM(1));
00886 return 0;
00887 }
00888
00889
00898 int SO3WidgetGetZOrder(mmachine m)
00899 {
00900 #ifdef SO3_DEBUG
00901 MMechostr(MSKDEBUG, "SO3WidgetGetZOrder\n");
00902 #endif
00903
00904 int fc = MMget(m, 0);
00905 if(fc==NIL)
00906 {
00907 MMset(m, 0, NIL);
00908 return 0;
00909 }
00910
00911 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
00912 if(widget==NULL)
00913 {
00914 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00915 MMset(m, 0, NIL);
00916 return 0;
00917 }
00918
00919 MMset(m, 0, ITOM(static_cast<int> (widget->GetZOrder())));
00920 return 0;
00921 }
00922
00923
00934 int SO3WidgetSetPosition(mmachine m)
00935 {
00936 #ifdef SO3_DEBUG
00937 MMechostr(MSKDEBUG, "SO3WidgetSetPosition\n");
00938 #endif
00939
00940 int y = MTOI(MMpull(m));
00941 int x = MTOI(MMpull(m));
00942 int fc = MTOP(MMget(m, 0));
00943 if((fc==NIL))
00944 {
00945 MMset(m,0,NIL);
00946 return 0;
00947 }
00948
00949 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
00950 if(widget==NULL)
00951 {
00952 MMechostr(MSKDEBUG,"widget instance is NULL \n");
00953 MMset(m, 0, NIL);
00954 return 0;
00955 }
00956
00957 widget->SetPosition(SPoint<int>(x, y));
00958 MMset(m, 0, ITOM(1));
00959 return 0;
00960 }
00961
00962
00971 int SO3WidgetGetPosition(mmachine m)
00972 {
00973 #ifdef SO3_DEBUG
00974 MMechostr(MSKDEBUG, "SO3WidgetGetPosition\n");
00975 #endif
00976
00977 int fc = MTOP(MMget(m, 0));
00978 if(fc==NIL)
00979 {
00980 MMset(m, 0, NIL);
00981 return 0;
00982 }
00983
00984 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
00985 if(widget==NULL)
00986 {
00987 MMechostr(MSKDEBUG, "widget instance is NULL \n");
00988 MMset(m, 0, NIL);
00989 return 0;
00990 }
00991
00992 int tuple = MMmalloc(m, 2, TYPETAB);
00993 if(tuple==NIL)
00994 {
00995 MMset(m, 0, NIL);
00996 return MERRMEM;
00997 }
00998
00999 SPoint<int> currentPosition = widget->GetPosition();
01000 MMstore(m, tuple, 0, ITOM(currentPosition.x));
01001 MMstore(m, tuple, 1, ITOM(currentPosition.y));
01002 MMset(m, 0, PTOM(tuple));
01003 return 0;
01004 }
01005
01006
01015 int SO3WidgetGetSize(mmachine m)
01016 {
01017 #ifdef SO3_DEBUG
01018 MMechostr(MSKDEBUG, "SO3WidgetGetSize\n");
01019 #endif
01020
01021 int fc = MTOP(MMget(m, 0));
01022 if(fc==NIL)
01023 {
01024 MMset(m, 0, NIL);
01025 return 0;
01026 }
01027
01028 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
01029 if(widget==0)
01030 {
01031 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01032 MMset(m, 0, NIL);
01033 return 0;
01034 }
01035
01036 int tuple = MMmalloc(m, 2, TYPETAB);
01037 if(tuple==NIL)
01038 {
01039 MMset(m, 0, NIL);
01040 return MERRMEM;
01041 }
01042
01043 MMstore(m, tuple, 0, ITOM((int)(widget->GetWidth())));
01044 MMstore(m, tuple, 1, ITOM((int)(widget->GetHeight())));
01045 MMset(m, 0, PTOM(tuple));
01046 return 0;
01047 }
01048
01049
01060 int SO3WidgetSetSize(mmachine m)
01061 {
01062 #ifdef SO3_DEBUG
01063 MMechostr(MSKDEBUG, "SO3WidgetSetSize\n");
01064 #endif
01065
01066 int h = MTOI(MMpull(m));
01067 int w = MTOI(MMpull(m));
01068 int fc = MMget(m, 0);
01069 if(fc==NIL)
01070 {
01071 MMset(m, 0, NIL);
01072 return 0;
01073 }
01074
01075 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
01076 if(widget==0)
01077 {
01078 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01079 MMset(m, 0, NIL);
01080 return 0;
01081 }
01082
01083 widget->SetSize(w, h);
01084 MMset(m, 0, ITOM(1));
01085 return 0;
01086 }
01087
01088
01097 int SO3WidgetGetName(mmachine m)
01098 {
01099 #ifdef SO3_DEBUG
01100 MMechostr(MSKDEBUG, "SO3WidgetGetName\n");
01101 #endif
01102
01103 int fc = MMget(m, 0);
01104 if(fc==NIL)
01105 {
01106 MMset(m, 0, NIL);
01107 return 0;
01108 }
01109
01110 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
01111 if(widget==0)
01112 {
01113 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01114 MMset(m, 0, NIL);
01115 return 0;
01116 }
01117
01118 MMpull(m);
01119 return Mpushstrbloc(m, (char*)(widget->GetName().c_str()));
01120 }
01121
01122
01131 int SO3WidgetGetType(mmachine m)
01132 {
01133 #ifdef SO3_DEBUG
01134 MMechostr(MSKDEBUG, "SO3WidgetGetType\n");
01135 #endif
01136
01137 int fc = MMget(m, 0);
01138 if(fc==NIL)
01139 {
01140 MMset(m, 0, NIL);
01141 return 0;
01142 }
01143
01144 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
01145 if(widget==0)
01146 {
01147 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01148 MMset(m, 0, NIL);
01149 return 0;
01150 }
01151
01152 MMpull(m);
01153 return Mpushstrbloc(m, (char*)(widget->GetType().c_str()));
01154 }
01155
01156
01166 int SO3WidgetSetVisibility(mmachine m)
01167 {
01168 #ifdef SO3_DEBUG
01169 MMechostr(MSKDEBUG, "SO3WidgetSetVisibility\n");
01170 #endif
01171
01172 int b = MTOI(MMpull(m));
01173 int fc = MTOP(MMget(m, 0));
01174 if(fc==NIL)
01175 {
01176 MMset(m, 0, NIL);
01177 return 0;
01178 }
01179
01180 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
01181 if(widget==NULL)
01182 {
01183 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01184 MMset(m, 0, NIL);
01185 return 0;
01186 }
01187
01188 if(b==0)
01189 widget->Hide();
01190 else
01191 widget->Show();
01192
01193 MMset(m, 0, ITOM(1));
01194 return 0;
01195 }
01196
01197
01206 int SO3WidgetGetVisibility(mmachine m)
01207 {
01208 #ifdef SO3_DEBUG
01209 MMechostr(MSKDEBUG, "SO3WidgetGetVisibility\n");
01210 #endif
01211 int fc = MTOP(MMget(m, 0));
01212 if(fc==NIL)
01213 {
01214 MMset(m, 0, NIL);
01215 return 0;
01216 }
01217
01218 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
01219 if(widget==NULL)
01220 {
01221 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01222 MMset(m, 0, NIL);
01223 return 0;
01224 }
01225
01226 int val = 0;
01227 if(widget->GetVisible())
01228 val = 1;
01229
01230 MMset(m, 0, ITOM(val));
01231 return 0;
01232 }
01233
01234
01244 int SO3WidgetSetKeyboardEnable(mmachine m)
01245 {
01246 #ifdef SO3_DEBUG
01247 MMechostr(MSKDEBUG, "SO3WidgetSetKeyboardEnable\n");
01248 #endif
01249 int enab = MTOI(MMpull(m));
01250 int widg = MTOP(MMget(m, 0));
01251 if(widg==NIL)
01252 {
01253 MMset(m, 0, NIL);
01254 return 0;
01255 }
01256
01257 SWidget* widget = (SWidget*) MMfetch(m, widg, 0);
01258 if(widget==NULL)
01259 {
01260 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01261 MMset(m, 0, NIL);
01262 return 0;
01263 }
01264
01265 bool enable = false;
01266 if(enab==1)
01267 enable = true;
01268
01269 widget->SetKeyboardEnable(enable);
01270 MMset(m, 0, ITOM(1));
01271 return 0;
01272 }
01273
01274
01283 int SO3WidgetGetKeyboardEnable(mmachine m)
01284 {
01285 #ifdef SO3_DEBUG
01286 MMechostr(MSKDEBUG, "SO3WidgetGetKeyboardEnable\n");
01287 #endif
01288 int widg = MTOP(MMget(m, 0));
01289 if(widg==NIL)
01290 {
01291 MMset(m, 0, NIL);
01292 return 0;
01293 }
01294
01295 SWidget* widget = (SWidget*) MMfetch(m, widg, 0);
01296 if(widget==NULL)
01297 {
01298 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01299 MMset(m, 0, NIL);
01300 return 0;
01301 }
01302
01303 int val = 0;
01304 if(widget->GetKeyboardEnable())
01305 val = 1;
01306
01307 MMset(m, 0, ITOM(val));
01308 return 0;
01309 }
01310
01311
01321 int SO3WidgetSetMouseEnable(mmachine m)
01322 {
01323 #ifdef SO3_DEBUG
01324 MMechostr(MSKDEBUG, "SO3WidgetSetMouseEnable\n");
01325 #endif
01326 int enab = MTOI(MMpull(m));
01327 int widg = MTOP(MMget(m, 0));
01328 if(widg==NIL)
01329 {
01330 MMset(m, 0, NIL);
01331 return 0;
01332 }
01333
01334 SWidget* widget = (SWidget*) MMfetch(m, widg, 0);
01335 if(widget==NULL)
01336 {
01337 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01338 MMset(m, 0, NIL);
01339 return 0;
01340 }
01341
01342 bool enable = false;
01343 if(enab==1)
01344 enable = true;
01345
01346 widget->SetMouseEnable(enable);
01347 MMset(m, 0, ITOM(1));
01348 return 0;
01349 }
01350
01351
01360 int SO3WidgetGetMouseEnable(mmachine m)
01361 {
01362 #ifdef SO3_DEBUG
01363 MMechostr(MSKDEBUG, "SO3WidgetGetMouseEnable\n");
01364 #endif
01365 int widg = MTOP(MMget(m, 0));
01366 if(widg==NIL)
01367 {
01368 MMset(m, 0, NIL);
01369 return 0;
01370 }
01371
01372 SWidget* widget = (SWidget*) MMfetch(m, widg, 0);
01373 if(widget==NULL)
01374 {
01375 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01376 MMset(m, 0, NIL);
01377 return 0;
01378 }
01379
01380 int val = 0;
01381 if(widget->GetMouseEnable())
01382 val = 1;
01383
01384 MMset(m, 0, ITOM(val));
01385 return 0;
01386 }
01387
01388
01397 int SO3WidgetIsMouseOver(mmachine m)
01398 {
01399 #ifdef SO3_DEBUG
01400 MMechostr(MSKDEBUG, "SO3WidgetIsMouseOver\n");
01401 #endif
01402
01403 int fc = MTOP(MMget(m, 0));
01404 if(fc==NIL)
01405 {
01406 MMset(m,0,NIL);
01407 return 0;
01408 }
01409
01410 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
01411 if(widget==NULL)
01412 {
01413 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01414 MMset(m, 0, NIL);
01415 return 0;
01416 }
01417
01418 int val = 0;
01419 if(widget->GetMouseOver())
01420 val = 1;
01421
01422 MMset(m, 0, ITOM(val));
01423 return 0;
01424 }
01425
01426
01436 int SO3WidgetSetTransparency(mmachine m)
01437 {
01438 #ifdef SO3_DEBUG
01439 MMechostr(MSKDEBUG, "SO3WidgetSetTransparency\n");
01440 #endif
01441
01442 int b = MMpull(m);
01443 int fc = MMget(m, 0);
01444 if((fc==NIL)||(b==NIL))
01445 {
01446 MMset(m, 0, NIL);
01447 return 0;
01448 }
01449
01450 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
01451 if(widget==NULL)
01452 {
01453 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01454 MMset(m, 0, NIL);
01455 return 0;
01456 }
01457
01458 bool val = false;
01459 if(MTOI(b) == 1)
01460 val = true;
01461
01462 widget->SetTransparency(val);
01463 MMset(m, 0, ITOM(1));
01464 return 0;
01465 }
01466
01467
01476 int SO3WidgetGetTransparency(mmachine m)
01477 {
01478 #ifdef SO3_DEBUG
01479 MMechostr(MSKDEBUG, "SO3WidgetGetTransparency\n");
01480 #endif
01481
01482 int fc = MTOP(MMget(m, 0));
01483 if(fc==NIL)
01484 {
01485 MMset(m, 0, NIL);
01486 return 0;
01487 }
01488
01489 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
01490 if(widget==NULL)
01491 {
01492 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01493 MMset(m, 0, NIL);
01494 return 0;
01495 }
01496
01497 int val = 0;
01498 if(widget->GetTransparency())
01499 val = 1;
01500
01501 MMset(m,0, ITOM(val));
01502 return 0;
01503 }
01504
01505
01515 int SO3WidgetSetOpacity(mmachine m)
01516 {
01517 #ifdef SO3_DEBUG
01518 MMechostr(MSKDEBUG, "SO3WidgetSetOpacity\n");
01519 #endif
01520
01521 int opacity = MMpull(m);
01522 int fc = MTOP(MMget(m, 0));
01523 if((fc==NIL)||(opacity==NIL))
01524 {
01525 MMset(m, 0, NIL);
01526 return 0;
01527 }
01528
01529 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
01530 if(widget==NULL)
01531 {
01532 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01533 MMset(m, 0, NIL);
01534 return 0;
01535 }
01536
01537 widget->SetOpacity(MTOF(opacity));
01538 MMset(m, 0, ITOM(1));
01539 return 0;
01540 }
01541
01542
01551 int SO3WidgetGetOpacity(mmachine m)
01552 {
01553 #ifdef SO3_DEBUG
01554 MMechostr(MSKDEBUG, "SO3WidgetGetOpacity\n");
01555 #endif
01556
01557 int fc = MTOP(MMget(m, 0));
01558 if(fc==NIL)
01559 {
01560 MMset(m, 0, NIL);
01561 return 0;
01562 }
01563
01564 SWidget* widget = (SWidget*) MMfetch(m, fc, 0);
01565 if(widget==NULL)
01566 {
01567 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01568 MMset(m, 0, NIL);
01569 return 0;
01570 }
01571
01572 MMset(m, 0, FTOM(widget->GetOpacity()));
01573 return 0;
01574 }
01575
01576
01585 int SO3WidgetHasFocus(mmachine m)
01586 {
01587 #ifdef SO3_DEBUG
01588 MMechostr(MSKDEBUG, "SO3WidgetHasFocus\n");
01589 #endif
01590
01591 int fc = MMget(m, 0);
01592 if(fc==NIL)
01593 {
01594 MMset(m, 0, NIL);
01595 return 0;
01596 }
01597
01598 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
01599 if(widget==NULL)
01600 {
01601 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01602 MMset(m, 0, NIL);
01603 return 0;
01604 }
01605
01606 int val = 0;
01607 if(widget->HasFocus())
01608 val = 1;
01609
01610 MMset(m, 0, ITOM(val));
01611 return 0;
01612 }
01613
01614
01626 int SO3WidgetCallFunction(mmachine m)
01627 {
01628 #ifdef SO3_DEBUG
01629 MMechostr(MSKDEBUG, "SO3WidgetCallFunction\n");
01630 #endif
01631
01632 int list = MTOP(MMpull(m));
01633 int f = MMpull(m);
01634 int fc = MMget(m, 0);
01635 if((fc==NIL)||(f==NIL))
01636 {
01637 MMset(m, 0, NIL);
01638 return 0;
01639 }
01640
01641 SWidget* widget = (SWidget*) MMfetch(m, MTOP(fc), 0);
01642 if(widget==NULL)
01643 {
01644 MMechostr(MSKDEBUG, "widget instance is NULL \n");
01645 MMset(m, 0, NIL);
01646 return 0;
01647 }
01648
01649
01650 std::string asFunc(MMstartstr(m, MTOP(f)));
01651
01652
01653 std::vector<std::string> argVec;
01654 int curPointer;
01655 while(list!=NIL)
01656 {
01657 curPointer = MTOP( MMfetch(m, list, 0) );
01658 std::string argumentStr(MMstartstr(m, curPointer));
01659 argVec.push_back(argumentStr);
01660 list = MTOP( MMfetch(m, list, 1));
01661 }
01662
01663
01664 try
01665 {
01666 widget->RunScriptFunction(asFunc, argVec);
01667 }
01668 catch (Ogre::Exception &e)
01669 {
01670 MMechostr(MSKDEBUG, "An exception has occurred: %s\n", e.what());
01671 MMset(m, 0, NIL);
01672 return 0;
01673 }
01674
01675 MMset(m, 0, ITOM(1));
01676 return 0;
01677 }
01678
01679
01692 int SO3WidgetInsideCb(mmachine m)
01693 {
01694 #ifdef SO3_DEBUG
01695 MMechostr(MSKDEBUG, "SO3WidgetInsideCb\n");
01696 #endif
01697
01698 return OBJaddreflex(m, SO3WIDGET, SO3_WIDGET_IS_INSIDE_EVENT);
01699 }
01700
01701
01712 int SO3WidgetInsideEventCb(mmachine m)
01713 {
01714 #ifdef SO3_DEBUG
01715 MMechostr(MSKDEBUG, "SO3WidgetInsideEventCb\n");
01716 #endif
01717
01718 return OBJaddreflex(m, SO3WIDGET, SO3_WIDGET_ENTER_EVENT);
01719 }
01720
01721
01732 int SO3WidgetOutsideEventCb(mmachine m)
01733 {
01734 #ifdef SO3_DEBUG
01735 MMechostr(MSKDEBUG, "SO3WidgetOutsideEventCb\n");
01736 #endif
01737
01738 return OBJaddreflex(m, SO3WIDGET, SO3_WIDGET_EXIT_EVENT);
01739 }
01740
01741
01755 int SO3WidgetMouseDownEventCb(mmachine m)
01756 {
01757 #ifdef SO3_DEBUG
01758 MMechostr(MSKDEBUG, "SO3WidgetMouseDownEventCb\n");
01759 #endif
01760
01761 return OBJaddreflex(m, SO3WIDGET, SO3_WIDGET_MOUSE_DOWN_EVENT);
01762 }
01763
01764
01778 int SO3WidgetMouseUpEventCb(mmachine m)
01779 {
01780 #ifdef SO3_DEBUG
01781 MMechostr(MSKDEBUG, "SO3WidgetMouseUpEventCb\n");
01782 #endif
01783
01784 return OBJaddreflex(m, SO3WIDGET, SO3_WIDGET_MOUSE_UP_EVENT);
01785 }
01786
01787
01800 int SO3WidgetMouseWheelEvent(mmachine m)
01801 {
01802 #ifdef SO3_DEBUG
01803 MMechostr(MSKDEBUG, "SO3WidgetMouseWheelEvent\n");
01804 #endif
01805
01806 return OBJaddreflex(m, SO3WIDGET, SO3_WIDGET_MOUSEWHEEL_EVENT);
01807 }
01808
01809
01824 int SO3WidgetOnScriptEventCb(mmachine m)
01825 {
01826 #ifdef SO3_DEBUG
01827 MMechostr(MSKDEBUG, "SO3WidgetOnScriptEventCb\n");
01828 #endif
01829
01830 return OBJaddreflex(m, SO3WIDGET, SO3_WIDGET_SCRIPT_EVENT);
01831 }
01832
01833
01837 #define WIDGET_NB_PKG 38
01838
01839
01843 char* WIDGET_FUNCTIONS_NAMES[WIDGET_NB_PKG]=
01844 {
01845 "SO3WidgetGetType",
01846 "SO3WidgetLoadFile",
01847 "SO3WidgetLoadUrl",
01848 "SO3WidgetDestroy",
01849 "SO3WidgetSetSize",
01850 "SO3WidgetGetSize",
01851 "SO3WidgetSetPosition",
01852 "SO3WidgetGetPosition",
01853 "SO3WidgetGetName",
01854 "SO3WidgetGetVisibility",
01855 "SO3WidgetSetVisibility",
01856 "SO3WidgetGetTransparency",
01857 "SO3WidgetSetTransparency",
01858 "SO3WidgetGetOpacity",
01859 "SO3WidgetSetOpacity",
01860 "SO3WidgetGetIgnoreTransparentPixels",
01861 "SO3WidgetSetIgnoreTransparentPixels",
01862 "SO3WidgetGetZOrder",
01863 "SO3WidgetSetZOrder",
01864 "SO3WidgetGetForeground",
01865 "SO3WidgetSetForeground",
01866 "SO3WidgetHasFocus",
01867 "SO3WidgetSetFocus",
01868 "SO3WidgetGetTopOnFocus",
01869 "SO3WidgetSetTopOnFocus",
01870 "SO3WidgetGetKeyboardEnable",
01871 "SO3WidgetSetKeyboardEnable",
01872 "SO3WidgetGetMouseEnable",
01873 "SO3WidgetSetMouseEnable",
01874 "SO3WidgetIsMouseOver",
01875 "SO3WidgetCallFunction",
01876 "SO3WidgetInsideCb",
01877 "SO3WidgetInsideEventCb",
01878 "SO3WidgetOutsideEventCb",
01879 "SO3WidgetMouseDownEventCb",
01880 "SO3WidgetMouseUpEventCb",
01881 "SO3WidgetMouseWheelEvent",
01882 "SO3WidgetOnScriptEventCb"
01883 };
01884
01885
01889 int (*WIDGET_FUNCTIONS[WIDGET_NB_PKG])(mmachine m)=
01890 {
01891 SO3WidgetGetType,
01892 SO3WidgetLoadFile,
01893 SO3WidgetLoadUrl,
01894 SO3WidgetDestroy,
01895 SO3WidgetSetSize,
01896 SO3WidgetGetSize,
01897 SO3WidgetSetPosition,
01898 SO3WidgetGetPosition,
01899 SO3WidgetGetName,
01900 SO3WidgetGetVisibility,
01901 SO3WidgetSetVisibility,
01902 SO3WidgetGetTransparency,
01903 SO3WidgetSetTransparency,
01904 SO3WidgetGetOpacity,
01905 SO3WidgetSetOpacity,
01906 SO3WidgetGetIgnoreTransparentPixels,
01907 SO3WidgetSetIgnoreTransparentPixels,
01908 SO3WidgetGetZOrder,
01909 SO3WidgetSetZOrder,
01910 SO3WidgetGetForeground,
01911 SO3WidgetSetForeground,
01912 SO3WidgetHasFocus,
01913 SO3WidgetSetFocus,
01914 SO3WidgetGetTopOnFocus,
01915 SO3WidgetSetTopOnFocus,
01916 SO3WidgetGetKeyboardEnable,
01917 SO3WidgetSetKeyboardEnable,
01918 SO3WidgetGetMouseEnable,
01919 SO3WidgetSetMouseEnable,
01920 SO3WidgetIsMouseOver,
01921 SO3WidgetCallFunction,
01922 SO3WidgetInsideCb,
01923 SO3WidgetInsideEventCb,
01924 SO3WidgetOutsideEventCb,
01925 SO3WidgetMouseDownEventCb,
01926 SO3WidgetMouseUpEventCb,
01927 SO3WidgetMouseWheelEvent,
01928 SO3WidgetOnScriptEventCb
01929 };
01930
01931
01935 int WIDGET_FUNCTIONS_NB_ARGS[WIDGET_NB_PKG]=
01936 {
01937 1,
01938 2,
01939 2,
01940 1,
01941 3,
01942 1,
01943 3,
01944 1,
01945 1,
01946 1,
01947 2,
01948 1,
01949 2,
01950 1,
01951 2,
01952 1,
01953 3,
01954 1,
01955 2,
01956 1,
01957 2,
01958 1,
01959 1,
01960 1,
01961 2,
01962 1,
01963 2,
01964 1,
01965 2,
01966 1,
01967 3,
01968 3,
01969 3,
01970 3,
01971 3,
01972 3,
01973 3,
01974 3
01975 };
01976
01977
01981 char* WIDGET_FUNCTIONS_SIGNATURES[WIDGET_NB_PKG]=
01982 {
01983 "fun [SO3_WIDGET] S",
01984 "fun [SO3_WIDGET P] I",
01985 "fun [SO3_WIDGET S] I",
01986 "fun [SO3_WIDGET] I",
01987 "fun [SO3_WIDGET I I] I",
01988 "fun [SO3_WIDGET] [I I]",
01989 "fun [SO3_WIDGET I I] I",
01990 "fun [SO3_WIDGET] [I I]",
01991 "fun [SO3_WIDGET] S",
01992 "fun [SO3_WIDGET] I",
01993 "fun [SO3_WIDGET I] I",
01994 "fun [SO3_WIDGET] I",
01995 "fun [SO3_WIDGET I] I",
01996 "fun [SO3_WIDGET] F",
01997 "fun [SO3_WIDGET F] I",
01998 "fun [SO3_WIDGET] [I I]",
01999 "fun [SO3_WIDGET I I] I",
02000 "fun [SO3_WIDGET] I",
02001 "fun [SO3_WIDGET I] I",
02002 "fun [SO3_WIDGET] I",
02003 "fun [SO3_WIDGET I] I",
02004 "fun [SO3_WIDGET] I",
02005 "fun [SO3_WIDGET] I",
02006 "fun [SO3_WIDGET] I",
02007 "fun [SO3_WIDGET I] I",
02008 "fun [SO3_WIDGET] I",
02009 "fun [SO3_WIDGET I] I",
02010 "fun [SO3_WIDGET] I",
02011 "fun [SO3_WIDGET I] I",
02012 "fun [SO3_WIDGET] I",
02013 "fun [SO3_WIDGET S [S r1]] I",
02014 "fun [SO3_WIDGET fun [SO3_WIDGET u0 [I I]] u1 u0] SO3_WIDGET",
02015 "fun [SO3_WIDGET fun [SO3_WIDGET u0] u1 u0] SO3_WIDGET",
02016 "fun [SO3_WIDGET fun [SO3_WIDGET u0] u1 u0] SO3_WIDGET",
02017 "fun [SO3_WIDGET fun [SO3_WIDGET u0 I [I I]] u1 u0] SO3_WIDGET",
02018 "fun [SO3_WIDGET fun [SO3_WIDGET u0 I [I I]] u1 u0] SO3_WIDGET",
02019 "fun [SO3_WIDGET fun [SO3_WIDGET u0 I] u1 u0] SO3_WIDGET",
02020 "fun [SO3_WIDGET fun [SO3_WIDGET u0 S [S r1 ]] u1 u0] SO3_WIDGET"
02021 };
02022
02023
02027 ScolWidgetEventsListener* scolWidgetEventsListener = 0;
02028
02029
02035 int SCOLloadWidget(mmachine m, cbmachine w)
02036 {
02037 scolWidgetEventsListener = new ScolWidgetEventsListener(hwndScol);
02038 assert(scolWidgetEventsListener != 0);
02039 SWidgetManager::getSingleton().AddWidgetListener(scolWidgetEventsListener);
02040
02041 WIDGET_SCRIPT_EVENT = OBJgetUserEvent();
02042 OBJdefEvent(WIDGET_SCRIPT_EVENT, (int (__cdecl *)(struct Mmachine *,int, unsigned int, int, int, int*))getWidgetCallbackOnScriptCallback );
02043
02044 WIDGET_IS_INSIDE_EVENT = OBJgetUserEvent();
02045 OBJdefEvent(WIDGET_IS_INSIDE_EVENT, (int (__cdecl*)(struct Mmachine*, int, unsigned int, int, int, int*))getWidgetCallbackIsInside);
02046
02047 WIDGET_ENTER_EVENT = OBJgetUserEvent();
02048 OBJdefEvent(WIDGET_ENTER_EVENT, (int (__cdecl*)(struct Mmachine*, int, unsigned int, int, int, int*))getWidgetCallbackOnEnterEvent);
02049
02050 WIDGET_EXIT_EVENT = OBJgetUserEvent();
02051 OBJdefEvent(WIDGET_EXIT_EVENT, (int (__cdecl*)(struct Mmachine*, int, unsigned int, int, int, int*))getWidgetCallbackOnExitEvent);
02052
02053 WIDGET_MOUSEDOWN_EVENT = OBJgetUserEvent();
02054 OBJdefEvent(WIDGET_MOUSEDOWN_EVENT, (int (__cdecl*)(struct Mmachine*, int, unsigned int, int, int, int*))getWidgetCallbackMouseDownEvent);
02055
02056 WIDGET_MOUSEUP_EVENT = OBJgetUserEvent();
02057 OBJdefEvent(WIDGET_MOUSEUP_EVENT, (int (__cdecl*)(struct Mmachine*, int, unsigned int, int, int, int*))getWidgetCallbackMouseUpEvent);
02058
02059 WIDGET_MOUSEWHEEL_EVENT = OBJgetUserEvent();
02060 OBJdefEvent(WIDGET_MOUSEWHEEL_EVENT, (int (__cdecl*)(struct Mmachine*, int, unsigned int, int, int, int*))getWidgetCallbackMouseWheelEvent);
02061
02062 return PKhardpak(m, "Widget", WIDGET_NB_PKG, WIDGET_FUNCTIONS_NAMES, WIDGET_FUNCTIONS, WIDGET_FUNCTIONS_NB_ARGS, WIDGET_FUNCTIONS_SIGNATURES);
02063 }
02064
02065
02070 int SCOLfreeWidget()
02071 {
02072 SWidgetManager::getSingleton().RemoveWidgetListener(scolWidgetEventsListener);
02073 SAFE_DELETE(scolWidgetEventsListener);
02074 return 0;
02075 }