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 the 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 ViewportEvent = BasicScreenedApplication<Application>::ViewportEvent
Viewport event.
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.
using MouseScrollEvent = BasicScreenedApplication<Application>::MouseScrollEvent new in 2019.10
Mouse scroll event.
using TextInputEvent = BasicScreenedApplication<Application>::TextInputEvent new in 2019.10
Text input event.
using TextEditingEvent = BasicScreenedApplication<Application>::TextEditingEvent new in 2019.10
Text editing event.

Constructors, destructors, conversion operators

BasicScreen() explicit
Construct a detached screen.
BasicScreen(BasicScreenedApplication<Application>& application, PropagatedEvents events) explicit new in 2019.10
Construct a screen and attach it to an application.

Public functions

auto propagatedEvents() const -> PropagatedEvents
Events propagated to this screen.
void setPropagatedEvents(PropagatedEvents events)
Set events propagated to this screen.
auto hasApplication() -> bool
Whether the screen is added to an application.
auto application() -> BasicScreenedApplication<Application>&
Application holding this screen.
auto application() const -> const BasicScreenedApplication<Application>&
template<class T = BasicScreenedApplication<Application>>
auto application() -> T&
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>*

Screen handling

void redraw() protected virtual
Request redraw.
void focusEvent() private virtual
Focus event.
void blurEvent() private virtual
Blur event.
void viewportEvent(ViewportEvent& event) private virtual
Viewport event.
void viewportEvent(const Vector2i& size) deprecated in 2018.10 private virtual
Viewport event.
void drawEvent() private pure virtual
Draw event.

Keyboard handling

void keyPressEvent(KeyEvent& event) private virtual
Key press event.
void keyReleaseEvent(KeyEvent& event) private virtual
Key release event.

Mouse handling

void mousePressEvent(MouseEvent& event) private virtual
Mouse press event.
void mouseReleaseEvent(MouseEvent& event) private virtual
Mouse release event.
void mouseMoveEvent(MouseMoveEvent& event) private virtual
Mouse move event.
void mouseScrollEvent(MouseScrollEvent& event) private virtual new in 2019.10
Mouse scroll event.

Text input handling

void textInputEvent(TextInputEvent& event) private virtual new in 2019.10
Text input event.
void textEditingEvent(TextEditingEvent& event) private virtual new in 2019.10
Text editing 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(), mouseMoveEvent(), mouseScrollEvent(), textInputEvent() and textEditingEvent() are propagated to this screen.

Typedef documentation

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

Events propagated to given screen.

template<class Application>
typedef BasicScreenedApplication<Application>::KeyEvent Magnum::Platform::BasicScreen<Application>::KeyEvent

Key event.

Defined only if the application has a KeyEvent.

template<class Application>
typedef BasicScreenedApplication<Application>::MouseScrollEvent Magnum::Platform::BasicScreen<Application>::MouseScrollEvent new in 2019.10

Mouse scroll event.

Defined only if the application has a MouseScrollEvent.

template<class Application>
typedef BasicScreenedApplication<Application>::TextInputEvent Magnum::Platform::BasicScreen<Application>::TextInputEvent new in 2019.10

Text input event.

Defined only if the application has a TextInputEvent.

template<class Application>
typedef BasicScreenedApplication<Application>::TextEditingEvent Magnum::Platform::BasicScreen<Application>::TextEditingEvent new in 2019.10

Text editing event.

Defined only if the application has a TextEditingEvent.

Function documentation

template<class Application>
Magnum::Platform::BasicScreen<Application>::BasicScreen() explicit

Construct a detached screen.

The screen is not attached to any application, use BasicScreenedApplication::addScreen() to add it. Alternatively, use BasicScreen(BasicScreenedApplication<Application>&, PropagatedEvents) to attach the screen right during the construction.

template<class Application>
Magnum::Platform::BasicScreen<Application>::BasicScreen(BasicScreenedApplication<Application>& application, PropagatedEvents events) explicit new in 2019.10

Construct a screen and attach it to an application.

Unlike with BasicScreen(), the screen is added to the application already during the construction, removing the need to call BasicScreenedApplication::addScreen() later. This also means focusEvent() is not called for the very first time, assuming the screen is put into desired state already during construction.

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>
bool Magnum::Platform::BasicScreen<Application>::hasApplication()

Whether the screen is added to an application.

If not, the application() accessor can't be used.

template<class Application>
BasicScreenedApplication<Application>& Magnum::Platform::BasicScreen<Application>::application()

Application holding this screen.

Expects that the screen is added to an application.

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

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> 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>::redraw() virtual protected

Request redraw.

Expects that the screen is added to an application.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::focusEvent() virtual private

Focus event.

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

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

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(ViewportEvent& event) virtual private

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>::viewportEvent(const Vector2i& size) virtual private

Viewport event.

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

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 private

Key press event.

Called when PropagatedEvent::Input is enabled and an key is pressed. See *Application::keyPressEvent() for more information. Defined only if the application has a KeyEvent.

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

Key release event.

Called when PropagatedEvent::Input is enabled and an key is released. See *Application::keyReleaseEvent() for more information. Defined only if the application has a KeyEvent.

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

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 private

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 private

Mouse move event.

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

template<class Application>
void Magnum::Platform::BasicScreen<Application>::mouseScrollEvent(MouseScrollEvent& event) virtual private new in 2019.10

Mouse scroll event.

Called when PropagatedEvent::Input is enabled and mouse wheel is rotated. See *Application::mouseScrollEvent() for more information. Defined only if the application has a MouseScrollEvent.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::textInputEvent(TextInputEvent& event) virtual private new in 2019.10

Text input event.

Called when PropagatedEvent::Input is enabled and text is being input. Defined only if the application has a TextInputEvent.

template<class Application>
void Magnum::Platform::BasicScreen<Application>::textEditingEvent(TextEditingEvent& event) virtual private new in 2019.10

Text editing event.

Called when PropagatedEvent::Input and the text is being edited. Defined only if the application has a TextEditingEvent.