56 return (*msSingleton);
69 WidgetFactoryList widgetFactoryListCopy = widgetFactoryList;
70 WidgetFactoryList::iterator iWidgetFactoryList = widgetFactoryListCopy.begin();
71 while (iWidgetFactoryList != widgetFactoryListCopy.end())
76 widgetFactoryList.clear();
86 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(newWidgetFactory->
GetType());
87 if(iWidgetFactorySearched == widgetFactoryList.end())
88 widgetFactoryList.insert(WidgetFactoryList::value_type(newWidgetFactory->
GetType(), newWidgetFactory));
90 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"Cannot add factory for widget \""+ newWidgetFactory->
GetType() +
"\", factory already exists in widget manager!",
"SWidgetManager::AddWidgetFactory");
100 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(existingWidgetFactoryName);
101 if(iWidgetFactorySearched != widgetFactoryList.end())
102 widgetFactoryList.erase(iWidgetFactorySearched);
104 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND,
"Cannot remove factory for widget \""+ existingWidgetFactoryName +
"\", factory does not exists in widget manager!",
"SWidgetManager::RemoveWidgetFactory");
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)
110 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(widgetType);
111 if(iWidgetFactorySearched != widgetFactoryList.end())
113 WidgetList::iterator iWidgetSearched = widgetList.find(widgetName);
114 if(iWidgetSearched == widgetList.end())
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));
124 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"Cannot create a widget named \""+ widgetName +
"\", a widget with the same name already exists!",
"SWidgetManager::CreateWidget");
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");
135 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(widgetType);
136 if(iWidgetFactorySearched != widgetFactoryList.end())
138 WidgetList::iterator iWidgetSearched = widgetList.find(widgetName);
139 if(iWidgetSearched == widgetList.end())
141 newWidget = iWidgetFactorySearched->second->CreateWidget(targetScene, widgetName, xPos, yPos, width, height, targetViewport);
142 widgetList.insert(WidgetList::value_type(widgetName, newWidget));
145 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"Cannot create a widget named \""+ widgetName +
"\", a widget with the same name already exists!",
"SWidgetManager::CreateWidget");
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");
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)
156 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(widgetType);
157 if(iWidgetFactorySearched != widgetFactoryList.end())
159 WidgetList::iterator iWidgetSearched = widgetList.find(widgetName);
160 if(iWidgetSearched == widgetList.end())
162 newWidget = iWidgetFactorySearched->second->CreateWidget(targetScene, widgetName, width, height, targetMaterial, targetTechnique, targetPass, targetTextureUnit);
163 widgetList.insert(WidgetList::value_type(widgetName, newWidget));
166 OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"Cannot create a widget named \""+ widgetName +
"\", a widget with the same name already exists!",
"SWidgetManager::CreateWidget");
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");
176 WidgetFactoryList::iterator iWidgetFactorySearched = widgetFactoryList.find(existingWidget->
GetType());
177 if(iWidgetFactorySearched != widgetFactoryList.end())
179 std::string widgetName = existingWidget->
GetName();
180 WidgetList::iterator iWidgetSearched = widgetList.find(widgetName);
181 if(iWidgetSearched != widgetList.end())
184 WidgetList::iterator iOverlayedWidgetSearched = overlayedWidgetList.find(widgetName);
185 if(iOverlayedWidgetSearched != overlayedWidgetList.end())
186 overlayedWidgetList.erase(iOverlayedWidgetSearched);
189 if(focusedWidget == existingWidget)
192 WidgetInputList::iterator iInputList = inputList.begin();
193 while (iInputList != inputList.end())
195 if (iInputList->second.widget == existingWidget)
196 iInputList = inputList.erase(iInputList);
202 iWidgetFactorySearched->second->DeleteWidget(existingWidget);
203 widgetList.erase(widgetName);
206 OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND,
"Cannot delete a widget named \""+ widgetName +
"\", widget not found!",
"SWidgetManager::DeleteWidget");
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");
220 SWidget* widgetUnder = GetWidgetUnder(originWindow, px, py);
222 if (widgetUnder != 0)
226 if (widgetUnder->isOverlayed || widgetUnder->is2DRect)
229 widgetUnder->
InjectMouseMove(px - widgetPosition.
x, py - widgetPosition.
y, button);
232 _FireMouseMoveWidgetEvent(widgetUnder, px - widgetPosition.
x, py - widgetPosition.
y, button);
240 _FireMouseMoveWidgetEvent(widgetUnder, injectPosition.
x, injectPosition.
y, button);
246 WidgetList::iterator iWidgetList = overlayedWidgetList.begin();
247 while(iWidgetList != overlayedWidgetList.end())
250 if((iWidgetList->second != widgetUnder) && (iWidgetList->second->GetMouseEnable()))
252 SPointInt widgetPosition = iWidgetList->second->GetPosition();
253 iWidgetList->second->InjectMouseMove(px - widgetPosition.
x, py - widgetPosition.
y, button);
255 _FireMouseMoveWidgetEvent(iWidgetList->second, px - widgetPosition.
x, py - widgetPosition.
y, button);
264 if(focusedWidget != 0)
269 focusedWidget->
InjectMouseWheel(scrollX - widgetPosition.
x, scrollY - widgetPosition.
y, relativeScroll);
270 _FireMouseWheelWidgetEvent(focusedWidget, scrollX - widgetPosition.
x, scrollY - widgetPosition.
y, relativeScroll);
284 if (focusedWidget != 0)
290 if (focusedWidget->isOverlayed || focusedWidget->is2DRect)
293 focusedWidget->
InjectMouseDown(px - widgetPosition.
x, py - widgetPosition.
y, button);
296 _FireMouseDownWidgetEvent(focusedWidget, px - widgetPosition.
x, py - widgetPosition.
y, button);
303 _FireMouseDownWidgetEvent(focusedWidget, injectPosition.
x, injectPosition.
y, button);
316 if (focusedWidget != 0)
320 if (focusedWidget->isOverlayed || focusedWidget->is2DRect)
323 focusedWidget->
InjectMouseUp(px - widgetPosition.
x, py - widgetPosition.
y, button);
326 _FireMouseUpWidgetEvent(focusedWidget, px - widgetPosition.
x, py - widgetPosition.
y, button);
332 focusedWidget->
InjectMouseUp(injectPosition.
x, injectPosition.
y, button);
333 _FireMouseUpWidgetEvent(focusedWidget, injectPosition.
x, injectPosition.
y, button);
349 WidgetInputList::iterator iTouchListSearched = inputList.find(touchid);
350 if (iTouchListSearched == inputList.end())
351 inputList.insert(WidgetInputList::value_type(touchid,
INPUTInfo(touchid, px, py, focusedWidget)));
354 iTouchListSearched->second.x = px;
355 iTouchListSearched->second.y = py;
356 iTouchListSearched->second.widget = focusedWidget;
359 if (focusedWidget != 0)
363 if (focusedWidget->isOverlayed || focusedWidget->is2DRect)
366 focusedWidget->
InjectTouchAdd(px - widgetPosition.
x, py - widgetPosition.
y, touchid);
367 _FireTouchAddWidgetEvent(focusedWidget, px - widgetPosition.
x, py - widgetPosition.
y, touchid);
374 _FireTouchAddWidgetEvent(focusedWidget, injectPosition.
x, injectPosition.
y, touchid);
382 WidgetInputList::iterator iTouchListSearched = inputList.find(touchid);
383 if (iTouchListSearched == inputList.end())
387 if (iTouchListSearched->second.widget != 0)
389 if (iTouchListSearched->second.widget->GetMouseEnable())
391 if (iTouchListSearched->second.widget->isOverlayed || iTouchListSearched->second.widget->is2DRect)
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);
402 iTouchListSearched->second.widget->InjectTouchRemove(touchid);
403 _FireTouchRemoveWidgetEvent(iTouchListSearched->second.widget, injectPosition.
x, injectPosition.
y, touchid);
407 inputList.erase(iTouchListSearched);
419 WidgetInputList::iterator iTouchListSearched = inputList.find(touchid);
420 if (iTouchListSearched == inputList.end())
424 iTouchListSearched->second.x = px;
425 iTouchListSearched->second.y = py;
426 SWidget* widgetUnder = iTouchListSearched->second.widget;
428 if (widgetUnder != 0)
432 if (widgetUnder->isOverlayed || widgetUnder->is2DRect)
435 widgetUnder->
InjectTouchUpdate(px - widgetPosition.
x, py - widgetPosition.
y, vx, vy, touchid);
436 _FireTouchUpdateWidgetEvent(widgetUnder, px - widgetPosition.
x, py - widgetPosition.
y, vx, vy, touchid);
443 _FireTouchUpdateWidgetEvent(widgetUnder, injectPosition.
x, injectPosition.
y, vx, vy, touchid);
453 WidgetList::iterator iWidgetGlobalList = widgetList.begin();
454 while (iWidgetGlobalList != widgetList.end())
456 SWidget* currentWidget = iWidgetGlobalList->second;
457 if (!currentWidget->isOverlayed)
459 if ((widget == currentWidget)
465 _FireEnterWidgetEvent(currentWidget,
id);
467 _FireInsideWidgetEvent(currentWidget,
id);
471 _FireExitWidgetEvent(currentWidget,
id);
477 _FireExitWidgetEvent(currentWidget,
id);
483 if (widget && widget->
GetMouseEnable() && !widget->isOverlayed && !widget->is2DRect)
488 _FireMouseMoveWidgetEvent(widget, injectPosition.
x, injectPosition.
y, button,
id);
497 if (focusedWidget != 0)
498 if (focusedWidget->
GetMouseEnable() && !focusedWidget->isOverlayed && !focusedWidget->is2DRect)
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)));
507 iTouchListSearched->second.x = injectPosition.
x;
508 iTouchListSearched->second.y = injectPosition.
y;
509 iTouchListSearched->second.widget = focusedWidget;
513 _FireMouseDownWidgetEvent(focusedWidget, injectPosition.
x, injectPosition.
y, button,
id);
522 if (focusedWidget != 0)
527 _FireMouseWheelWidgetEvent(focusedWidget, injectPosition.
x, injectPosition.
y, relativeScroll,
id);
533 WidgetInputList::iterator iTouchListSearched = inputList.find(
id);
534 if (iTouchListSearched == inputList.end())
538 SWidget* widgetUnder = iTouchListSearched->second.widget;
539 if (widgetUnder != 0)
540 if (widgetUnder->
GetMouseEnable() && !widgetUnder->isOverlayed && !widgetUnder->is2DRect)
543 widgetUnder->
InjectMouseUp(injectPosition.
x, injectPosition.
y, button);
544 _FireMouseUpWidgetEvent(widgetUnder, injectPosition.
x, injectPosition.
y, button,
id);
546 inputList.erase(iTouchListSearched);
555 if (focusedWidget != 0)
556 if (focusedWidget->
GetMouseEnable() && !focusedWidget->isOverlayed && !focusedWidget->is2DRect)
560 _FireTouchAddWidgetEvent(focusedWidget, injectPosition.
x, injectPosition.
y, touchid);
566 if (focusedWidget != 0)
567 if (focusedWidget->
GetMouseEnable() && !focusedWidget->isOverlayed && !focusedWidget->is2DRect)
571 _FireTouchRemoveWidgetEvent(focusedWidget, injectPosition.
x, injectPosition.
y, touchid);
578 WidgetList::iterator iWidgetGlobalList = widgetList.begin();
579 while (iWidgetGlobalList != widgetList.end())
581 SWidget* currentWidget = iWidgetGlobalList->second;
582 if (!currentWidget->isOverlayed)
584 if ((widget == currentWidget)
590 _FireEnterWidgetEvent(currentWidget, touchid);
592 _FireInsideWidgetEvent(currentWidget, touchid);
596 _FireExitWidgetEvent(currentWidget, touchid);
602 _FireExitWidgetEvent(currentWidget, touchid);
608 if (widget && widget->
GetMouseEnable() && !widget->isOverlayed && !widget->is2DRect)
613 _FireTouchUpdateWidgetEvent(widget, injectPosition.
x, injectPosition.
y, 0, 0, touchid);
619 if(focusedWidget != 0)
623 _FireKeyWidgetEvent(focusedWidget, msg, hwnd, wParam, lParam);
629 if(focusedWidget != 0)
636 std::multimap<unsigned short, SWidget*> widgetListForeground;
637 std::multimap<unsigned short, SWidget*> widgetListNotForeground;
638 widgetListByZOrder.clear();
641 WidgetList::iterator iWidgetList = overlayedWidgetList.begin();
642 while(iWidgetList != overlayedWidgetList.end())
644 if(iWidgetList->second->GetForeground())
645 widgetListForeground.insert(std::multimap<unsigned short, SWidget*>::value_type(iWidgetList->second->GetZOrder(), iWidgetList->second));
647 widgetListNotForeground.insert(std::multimap<unsigned short, SWidget*>::value_type(iWidgetList->second->GetZOrder(), iWidgetList->second));
653 unsigned short zOrder = 650;
654 unsigned short topOnFocusZOrder = zOrder;
658 std::multimap<unsigned short, SWidget*>::reverse_iterator iOrderedWidgetIterator = widgetListForeground.rbegin();
659 while(iOrderedWidgetIterator != widgetListForeground.rend())
661 SWidget* currentWidget = iOrderedWidgetIterator->second;
662 bool forceZOrder =
false;
665 if (currentWidget == focusedWidget)
668 currentWidget->_SetOgreOverlayZOrder(topOnFocusZOrder);
669 widgetListByZOrder.insert(WidgetListByZOrder::value_type(topOnFocusZOrder, currentWidget));
676 currentWidget->_SetOgreOverlayZOrder(zOrder);
677 widgetListByZOrder.insert(WidgetListByZOrder::value_type(zOrder, currentWidget));
683 iOrderedWidgetIterator++;
688 topOnFocusZOrder = zOrder;
693 iOrderedWidgetIterator = widgetListNotForeground.rbegin();
694 while(iOrderedWidgetIterator != widgetListNotForeground.rend())
696 SWidget* currentWidget = iOrderedWidgetIterator->second;
697 bool forceZOrder =
false;
700 if(currentWidget == focusedWidget)
703 currentWidget->_SetOgreOverlayZOrder(topOnFocusZOrder);
704 widgetListByZOrder.insert(WidgetListByZOrder::value_type(topOnFocusZOrder, currentWidget));
711 currentWidget->_SetOgreOverlayZOrder(zOrder);
712 widgetListByZOrder.insert(WidgetListByZOrder::value_type(zOrder, currentWidget));
719 iOrderedWidgetIterator++;
725 if (focusTargetedWidget == focusedWidget)
732 _FireFocusWidgetEvent(focusedWidget,
false);
736 focusedWidget = focusTargetedWidget;
740 _FireFocusWidgetEvent(focusedWidget,
true);
748 return focusedWidget;
751SWidget* SWidgetManager::GetWidgetUnder(
SWindow* originWindow,
const int& posX,
const int& posY,
const int&
id)
756 WidgetListByZOrder::reverse_iterator iWidgetList = widgetListByZOrder.rbegin();
757 while(iWidgetList != widgetListByZOrder.rend())
760 SWidget* currentWidget = iWidgetList->second;
762 unsigned short widgetWidth = currentWidget->
GetWidth();
763 unsigned short widgetHeight = currentWidget->
GetHeight();
765 if((posX >= position.
x)
766 && (posY >= position.
y)
767 && (posX <= (position.
x + widgetWidth))
768 && (posY <= (position.
y + widgetHeight))
772 if (currentWidget->isTransparent && currentWidget->transparentIgnorePixels)
774 if (currentWidget->
CheckPixelAlpha(posX - position.
x, posY - position.
y) && !returnWidget)
778 _FireEnterWidgetEvent(currentWidget,
id);
780 _FireInsideWidgetEvent(currentWidget,
id);
783 returnWidget = currentWidget;
789 _FireExitWidgetEvent(currentWidget,
id);
792 else if (!returnWidget)
796 _FireEnterWidgetEvent(currentWidget,
id);
798 _FireInsideWidgetEvent(currentWidget,
id);
801 returnWidget = currentWidget;
807 _FireExitWidgetEvent(currentWidget,
id);
814 _FireExitWidgetEvent(currentWidget,
id);
821 WidgetList::iterator iWidgetGlobalList = widgetList.begin();
822 while(iWidgetGlobalList != widgetList.end())
824 SWidget* currentWidget = iWidgetGlobalList->second;
825 if(!currentWidget->isOverlayed)
829 if(materialUnderMouse != 0)
831 if ((materialUnderMouse->GetAssociatedWidget() == currentWidget) && !returnWidget)
834 if(!currentWidget->GetInputOver(
id))
835 _FireEnterWidgetEvent(currentWidget);
837 _FireInsideWidgetEvent(currentWidget);
840 returnWidget = currentWidget;
842 else if(currentWidget->GetInputOver(
id))
844 _FireExitWidgetEvent(currentWidget,
id);
850 if(currentWidget->GetInputOver(
id))
851 _FireExitWidgetEvent(currentWidget,
id);
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");
865 widgetListenerList.insert(newWidgetListener);
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");
873 widgetListenerList.erase(existingWidgetListener);
876void SWidgetManager::_FireEnterWidgetEvent(
SWidget* targetedWidget,
const int&
id)
882 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
883 while (iWidgetListenerList != widgetListenerList.end())
886 (*iWidgetListenerList)->OnEnter(targetedWidget);
887 iWidgetListenerList++;
892void SWidgetManager::_FireInsideWidgetEvent(SWidget* targetedWidget,
const int&
id)
894 if (targetedWidget->GetInputOver(
id))
896 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
897 while (iWidgetListenerList != widgetListenerList.end())
900 (*iWidgetListenerList)->OnInside(targetedWidget);
901 iWidgetListenerList++;
906void SWidgetManager::_FireExitWidgetEvent(SWidget* targetedWidget,
const int&
id)
908 bool prev = targetedWidget->GetMouseOver();
909 targetedWidget->SetInputOver(
id,
false);
911 if (targetedWidget->GetMouseOver() != prev)
913 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
914 while (iWidgetListenerList != widgetListenerList.end())
917 (*iWidgetListenerList)->OnExit(targetedWidget);
918 iWidgetListenerList++;
923void SWidgetManager::_FireMouseMoveWidgetEvent(SWidget* targetedWidget,
const int& mousePosX,
const int& mousePosY,
const MouseButtonId& mouseButton,
const int&
id)
925 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
926 while(iWidgetListenerList != widgetListenerList.end())
928 (*iWidgetListenerList)->OnMouseMove(targetedWidget, mousePosX, mousePosY, mouseButton,
id);
929 iWidgetListenerList++;
933void SWidgetManager::_FireMouseDownWidgetEvent(SWidget* targetedWidget,
const int& mousePosX,
const int& mousePosY,
const MouseButtonId& mouseButton,
const int&
id)
935 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
936 while(iWidgetListenerList != widgetListenerList.end())
938 (*iWidgetListenerList)->OnMouseDown(targetedWidget, mousePosX, mousePosY, mouseButton,
id);
939 iWidgetListenerList++;
943void SWidgetManager::_FireMouseUpWidgetEvent(SWidget* targetedWidget,
const int& mousePosX,
const int& mousePosY,
const MouseButtonId& mouseButton,
const int&
id)
945 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
946 while(iWidgetListenerList != widgetListenerList.end())
948 (*iWidgetListenerList)->OnMouseUp(targetedWidget, mousePosX, mousePosY, mouseButton,
id);
949 iWidgetListenerList++;
953void SWidgetManager::_FireMouseWheelWidgetEvent(SWidget* targetedWidget,
const int& mousePosX,
const int& mousePosY,
const int& relativeScroll,
const int&
id)
955 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
956 while(iWidgetListenerList != widgetListenerList.end())
958 (*iWidgetListenerList)->OnMouseWheel(targetedWidget, mousePosX, mousePosY, relativeScroll,
id);
959 iWidgetListenerList++;
963void SWidgetManager::_FireTouchAddWidgetEvent(SWidget* targetedWidget,
const int& mousePosX,
const int& mousePosY,
const int& touchid)
965 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
966 while (iWidgetListenerList != widgetListenerList.end())
968 (*iWidgetListenerList)->OnTouchAdd(targetedWidget, mousePosX, mousePosY, touchid);
969 iWidgetListenerList++;
973void SWidgetManager::_FireTouchRemoveWidgetEvent(SWidget* targetedWidget,
const int& mousePosX,
const int& mousePosY,
const int& touchid)
975 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
976 while (iWidgetListenerList != widgetListenerList.end())
978 (*iWidgetListenerList)->OnTouchRemove(targetedWidget, mousePosX, mousePosY, touchid);
979 iWidgetListenerList++;
983void SWidgetManager::_FireTouchUpdateWidgetEvent(SWidget* targetedWidget,
const int& mousePosX,
const int& mousePosY,
const int& vx,
const int& vy,
const int& touchid)
985 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
986 while (iWidgetListenerList != widgetListenerList.end())
988 (*iWidgetListenerList)->OnTouchUpdate(targetedWidget, mousePosX, mousePosY, vx, vy, touchid);
989 iWidgetListenerList++;
993void SWidgetManager::_FireKeyWidgetEvent(SWidget* targetedWidget,
const UINT& msg,
const ScolWindowHandle& hwnd,
const UINT& wParam,
const LONG& lParam)
995 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
996 while(iWidgetListenerList != widgetListenerList.end())
998 (*iWidgetListenerList)->OnKey(targetedWidget, msg, hwnd, wParam, lParam);
999 iWidgetListenerList++;
1003void SWidgetManager::_FireFocusWidgetEvent(SWidget* targetedWidget,
const bool& focused)
1005 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1006 while(iWidgetListenerList != widgetListenerList.end())
1008 (*iWidgetListenerList)->OnFocus(targetedWidget, focused);
1009 iWidgetListenerList++;
1015 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1016 while(iWidgetListenerList != widgetListenerList.end())
1018 (*iWidgetListenerList)->OnScriptCall(targetedWidget, functionCalled);
1019 iWidgetListenerList++;
1025 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1026 while(iWidgetListenerList != widgetListenerList.end())
1028 (*iWidgetListenerList)->OnLoadStart(targetedWidget);
1029 iWidgetListenerList++;
1035 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1036 while(iWidgetListenerList != widgetListenerList.end())
1038 (*iWidgetListenerList)->OnLoadEnd(targetedWidget);
1039 iWidgetListenerList++;
1045 WidgetListenerList::iterator iWidgetListenerList = widgetListenerList.begin();
1046 while(iWidgetListenerList != widgetListenerList.end())
1048 (*iWidgetListenerList)->OnLoadError(targetedWidget, errorCode, failedUrl);
1049 iWidgetListenerList++;
1053SPointInt SWidgetManager::ConvertTextureUvToWidgetCoordinates(
SWidget* targetedWidget,
const float& uCoor,
const float& vCoor)
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));
1063 if(uCoordinates < 0)
1064 uCoordinates += 1.0f;
1065 if(vCoordinates < 0)
1066 vCoordinates += 1.0f;
1070 widgetSpacePosition.
x =
static_cast <int> (uCoordinates * targetedWidget->
GetWidth());
1071 widgetSpacePosition.
y =
static_cast <int> (vCoordinates * targetedWidget->
GetHeight());
1072 return widgetSpacePosition;
std::string GetName() const
void ToPixelPos(int &px, int &py)
SRaycastResult IndRayCast(const int &pixelsX, const int &pixelsY)
SRaycastResult & GetLastRayCast()