Project

General

Profile

SO3Engine
SCOLWebNavigatorWidget.cpp
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
25
33#include "SCOLPack/SO3SCOL.h"
34
35// Renderer includes
37#include "SO3Renderer/SO3Root.h"
40
41// Scene Graph includes
43
44#if SO3_WEB_NAVIGATOR_BUILD == 1
45
46#if defined(_WIN32)
47extern int(*CallMainThread)(void*, mmachine m);
48#endif
49
66{
67#ifdef SO3_DEBUG
68 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCreate\n");
69#endif
70 //$BB reorder params
71 int z = MTOI(MMpull(m));
72 int h = MTOI(MMpull(m));
73 int w = MTOI(MMpull(m));
74 int topPos = MTOI(MMpull(m));
75 int leftPos = MTOI(MMpull(m));
76 int nam = MMpull(m);
77 int vp = MMpull(m);
78 int s = MMget(m, 0);
79
80 if ((s == NIL) || (vp == NIL) || (nam == NIL) || (w == NIL) || (h == NIL) || (z == NIL))
81 {
82 MMset(m, 0, NIL);
83 return 0;
84 }
85
86 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
87 if (scene == NULL)
88 {
89 MMset(m, 0, NIL);
90 return 0;
91 }
92
93 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
94 if (viewport == NULL)
95 {
96 MMechostr(MSKDEBUG, "vp is NULL \n");
97 MMset(m, 0, NIL);
98 return 0;
99 }
100
101 std::string name(MMstartstr(m, MTOP(nam)));
102 if (name.empty())
103 {
104 MMechostr(MSKDEBUG, "name is NULL \n");
105 MMset(m, 0, NIL);
106 return 0;
107 }
108
109 // Hack : If we set bigger value memset crashes : Dont' know why
110 if (w >= 5000 || h >= 5000)
111 {
112 MMechostr(MSKDEBUG, "too bigger values \n");
113 MMset(m, 0, NIL);
114 return 0;
115 }
116
117 SWebNavigatorWidget* webNavigatorWidget = 0;
118 try
119 {
120 webNavigatorWidget = static_cast<SWebNavigatorWidget*> (SWidgetManager::getSingleton().CreateWidget(scene, name, leftPos, topPos, w, h, viewport, z, SO3_WEB_NAVIGATOR_WIDGET_TYPE));
121 }
122 catch (Ogre::Exception &e)
123 {
124 MMechostr(MSKDEBUG, "An exception has occurred while creating web navigator widget: %s\n", e.what());
125 MMset(m, 0, NIL);
126 return 0;
127 }
128
129 //get scene scol object
130 int p = OBJfindTH(m, SO3SCENETYPE, SCOL_PTR scene);
131 // push channel
132 MMset(m, 0, MMfetch(m, p, OFFOBJCHN));
133
134 if ((MMpushPointer(m, webNavigatorWidget) != 0))
135 {
136 SWidgetManager::getSingleton().DeleteWidget(webNavigatorWidget);
137 MMset(m, 0, NIL);
138 return MERRMEM;
139 }
140
141 return OBJcreate(m, SO3WIDGET, SCOL_PTR webNavigatorWidget, SO3VPTYPE, SCOL_PTR viewport);
142}
143/*
144int SO3WebNavigatorWidgetCreate(mmachine m)
145{
146 CallMainThread((void*)SO3WebNavigatorWidgetCreateSync, m);
147 return 0;
148}*/
149
165{
166#ifdef SO3_DEBUG
167 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCreateBackground\n");
168#endif
169
170 int h = MTOI(MMpull(m));
171 int w = MTOI(MMpull(m));
172 int topPos = MTOI(MMpull(m));
173 int leftPos = MTOI(MMpull(m));
174 int nam = MMpull(m);
175 int vp = MMpull(m);
176 int s = MMget(m, 0);
177
178 if ((s == NIL) || (vp == NIL) || (nam == NIL) || (w == NIL) || (h == NIL))
179 {
180 MMset(m, 0, NIL);
181 return 0;
182 }
183
184 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
185 if (scene == NULL)
186 {
187 MMset(m, 0, NIL);
188 return 0;
189 }
190
191 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
192 if (viewport == NULL)
193 {
194 MMechostr(MSKDEBUG, "vp is NULL \n");
195 MMset(m, 0, NIL);
196 return 0;
197 }
198
199 std::string name(MMstartstr(m, MTOP(nam)));
200 if (name.empty())
201 {
202 MMechostr(MSKDEBUG, "name is NULL \n");
203 MMset(m, 0, NIL);
204 return 0;
205 }
206
207 // Hack : If we set bigger value memset crashes : Dont' know why
208 if (w >= 5000 || h >= 5000)
209 {
210 MMechostr(MSKDEBUG, "too bigger values \n");
211 MMset(m, 0, NIL);
212 return 0;
213 }
214
215 SWebNavigatorWidget* webNavigatorWidget = 0;
216 try
217 {
218 webNavigatorWidget = static_cast<SWebNavigatorWidget*> (SWidgetManager::getSingleton().CreateWidget(scene, name, leftPos, topPos, w, h, viewport, SO3_WEB_NAVIGATOR_WIDGET_TYPE));
219 }
220 catch (Ogre::Exception &e)
221 {
222 MMechostr(MSKDEBUG, "An exception has occurred while creating web navigator widget: %s\n", e.what());
223 MMset(m, 0, NIL);
224 return 0;
225 }
226
227 //get scene scol object
228 int p = OBJfindTH(m, SO3SCENETYPE, SCOL_PTR scene);
229 // push channel
230 MMset(m, 0, MMfetch(m, p, OFFOBJCHN));
231
232 if ((MMpushPointer(m, webNavigatorWidget) != 0))
233 {
234 SWidgetManager::getSingleton().DeleteWidget(webNavigatorWidget);
235 MMset(m, 0, NIL);
236 return MERRMEM;
237 }
238
239 return OBJcreate(m, SO3WIDGET, SCOL_PTR webNavigatorWidget, SO3VPTYPE, SCOL_PTR viewport);
240}
241/*
242int SO3WebNavigatorWidgetCreateBackground(mmachine m)
243{
244 CallMainThread((void*)SO3WebNavigatorWidgetCreateBackgroundSync, m);
245 return 0;
246}*/
247
265{
266#ifdef SO3_DEBUG
267 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCreateOnMaterial\n");
268#endif
269 int index = MTOI(MMpull(m));
270 int pass = MTOI(MMpull(m));
271 int tec = MTOI(MMpull(m));
272 int h = MMpull(m);
273 int w = MMpull(m);
274 int n = MMpull(m);
275 int mat = MMpull(m);
276 int s = MMget(m, 0);
277 if ((s == NIL) || (mat == NIL) || (tec == NIL) || (pass == NIL) || (index == NIL) || (w == NIL) || (h == NIL) || (n == NIL))
278 {
279 MMset(m, 0, NIL);
280 return 0;
281 }
282
283 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
284 if (scene == NULL)
285 {
286 MMset(m, 0, NIL);
287 return 0;
288 }
289
290 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
291 if (material == NULL)
292 {
293 MMechostr(MSKDEBUG, "material==NULL\n");
294 MMset(m, 0, NIL);
295 return 0;
296 }
297
298 if (material->GetAssociatedWidget() != 0)
299 {
300 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCreateOnMaterial : %s already have a widget on it!\n", material->GetName().c_str());
301 MMset(m, 0, NIL);
302 return 0;
303 }
304
305 std::string name(MMstartstr(m, MTOP(n)));
306 if (name.empty())
307 {
308 MMechostr(MSKDEBUG, "name is NULL \n");
309 MMset(m, 0, NIL);
310 return 0;
311 }
312
313 if (!strcmp("BaseWhite", material->getOgreMaterialPointer()->getName().c_str()))
314 {
315 Ogre::LogManager::getSingleton().logMessage("Can't load web navigator widget: Material BaseWhite is Protected!", Ogre::LML_CRITICAL, true);
316 MMechostr(MSKDEBUG, "Material BaseWhite is Protected \n");
317 MMset(m, 0, NIL);
318 return 0;
319 }
320
321 if (material->GetNumTechniques() < tec + 1)
322 {
323 Ogre::LogManager::getSingleton().logMessage("Can't load web navigator widget: Material has not enough Technique! ", Ogre::LML_CRITICAL, true);
324 MMset(m, 0, NIL);
325 return 0;
326 }
327
328 if ((material->getOgreMaterialPointer()->getTechnique(tec)->getNumPasses()) < pass + 1)
329 {
330 Ogre::LogManager::getSingleton().logMessage("Can't load web navigator widget: Material has not enough Pass! ", Ogre::LML_CRITICAL, true);
331 MMset(m, 0, NIL);
332 return 0;
333 }
334
335 if ((material->getOgreMaterialPointer()->getTechnique(tec)->getPass(pass)->getNumTextureUnitStates()) == 0)
336 {
337 Ogre::LogManager::getSingleton().logMessage("Can't load web navigator widget: Material has not enough Texture! ", Ogre::LML_CRITICAL, true);
338 MMset(m, 0, NIL);
339 return 0;
340 }
341
342 if ((material->getOgreMaterialPointer()->getTechnique(tec)->getPass(pass)->getNumTextureUnitStates()) < index + 1)
343 {
344 Ogre::LogManager::getSingleton().logMessage("Can't load web navigator widget: Material has not enough Texture! ", Ogre::LML_CRITICAL, true);
345 MMset(m, 0, NIL);
346 return 0;
347 }
348
349 SWebNavigatorWidget* webNavigatorWidget = 0;
350 try
351 {
352 webNavigatorWidget = static_cast<SWebNavigatorWidget*> (SWidgetManager::getSingleton().CreateWidget(scene, name, MTOI(w), MTOI(h), material, tec, pass, index, SO3_WEB_NAVIGATOR_WIDGET_TYPE));
353 }
354 catch (Ogre::Exception &e)
355 {
356 MMechostr(MSKDEBUG, "An exception has occurred while creating web navigator widget: %s\n", e.what());
357 MMset(m, 0, NIL);
358 return 0;
359 }
360
361 //get scene scol object
362 int p = OBJfindTH(m, SO3SCENETYPE, SCOL_PTR scene);
363 // push channel
364 MMset(m, 0, MMfetch(m, p, OFFOBJCHN));
365
366 if ((MMpushPointer(m, webNavigatorWidget) != 0))
367 {
368 SWidgetManager::getSingleton().DeleteWidget(webNavigatorWidget);
369 MMset(m, 0, NIL);
370 return MERRMEM;
371 }
372
373 return OBJcreate(m, SO3WIDGET, SCOL_PTR webNavigatorWidget, SO3MATERIAL, SCOL_PTR material);
374}
375/*
376int SO3WebNavigatorWidgetCreateOnMaterial(mmachine m)
377{
378 CallMainThread((void*)SO3WebNavigatorWidgetCreateOnMaterialSync, m);
379 return 0;
380}*/
381
392{
393#ifdef SO3_DEBUG
394 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetLoadHTML\n");
395#endif
396
397 int scolHtml = MMpull(m);
398 int scolWidget = MMget(m, 0);
399 if ((scolWidget == NIL) || (scolHtml == NIL))
400 {
401 MMset(m, 0, NIL);
402 return 0;
403 }
404
405 // Get the widget pointer
406 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
407 if (widget == 0)
408 {
409 MMechostr(MSKDEBUG, "widget instance is NULL \n");
410 MMset(m, 0, NIL);
411 return 0;
412 }
413
414 // Get HTML content
415 const char* html = MMstartstr(m, MTOP(scolHtml));
416 if (html == 0)
417 {
418 MMechostr(MSKDEBUG, "Html content is NULL \n");
419 MMset(m, 0, NIL);
420 return 0;
421 }
422
423 if (!strcmp("", html))
424 {
425 MMechostr(MSKDEBUG, "Html content is NULL \n");
426 MMset(m, 0, NIL);
427 return 0;
428 }
429
430 // Check the type of the widget
431 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
432 {
433 MMechostr(MSKDEBUG, "bad widget type \n");
434 MMset(m, 0, NIL);
435 return 0;
436 }
437 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
438
439 // Load HTML content
440 try
441 {
442 webNavigatorWidget->LoadHTML(std::string(html));
443 }
444 catch (const Ogre::Exception& e)
445 {
446 MMechostr(MSKDEBUG, "An error occurs while trying to load a html content on a widget: %s\n", e.what());
447 MMset(m, 0, NIL);
448 return 0;
449 }
450 MMset(m, 0, ITOM(1));
451 return 0;
452}
453
464{
465#ifdef SCOL_DEBUG
466 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionUndo\n");
467#endif
468
469 int scolFrameName = MMpull(m);
470 int scolWidget = MMget(m, 0);
471 if (scolWidget == NIL)
472 {
473 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionUndo: Invalid parameters!\n");
474 MMset(m, 0, NIL);
475 return 0;
476 }
477
478 // Get the widget pointer
479 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
480 if (widget == 0)
481 {
482 MMechostr(MSKDEBUG, "widget instance is NULL \n");
483 MMset(m, 0, NIL);
484 return 0;
485 }
486
487 // Check the type of the widget
488 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
489 {
490 MMechostr(MSKDEBUG, "bad widget type \n");
491 MMset(m, 0, NIL);
492 return 0;
493 }
494 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
495
496 // Get the optional frame name
497 std::string frameName = "";
498 if (scolFrameName != NIL)
499 frameName = MMstartstr(m, MTOP(scolFrameName));
500
501 webNavigatorWidget->Undo(frameName);
502 MMset(m, 0, ITOM(1));
503 return 0;
504}
505
516{
517#ifdef SCOL_DEBUG
518 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionRedo\n");
519#endif
520
521 int scolFrameName = MMpull(m);
522 int scolWidget = MMget(m, 0);
523 if (scolWidget == NIL)
524 {
525 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionRedo: Invalid parameters!\n");
526 MMset(m, 0, NIL);
527 return 0;
528 }
529
530 // Get the widget pointer
531 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
532 if (widget == 0)
533 {
534 MMechostr(MSKDEBUG, "widget instance is NULL \n");
535 MMset(m, 0, NIL);
536 return 0;
537 }
538
539 // Check the type of the widget
540 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
541 {
542 MMechostr(MSKDEBUG, "bad widget type \n");
543 MMset(m, 0, NIL);
544 return 0;
545 }
546 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
547
548 // Get the optional frame name
549 std::string frameName = "";
550 if (scolFrameName != NIL)
551 frameName = MMstartstr(m, MTOP(scolFrameName));
552
553 webNavigatorWidget->Redo(frameName);
554 MMset(m, 0, ITOM(1));
555 return 0;
556}
557
568{
569#ifdef SCOL_DEBUG
570 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionCut\n");
571#endif
572
573 int scolFrameName = MMpull(m);
574 int scolWidget = MMget(m, 0);
575 if (scolWidget == NIL)
576 {
577 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionCut: Invalid parameters!\n");
578 MMset(m, 0, NIL);
579 return 0;
580 }
581
582 // Get the widget pointer
583 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
584 if (widget == 0)
585 {
586 MMechostr(MSKDEBUG, "widget instance is NULL \n");
587 MMset(m, 0, NIL);
588 return 0;
589 }
590
591 // Check the type of the widget
592 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
593 {
594 MMechostr(MSKDEBUG, "bad widget type \n");
595 MMset(m, 0, NIL);
596 return 0;
597 }
598 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
599
600 // Get the optional frame name
601 std::string frameName = "";
602 if (scolFrameName != NIL)
603 frameName = MMstartstr(m, MTOP(scolFrameName));
604
605 webNavigatorWidget->Cut(frameName);
606 MMset(m, 0, ITOM(1));
607 return 0;
608}
609
620{
621#ifdef SCOL_DEBUG
622 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionCopy\n");
623#endif
624
625 int scolFrameName = MMpull(m);
626 int scolWidget = MMget(m, 0);
627 if (scolWidget == NIL)
628 {
629 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionCopy: Invalid parameters!\n");
630 MMset(m, 0, NIL);
631 return 0;
632 }
633
634 // Get the widget pointer
635 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
636 if (widget == 0)
637 {
638 MMechostr(MSKDEBUG, "widget instance is NULL \n");
639 MMset(m, 0, NIL);
640 return 0;
641 }
642
643 // Check the type of the widget
644 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
645 {
646 MMechostr(MSKDEBUG, "bad widget type \n");
647 MMset(m, 0, NIL);
648 return 0;
649 }
650 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
651
652 // Get the optional frame name
653 std::string frameName = "";
654 if (scolFrameName != NIL)
655 frameName = MMstartstr(m, MTOP(scolFrameName));
656
657 webNavigatorWidget->Copy(frameName);
658 MMset(m, 0, ITOM(1));
659 return 0;
660}
661
672{
673#ifdef SCOL_DEBUG
674 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionPaste\n");
675#endif
676
677 int scolFrameName = MMpull(m);
678 int scolWidget = MMget(m, 0);
679 if (scolWidget == NIL)
680 {
681 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionPaste: Invalid parameters!\n");
682 MMset(m, 0, NIL);
683 return 0;
684 }
685
686 // Get the widget pointer
687 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
688 if (widget == 0)
689 {
690 MMechostr(MSKDEBUG, "widget instance is NULL \n");
691 MMset(m, 0, NIL);
692 return 0;
693 }
694
695 // Check the type of the widget
696 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
697 {
698 MMechostr(MSKDEBUG, "bad widget type \n");
699 MMset(m, 0, NIL);
700 return 0;
701 }
702 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
703
704 // Get the optional frame name
705 std::string frameName = "";
706 if (scolFrameName != NIL)
707 frameName = MMstartstr(m, MTOP(scolFrameName));
708
709 webNavigatorWidget->Paste(frameName);
710 MMset(m, 0, ITOM(1));
711 return 0;
712}
713
724{
725#ifdef SCOL_DEBUG
726 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionDelete\n");
727#endif
728
729 int scolFrameName = MMpull(m);
730 int scolWidget = MMget(m, 0);
731 if (scolWidget == NIL)
732 {
733 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionDelete: Invalid parameters!\n");
734 MMset(m, 0, NIL);
735 return 0;
736 }
737
738 // Get the widget pointer
739 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
740 if (widget == 0)
741 {
742 MMechostr(MSKDEBUG, "widget instance is NULL \n");
743 MMset(m, 0, NIL);
744 return 0;
745 }
746
747 // Check the type of the widget
748 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
749 {
750 MMechostr(MSKDEBUG, "bad widget type \n");
751 MMset(m, 0, NIL);
752 return 0;
753 }
754 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
755
756 // Get the optional frame name
757 std::string frameName = "";
758 if (scolFrameName != NIL)
759 frameName = MMstartstr(m, MTOP(scolFrameName));
760
761 webNavigatorWidget->Delete(frameName);
762 MMset(m, 0, ITOM(1));
763 return 0;
764}
765
776{
777#ifdef SCOL_DEBUG
778 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionSelectAll\n");
779#endif
780
781 int scolFrameName = MMpull(m);
782 int scolWidget = MMget(m, 0);
783 if (scolWidget == NIL)
784 {
785 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetActionSelectAll: Invalid parameters!\n");
786 MMset(m, 0, NIL);
787 return 0;
788 }
789
790 // Get the widget pointer
791 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
792 if (widget == 0)
793 {
794 MMechostr(MSKDEBUG, "widget instance is NULL \n");
795 MMset(m, 0, NIL);
796 return 0;
797 }
798
799 // Check the type of the widget
800 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
801 {
802 MMechostr(MSKDEBUG, "bad widget type \n");
803 MMset(m, 0, NIL);
804 return 0;
805 }
806 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
807
808 // Get the optional frame name
809 std::string frameName = "";
810 if (scolFrameName != NIL)
811 frameName = MMstartstr(m, MTOP(scolFrameName));
812
813 webNavigatorWidget->SelectAll(frameName);
814 MMset(m, 0, ITOM(1));
815 return 0;
816}
817
828{
829#ifdef SCOL_DEBUG
830 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetPrint\n");
831#endif
832
833 int scolFrameName = MMpull(m);
834 int scolWidget = MMget(m, 0);
835 if (scolWidget == NIL)
836 {
837 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetPrint: Invalid parameters!\n");
838 MMset(m, 0, NIL);
839 return 0;
840 }
841
842 // Get the widget pointer
843 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
844 if (widget == 0)
845 {
846 MMechostr(MSKDEBUG, "widget instance is NULL \n");
847 MMset(m, 0, NIL);
848 return 0;
849 }
850
851 // Check the type of the widget
852 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
853 {
854 MMechostr(MSKDEBUG, "bad widget type \n");
855 MMset(m, 0, NIL);
856 return 0;
857 }
858 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
859
860 // Get the optional frame name
861 std::string frameName = "";
862 if (scolFrameName != NIL)
863 frameName = MMstartstr(m, MTOP(scolFrameName));
864
865 webNavigatorWidget->Print(frameName);
866 MMset(m, 0, ITOM(1));
867 return 0;
868}
869
880{
881#ifdef SCOL_DEBUG
882 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetViewSource\n");
883#endif
884
885 int scolFrameName = MMpull(m);
886 int scolWidget = MMget(m, 0);
887 if (scolWidget == NIL)
888 {
889 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetViewSource: Invalid parameters!\n");
890 MMset(m, 0, NIL);
891 return 0;
892 }
893
894 // Get the widget pointer
895 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
896 if (widget == 0)
897 {
898 MMechostr(MSKDEBUG, "widget instance is NULL \n");
899 MMset(m, 0, NIL);
900 return 0;
901 }
902
903 // Check the type of the widget
904 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
905 {
906 MMechostr(MSKDEBUG, "bad widget type \n");
907 MMset(m, 0, NIL);
908 return 0;
909 }
910 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
911
912 // Get the optional frame name
913 std::string frameName = "";
914 if (scolFrameName != NIL)
915 frameName = MMstartstr(m, MTOP(scolFrameName));
916
917 webNavigatorWidget->ViewSource(frameName);
918 MMset(m, 0, ITOM(1));
919 return 0;
920}
921
932{
933#ifdef SCOL_DEBUG
934 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGetSource\n");
935#endif
936
937 int scolFrameName = MMpull(m);
938 int scolWidget = MMpull(m);
939 if (scolWidget == NIL)
940 {
941 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGetSource: Invalid parameters!\n");
942 MMpush(m, NIL);
943 return 0;
944 }
945
946 // Get the widget pointer
947 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
948 if (widget == 0)
949 {
950 MMechostr(MSKDEBUG, "widget instance is NULL \n");
951 MMset(m, 0, NIL);
952 return 0;
953 }
954
955 // Check the type of the widget
956 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
957 {
958 MMechostr(MSKDEBUG, "bad widget type \n");
959 MMset(m, 0, NIL);
960 return 0;
961 }
962 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
963
964 // Get the optional frame name
965 std::string frameName = "";
966 if (scolFrameName != NIL)
967 frameName = MMstartstr(m, MTOP(scolFrameName));
968
969 std::string frameSource = webNavigatorWidget->GetSource(frameName);
970 return Mpushstrbloc(m, (char*)(frameSource.c_str()));
971 return 0;
972}
973
984{
985#ifdef SCOL_DEBUG
986 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGetText\n");
987#endif
988
989 int scolFrameName = MMpull(m);
990 int scolWidget = MMpull(m);
991 if (scolWidget == NIL)
992 {
993 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGetText: Invalid parameters!\n");
994 MMpush(m, NIL);
995 return 0;
996 }
997
998 // Get the widget pointer
999 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1000 if (widget == 0)
1001 {
1002 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1003 MMset(m, 0, NIL);
1004 return 0;
1005 }
1006
1007 // Check the type of the widget
1008 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1009 {
1010 MMechostr(MSKDEBUG, "bad widget type \n");
1011 MMset(m, 0, NIL);
1012 return 0;
1013 }
1014 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1015
1016 // Get the optional frame name
1017 std::string frameName = "";
1018 if (scolFrameName != NIL)
1019 frameName = MMstartstr(m, MTOP(scolFrameName));
1020
1021 std::string frameText = webNavigatorWidget->GetText(frameName);
1022 return Mpushstrbloc(m, (char*)(frameText.c_str()));
1023 return 0;
1024}
1025
1026
1037{
1038#ifdef SCOL_DEBUG
1039 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGetURL\n");
1040#endif
1041
1042 int scolFrameName = MMpull(m);
1043 int scolWidget = MMpull(m);
1044 if (scolWidget == NIL)
1045 {
1046 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGetURL: Invalid parameters!\n");
1047 MMpush(m, NIL);
1048 return 0;
1049 }
1050
1051 // Get the widget pointer
1052 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1053 if (widget == 0)
1054 {
1055 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1056 MMset(m, 0, NIL);
1057 return 0;
1058 }
1059
1060 // Check the type of the widget
1061 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1062 {
1063 MMechostr(MSKDEBUG, "bad widget type \n");
1064 MMset(m, 0, NIL);
1065 return 0;
1066 }
1067 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1068
1069 // Get the optional frame name
1070 std::string frameName = "";
1071 if (scolFrameName != NIL)
1072 frameName = MMstartstr(m, MTOP(scolFrameName));
1073
1074 std::string url = webNavigatorWidget->GetURL(frameName);
1075 return Mpushstrbloc(m, (char*)(url.c_str()));
1076 return 0;
1077}
1078
1088{
1089#ifdef SCOL_DEBUG
1090 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCanGoBack\n");
1091#endif
1092
1093 int scolWidget = MMget(m, 0);
1094 if (scolWidget == NIL)
1095 {
1096 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCanGoBack: Invalid parameters!\n");
1097 MMset(m, 0, NIL);
1098 return 0;
1099 }
1100
1101 // Get the widget pointer
1102 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1103 if (widget == 0)
1104 {
1105 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1106 MMset(m, 0, NIL);
1107 return 0;
1108 }
1109
1110 // Check the type of the widget
1111 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1112 {
1113 MMechostr(MSKDEBUG, "bad widget type \n");
1114 MMset(m, 0, NIL);
1115 return 0;
1116 }
1117 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1118
1119 if (webNavigatorWidget->CanGoBack())
1120 MMset(m, 0, ITOM(1));
1121 else
1122 MMset(m, 0, ITOM(0));
1123 return 0;
1124}
1125
1135{
1136#ifdef SCOL_DEBUG
1137 MMechostr(MSKDEBUG, "WebNavigatorGoBack\n");
1138#endif
1139
1140 int scolWidget = MMget(m, 0);
1141 if (scolWidget == NIL)
1142 {
1143 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGoBack: Invalid parameters!\n");
1144 MMset(m, 0, NIL);
1145 return 0;
1146 }
1147
1148 // Get the widget pointer
1149 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1150 if (widget == 0)
1151 {
1152 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1153 MMset(m, 0, NIL);
1154 return 0;
1155 }
1156
1157 // Check the type of the widget
1158 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1159 {
1160 MMechostr(MSKDEBUG, "bad widget type \n");
1161 MMset(m, 0, NIL);
1162 return 0;
1163 }
1164 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1165
1166 webNavigatorWidget->GoBack();
1167 MMset(m, 0, ITOM(1));
1168 return 0;
1169}
1170
1180{
1181#ifdef SCOL_DEBUG
1182 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCanGoForward\n");
1183#endif
1184
1185 int scolWidget = MMget(m, 0);
1186 if (scolWidget == NIL)
1187 {
1188 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCanGoForward: Invalid parameters!\n");
1189 MMset(m, 0, NIL);
1190 return 0;
1191 }
1192
1193 // Get the widget pointer
1194 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1195 if (widget == 0)
1196 {
1197 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1198 MMset(m, 0, NIL);
1199 return 0;
1200 }
1201
1202 // Check the type of the widget
1203 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1204 {
1205 MMechostr(MSKDEBUG, "bad widget type \n");
1206 MMset(m, 0, NIL);
1207 return 0;
1208 }
1209 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1210
1211 if (webNavigatorWidget->CanGoForward())
1212 MMset(m, 0, ITOM(1));
1213 else
1214 MMset(m, 0, ITOM(0));
1215 return 0;
1216}
1217
1227{
1228#ifdef SCOL_DEBUG
1229 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGoForward\n");
1230#endif
1231
1232 int scolWidget = MMget(m, 0);
1233 if (scolWidget == NIL)
1234 {
1235 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGoForward: Invalid parameters!\n");
1236 MMset(m, 0, NIL);
1237 return 0;
1238 }
1239
1240 // Get the widget pointer
1241 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1242 if (widget == 0)
1243 {
1244 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1245 MMset(m, 0, NIL);
1246 return 0;
1247 }
1248
1249 // Check the type of the widget
1250 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1251 {
1252 MMechostr(MSKDEBUG, "bad widget type \n");
1253 MMset(m, 0, NIL);
1254 return 0;
1255 }
1256 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1257
1258 webNavigatorWidget->GoForward();
1259 MMset(m, 0, ITOM(1));
1260 return 0;
1261}
1262
1272{
1273#ifdef SCOL_DEBUG
1274 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetReload\n");
1275#endif
1276
1277 int scolWidget = MMget(m, 0);
1278 if (scolWidget == NIL)
1279 {
1280 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetReload: Invalid parameters!\n");
1281 MMset(m, 0, NIL);
1282 return 0;
1283 }
1284
1285 // Get the widget pointer
1286 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1287 if (widget == 0)
1288 {
1289 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1290 MMset(m, 0, NIL);
1291 return 0;
1292 }
1293
1294 // Check the type of the widget
1295 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1296 {
1297 MMechostr(MSKDEBUG, "bad widget type \n");
1298 MMset(m, 0, NIL);
1299 return 0;
1300 }
1301 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1302
1303 webNavigatorWidget->Reload();
1304 MMset(m, 0, ITOM(1));
1305 return 0;
1306}
1307
1317{
1318#ifdef SCOL_DEBUG
1319 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetReloadIgnoreCache\n");
1320#endif
1321
1322 int scolWidget = MMget(m, 0);
1323 if (scolWidget == NIL)
1324 {
1325 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetReloadIgnoreCache: Invalid parameters!\n");
1326 MMset(m, 0, NIL);
1327 return 0;
1328 }
1329
1330 // Get the widget pointer
1331 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1332 if (widget == 0)
1333 {
1334 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1335 MMset(m, 0, NIL);
1336 return 0;
1337 }
1338
1339 // Check the type of the widget
1340 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1341 {
1342 MMechostr(MSKDEBUG, "bad widget type \n");
1343 MMset(m, 0, NIL);
1344 return 0;
1345 }
1346 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1347
1348 webNavigatorWidget->ReloadIgnoreCache();
1349 MMset(m, 0, ITOM(1));
1350 return 0;
1351}
1352
1362{
1363#ifdef SCOL_DEBUG
1364 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetStopLoad\n");
1365#endif
1366
1367 int scolWidget = MMget(m, 0);
1368 if (scolWidget == NIL)
1369 {
1370 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetStopLoad: Invalid parameters!\n");
1371 MMset(m, 0, NIL);
1372 return 0;
1373 }
1374
1375 // Get the widget pointer
1376 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1377 if (widget == 0)
1378 {
1379 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1380 MMset(m, 0, NIL);
1381 return 0;
1382 }
1383
1384 // Check the type of the widget
1385 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1386 {
1387 MMechostr(MSKDEBUG, "bad widget type \n");
1388 MMset(m, 0, NIL);
1389 return 0;
1390 }
1391 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1392
1393 webNavigatorWidget->StopLoad();
1394 MMset(m, 0, ITOM(1));
1395 return 0;
1396}
1397
1412{
1413#ifdef SCOL_DEBUG
1414 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetFind\n");
1415#endif
1416
1417 int scolFirstSearch = MMpull(m);
1418 int scolCaseSensitive = MMpull(m);
1419 int scolSearchForward = MMpull(m);
1420 int scolSearchedText = MMpull(m);
1421 int scolSearchIdentifier = MMpull(m);
1422 int scolWidget = MMget(m, 0);
1423 if ((scolWidget == NIL) || (scolSearchedText == NIL) || (scolSearchIdentifier == NIL))
1424 {
1425 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetFind: Invalid parameters!\n");
1426 MMset(m, 0, NIL);
1427 return 0;
1428 }
1429
1430 // Get the widget pointer
1431 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1432 if (widget == 0)
1433 {
1434 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1435 MMset(m, 0, NIL);
1436 return 0;
1437 }
1438
1439 // Check the type of the widget
1440 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1441 {
1442 MMechostr(MSKDEBUG, "bad widget type \n");
1443 MMset(m, 0, NIL);
1444 return 0;
1445 }
1446 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1447
1448 // Get the search index
1449 int searchIdentifier = MTOI(scolSearchIdentifier);
1450
1451 // Get text to search
1452 std::string searchedText = MMstartstr(m, MTOP(scolSearchedText));
1453
1454 // Search forward?
1455 bool searchForward = true;
1456 if (scolSearchForward != NIL)
1457 if (MTOI(scolSearchForward) == 0)
1458 searchForward = false;
1459
1460 // Case sensitive?
1461 bool caseSensitive = false;
1462 if (scolCaseSensitive != NIL)
1463 if (MTOI(scolCaseSensitive) == 0)
1464 caseSensitive = true;
1465
1466 // First search or follow up?
1467 bool firstSearch = true;
1468 if (scolFirstSearch != NIL)
1469 if (MTOI(scolFirstSearch) == 0)
1470 firstSearch = false;
1471
1472 // Launch search, response will be sent in the dedicated callback
1473 webNavigatorWidget->Find(searchIdentifier, searchedText, searchForward, caseSensitive, firstSearch);
1474 MMset(m, 0, ITOM(1));
1475 return 0;
1476}
1477
1488{
1489#ifdef SCOL_DEBUG
1490 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetStopFinding\n");
1491#endif
1492
1493 int scolClearSelection = MMpull(m);
1494 int scolWidget = MMget(m, 0);
1495 if (scolWidget == NIL)
1496 {
1497 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetStopFinding: Invalid parameters!\n");
1498 MMset(m, 0, NIL);
1499 return 0;
1500 }
1501
1502 // Get the widget pointer
1503 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1504 if (widget == 0)
1505 {
1506 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1507 MMset(m, 0, NIL);
1508 return 0;
1509 }
1510
1511 // Check the type of the widget
1512 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1513 {
1514 MMechostr(MSKDEBUG, "bad widget type \n");
1515 MMset(m, 0, NIL);
1516 return 0;
1517 }
1518 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1519
1520 bool clearSelection = false;
1521 if (scolClearSelection != NIL)
1522 if (MTOI(scolClearSelection) == 1)
1523 clearSelection = true;
1524
1525 webNavigatorWidget->StopFinding(clearSelection);
1526 MMset(m, 0, ITOM(1));
1527 return 0;
1528}
1529
1539{
1540#ifdef SCOL_DEBUG
1541 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGetZoomLevel\n");
1542#endif
1543
1544 int scolWidget = MMget(m, 0);
1545 if (scolWidget == NIL)
1546 {
1547 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetGetZoomLevel: Invalid parameters!\n");
1548 MMset(m, 0, NIL);
1549 return 0;
1550 }
1551
1552 // Get the widget pointer
1553 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1554 if (widget == 0)
1555 {
1556 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1557 MMset(m, 0, NIL);
1558 return 0;
1559 }
1560
1561 // Check the type of the widget
1562 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1563 {
1564 MMechostr(MSKDEBUG, "bad widget type \n");
1565 MMset(m, 0, NIL);
1566 return 0;
1567 }
1568 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1569
1570 float zoomLevel = webNavigatorWidget->GetZoomLevel();
1571 MMset(m, 0, FTOM(zoomLevel));
1572 return 0;
1573}
1574
1585{
1586#ifdef SCOL_DEBUG
1587 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetSetZoomLevel\n");
1588#endif
1589
1590 int scolZoomLevel = MMpull(m);
1591 int scolWidget = MMget(m, 0);
1592 if ((scolWidget == NIL) || (scolZoomLevel == NIL))
1593 {
1594 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetSetZoomLevel: Invalid parameters!\n");
1595 MMset(m, 0, NIL);
1596 return 0;
1597 }
1598
1599 // Get the widget pointer
1600 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1601 if (widget == 0)
1602 {
1603 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1604 MMset(m, 0, NIL);
1605 return 0;
1606 }
1607
1608 // Check the type of the widget
1609 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1610 {
1611 MMechostr(MSKDEBUG, "bad widget type \n");
1612 MMset(m, 0, NIL);
1613 return 0;
1614 }
1615 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1616
1617 float zoomLevel = MTOF(scolZoomLevel);
1618 webNavigatorWidget->SetZoomLevel(zoomLevel);
1619 MMset(m, 0, ITOM(1));
1620 return 0;
1621}
1622
1632{
1633#ifdef SCOL_DEBUG
1634 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetClearHistory\n");
1635#endif
1636
1637 int scolWidget = MMget(m, 0);
1638 if (scolWidget == NIL)
1639 {
1640 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetClearHistory: Invalid parameters!\n");
1641 MMset(m, 0, NIL);
1642 return 0;
1643 }
1644
1645 // Get the widget pointer
1646 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1647 if (widget == 0)
1648 {
1649 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1650 MMset(m, 0, NIL);
1651 return 0;
1652 }
1653
1654 // Check the type of the widget
1655 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1656 {
1657 MMechostr(MSKDEBUG, "bad widget type \n");
1658 MMset(m, 0, NIL);
1659 return 0;
1660 }
1661 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1662
1663 webNavigatorWidget->ClearHistory();
1664 MMset(m, 0, ITOM(1));
1665 return 0;
1666}
1667
1677{
1678#ifdef SCOL_DEBUG
1679 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetShowDevTools\n");
1680#endif
1681
1682 int scolWidget = MMget(m, 0);
1683 if (scolWidget == NIL)
1684 {
1685 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetShowDevTools: Invalid parameters!\n");
1686 MMset(m, 0, NIL);
1687 return 0;
1688 }
1689
1690 // Get the widget pointer
1691 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1692 if (widget == 0)
1693 {
1694 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1695 MMset(m, 0, NIL);
1696 return 0;
1697 }
1698
1699 // Check the type of the widget
1700 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1701 {
1702 MMechostr(MSKDEBUG, "bad widget type \n");
1703 MMset(m, 0, NIL);
1704 return 0;
1705 }
1706 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1707
1708 webNavigatorWidget->ShowDevTools();
1709 MMset(m, 0, ITOM(1));
1710 return 0;
1711}
1712
1722{
1723#ifdef SCOL_DEBUG
1724 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCloseDevTools\n");
1725#endif
1726 int scolWidget = MMget(m, 0);
1727 if (scolWidget == NIL)
1728 {
1729 MMechostr(MSKDEBUG, "SO3WebNavigatorWidgetCloseDevTools: Invalid parameters!\n");
1730 MMset(m, 0, NIL);
1731 return 0;
1732 }
1733
1734 // Get the widget pointer
1735 SWidget* widget = MMgetPointer<SWidget*>(m, MTOP(scolWidget));
1736 if (widget == 0)
1737 {
1738 MMechostr(MSKDEBUG, "widget instance is NULL \n");
1739 MMset(m, 0, NIL);
1740 return 0;
1741 }
1742
1743 // Check the type of the widget
1744 if (widget->GetType() != SO3_WEB_NAVIGATOR_WIDGET_TYPE)
1745 {
1746 MMechostr(MSKDEBUG, "bad widget type \n");
1747 MMset(m, 0, NIL);
1748 return 0;
1749 }
1750 SWebNavigatorWidget* webNavigatorWidget = static_cast<SWebNavigatorWidget*>(widget);
1751
1752 webNavigatorWidget->CloseDevTools();
1753 MMset(m, 0, ITOM(1));
1754 return 0;
1755}
1756
1757
1758NativeDefinition natSO3WebWidget[] = {
1759 { "SO3WebNavigatorWidgetCreate", 8, "fun [SO3_SCENE SO3_VIEWPORT S I I I I I] SO3_WIDGET", SO3WebNavigatorWidgetCreate },
1760 { "SO3WebNavigatorWidgetCreateBackground", 7, "fun [SO3_SCENE SO3_VIEWPORT S I I I I] SO3_WIDGET", SO3WebNavigatorWidgetCreateBackground },
1761 { "SO3WebNavigatorWidgetCreateOnMaterial", 8, "fun [SO3_SCENE SO3_MATERIAL S I I I I I] SO3_WIDGET", SO3WebNavigatorWidgetCreateOnMaterial },
1762 { "SO3WebNavigatorWidgetLoadHTML", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetLoadHTML },
1763 { "SO3WebNavigatorWidgetActionUndo", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetActionUndo },
1764 { "SO3WebNavigatorWidgetActionRedo", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetActionRedo },
1765 { "SO3WebNavigatorWidgetActionCut", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetActionCut },
1766 { "SO3WebNavigatorWidgetActionCopy", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetActionCopy },
1767 { "SO3WebNavigatorWidgetActionPaste", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetActionPaste },
1768 { "SO3WebNavigatorWidgetActionDelete", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetActionDelete },
1769 { "SO3WebNavigatorWidgetActionSelectAll", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetActionSelectAll },
1770 { "SO3WebNavigatorWidgetPrint", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetPrint },
1771 { "SO3WebNavigatorWidgetViewSource", 2, "fun [SO3_WIDGET S] I", SO3WebNavigatorWidgetViewSource },
1772 { "SO3WebNavigatorWidgetGetSource", 2, "fun [SO3_WIDGET S] S", SO3WebNavigatorWidgetGetSource },
1773 { "SO3WebNavigatorWidgetGetText", 2, "fun [SO3_WIDGET S] S", SO3WebNavigatorWidgetGetText },
1774 { "SO3WebNavigatorWidgetGetURL", 2, "fun [SO3_WIDGET S] S", SO3WebNavigatorWidgetGetURL },
1775 { "SO3WebNavigatorWidgetCanGoBack", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetCanGoBack },
1776 { "SO3WebNavigatorWidgetGoBack", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetGoBack },
1777 { "SO3WebNavigatorWidgetCanGoForward", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetCanGoForward },
1778 { "SO3WebNavigatorWidgetGoForward", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetGoForward },
1779 { "SO3WebNavigatorWidgetReload", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetReload },
1780 { "SO3WebNavigatorWidgetReloadIgnoreCache", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetReloadIgnoreCache },
1781 { "SO3WebNavigatorWidgetStopLoad", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetStopLoad },
1782 { "SO3WebNavigatorWidgetFind", 6, "fun [SO3_WIDGET I S I I I] I", SO3WebNavigatorWidgetFind },
1783 { "SO3WebNavigatorWidgetStopFinding", 2, "fun [SO3_WIDGET I] I", SO3WebNavigatorWidgetStopFinding },
1784 { "SO3WebNavigatorWidgetGetZoomLevel", 1, "fun [SO3_WIDGET] F", SO3WebNavigatorWidgetGetZoomLevel },
1785 { "SO3WebNavigatorWidgetSetZoomLevel", 2, "fun [SO3_WIDGET F] I", SO3WebNavigatorWidgetSetZoomLevel },
1786 { "SO3WebNavigatorWidgetClearHistory", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetClearHistory },
1787 { "SO3WebNavigatorWidgetShowDevTools", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetShowDevTools },
1788 { "SO3WebNavigatorWidgetCloseDevTools", 1, "fun [SO3_WIDGET] I", SO3WebNavigatorWidgetCloseDevTools }
1789};
1790
1791
1798{
1799 return PKhardpak2(m, "SO3WebWidget.pkg", sizeof(natSO3WebWidget) / sizeof(natSO3WebWidget[0]), natSO3WebWidget);
1800}
1801
1802
1808{
1809 return 0;
1810}
1811
1812#endif
NativeDefinition natSO3WebWidget[]
int SCOLloadWebNavigatorWidget(mmachine m)
Load the SO3Engine Web navigator widget functions.
int SCOLfreeWebNavigatorWidget()
free the SO3Engine Viewport function
int(* CallMainThread)(void *, mmachine m)
main include
Definition SO3SCOL.cpp:84
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
Definition SO3SCOL.cpp:5150
int SO3MATERIAL
Definition SO3SCOL.cpp:97
int SO3SCENETYPE
Definition SO3SCOL.cpp:88
int SO3VPTYPE
Definition SO3SCOL.cpp:94
int SO3WIDGET
Definition SO3SCOL.cpp:101
int SO3WebNavigatorWidgetActionCut(mmachine m)
SO3WebNavigatorWidgetActionCut : Execute cut on a frame.
int SO3WebNavigatorWidgetGetURL(mmachine m)
SO3WebNavigatorWidgetGetURL : Returns the URL currently loaded in a frame.
int SO3WebNavigatorWidgetCreate(mmachine m)
SO3WebNavigatorWidgetCreate : Create a new web navigator widget.
int SO3WebNavigatorWidgetGetSource(mmachine m)
SO3WebNavigatorWidgetGetSource : Returns a frame's HTML source as a string.
int SO3WebNavigatorWidgetGoForward(mmachine m)
SO3WebNavigatorWidgetGoForward : Navigate forward.
int SO3WebNavigatorWidgetLoadHTML(mmachine m)
SO3WebNavigatorWidgetLoadHTML : Load a html content in a web navigator widget.
int SO3WebNavigatorWidgetActionDelete(mmachine m)
SO3WebNavigatorWidgetActionDelete : Execute delete on a frame.
int SO3WebNavigatorWidgetShowDevTools(mmachine m)
SO3WebNavigatorWidgetShowDevTools : Open developer tools window.
int SO3WebNavigatorWidgetActionRedo(mmachine m)
SO3WebNavigatorWidgetActionRedo : Execute redo on a frame.
int SO3WebNavigatorWidgetActionSelectAll(mmachine m)
SO3WebNavigatorWidgetActionSelectAll : Execute select all on a frame.
int SO3WebNavigatorWidgetCreateOnMaterial(mmachine m)
SO3WebNavigatorWidgetCreateOnMaterial : Set a texture web navigator on a material.
int SO3WebNavigatorWidgetStopFinding(mmachine m)
SO3WebNavigatorWidgetStopFinding : Cancel all searches that are currently going on.
int SO3WebNavigatorWidgetReloadIgnoreCache(mmachine m)
SO3WebNavigatorWidgetReloadIgnoreCache : Reload the current page ignoring any cached data.
int SO3WebNavigatorWidgetFind(mmachine m)
SO3WebNavigatorWidgetFind : Search for text in the current page.
int SO3WebNavigatorWidgetGetText(mmachine m)
SO3WebNavigatorWidgetGetText : Returns a frame's display text as a string.
int SO3WebNavigatorWidgetActionCopy(mmachine m)
SO3WebNavigatorWidgetActionCopy : Execute copy on a frame.
int SO3WebNavigatorWidgetStopLoad(mmachine m)
SO3WebNavigatorWidgetStopLoad : Stop loading the page.
int SO3WebNavigatorWidgetCreateBackground(mmachine m)
SO3WebNavigatorWidgetCreateBackground : Create a new web navigator widget.
int SO3WebNavigatorWidgetActionUndo(mmachine m)
SO3WebNavigatorWidgetActionUndo : Execute undo on a frame.
int SO3WebNavigatorWidgetCloseDevTools(mmachine m)
SO3WebNavigatorWidgetCloseDevTools : Close the developer tools window if one exists for this browser ...
int SO3WebNavigatorWidgetReload(mmachine m)
SO3WebNavigatorWidgetReload : Reload the current page.
int SO3WebNavigatorWidgetSetZoomLevel(mmachine m)
SO3WebNavigatorWidgetSetZoomLevel : Change the zoom level.
int SO3WebNavigatorWidgetPrint(mmachine m)
SO3WebNavigatorWidgetPrint : Execute printing on a frame. The user will be prompted with the print di...
int SO3WebNavigatorWidgetViewSource(mmachine m)
SO3WebNavigatorWidgetViewSource : Save a frame's HTML source to a temporary file and open it in the d...
int SO3WebNavigatorWidgetClearHistory(mmachine m)
SO3WebNavigatorWidgetClearHistory : Clear the back/forward browsing history.
int SO3WebNavigatorWidgetGetZoomLevel(mmachine m)
SO3WebNavigatorWidgetGetZoomLevel : Get the zoom level.
int SO3WebNavigatorWidgetActionPaste(mmachine m)
SO3WebNavigatorWidgetActionPaste : Execute paste on a frame.
int SO3WebNavigatorWidgetGoBack(mmachine m)
SO3WebNavigatorWidgetGoBack : Navigate backward.
int SO3WebNavigatorWidgetCanGoBack(mmachine m)
SO3WebNavigatorWidgetCanGoBack : Does the browser can navigate backward?
int SO3WebNavigatorWidgetCanGoForward(mmachine m)
SO3WebNavigatorWidgetCanGoForward : Does the browser can navigate forward?