Magnum::Ui namespace

UI library.

Widgets for efficient and simple user interfaces.

This library is built if MAGNUM_WITH_UI is enabled when building Magnum Extras. To use this library with CMake, put FindMagnumExtras.cmake into your modules/ directory, request the Ui component of the MagnumExtras package and link to the MagnumExtras::Ui target:

find_package(MagnumExtras REQUIRED)

# ...
target_link_libraries(your-app PRIVATE MagnumExtras::Ui)

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-extras repository and do the following before calling find_package():

set(MAGNUM_WITH_UI ON CACHE BOOL "" FORCE)
add_subdirectory(magnum-extras EXCLUDE_FROM_ALL)

Additional apps are built separately. See the magnum-ui-gallery app documentation, Downloading and building extras and Extras library usage with CMake for more information.

Classes

class AbstractPlane
Non-templated base for planes.
class AbstractUiShader
Base for UI shaders.
class AbstractUserInterface
Non-templated base for user interfaces.
class Anchor
Anchor.
template<class VertexData>
class BasicGLLayer
Layer with OpenGL backend.
template<class InstanceData>
class BasicInstancedGLLayer
Base for instanced layers with OpenGL backend.
template<class InstanceData>
class BasicInstancedLayer
Base for instanced layers.
template<class VertexData>
class BasicLayer
Basic layer.
template<class ... Layers>
class BasicPlane
Base for planes.
template<class ... Layers>
class BasicUserInterface
Base for user interfaces.
class Button
Button widget.
class Input
Input widget.
class Label
Label widget.
class Modal
Modal widget.
class Plane
Default UI plane.
class StyleConfiguration
Style configuration.
class UserInterface
Default user interface.
class ValidatedInput
Validated input.
class Widget
Base for widgets.

Enums

enum class Snap: UnsignedByte { Left = 1 << 0, Right = 1 << 1, Bottom = 1 << 2, Top = 1 << 3, InsideX = 1 << 4, InsideY = 1 << 5, NoSpaceX = 1 << 6, NoSpaceY = 1 << 7 }
Snap.
enum class PlaneFlag: UnsignedInt { Hidden = 1 << 0 }
Plane flag.
enum class Type: UnsignedInt { Button = 0, Label = 1, Input = 2, Modal = 3 }
Widget type.
enum class State: UnsignedInt { Default = 0, Hover = 1, Pressed = 2, Active = 3, Disabled = 4, Hidden = 5 }
Widget state.
enum class Style: UnsignedInt { Default = 0, Primary = 1, Success = 2, Info = 3, Warning = 4, Danger = 5, Dim = 6, Flat = 7 }
Widget style.
enum class WidgetFlag: UnsignedInt { Hovered = 1 << 0, Pressed = 1 << 1, Active = 1 << 2, Disabled = 1 << 3, Hidden = 1 << 4 }
Widget flag.

Typedefs

using Snaps = Containers::EnumSet<Snap>
Set of snaps.
using PlaneFlags = Containers::EnumSet<PlaneFlag>
Plane flags.
using WidgetFlags = Containers::EnumSet<WidgetFlag>
Widget flags.

Functions

auto operator<<(Debug& debug, PlaneFlag value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, PlaneFlags value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, Type value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, State value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, Style value) -> Debug&
Debug output operator.
auto defaultStyleConfiguration() -> StyleConfiguration
Default style configuration.
auto mcssDarkStyleConfiguration() -> StyleConfiguration
m.css dark style configuration
auto operator<<(Debug& debug, WidgetFlag value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, WidgetFlags value) -> Debug&
Debug output operator.

Enum documentation

enum class Magnum::Ui::Snap: UnsignedByte

Snap.

See particular values for detailed documentation.

Specifying neither Snap::Left nor Snap::Right will result in horizontal centering. Specifying both Snap::Left and Snap::Right will cause the widget width to match width of reference widget, plane or user interface. In case Snap::InsideY is specified, horizontal BasicPlane::padding() or left/right-side Widget::padding() is taken into account.

Specifying neither Snap::Bottom nor Snap::Top will result in verical centering. Specifying both Snap::Bottom and Snap::Top will cause the widget height to match height of reference widget, plane or user interface. In case Snap::InsideX is specified, horizontal BasicPlane::padding() or bottom/top-side Widget::padding() is taken into account.

Specifying Snap::NoSpaceX and/or Snap::NoSpaceY will ignore horizontal and/or vertical BasicPlane::padding(), Widget::padding() and BasicPlane::margin().

Enumerators
Left

If anchoring to a widget, snaps right side of a widget to left side of the reference widget, taking horizontal BasicPlane::margin() into account.

If combined with Snap::InsideX or anchoring to a plane or user interface, snaps left side of a widget to left side of reference widget, plane or user interface, taking left-side Widget::padding() or horizontal BasicPlane::padding() into account.

Right

If anchoring to a widget, snaps left side of a widget to right side of the reference widget, taking horizontal BasicPlane::margin() into account.

If combined with Snap::InsideX or anchoring to a plane or user interface, snaps left side of a widget to left side of reference widget, plane or user interface, taking right-side Widget::padding() or horizontal BasicPlane::padding() into account.

Bottom

If anchoring to a widget, snaps top side of a widget to bottom side of the reference widget, taking vertical BasicPlane::margin() into account.

If combined with Snap::InsideY or anchoring to a plane or user interface, snaps bottom side of a widget to bottom side of reference widget, plane or user interface, taking bottom-side Widget::padding() or vertical BasicPlane::padding() into account.

Top

If anchoring to a widget, snaps bottom side of a widget to top side of the reference widget, taking vertical BasicPlane::margin() into account.

If combined with Snap::InsideY or anchoring to a plane or user interface, snaps top side of a widget to top side of reference widget, plane or user interface, taking top-side Widget::padding() or vertical BasicPlane::padding() into account.

InsideX

When combined with Snap::Left or Snap::Right, snaps horizontally inside reference widget instead of outside. Implicit when anchoring to a plane or user interface.

InsideY

When combined with Snap::Bottom or Snap::Top, snaps vertically inside reference widget instead of outside. Implicit when anchoring to a plane or user interface.

NoSpaceX

Ignore horizontal BasicPlane::padding(), Widget::padding() and BasicPlane::margin().

NoSpaceY

Ignore vertical BasicPlane::padding(), Widget::padding() and BasicPlane::margin().

enum class Magnum::Ui::PlaneFlag: UnsignedInt

Plane flag.

Enumerators
Hidden

The plane is hidden.

enum class Magnum::Ui::Type: UnsignedInt

Widget type.

Enumerators
Button

Button

Label

Label

Input

Input

Modal

Modal

enum class Magnum::Ui::State: UnsignedInt

Widget state.

Extracted from WidgetFlags, see particular values for details.

Enumerators
Default

Default state

Hover

The widget was hovered. Note that to reduce combinatorial explosion of colors, State::Hover gets a preference over State::Pressed, but not before State::Active (so if the widget is both pressed and hovered, hover style gets a preference).

Pressed

The widget was pressed. Note that to reduce combinatorial explosion of colors, State::Hover gets a preference over State::Pressed, if the widget is both pressed and hovered.

Active

The widget is active. Note that to reduce combinatorial explosion of colors, State::Active gets a preference over State::Hover, if the widget is both active and hovered.

Disabled

The widget is disabled.

Hidden

The widget is hidden. This is implicitly mapped to transparent colors.

enum class Magnum::Ui::Style: UnsignedInt

Widget style.

Enumerators
Default

Default. Used for common widgets that don't stand out.

Primary

Primary. Denotes primary widget.

Success

Success. Colored green.

Info

Info. Colored light blue.

Warning

Warning. Colored yellow.

Danger

Danger. Colored red.

Dim

Dim. Toned-down version of State::Default that tries hard to not gain attention. Used also for dimming out the background.

Flat

Flat version of State::Default.

enum class Magnum::Ui::WidgetFlag: UnsignedInt

Widget flag.

Enumerators
Hovered

The widget is currently under mouse cursor.

Pressed

The widget is currently pressed.

Active

The widget has been tapped, meaning both press event and release event happened on it and the user didn't blur it since.

Disabled

The widget was disabled, it is visible but it is not receiving any events until it's re-enabled again using Widget::enable() / Widget::setEnabled().

Hidden

The widget was hidden, is not visible and it is not receiving any events until it's shown again using Widget::show() / Widget::setVisible().

Typedef documentation

typedef Containers::EnumSet<Snap> Magnum::Ui::Snaps

Set of snaps.

typedef Containers::EnumSet<PlaneFlag> Magnum::Ui::PlaneFlags

Plane flags.

typedef Containers::EnumSet<WidgetFlag> Magnum::Ui::WidgetFlags

Widget flags.

Function documentation

Debug& Magnum::Ui::operator<<(Debug& debug, PlaneFlag value)

Debug output operator.

Debug& Magnum::Ui::operator<<(Debug& debug, PlaneFlags value)

Debug output operator.

Debug& Magnum::Ui::operator<<(Debug& debug, Type value)

Debug output operator.

Debug& Magnum::Ui::operator<<(Debug& debug, State value)

Debug output operator.

Debug& Magnum::Ui::operator<<(Debug& debug, Style value)

Debug output operator.

StyleConfiguration Magnum::Ui::defaultStyleConfiguration()

Default style configuration.

StyleConfiguration Magnum::Ui::mcssDarkStyleConfiguration()

m.css dark style configuration

The dark CSS theme from http://mcss.mosra.cz.

Debug& Magnum::Ui::operator<<(Debug& debug, WidgetFlag value)

Debug output operator.

Debug& Magnum::Ui::operator<<(Debug& debug, WidgetFlags value)

Debug output operator.