|
|
@@ -114,89 +114,17 @@ namespace BansheeEngine
|
|
|
|
|
|
bool GUIWidget::_mouseEvent(GUIElement* element, const GUIMouseEvent& ev)
|
|
|
{
|
|
|
- // If an element has any parents we send the events to all parents first and only then to the children unless
|
|
|
- // the parents process them
|
|
|
- Stack<GUIElement*>::type todo;
|
|
|
- GUIElementBase* curElement = element;
|
|
|
- do
|
|
|
- {
|
|
|
- if(curElement->_getType() == GUIElementBase::Type::Element)
|
|
|
- todo.push(static_cast<GUIElement*>(curElement));
|
|
|
-
|
|
|
- curElement = curElement->_getParent();
|
|
|
- } while(curElement != nullptr);
|
|
|
-
|
|
|
- while(true)
|
|
|
- {
|
|
|
- GUIElement* elem = todo.top();
|
|
|
- todo.pop();
|
|
|
-
|
|
|
- if(elem->mouseEvent(ev))
|
|
|
- return true;
|
|
|
-
|
|
|
- if(todo.size() == 0)
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
+ return element->mouseEvent(ev);
|
|
|
}
|
|
|
|
|
|
bool GUIWidget::_textInputEvent(GUIElement* element, const GUITextInputEvent& ev)
|
|
|
{
|
|
|
- // If an element has any parents we send the events to all parents first and only then to the children unless
|
|
|
- // the parents process them
|
|
|
- Stack<GUIElement*>::type todo;
|
|
|
- GUIElementBase* curElement = element;
|
|
|
- do
|
|
|
- {
|
|
|
- if(curElement->_getType() == GUIElementBase::Type::Element)
|
|
|
- todo.push(static_cast<GUIElement*>(curElement));
|
|
|
-
|
|
|
- curElement = curElement->_getParent();
|
|
|
- } while(curElement != nullptr);
|
|
|
-
|
|
|
- while(true)
|
|
|
- {
|
|
|
- GUIElement* elem = todo.top();
|
|
|
- todo.pop();
|
|
|
-
|
|
|
- if(elem->textInputEvent(ev))
|
|
|
- return true;
|
|
|
-
|
|
|
- if(todo.size() == 0)
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
+ return element->textInputEvent(ev);
|
|
|
}
|
|
|
|
|
|
bool GUIWidget::_commandEvent(GUIElement* element, const GUICommandEvent& ev)
|
|
|
{
|
|
|
- // If an element has any parents we send the events to all parents first and only then to the children unless
|
|
|
- // the parents process them
|
|
|
- Stack<GUIElement*>::type todo;
|
|
|
- GUIElementBase* curElement = element;
|
|
|
- do
|
|
|
- {
|
|
|
- if(curElement->_getType() == GUIElementBase::Type::Element)
|
|
|
- todo.push(static_cast<GUIElement*>(curElement));
|
|
|
-
|
|
|
- curElement = curElement->_getParent();
|
|
|
- } while(curElement != nullptr);
|
|
|
-
|
|
|
- while(true)
|
|
|
- {
|
|
|
- GUIElement* elem = todo.top();
|
|
|
- todo.pop();
|
|
|
-
|
|
|
- if(elem->commandEvent(ev))
|
|
|
- return true;
|
|
|
-
|
|
|
- if(todo.size() == 0)
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
+ return element->commandEvent(ev);
|
|
|
}
|
|
|
|
|
|
void GUIWidget::registerElement(GUIElement* elem)
|