template<class Application>
Magnum::Platform::BasicScreenedApplication class

Base for applications with screen management.

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::setPropagatedEvents(). When application gets an event, they are propagated to the screens:

Uses Corrade::Containers::LinkedList for efficient screen management. Traversing front-to-back through the list of screens can be done using range-based for:

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::Containers::LinkedList::last() and BasicScreen::nextNearerScreen().

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(typename Application::ViewportEvent& 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::focusEvent() is called. If not, neither BasicScreen::blurEvent() nor BasicScreen::focusEvent() is called (i.e. the screen default state is used).

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(typename Application::ViewportEvent& size) virtual protected

Global viewport event.

Called when window size changes, before all screens' viewportEvent(). Default implementation does nothing. See *Application::viewportEvent() for more information.

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().