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

Base for application screens.

See BasicScreenedApplication for more information.

If exactly one application header is included, this class is also aliased to Platform::Screen.

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.

Public types

enum class PropagatedEvent: UnsignedByte { Draw = 1 << 0, Input = 1 << 1 }
Event propagated to given screen.
using PropagatedEvents = Containers::EnumSet<PropagatedEvent>
Events propagated to given screen.
using InputEvent = BasicScreenedApplication<Application>::InputEvent
Input event.
using KeyEvent = BasicScreenedApplication<Application>::KeyEvent
Key event.
using MouseEvent = BasicScreenedApplication<Application>::MouseEvent
Mouse event.
using MouseMoveEvent = BasicScreenedApplication<Application>::MouseMoveEvent
Mouse move event.

Public functions

auto propagatedEvents() const -> PropagatedEvents
Events propagated to this screen.
void setPropagatedEvents(PropagatedEvents events)
Set events propagated to this screen.
template<class T = BasicScreenedApplication<Application>>
auto application() -> T*
Application holding this screen.
template<class T = BasicScreenedApplication<Application>>
auto application() const -> const T*
auto nextNearerScreen() -> BasicScreen<Application>*
Next nearer screen.
auto nextNearerScreen() const -> const BasicScreen<Application>*
auto nextFartherScreen() -> BasicScreen<Application>*
Next farther screen.
auto nextFartherScreen() const -> const BasicScreen<Application>*

Protected functions

void redraw() virtual
Request redraw.
void focusEvent() pure virtual
Focus event.
void blurEvent() pure virtual
Blur event.
void viewportEvent(const Vector2i& size) pure virtual
Viewport event.
void drawEvent() pure virtual
Draw event.
void keyPressEvent(KeyEvent& event) virtual
Key press event.
void keyReleaseEvent(KeyEvent& event) virtual
Key release event.
void mousePressEvent(MouseEvent& event) virtual
Mouse press event.
void mouseReleaseEvent(MouseEvent& event) virtual
Mouse release event.
void mouseMoveEvent(MouseMoveEvent& event) virtual
Mouse move event.

Enum documentation

template<class Application>
enum class Magnum::Platform::BasicScreen<Application>::PropagatedEvent: UnsignedByte

Event propagated to given screen.

Enumerators
Draw

Draw event.

When enabled, drawEvent() is propagated to this screen.

Input

Input events.

When enabled, keyPressEvent(), keyReleaseEvent(), mousePressEvent(), mouseReleaseEvent() and mouseMoveEvent() are propagated to this screen.

Typedef documentation

template<class Application>
typedef Containers::EnumSet<PropagatedEvent> Magnum::Platform::BasicScreen<Application>::PropagatedEvents

Events propagated to given screen.

Function documentation

template<class Application>
void Magnum::Platform::BasicScreen<Application>::setPropagatedEvents(PropagatedEvents events)

Set events propagated to this screen.

For non-propagated events related event functions are not called. No events are propagated by default, call this function in focusEvent() and blurEvent() to reflect focus changes.

template<class Application> template<class T = BasicScreenedApplication<Application>>
const T* Magnum::Platform::BasicScreen<Application>::application() 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>
BasicScreen<Application>* Magnum::Platform::BasicScreen<Application>::nextNearerScreen()

Next nearer screen.

Use application().screens().first() to access the front screen and application().screens().last() to access the back screen.

template<class Application>
const BasicScreen<Application>* Magnum::Platform::BasicScreen<Application>::nextNearerScreen() 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>
BasicScreen<Application>* Magnum::Platform::BasicScreen<Application>::nextFartherScreen()

Next farther screen.

Use application().screens().first() to access the front screen and application().screens().last() to access the back screen.

template<class Application>
const BasicScreen<Application>* Magnum::Platform::BasicScreen<Application>::nextFartherScreen() 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::BasicScreen<Application>::focusEvent() pure virtual protected

Focus event.

Called when screen is focused using BasicScreenedApplication::focusScreen() or BasicScreenedApplication::addScreen().

template<class Application>
void Magnum::Platform::BasicScreen<Application>::blurEvent() pure virtual protected

Blur event.

Called when another screen is focused using BasicScreenedApplication::focusScreen(), BasicScreenedApplication::addScreen() or before the screen is removed from application using BasicScreenedApplication::removeScreen().

template<class Application>
void Magnum::Platform::BasicScreen<Application>::viewportEvent(const Vector2i& size) pure virtual protected

Viewport event.

Called from holder application when viewport size changes. See *Application::viewportEvent() for more information. Setting viewport on default framebuffer should be done by the holder application.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::drawEvent() pure virtual protected

Draw event.

Called when PropagatedEvent::Draw is enabled and the screen is redrawn. See *Application::viewportEvent() for more information. Buffer swapping and clearing of default framebufer should be done by the holder application.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::keyPressEvent(KeyEvent& event) virtual protected

Key press event.

Called when PropagatedEvent::Input is enabled and an key is pressed. See *Application::keyPressEvent() for more information.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::keyReleaseEvent(KeyEvent& event) virtual protected

Key release event.

Called when PropagatedEvent::Input is enabled and an key is released. See *Application::keyReleaseEvent() for more information.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::mousePressEvent(MouseEvent& event) virtual protected

Mouse press event.

Called when PropagatedEvent::Input is enabled and mouse button is pressed. See *Application::mousePressEvent() for more information.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::mouseReleaseEvent(MouseEvent& event) virtual protected

Mouse release event.

Called when PropagatedEvent::Input is enabled and mouse button is released. See *Application::mouseReleaseEvent() for more information.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::mouseMoveEvent(MouseMoveEvent& event) virtual protected

Mouse move event.

Called when PropagatedEvent::Input is enabled and mouse is moved. See *Application::mouseMoveEvent() for more information.