SO3Engine
SO3WidgetManager.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
31#include "SO3Renderer/SO3Root.h"
37#include <Ogre.h>
38
39namespace Ogre
40{
41 //Singleton instance
42 template<> SO3::SWidgetManager* Ogre::Singleton<SO3::SWidgetManager>::msSingleton = 0;
43}
44
45namespace SO3
46{
47
49{
50 return msSingleton;
51}
52
54{
55 assert(msSingleton);
56 return (*msSingleton);
57}
58
60{
61 focusedWidget = 0;
62}
63
65{
66 focusedWidget = 0;
67
68 // Factories instance are not deleted, it's the wanted behavior.
69 WidgetFactoryList widgetFactoryListCopy = widgetFactoryList;
70 WidgetFactoryList::iterator iWidgetFactoryList = widgetFactoryListCopy.begin();
71 while (iWidgetFactoryList != widgetFactoryListCopy.end())
72 {
73 RemoveWidgetFactory(iWidgetFactoryList->second);
74 iWidgetFactoryList++;
75 }
76 widgetFactoryList.clear();
77}
78
83
85{
86 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(newWidgetFactory->GetType());
87 if(iWidgetFactorySearched == widgetFactoryList.end())
88 widgetFactoryList.insert(WidgetFactoryList::value_type(newWidgetFactory->GetType(), newWidgetFactory));
89 else
90 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM, "Cannot add factory for widget \""+ newWidgetFactory->GetType() +"\", factory already exists in widget manager!", "SWidgetManager::AddWidgetFactory");
91}
92
94{
95 RemoveWidgetFactory(existingWidgetFactory->GetType());
96}
97
98void SWidgetManager::RemoveWidgetFactory(const std::string& existingWidgetFactoryName)
99{
100 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(existingWidgetFactoryName);
101 if(iWidgetFactorySearched != widgetFactoryList.end())
102 widgetFactoryList.erase(iWidgetFactorySearched);
103 else
104 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Cannot remove factory for widget \""+ existingWidgetFactoryName +"\", factory does not exists in widget manager!", "SWidgetManager::RemoveWidgetFactory");
105}
106
107SWidget* SWidgetManager::CreateWidget(SScene* targetScene, const std::string& widgetName, const int& xPos, const int& yPos, const unsigned short& width, const unsigned short& height, SViewPort* targetViewport, const unsigned int& widgetZOrder, const std::string& widgetType)
108{
109 SWidget* newWidget = 0;
110 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(widgetType);
111 if(iWidgetFactorySearched != widgetFactoryList.end())
112 {
113 WidgetList::iterator iWidgetSearched = widgetList.find(widgetName);
114 if(iWidgetSearched == widgetList.end())
115 {
116 newWidget = iWidgetFactorySearched->second->CreateWidget(targetScene, widgetName, xPos, yPos, width, height, targetViewport, widgetZOrder);
117 widgetList.insert(WidgetList::value_type(widgetName, newWidget));
118 overlayedWidgetList.insert(WidgetList::value_type(widgetName, newWidget));
119
120 // Update zOrder of all overlayed widgets
122 }
123 else
124 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM, "Cannot create a widget named \""+ widgetName +"\", a widget with the same name already exists!", "SWidgetManager::CreateWidget");
125 }
126 else
127 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Cannot create a widget with factory \""+ widgetType +"\", factory does not exists in widget manager!", "SWidgetManager::CreateWidget");
128
129 return newWidget;
130}
131
132SWidget* SWidgetManager::CreateWidget(SScene* targetScene, const std::string& widgetName, const int& xPos, const int& yPos, const unsigned short& width, const unsigned short& height, SViewPort* targetViewport, const std::string& widgetType)
133{
134 SWidget* newWidget = 0;
135 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(widgetType);
136 if(iWidgetFactorySearched != widgetFactoryList.end())
137 {
138 WidgetList::iterator iWidgetSearched = widgetList.find(widgetName);
139 if(iWidgetSearched == widgetList.end())
140 {
141 newWidget = iWidgetFactorySearched->second->CreateWidget(targetScene, widgetName, xPos, yPos, width, height, targetViewport);
142 widgetList.insert(WidgetList::value_type(widgetName, newWidget));
143 }
144 else
145 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM, "Cannot create a widget named \""+ widgetName +"\", a widget with the same name already exists!", "SWidgetManager::CreateWidget");
146 }
147 else
148 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Cannot create a widget with factory \""+ widgetType +"\", factory does not exists in widget manager!", "SWidgetManager::CreateWidget");
149
150 return newWidget;
151}
152
153SWidget* SWidgetManager::CreateWidget(SScene* targetScene, const std::string& widgetName, const unsigned short& width, const unsigned short& height, SMaterial* targetMaterial, const unsigned short& targetTechnique, const unsigned short& targetPass, const unsigned short& targetTextureUnit, const std::string& widgetType)
154{
155 SWidget* newWidget = 0;
156 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(widgetType);
157 if(iWidgetFactorySearched != widgetFactoryList.end())
158 {
159 WidgetList::iterator iWidgetSearched = widgetList.find(widgetName);
160 if(iWidgetSearched == widgetList.end())
161 {
162 newWidget = iWidgetFactorySearched->second->CreateWidget(targetScene, widgetName, width, height, targetMaterial, targetTechnique, targetPass, targetTextureUnit);
163 widgetList.insert(WidgetList::value_type(widgetName, newWidget));
164 }
165 else
166 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM, "Cannot create a widget named \""+ widgetName +"\", a widget with the same name already exists!", "SWidgetManager::CreateWidget");
167 }
168 else
169 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Cannot create a widget with factory \""+ widgetType +"\", factory does not exists in widget manager!", "SWidgetManager::CreateWidget");
170
171 return newWidget;
172}
173
175{
176 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(existingWidget->GetType());
177 if(iWidgetFactorySearched != widgetFactoryList.end())
178 {
179 std::string widgetName = existingWidget->GetName();
180 WidgetList::iterator iWidgetSearched = widgetList.find(widgetName);
181 if(iWidgetSearched != widgetList.end())
182 {
183 // Check if our widget is an overlayed widget
184 WidgetList::iterator iOverlayedWidgetSearched = overlayedWidgetList.find(widgetName);
185 if(iOverlayedWidgetSearched != overlayedWidgetList.end())
186 overlayedWidgetList.erase(iOverlayedWidgetSearched);
187
188 // Unfocus this widget if it's the last focused.
189 if(focusedWidget == existingWidget)
191
192 WidgetInputList::iterator iInputList = inputList.begin();
193 while (iInputList != inputList.end())
194 {
195 if (iInputList->second.widget == existingWidget)
196 iInputList = inputList.erase(iInputList);
197 else
198 iInputList++;
199 }
200
201 // SWidget destructor should call UpdateWidgetsZOrder if needed (if widget is overlayed).
202 iWidgetFactorySearched->second->DeleteWidget(existingWidget);
203 widgetList.erase(widgetName);
204 }
205 else
206 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Cannot delete a widget named \""+ widgetName +"\", widget not found!", "SWidgetManager::DeleteWidget");
207 }
208 else
209 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Cannot delete a widget with factory \""+ existingWidget->GetType() +"\", factory does not exists in widget manager!", "SWidgetManager::DeleteWidget");
210}
211
212void SWidgetManager::InjectMouseMove(SWindow* originWindow, const int& xPos, const int& yPos, const MouseButtonId& button)
213{
214 int px = xPos;
215 int py = yPos;
216
217 originWindow->ToPixelPos(px, py);
218
219 // Focus 3D widget (not overlayed) when mouse is over automaticaly.
220 SWidget* widgetUnder = GetWidgetUnder(originWindow, px, py);
221
222 if (widgetUnder != 0)
223 {
224 if (widgetUnder->GetMouseEnable())
225 {
226 if (widgetUnder->isOverlayed || widgetUnder->is2DRect)
227 {
228 SPointInt widgetPosition = widgetUnder->GetPosition();
229 widgetUnder->InjectMouseMove(px - widgetPosition.x, py - widgetPosition.y, button);
230
231 //MMechostr(MSKDEBUG, ">> InjectMouseMove from %i : %i to %i : %i\n", xPos, yPos, px - widgetPosition.x, py - widgetPosition.y);
232 _FireMouseMoveWidgetEvent(widgetUnder, px - widgetPosition.x, py - widgetPosition.y, button);
233 }
234 else
235 {
236 SRaycastResult raycast = originWindow->GetLastRayCast();
237 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(widgetUnder, raycast.uvResult.x, raycast.uvResult.y);
238 widgetUnder->InjectMouseMove(injectPosition.x, injectPosition.y, button);
239
240 _FireMouseMoveWidgetEvent(widgetUnder, injectPosition.x, injectPosition.y, button);
241 }
242 }
243 }
244
245 // We want to inject mouse move to all overlayed widget, even if they are not focused.
246 WidgetList::iterator iWidgetList = overlayedWidgetList.begin();
247 while(iWidgetList != overlayedWidgetList.end())
248 {
249 // Ignore widgetUnder, cause we already sent event.
250 if((iWidgetList->second != widgetUnder) && (iWidgetList->second->GetMouseEnable()))
251 {
252 SPointInt widgetPosition = iWidgetList->second->GetPosition();
253 iWidgetList->second->InjectMouseMove(px - widgetPosition.x, py - widgetPosition.y, button);
254
255 _FireMouseMoveWidgetEvent(iWidgetList->second, px - widgetPosition.x, py - widgetPosition.y, button);
256 }
257
258 iWidgetList++;
259 }
260}
261
262void SWidgetManager::InjectMouseWheel(SWindow* originWindow, const int& scrollX, const int& scrollY, const int& relativeScroll)
263{
264 if(focusedWidget != 0)
265 if(focusedWidget->GetMouseEnable())
266 {
267 // Point(0,0) is returned if it's not an overlayed widget, so it's safe to call GetPosition everytime.
268 SPointInt widgetPosition = focusedWidget->GetPosition();
269 focusedWidget->InjectMouseWheel(scrollX - widgetPosition.x, scrollY - widgetPosition.y, relativeScroll);
270 _FireMouseWheelWidgetEvent(focusedWidget, scrollX - widgetPosition.x, scrollY - widgetPosition.y, relativeScroll);
271 }
272}
273
274void SWidgetManager::InjectMouseDown(SWindow* originWindow, const int& xPos, const int& yPos, const MouseButtonId& button)
275{
276 int px = xPos;
277 int py = yPos;
278
279 originWindow->ToPixelPos(px, py);
280
281 // Verify focused widget
282 UpdateFocusedWidget(GetWidgetUnder(originWindow, px, py));
283
284 if (focusedWidget != 0)
285 {
286 if (focusedWidget->GetMouseEnable())
287 {
288 int xRealPos = 0;
289 int yRealPos = 0;
290 if (focusedWidget->isOverlayed || focusedWidget->is2DRect)
291 {
292 SPointInt widgetPosition = focusedWidget->GetPosition();
293 focusedWidget->InjectMouseDown(px - widgetPosition.x, py - widgetPosition.y, button);
294
295 //MMechostr(MSKDEBUG, ">> InjectMouseDown from %i : %i to %i : %i\n", xPos, yPos, px - widgetPosition.x, py - widgetPosition.y);
296 _FireMouseDownWidgetEvent(focusedWidget, px - widgetPosition.x, py - widgetPosition.y, button);
297 }
298 else
299 {
300 SRaycastResult raycast = originWindow->GetLastRayCast();
301 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(focusedWidget, raycast.uvResult.x, raycast.uvResult.y);
302 focusedWidget->InjectMouseDown(injectPosition.x, injectPosition.y, button);
303 _FireMouseDownWidgetEvent(focusedWidget, injectPosition.x, injectPosition.y, button);
304 }
305 }
306 }
307}
308
309void SWidgetManager::InjectMouseUp(SWindow* originWindow, const int& xPos, const int& yPos, const MouseButtonId& button)
310{
311 int px = xPos;
312 int py = yPos;
313
314 originWindow->ToPixelPos(px, py);
315
316 if (focusedWidget != 0)
317 {
318 if (focusedWidget->GetMouseEnable())
319 {
320 if (focusedWidget->isOverlayed || focusedWidget->is2DRect)
321 {
322 SPointInt widgetPosition = focusedWidget->GetPosition();
323 focusedWidget->InjectMouseUp(px - widgetPosition.x, py - widgetPosition.y, button);
324
325 //MMechostr(MSKDEBUG, ">> InjectMouseUp from %i : %i to %i : %i\n", xPos, yPos, px - widgetPosition.x, py - widgetPosition.y);
326 _FireMouseUpWidgetEvent(focusedWidget, px - widgetPosition.x, py - widgetPosition.y, button);
327 }
328 else
329 {
330 SRaycastResult raycast = originWindow->GetLastRayCast();
331 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(focusedWidget, raycast.uvResult.x, raycast.uvResult.y);
332 focusedWidget->InjectMouseUp(injectPosition.x, injectPosition.y, button);
333 _FireMouseUpWidgetEvent(focusedWidget, injectPosition.x, injectPosition.y, button);
334 }
335 }
336 }
337}
338
339void SWidgetManager::InjectTouchAdd(SWindow* originWindow, const int& xPos, const int& yPos, const int& touchid)
340{
341 int px = xPos;
342 int py = yPos;
343
344 originWindow->ToPixelPos(px, py);
345
346 // Verify focused widget
347 UpdateFocusedWidget(GetWidgetUnder(originWindow, px, py, touchid));
348
349 WidgetInputList::iterator iTouchListSearched = inputList.find(touchid);
350 if (iTouchListSearched == inputList.end())
351 inputList.insert(WidgetInputList::value_type(touchid, INPUTInfo(touchid, px, py, focusedWidget)));
352 else
353 {
354 iTouchListSearched->second.x = px;
355 iTouchListSearched->second.y = py;
356 iTouchListSearched->second.widget = focusedWidget;
357 }
358
359 if (focusedWidget != 0)
360 {
361 if (focusedWidget->GetMouseEnable())
362 {
363 if (focusedWidget->isOverlayed || focusedWidget->is2DRect)
364 {
365 SPointInt widgetPosition = focusedWidget->GetPosition();
366 focusedWidget->InjectTouchAdd(px - widgetPosition.x, py - widgetPosition.y, touchid);
367 _FireTouchAddWidgetEvent(focusedWidget, px - widgetPosition.x, py - widgetPosition.y, touchid);
368 }
369 else
370 {
371 SRaycastResult raycast = originWindow->IndRayCast(px, py);
372 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(focusedWidget, raycast.uvResult.x, raycast.uvResult.y);
373 focusedWidget->InjectTouchAdd(injectPosition.x, injectPosition.y, touchid);
374 _FireTouchAddWidgetEvent(focusedWidget, injectPosition.x, injectPosition.y, touchid);
375 }
376 }
377 }
378}
379
380void SWidgetManager::InjectTouchRemove(SWindow* originWindow, const int& touchid)
381{
382 WidgetInputList::iterator iTouchListSearched = inputList.find(touchid);
383 if (iTouchListSearched == inputList.end())
384 return;
385 else
386 {
387 if (iTouchListSearched->second.widget != 0)
388 {
389 if (iTouchListSearched->second.widget->GetMouseEnable())
390 {
391 if (iTouchListSearched->second.widget->isOverlayed || iTouchListSearched->second.widget->is2DRect)
392 {
393 SPointInt widgetPosition = iTouchListSearched->second.widget->GetPosition();
394 iTouchListSearched->second.widget->InjectTouchRemove(touchid);
395 _FireTouchRemoveWidgetEvent(iTouchListSearched->second.widget, iTouchListSearched->second.x - widgetPosition.x, iTouchListSearched->second.y - widgetPosition.y, touchid);
396 }
397 else
398 {
399 SRaycastResult raycast = originWindow->IndRayCast(iTouchListSearched->second.x, iTouchListSearched->second.y);
400 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(focusedWidget, raycast.uvResult.x, raycast.uvResult.y);
401
402 iTouchListSearched->second.widget->InjectTouchRemove(touchid);
403 _FireTouchRemoveWidgetEvent(iTouchListSearched->second.widget, injectPosition.x, injectPosition.y, touchid);
404 }
405 }
406
407 inputList.erase(iTouchListSearched);
408 }
409 }
410}
411
412void SWidgetManager::InjectTouchUpdate(SWindow* originWindow, const int& xPos, const int& yPos, const int& vx, const int& vy, const int& touchid)
413{
414 int px = xPos;
415 int py = yPos;
416
417 originWindow->ToPixelPos(px, py);
418
419 WidgetInputList::iterator iTouchListSearched = inputList.find(touchid);
420 if (iTouchListSearched == inputList.end())
421 return;
422 else
423 {
424 iTouchListSearched->second.x = px;
425 iTouchListSearched->second.y = py;
426 SWidget* widgetUnder = iTouchListSearched->second.widget;
427
428 if (widgetUnder != 0)
429 {
430 if (widgetUnder->GetMouseEnable())
431 {
432 if (widgetUnder->isOverlayed || widgetUnder->is2DRect)
433 {
434 SPointInt widgetPosition = widgetUnder->GetPosition();
435 widgetUnder->InjectTouchUpdate(px - widgetPosition.x, py - widgetPosition.y, vx, vy, touchid);
436 _FireTouchUpdateWidgetEvent(widgetUnder, px - widgetPosition.x, py - widgetPosition.y, vx, vy, touchid);
437 }
438 else
439 {
440 SRaycastResult raycast = originWindow->IndRayCast(px, py);
441 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(widgetUnder, raycast.uvResult.x, raycast.uvResult.y);
442 widgetUnder->InjectTouchUpdate(injectPosition.x, injectPosition.y, vx, vy, touchid);
443 _FireTouchUpdateWidgetEvent(widgetUnder, injectPosition.x, injectPosition.y, vx, vy, touchid);
444 }
445 }
446 }
447 }
448}
449
450void SWidgetManager::InjectMouseMove(SWidget* widget, const SRaycastResult& raycast, const MouseButtonId& button, const int& id)
451{
452 // Manage enter/in events
453 WidgetList::iterator iWidgetGlobalList = widgetList.begin();
454 while (iWidgetGlobalList != widgetList.end())
455 {
456 SWidget* currentWidget = iWidgetGlobalList->second;
457 if (!currentWidget->isOverlayed)
458 {
459 if ((widget == currentWidget)
460 && (currentWidget->GetVisible())
461 && (currentWidget->GetMouseEnable()))
462 {
463 // Manage enter/in events
464 if (!currentWidget->GetInputOver(id))
465 _FireEnterWidgetEvent(currentWidget, id);
466 else
467 _FireInsideWidgetEvent(currentWidget, id);
468 }
469 else if (currentWidget->GetInputOver(id))
470 {
471 _FireExitWidgetEvent(currentWidget, id);
472 }
473 else
474 {
475 // Manage exit events
476 if (currentWidget->GetInputOver(id))
477 _FireExitWidgetEvent(currentWidget, id);
478 }
479 }
480 iWidgetGlobalList++;
481 }
482
483 if (widget && widget->GetMouseEnable() && !widget->isOverlayed && !widget->is2DRect)
484 {
485 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(widget, raycast.uvResult.x, raycast.uvResult.y);
486 widget->InjectMouseMove(injectPosition.x, injectPosition.y, button);
487
488 _FireMouseMoveWidgetEvent(widget, injectPosition.x, injectPosition.y, button, id);
489 }
490}
491
492void SWidgetManager::InjectMouseDown(SWidget* widget, const SRaycastResult& raycast, const MouseButtonId& button, const int& id)
493{
494 // Verify focused widget
495 UpdateFocusedWidget(widget);
496
497 if (focusedWidget != 0)
498 if (focusedWidget->GetMouseEnable() && !focusedWidget->isOverlayed && !focusedWidget->is2DRect)
499 {
500 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(focusedWidget, raycast.uvResult.x, raycast.uvResult.y);
501
502 WidgetInputList::iterator iTouchListSearched = inputList.find(id);
503 if (iTouchListSearched == inputList.end())
504 inputList.insert(WidgetInputList::value_type(id, INPUTInfo(id, injectPosition.x, injectPosition.y, focusedWidget)));
505 else
506 {
507 iTouchListSearched->second.x = injectPosition.x;
508 iTouchListSearched->second.y = injectPosition.y;
509 iTouchListSearched->second.widget = focusedWidget;
510 }
511
512 focusedWidget->InjectMouseDown(injectPosition.x, injectPosition.y, button);
513 _FireMouseDownWidgetEvent(focusedWidget, injectPosition.x, injectPosition.y, button, id);
514 }
515}
516
517void SWidgetManager::InjectMouseWheel(SWidget* widget, const SRaycastResult& raycast, const int& relativeScroll, const int& id)
518{
519 // Verify focused widget
520 UpdateFocusedWidget(widget);
521
522 if (focusedWidget != 0)
523 if (focusedWidget->GetMouseEnable())
524 {
525 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(focusedWidget, raycast.uvResult.x, raycast.uvResult.y);
526 focusedWidget->InjectMouseWheel(injectPosition.x, injectPosition.y, relativeScroll);
527 _FireMouseWheelWidgetEvent(focusedWidget, injectPosition.x, injectPosition.y, relativeScroll, id);
528 }
529}
530
531void SWidgetManager::InjectMouseUp(const SRaycastResult& raycast, const MouseButtonId& button, const int& id)
532{
533 WidgetInputList::iterator iTouchListSearched = inputList.find(id);
534 if (iTouchListSearched == inputList.end())
535 return;
536 else
537 {
538 SWidget* widgetUnder = iTouchListSearched->second.widget;
539 if (widgetUnder != 0)
540 if (widgetUnder->GetMouseEnable() && !widgetUnder->isOverlayed && !widgetUnder->is2DRect)
541 {
542 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(widgetUnder, raycast.uvResult.x, raycast.uvResult.y);
543 widgetUnder->InjectMouseUp(injectPosition.x, injectPosition.y, button);
544 _FireMouseUpWidgetEvent(widgetUnder, injectPosition.x, injectPosition.y, button, id);
545 }
546 inputList.erase(iTouchListSearched);
547 }
548}
549
550void SWidgetManager::InjectTouchAdd(SWidget* widget, const SRaycastResult& raycast, const int& touchid)
551{
552 // Verify focused widget
553 UpdateFocusedWidget(widget);
554
555 if (focusedWidget != 0)
556 if (focusedWidget->GetMouseEnable() && !focusedWidget->isOverlayed && !focusedWidget->is2DRect)
557 {
558 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(focusedWidget, raycast.uvResult.x, raycast.uvResult.y);
559 focusedWidget->InjectTouchAdd(injectPosition.x, injectPosition.y, touchid);
560 _FireTouchAddWidgetEvent(focusedWidget, injectPosition.x, injectPosition.y, touchid);
561 }
562}
563
564void SWidgetManager::InjectTouchRemove(SWidget* widget, const SRaycastResult& raycast, const int& touchid)
565{
566 if (focusedWidget != 0)
567 if (focusedWidget->GetMouseEnable() && !focusedWidget->isOverlayed && !focusedWidget->is2DRect)
568 {
569 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(focusedWidget, raycast.uvResult.x, raycast.uvResult.y);
570 focusedWidget->InjectTouchRemove(touchid);
571 _FireTouchRemoveWidgetEvent(focusedWidget, injectPosition.x, injectPosition.y, touchid);
572 }
573}
574
575void SWidgetManager::InjectTouchUpdate(SWidget* widget, const SRaycastResult& raycast, const int& touchid)
576{
577 // Manage enter/in events
578 WidgetList::iterator iWidgetGlobalList = widgetList.begin();
579 while (iWidgetGlobalList != widgetList.end())
580 {
581 SWidget* currentWidget = iWidgetGlobalList->second;
582 if (!currentWidget->isOverlayed)
583 {
584 if ((widget == currentWidget)
585 && (currentWidget->GetVisible())
586 && (currentWidget->GetMouseEnable()))
587 {
588 // Manage enter/in events
589 if (!currentWidget->GetInputOver(touchid))
590 _FireEnterWidgetEvent(currentWidget, touchid);
591 else
592 _FireInsideWidgetEvent(currentWidget, touchid);
593 }
594 else if (currentWidget->GetInputOver(touchid))
595 {
596 _FireExitWidgetEvent(currentWidget, touchid);
597 }
598 else
599 {
600 // Manage exit events
601 if (currentWidget->GetInputOver(touchid))
602 _FireExitWidgetEvent(currentWidget, touchid);
603 }
604 }
605 iWidgetGlobalList++;
606 }
607
608 if (widget && widget->GetMouseEnable() && !widget->isOverlayed && !widget->is2DRect)
609 {
610 SPointInt injectPosition = ConvertTextureUvToWidgetCoordinates(widget, raycast.uvResult.x, raycast.uvResult.y);
611 widget->InjectTouchUpdate(injectPosition.x, injectPosition.y, 0, 0, touchid);
612
613 _FireTouchUpdateWidgetEvent(widget, injectPosition.x, injectPosition.y, 0, 0, touchid);
614 }
615}
616
617void SWidgetManager::InjectKeyEvent(const UINT& msg, const ScolWindowHandle& hwnd, const WPARAM& wParam, const LPARAM& lParam)
618{
619 if(focusedWidget != 0)
620 if(focusedWidget->GetKeyboardEnable())
621 {
622 focusedWidget->InjectKeyEvent(msg, hwnd, wParam, lParam);
623 _FireKeyWidgetEvent(focusedWidget, msg, hwnd, wParam, lParam);
624 }
625}
626
627void SWidgetManager::InjectTextEvent(const std::string& text)
628{
629 if(focusedWidget != 0)
630 focusedWidget->InjectTextEvent(text);
631}
632
634{
635 // The map orders the elements by their keys using a stored function key_compare, which simply does a less-than comparison.
636 std::multimap<unsigned short, SWidget*> widgetListForeground;
637 std::multimap<unsigned short, SWidget*> widgetListNotForeground;
638 widgetListByZOrder.clear();
639
640 // First, we need to separate widgets that have foreground flag from those who don't.
641 WidgetList::iterator iWidgetList = overlayedWidgetList.begin();
642 while(iWidgetList != overlayedWidgetList.end())
643 {
644 if(iWidgetList->second->GetForeground())
645 widgetListForeground.insert(std::multimap<unsigned short, SWidget*>::value_type(iWidgetList->second->GetZOrder(), iWidgetList->second));
646 else
647 widgetListNotForeground.insert(std::multimap<unsigned short, SWidget*>::value_type(iWidgetList->second->GetZOrder(), iWidgetList->second));
648
649 iWidgetList++;
650 }
651
652 // Continuing to set zOrder with foreground widgets.
653 unsigned short zOrder = 650;
654 unsigned short topOnFocusZOrder = zOrder;
655 // Reserve the next zOrder for set eventually the focused "top on focus" widget".
656 zOrder--;
657
658 std::multimap<unsigned short, SWidget*>::reverse_iterator iOrderedWidgetIterator = widgetListForeground.rbegin();
659 while(iOrderedWidgetIterator != widgetListForeground.rend())
660 {
661 SWidget* currentWidget = iOrderedWidgetIterator->second;
662 bool forceZOrder = false;
663
664 // If a focused "get on top on focus" overlay is detected, set the higher overlay to him.
665 if (currentWidget == focusedWidget)
666 if (currentWidget->GetTopOnFocus())
667 {
668 currentWidget->_SetOgreOverlayZOrder(topOnFocusZOrder);
669 widgetListByZOrder.insert(WidgetListByZOrder::value_type(topOnFocusZOrder, currentWidget));
670 forceZOrder = true;
671 }
672
673 // Normal zOrder
674 if (!forceZOrder)
675 {
676 currentWidget->_SetOgreOverlayZOrder(zOrder);
677 widgetListByZOrder.insert(WidgetListByZOrder::value_type(zOrder, currentWidget));
678
679 // up to 650 ordered overlays, other are all at the same zOrder
680 if (zOrder > 0)
681 zOrder--;
682 }
683 iOrderedWidgetIterator++;
684 zOrder--;
685 }
686
687 // Reserve the next zOrder for set eventually the focused "top on focus" widget".
688 topOnFocusZOrder = zOrder;
689 if(zOrder > 0)
690 zOrder--;
691
692 // Then set zOrder with no foreground widgets.
693 iOrderedWidgetIterator = widgetListNotForeground.rbegin();
694 while(iOrderedWidgetIterator != widgetListNotForeground.rend())
695 {
696 SWidget* currentWidget = iOrderedWidgetIterator->second;
697 bool forceZOrder = false;
698
699 // If a focused "get on top on focus" overlay is detected, set the higher overlay to him.
700 if(currentWidget == focusedWidget)
701 if(currentWidget->GetTopOnFocus())
702 {
703 currentWidget->_SetOgreOverlayZOrder(topOnFocusZOrder);
704 widgetListByZOrder.insert(WidgetListByZOrder::value_type(topOnFocusZOrder, currentWidget));
705 forceZOrder = true;
706 }
707
708 // Normal zOrder
709 if(!forceZOrder)
710 {
711 currentWidget->_SetOgreOverlayZOrder(zOrder);
712 widgetListByZOrder.insert(WidgetListByZOrder::value_type(zOrder, currentWidget));
713
714 // up to 650 ordered overlays, other are all at the same zOrder
715 if(zOrder > 0)
716 zOrder--;
717 }
718
719 iOrderedWidgetIterator++;
720 }
721}
722
724{
725 if (focusTargetedWidget == focusedWidget)
726 return;
727
728 //previous focused widget
729 if (focusedWidget)
730 {
731 focusedWidget->SetFocusImpl(false);
732 _FireFocusWidgetEvent(focusedWidget, false);
733 }
734
735 //focus the new widget
736 focusedWidget = focusTargetedWidget;
737 if (focusedWidget)
738 {
739 focusedWidget->SetFocusImpl(true);
740 _FireFocusWidgetEvent(focusedWidget, true);
741 }
742
744}
745
747{
748 return focusedWidget;
749}
750
751SWidget* SWidgetManager::GetWidgetUnder(SWindow* originWindow, const int& posX, const int& posY, const int& id)
752{
753 SWidget* returnWidget = 0;
754
755 // Overlayed widget are over all other one, so start mouse detection with overlayed widget.
756 WidgetListByZOrder::reverse_iterator iWidgetList = widgetListByZOrder.rbegin();
757 while(iWidgetList != widgetListByZOrder.rend())
758 {
759 // Easy check for overlayed components
760 SWidget* currentWidget = iWidgetList->second;
761 SPoint<int> position = currentWidget->GetPosition();
762 unsigned short widgetWidth = currentWidget->GetWidth();
763 unsigned short widgetHeight = currentWidget->GetHeight();
764
765 if((posX >= position.x)
766 && (posY >= position.y)
767 && (posX <= (position.x + widgetWidth))
768 && (posY <= (position.y + widgetHeight))
769 && (currentWidget->GetVisible())
770 && (currentWidget->GetMouseEnable()))
771 {
772 if (currentWidget->isTransparent && currentWidget->transparentIgnorePixels)
773 {
774 if (currentWidget->CheckPixelAlpha(posX - position.x, posY - position.y) && !returnWidget)
775 {
776 // Manage enter/in events
777 if(!currentWidget->GetInputOver(id))
778 _FireEnterWidgetEvent(currentWidget, id);
779 else
780 _FireInsideWidgetEvent(currentWidget, id);
781
782 // Set this widget as the first found under mouse coordonates
783 returnWidget = currentWidget;
784 }
785 else
786 {
787 // Manage exit events
788 if(currentWidget->GetInputOver(id))
789 _FireExitWidgetEvent(currentWidget, id);
790 }
791 }
792 else if (!returnWidget)
793 {
794 // Manage enter/in events
795 if(!currentWidget->GetInputOver(id))
796 _FireEnterWidgetEvent(currentWidget, id);
797 else
798 _FireInsideWidgetEvent(currentWidget, id);
799
800 // Set this widget as the first found under mouse coordonates
801 returnWidget = currentWidget;
802 }
803 else
804 {
805 // Manage exit events
806 if (currentWidget->GetInputOver(id))
807 _FireExitWidgetEvent(currentWidget, id);
808 }
809 }
810 else
811 {
812 // Manage exit events
813 if(currentWidget->GetInputOver(id))
814 _FireExitWidgetEvent(currentWidget, id);
815 }
816
817 iWidgetList++;
818 }
819
820 // If no overlayed widget was found under mouse, continue the checking with material widgets
821 WidgetList::iterator iWidgetGlobalList = widgetList.begin();
822 while(iWidgetGlobalList != widgetList.end())
823 {
824 SWidget* currentWidget = iWidgetGlobalList->second;
825 if(!currentWidget->isOverlayed)
826 {
827 // Not very efficient, but we can have more than one scene.
828 SMaterial* materialUnderMouse = originWindow->GetLastRayCast().material;
829 if(materialUnderMouse != 0)
830 {
831 if ((materialUnderMouse->GetAssociatedWidget() == currentWidget) && !returnWidget)
832 {
833 // Manage enter/in events
834 if(!currentWidget->GetInputOver(id))
835 _FireEnterWidgetEvent(currentWidget);
836 else
837 _FireInsideWidgetEvent(currentWidget);
838
839 // Set this widget as the first found under mouse coordonates
840 returnWidget = currentWidget;
841 }
842 else if(currentWidget->GetInputOver(id))
843 {
844 _FireExitWidgetEvent(currentWidget, id);
845 }
846 }
847 else
848 {
849 // Manage exit events
850 if(currentWidget->GetInputOver(id))
851 _FireExitWidgetEvent(currentWidget, id);
852 }
853 }
854 iWidgetGlobalList++;
855 }
856
857 return returnWidget;
858}
859
861{
862 if(widgetListenerList.count(newWidgetListener))
863 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM, "Cannot add this listener, it already exists in the listener list!", "SWidgetManager::AddWidgetListener");
864
865 widgetListenerList.insert(newWidgetListener);
866}
867
869{
870 if(!widgetListenerList.count(existingWidgetListener))
871 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM, "Cannot remove listener, this listener does not exists in the listener list!", "SWidgetManager::RemoveWidgetListener");
872
873 widgetListenerList.erase(existingWidgetListener);
874}
875
876void SWidgetManager::_FireEnterWidgetEvent(SWidget* targetedWidget, const int& id)
877{
878 bool prev = targetedWidget->GetMouseOver();
879 targetedWidget->SetInputOver(id, true);
880 if (targetedWidget->GetMouseOver() != prev)
881 {
882 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
883 while (iWidgetListenerList != widgetListenerList.end())
884 {
885 //MMechostr(MSKDEBUG, ">> OnEnter\n");
886 (*iWidgetListenerList)->OnEnter(targetedWidget);
887 iWidgetListenerList++;
888 }
889 }
890}
891
892void SWidgetManager::_FireInsideWidgetEvent(SWidget* targetedWidget, const int& id)
893{
894 if (targetedWidget->GetInputOver(id))
895 {
896 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
897 while (iWidgetListenerList != widgetListenerList.end())
898 {
899 //MMechostr(MSKDEBUG, ">> OnInside\n");
900 (*iWidgetListenerList)->OnInside(targetedWidget);
901 iWidgetListenerList++;
902 }
903 }
904}
905
906void SWidgetManager::_FireExitWidgetEvent(SWidget* targetedWidget, const int& id)
907{
908 bool prev = targetedWidget->GetMouseOver();
909 targetedWidget->SetInputOver(id, false);
910
911 if (targetedWidget->GetMouseOver() != prev)
912 {
913 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
914 while (iWidgetListenerList != widgetListenerList.end())
915 {
916 //MMechostr(MSKDEBUG, ">> OnExit\n");
917 (*iWidgetListenerList)->OnExit(targetedWidget);
918 iWidgetListenerList++;
919 }
920 }
921}
922
923void SWidgetManager::_FireMouseMoveWidgetEvent(SWidget* targetedWidget, const int& mousePosX, const int& mousePosY, const MouseButtonId& mouseButton, const int& id)
924{
925 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
926 while(iWidgetListenerList != widgetListenerList.end())
927 {
928 (*iWidgetListenerList)->OnMouseMove(targetedWidget, mousePosX, mousePosY, mouseButton, id);
929 iWidgetListenerList++;
930 }
931}
932
933void SWidgetManager::_FireMouseDownWidgetEvent(SWidget* targetedWidget, const int& mousePosX, const int& mousePosY, const MouseButtonId& mouseButton, const int& id)
934{
935 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
936 while(iWidgetListenerList != widgetListenerList.end())
937 {
938 (*iWidgetListenerList)->OnMouseDown(targetedWidget, mousePosX, mousePosY, mouseButton, id);
939 iWidgetListenerList++;
940 }
941}
942
943void SWidgetManager::_FireMouseUpWidgetEvent(SWidget* targetedWidget, const int& mousePosX, const int& mousePosY, const MouseButtonId& mouseButton, const int& id)
944{
945 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
946 while(iWidgetListenerList != widgetListenerList.end())
947 {
948 (*iWidgetListenerList)->OnMouseUp(targetedWidget, mousePosX, mousePosY, mouseButton, id);
949 iWidgetListenerList++;
950 }
951}
952
953void SWidgetManager::_FireMouseWheelWidgetEvent(SWidget* targetedWidget, const int& mousePosX, const int& mousePosY, const int& relativeScroll, const int& id)
954{
955 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
956 while(iWidgetListenerList != widgetListenerList.end())
957 {
958 (*iWidgetListenerList)->OnMouseWheel(targetedWidget, mousePosX, mousePosY, relativeScroll, id);
959 iWidgetListenerList++;
960 }
961}
962
963void SWidgetManager::_FireTouchAddWidgetEvent(SWidget* targetedWidget, const int& mousePosX, const int& mousePosY, const int& touchid)
964{
965 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
966 while (iWidgetListenerList != widgetListenerList.end())
967 {
968 (*iWidgetListenerList)->OnTouchAdd(targetedWidget, mousePosX, mousePosY, touchid);
969 iWidgetListenerList++;
970 }
971}
972
973void SWidgetManager::_FireTouchRemoveWidgetEvent(SWidget* targetedWidget, const int& mousePosX, const int& mousePosY, const int& touchid)
974{
975 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
976 while (iWidgetListenerList != widgetListenerList.end())
977 {
978 (*iWidgetListenerList)->OnTouchRemove(targetedWidget, mousePosX, mousePosY, touchid);
979 iWidgetListenerList++;
980 }
981}
982
983void SWidgetManager::_FireTouchUpdateWidgetEvent(SWidget* targetedWidget, const int& mousePosX, const int& mousePosY, const int& vx, const int& vy, const int& touchid)
984{
985 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
986 while (iWidgetListenerList != widgetListenerList.end())
987 {
988 (*iWidgetListenerList)->OnTouchUpdate(targetedWidget, mousePosX, mousePosY, vx, vy, touchid);
989 iWidgetListenerList++;
990 }
991}
992
993void SWidgetManager::_FireKeyWidgetEvent(SWidget* targetedWidget, const UINT& msg, const ScolWindowHandle& hwnd, const UINT& wParam, const LONG& lParam)
994{
995 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
996 while(iWidgetListenerList != widgetListenerList.end())
997 {
998 (*iWidgetListenerList)->OnKey(targetedWidget, msg, hwnd, wParam, lParam);
999 iWidgetListenerList++;
1000 }
1001}
1002
1003void SWidgetManager::_FireFocusWidgetEvent(SWidget* targetedWidget, const bool& focused)
1004{
1005 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1006 while(iWidgetListenerList != widgetListenerList.end())
1007 {
1008 (*iWidgetListenerList)->OnFocus(targetedWidget, focused);
1009 iWidgetListenerList++;
1010 }
1011}
1012
1013void SWidgetManager::_FireScriptWidgetEvent(SWidget* targetedWidget, const SScriptFunction& functionCalled)
1014{
1015 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1016 while(iWidgetListenerList != widgetListenerList.end())
1017 {
1018 (*iWidgetListenerList)->OnScriptCall(targetedWidget, functionCalled);
1019 iWidgetListenerList++;
1020 }
1021}
1022
1024{
1025 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1026 while(iWidgetListenerList != widgetListenerList.end())
1027 {
1028 (*iWidgetListenerList)->OnLoadStart(targetedWidget);
1029 iWidgetListenerList++;
1030 }
1031}
1032
1034{
1035 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1036 while(iWidgetListenerList != widgetListenerList.end())
1037 {
1038 (*iWidgetListenerList)->OnLoadEnd(targetedWidget);
1039 iWidgetListenerList++;
1040 }
1041}
1042
1043void SWidgetManager::_FireOnLoadError(SWidget* targetedWidget, const int& errorCode, const std::string& failedUrl)
1044{
1045 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1046 while(iWidgetListenerList != widgetListenerList.end())
1047 {
1048 (*iWidgetListenerList)->OnLoadError(targetedWidget, errorCode, failedUrl);
1049 iWidgetListenerList++;
1050 }
1051}
1052
1053SPointInt SWidgetManager::ConvertTextureUvToWidgetCoordinates(SWidget* targetedWidget, const float& uCoor, const float& vCoor)
1054{
1055 // Keep only the floating point value, discard integer value (modf keep the sign)
1056 double discardedIntValue = 0.0f;
1057 float uCoordinates = uCoor;
1058 float vCoordinates = vCoor;
1059 uCoordinates = (float)(modf((double)uCoordinates, &discardedIntValue));
1060 vCoordinates = (float)(modf((double)vCoordinates, &discardedIntValue));
1061
1062 // Handle negative uv.
1063 if(uCoordinates < 0)
1064 uCoordinates += 1.0f;
1065 if(vCoordinates < 0)
1066 vCoordinates += 1.0f;
1067
1068 // Compute widget relative position
1069 SPointInt widgetSpacePosition;
1070 widgetSpacePosition.x = static_cast <int> (uCoordinates * targetedWidget->GetWidth());
1071 widgetSpacePosition.y = static_cast <int> (vCoordinates * targetedWidget->GetHeight());
1072 return widgetSpacePosition;
1073}
1074
1075}
long LONG
Definition SO3Android.h:59
unsigned int UINT
Definition SO3Android.h:58
std::string GetName() const
NUMERIC_TYPE y
Definition SO3Point.h:40
NUMERIC_TYPE x
Definition SO3Point.h:39
SMaterial * material
Definition SO3RayCast.h:48
Ogre::Vector2 uvResult
Definition SO3RayCast.h:59
virtual void InjectMouseDown(const int &xPos, const int &yPos, const MouseButtonId &button)=0
bool GetMouseEnable()
virtual void InjectMouseMove(const int &xPos, const int &yPos, const MouseButtonId &button)=0
virtual void InjectTouchAdd(const int &xPos, const int &yPos, const int &touchid)=0
unsigned short GetHeight()
unsigned short GetWidth()
virtual void SetFocusImpl(const bool &focusOnWidget)=0
bool GetInputOver(int id)
virtual void InjectTextEvent(const std::string &utf8)=0
virtual void InjectMouseWheel(const int &scrollX, const int &scrollY, const int &relativeScroll)=0
bool GetMouseOver()
SPoint< int > GetPosition()
bool GetTopOnFocus()
bool GetKeyboardEnable()
void SetInputOver(int id, bool state)
virtual void InjectMouseUp(const int &xPos, const int &yPos, const MouseButtonId &button)=0
bool GetVisible()
virtual bool CheckPixelAlpha(const int &posX, const int &posY)=0
std::string GetType()
virtual void InjectTouchRemove(const int &touchid)=0
virtual void InjectTouchUpdate(const int &xPos, const int &yPos, const int &vx, const int &vy, const int &touchid)=0
virtual void InjectKeyEvent(const UINT &msg, const ScolWindowHandle &hwnd, const WPARAM &wParam, const LPARAM &lParam)=0
void _FireOnLoadStart(SWidget *targetedWidget)
void AddWidgetListener(SWidgetListener *newWidgetListener)
void InjectMouseUp(SWindow *originWindow, const int &xPos, const int &yPos, const MouseButtonId &button)
void _FireScriptWidgetEvent(SWidget *targetedWidget, const SScriptFunction &functionCalled)
void InjectMouseMove(SWindow *originWindow, const int &xPos, const int &yPos, const MouseButtonId &button)
void InjectTouchRemove(SWindow *originWindow, const int &touchid)
void _FireOnLoadError(SWidget *targetedWidget, const int &errorCode, const std::string &failedUrl)
std::map< std::string, SWidget * > WidgetList
void InjectMouseWheel(SWindow *originWindow, const int &scrollX, const int &scrollY, const int &relativeScroll)
void InjectMouseDown(SWindow *originWindow, const int &xPos, const int &yPos, const MouseButtonId &button)
void RemoveWidgetListener(SWidgetListener *existingWidgetListener)
void AddWidgetFactory(SWidgetFactory *newWidgetFactory)
void DeleteWidget(SWidget *existingWidget)
void InjectTouchAdd(SWindow *originWindow, const int &xPos, const int &yPos, const int &touchid)
void RemoveWidgetFactory(SWidgetFactory *existingWidgetFactory)
void UpdateFocusedWidget(SWidget *focusTargetedWidget)
void InjectKeyEvent(const UINT &msg, const ScolWindowHandle &hwnd, const WPARAM &wParam, const LPARAM &lParam)
void InjectTouchUpdate(SWindow *originWindow, const int &xPos, const int &yPos, const int &vx, const int &vy, const int &touchid)
SWidget * CreateWidget(SScene *targetScene, const std::string &widgetName, const int &xPos, const int &yPos, const unsigned short &width, const unsigned short &height, SViewPort *targetViewport, const unsigned int &widgetZOrder, const std::string &widgetType)
void InjectTextEvent(const std::string &text)
void _FireOnLoadEnd(SWidget *targetedWidget)
static SWidgetManager & getSingleton()
static SWidgetManager * getSingletonPtr()
void ToPixelPos(int &px, int &py)
SRaycastResult IndRayCast(const int &pixelsX, const int &pixelsY)
SRaycastResult & GetLastRayCast()