template<class Application>
BasicScreenedApplication class
Base for applications with screen management.
Contents
Manages list of screens and propagates events to them.
If exactly one application header is included, this class is also aliased to Platform::ScreenedApplication
.
Each Screen specifies which set of events should be propagated to it using BasicScreen::
- viewportEvent() is propagated to all screens.
- drawEvent() is propagated in back-to-front order to screens which have BasicScreen::
PropagatedEvent:: Draw enabled. - Input events (keyPressEvent(), keyReleaseEvent(), mousePressEvent(), mouseReleaseEvent() and mouseMoveEvent()) are propagated in front-to-back order to screens which have BasicScreen::
PropagatedEvent:: Input enabled. If any screen sets the event as accepted, it is not propagated further.
Uses Corrade::
MyApplication app; for(Screen& screen: app.screens()) { // ... }
Or, if you need more flexibility, like in the following code. Traversing back-to-front can be done using Corrade::
for(Screen* s = app.screens().first(); s; s = s->nextFartherScreen()) { // ... }
Explicit template specializations
The following specialization are explicitly compiled into each particular *Application
library. For other specializations you have to use ScreenedApplication.hpp implementation file to avoid linker errors. See Template headers and implementation files for more information.
Constructors, destructors, conversion operators
- BasicScreenedApplication(const typename Application::Arguments& arguments, const typename Application::Configuration& configuration, const typename Application::GLConfiguration& glConfiguration) explicit
- Construct with given configuration for OpenGL context.
- BasicScreenedApplication(const typename Application::Arguments& arguments, const typename Application::Configuration& configuration = typename Application::Configuration{}) explicit
- Construct with given configuration.
- BasicScreenedApplication(const typename Application::Arguments& arguments, NoCreateT) explicit
- Constructor.
-
BasicScreenedApplication(const typename Application::Arguments& arguments,
std::
nullptr_t) deprecated explicit - Constructor.
Public functions
- auto addScreen(BasicScreen<Application>& screen) -> BasicScreenedApplication<Application>&
- Add screen to application.
- auto removeScreen(BasicScreen<Application>& screen) -> BasicScreenedApplication<Application>&
- Remove screen from application.
- auto focusScreen(BasicScreen<Application>& screen) -> BasicScreenedApplication<Application>&
- Focus screen.
-
auto screens() -> Containers::
LinkedList<BasicScreen<Application>>& - Application screens.
-
auto screens() const -> const Containers::
LinkedList<BasicScreen<Application>>&
Protected functions
- void globalViewportEvent(const Vector2i& size) virtual
- Global viewport event.
- void globalDrawEvent() pure virtual
- Draw event.
Function documentation
template<class Application>
Magnum:: Platform:: BasicScreenedApplication<Application>:: BasicScreenedApplication(const typename Application::Arguments& arguments,
const typename Application::Configuration& configuration,
const typename Application::GLConfiguration& glConfiguration) explicit
Construct with given configuration for OpenGL context.
Passes the arguments through to a particular application constructor.
template<class Application>
Magnum:: Platform:: BasicScreenedApplication<Application>:: BasicScreenedApplication(const typename Application::Arguments& arguments,
const typename Application::Configuration& configuration = typename Application::Configuration{}) explicit
Construct with given configuration.
Passes the arguments through to a particular application constructor.
template<class Application>
Magnum:: Platform:: BasicScreenedApplication<Application>:: BasicScreenedApplication(const typename Application::Arguments& arguments,
NoCreateT) explicit
Constructor.
Parameters | |
---|---|
arguments | Application arguments |
Unlike above, the context is not created and must be created later with create() or tryCreate().
template<class Application>
Magnum:: Platform:: BasicScreenedApplication<Application>:: BasicScreenedApplication(const typename Application::Arguments& arguments,
std:: nullptr_t) explicit
Constructor.
template<class Application>
BasicScreenedApplication<Application>& Magnum:: Platform:: BasicScreenedApplication<Application>:: addScreen(BasicScreen<Application>& screen)
Add screen to application.
Returns | Reference to self (for method chaining) |
---|
The new screen is added as backmost. If this is the first screen added, BasicScreen::
template<class Application>
BasicScreenedApplication<Application>& Magnum:: Platform:: BasicScreenedApplication<Application>:: removeScreen(BasicScreen<Application>& screen)
Remove screen from application.
Returns | Reference to self (for method chaining) |
---|
The screen is blurred before removing. Deleting the object is left up to the user.
template<class Application>
BasicScreenedApplication<Application>& Magnum:: Platform:: BasicScreenedApplication<Application>:: focusScreen(BasicScreen<Application>& screen)
Focus screen.
Returns | Reference to self (for method chaining) |
---|
Moves the screen to front. Previously focused screen is blurred and this screen is focused.
template<class Application>
Containers:: LinkedList<BasicScreen<Application>>& Magnum:: Platform:: BasicScreenedApplication<Application>:: screens()
Application screens.
The screens are sorted front-to-back.
template<class Application>
const Containers:: LinkedList<BasicScreen<Application>>& Magnum:: Platform:: BasicScreenedApplication<Application>:: screens() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class Application>
void Magnum:: Platform:: BasicScreenedApplication<Application>:: globalViewportEvent(const Vector2i& size) virtual protected
Global viewport event.
Called when window size changes, before all screens' viewportEvent(). Default implementation does nothing. See *Application::
template<class Application>
void Magnum:: Platform:: BasicScreenedApplication<Application>:: globalDrawEvent() pure virtual protected
Draw event.
Called after all screens' drawEvent(). You should call at least swapBuffers(). If you want to draw immediately again, call also redraw().