|
|
|
|
@ -49,7 +49,7 @@ template<class Application> BasicScreenedApplication<Application>::~BasicScreene
|
|
|
|
|
|
|
|
|
|
template<class Application> BasicScreenedApplication<Application>& BasicScreenedApplication<Application>::addScreen(BasicScreen<Application>& screen) { |
|
|
|
|
Containers::LinkedList<BasicScreen<Application>>::insert(&screen); |
|
|
|
|
if(frontScreen() == &screen) screen.focusEvent(); |
|
|
|
|
if(screens().first() == &screen) screen.focusEvent(); |
|
|
|
|
Application::redraw(); |
|
|
|
|
return *this; |
|
|
|
|
} |
|
|
|
|
@ -63,10 +63,10 @@ template<class Application> BasicScreenedApplication<Application>& BasicScreened
|
|
|
|
|
|
|
|
|
|
template<class Application> BasicScreenedApplication<Application>& BasicScreenedApplication<Application>::focusScreen(BasicScreen<Application>& screen) { |
|
|
|
|
/* Already focused, nothing to do */ |
|
|
|
|
if(frontScreen() == &screen) return *this; |
|
|
|
|
if(screens().first() == &screen) return *this; |
|
|
|
|
|
|
|
|
|
frontScreen()->blurEvent(); |
|
|
|
|
Containers::LinkedList<BasicScreen<Application>>::move(&screen, frontScreen()); |
|
|
|
|
screens().first()->blurEvent(); |
|
|
|
|
Containers::LinkedList<BasicScreen<Application>>::move(&screen, screens().first()); |
|
|
|
|
screen.focusEvent(); |
|
|
|
|
Application::redraw(); |
|
|
|
|
return *this; |
|
|
|
|
@ -78,13 +78,12 @@ template<class Application> void BasicScreenedApplication<Application>::viewport
|
|
|
|
|
/* Call viewport event after all other (because of framebuffer resizing) */ |
|
|
|
|
globalViewportEvent(size); |
|
|
|
|
|
|
|
|
|
for(BasicScreen<Application>* s = Containers::LinkedList<BasicScreen<Application>>::first(); s; s = s->next()) |
|
|
|
|
s->viewportEvent(size); |
|
|
|
|
for(BasicScreen<Application>& s: *this) s.viewportEvent(size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class Application> void BasicScreenedApplication<Application>::drawEvent() { |
|
|
|
|
/* Back-to-front rendering */ |
|
|
|
|
for(BasicScreen<Application>* s = backScreen(); s; s = s->nextNearerScreen()) |
|
|
|
|
for(BasicScreen<Application>* s = screens().last(); s; s = s->nextNearerScreen()) |
|
|
|
|
if(s->propagatedEvents() & Implementation::PropagatedScreenEvent::Draw) s->drawEvent(); |
|
|
|
|
|
|
|
|
|
/* Call global event after all other (because of buffer swapping) */ |
|
|
|
|
@ -93,7 +92,7 @@ template<class Application> void BasicScreenedApplication<Application>::drawEven
|
|
|
|
|
|
|
|
|
|
template<class Application> void BasicScreenedApplication<Application>::keyPressEvent(typename Application::KeyEvent& event) { |
|
|
|
|
/* Front-to-back event propagation, stop when the event gets accepted */ |
|
|
|
|
for(BasicScreen<Application>* s = frontScreen(); s; s = s->nextFartherScreen()) { |
|
|
|
|
for(BasicScreen<Application>* s = screens().first(); s; s = s->nextFartherScreen()) { |
|
|
|
|
if(s->propagatedEvents() & Implementation::PropagatedScreenEvent::Input) { |
|
|
|
|
s->keyPressEvent(event); |
|
|
|
|
if(event.isAccepted()) break; |
|
|
|
|
@ -103,7 +102,7 @@ template<class Application> void BasicScreenedApplication<Application>::keyPress
|
|
|
|
|
|
|
|
|
|
template<class Application> void BasicScreenedApplication<Application>::keyReleaseEvent(typename Application::KeyEvent& event) { |
|
|
|
|
/* Front-to-back event propagation, stop when the event gets accepted */ |
|
|
|
|
for(BasicScreen<Application>* s = frontScreen(); s; s = s->nextFartherScreen()) { |
|
|
|
|
for(BasicScreen<Application>* s = screens().first(); s; s = s->nextFartherScreen()) { |
|
|
|
|
if(s->propagatedEvents() & Implementation::PropagatedScreenEvent::Input) { |
|
|
|
|
s->keyReleaseEvent(event); |
|
|
|
|
if(event.isAccepted()) break; |
|
|
|
|
@ -113,7 +112,7 @@ template<class Application> void BasicScreenedApplication<Application>::keyRelea
|
|
|
|
|
|
|
|
|
|
template<class Application> void BasicScreenedApplication<Application>::mousePressEvent(typename Application::MouseEvent& event) { |
|
|
|
|
/* Front-to-back event propagation, stop when the event gets accepted */ |
|
|
|
|
for(BasicScreen<Application>* s = frontScreen(); s; s = s->nextFartherScreen()) { |
|
|
|
|
for(BasicScreen<Application>* s = screens().first(); s; s = s->nextFartherScreen()) { |
|
|
|
|
if(s->propagatedEvents() & Implementation::PropagatedScreenEvent::Input) { |
|
|
|
|
s->mousePressEvent(event); |
|
|
|
|
if(event.isAccepted()) break; |
|
|
|
|
@ -123,7 +122,7 @@ template<class Application> void BasicScreenedApplication<Application>::mousePre
|
|
|
|
|
|
|
|
|
|
template<class Application> void BasicScreenedApplication<Application>::mouseReleaseEvent(typename Application::MouseEvent& event) { |
|
|
|
|
/* Front-to-back event propagation, stop when the event gets accepted */ |
|
|
|
|
for(BasicScreen<Application>* s = frontScreen(); s; s = s->nextFartherScreen()) { |
|
|
|
|
for(BasicScreen<Application>* s = screens().first(); s; s = s->nextFartherScreen()) { |
|
|
|
|
if(s->propagatedEvents() & Implementation::PropagatedScreenEvent::Input) { |
|
|
|
|
s->mouseReleaseEvent(event); |
|
|
|
|
if(event.isAccepted()) break; |
|
|
|
|
@ -133,7 +132,7 @@ template<class Application> void BasicScreenedApplication<Application>::mouseRel
|
|
|
|
|
|
|
|
|
|
template<class Application> void BasicScreenedApplication<Application>::mouseMoveEvent(typename Application::MouseMoveEvent& event) { |
|
|
|
|
/* Front-to-back event propagation, stop when the event gets accepted */ |
|
|
|
|
for(BasicScreen<Application>* s = frontScreen(); s; s = s->nextFartherScreen()) { |
|
|
|
|
for(BasicScreen<Application>* s = screens().first(); s; s = s->nextFartherScreen()) { |
|
|
|
|
if(s->propagatedEvents() & Implementation::PropagatedScreenEvent::Input) { |
|
|
|
|
s->mouseMoveEvent(event); |
|
|
|
|
if(event.isAccepted()) break; |
|
|
|
|
|