window moving

This commit is contained in:
Eduardo Bart
2011-04-16 16:46:31 -03:00
parent 9b02312bf8
commit dc39c965cc
13 changed files with 102 additions and 33 deletions

View File

@@ -105,24 +105,22 @@ void UIContainer::onInputEvent(const InputEvent& event)
// events should pass only when element is visible and enabled
if(child->isEnabled() && child->isVisible()) {
if(event.type & EV_KEYBOARD) {
// keyboard events only go to focused elements
if(child == getFocusedElement()) {
// keyboard events only go to focused elements or containers
if(child->asUIContainer() || child == getFocusedElement()) {
shouldFire = true;
}
// mouse events
} else if(event.type & EV_MOUSE) {
// mouse down and wheel events only go to elements that contains the mouse position
if(event.type & EV_DOWN || event.type & EV_MOUSE_WHEEL) {
// mouse down and wheel events only go to elements that contains the mouse position and are not containers
if((event.type & EV_DOWN || event.type & EV_MOUSE_WHEEL) && !child->asUIContainer()) {
if(child->getRect().contains(event.mousePos)) {
// focus it
if(event.type == EV_MOUSE_LDOWN)
if(event.type == EV_MOUSE_LDOWN && child->isFocusable())
setFocusedElement(child);
shouldFire = true;
}
}
// mouse move and mouse up events go to all elements
else {
shouldFire = false;
} else {
shouldFire = true;
}
}
}