class new in Git master
#include <Magnum/Ui/UserInterfaceGL.h>
UserInterfaceGL OpenGL implementation of the main user interface.
Owns the whole user interface, providing everything from input event handling to animation and drawing. Compared to AbstractUserInterface includes everything that's needed by builtin widgets, while the UserInterface base class is a common interface not tied to OpenGL.
Setting up a user interface instance
The simplest variant of the constructor takes a UI size, in respect to which all contents as well as input events get positioned, and a style instance describing how the widgets all look like. At the moment, McssDarkStyle is the only style provided by the library itself.
Ui::UserInterfaceGL ui{{800, 600}, Ui::McssDarkStyle{}};
The rest of the setup — drawing and event handling — is the same for all AbstractUserInterface subclasses, see its documentation for details.
Additional setup options
The above by default populates the user interface with everything a style provides for use by builtin widgets — in particular, making baseLayer(), textLayer(), eventLayer() and snapLayouter() all available. In case you for example use just a subset of the builtin widgets that only need a part of the above, you can specify a StyleFeatures subset. This can be further combined with setStyle(), where, as long as you specify non-overlapping sets of StyleFeatures, you can combine multiple styles together:
/* Pick everything except icons from the builtin style */ Ui::UserInterfaceGL ui{{800, 600}, Ui::McssDarkStyle{}, ~Ui::StyleFeature::TextLayerImages}; … /* Use icons from a custom style instead */ ui.setStyle(myCustomStyle, Ui::StyleFeature::TextLayerImages);
The constructors also provide a way to supply external plugin managers for fonts and images, for example if you want to configure the plugins before they're used or if you're going to use the same plugin managers elsewhere and want to reduce duplication. The passed instances are expected to stay alive for the whole user interface lifetime.
PluginManager::Manager<Trade::AbstractImporter> importerManager; PluginManager::Manager<Text::AbstractFont> fontManager; … Ui::UserInterfaceGL ui{…, &importerManager, &fontManager};
Delayed user interface creation
By default, the class expects that a Magnum OpenGL context is available at the point of construction. If you're using delayed Application context creation or if you just need additional logic before creating the UI, you can employ a similar approach as with the application itself — construct with UserInterfaceGL(NoCreateT) and then call create() once you're ready:
class MyApplication: public Platform::Application { … private: Ui::UserInterfaceGL _ui{NoCreate}; }; MyApplication::MyApplication(const Arguments& arguments): Platform::Application{arguments, NoCreate} { … create(…); _ui.create(…, Ui::McssDarkStyle{}); }
The create() as well as the main constructor both exit the application if something goes wrong such as if a font plugin cannot be loaded. If you want to deal with potential errors more gracefully or try out several options, tryCreate() returns false
instead of exiting, and there's a trySetStyle() counterpart as well.
Supplying a custom renderer instance
Setting a style either in the constructor or in create() / tryCreate() implicitly sets up a RendererGL instance. If you want to supply a custom one — for example to set up a compositing framebuffer for a custom layer — pass it to setRendererInstance() and then call setSize() and setStyle() / trySetStyle() instead of create() / tryCreate():
Ui::UserInterfaceGL ui{NoCreate}; ui .setRendererInstance(Containers::pointer<Ui::RendererGL>(…)) .setSize(…) .setStyle(Ui::McssDarkStyle{});
Supplying custom layer and layouter instances
If a constructor or create() taking a style isn't used at all, or if a style is applied excluding a particular layer or layouter, you can supply a custom instance using setBaseLayerInstance(), setTextLayerInstance(), setEventLayerInstance() or setSnapLayouterInstance(). Note that however, at this point, you're on your own when you attempt to use any builtin widgets that rely on given instance being set up in a particular way.
Ui::UserInterfaceGL ui{…, Ui::McssDarkStyle{}, ~Ui::StyleFeature::BaseLayer}; … ui.setBaseLayerInstance(Containers::pointer<Ui::BaseLayerGL>(…));
Base classes
- class UserInterface new in Git master
- Main user interface.
Constructors, destructors, conversion operators
- UserInterfaceGL(NoCreateT) explicit
- Construct without creating the user interface.
-
UserInterfaceGL(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit - Construct.
-
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std::UserInterfaceGL(const Application& application, const AbstractStyle& style, PluginManager::
declval<AbstractUserInterface&>(), std:: declval<const Application&>()))> Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit - Construct with properties taken from an application instance.
-
UserInterfaceGL(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit - Construct with a subset of the style.
-
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std::UserInterfaceGL(const Application& application, const AbstractStyle& style, StyleFeatures styleFeatures, PluginManager::
declval<AbstractUserInterface&>(), std:: declval<const Application&>()))> Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit - Construct with a subset of the style with properties taken from an application instance.
-
UserInterfaceGL(const Vector2i& size,
const AbstractStyle& style,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit - Construct with an unscaled size.
-
UserInterfaceGL(const Vector2i& size,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit - Construct with an unscaled size and a subset of the style.
Public functions
-
auto create(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> UserInterfaceGL& - Create the user interface.
-
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std::auto create(const Application& application, const AbstractStyle& style, PluginManager::
declval<AbstractUserInterface&>(), std:: declval<const Application&>()))> Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> UserInterfaceGL& - Create the user interface with properties taken from an application instance.
-
auto create(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> UserInterfaceGL& - Create the user interface with a subset of the style.
-
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std::auto create(const Application& application, const AbstractStyle& style, StyleFeatures styleFeatures, PluginManager::
declval<AbstractUserInterface&>(), std:: declval<const Application&>()))> Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> UserInterfaceGL& - Create the user interface with a subset of the style with properties taken from an application instance.
-
auto create(const Vector2i& size,
const AbstractStyle& style,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> UserInterfaceGL& - Create the user interface with an unscaled size.
-
auto create(const Vector2i& size,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> UserInterfaceGL& - Create the user interface with an unscaled size and a subset of the style.
-
auto tryCreate(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> bool - Try to create the user interface.
-
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std::auto tryCreate(const Application& application, const AbstractStyle& style, PluginManager::
declval<AbstractUserInterface&>(), std:: declval<const Application&>()))> Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> bool - Try to create the user interface with properties taken from an application instance.
-
auto tryCreate(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> bool - Try to create the user interface with a subset of the style.
-
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std::auto tryCreate(const Application& application, const AbstractStyle& style, StyleFeatures styleFeatures, PluginManager::
declval<AbstractUserInterface&>(), std:: declval<const Application&>()))> Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> bool - Try to create the user interface with a subset of the style with properties taken from an application instance.
-
auto tryCreate(const Vector2i& size,
const AbstractStyle& style,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> bool - Try to create the user interface with an unscaled size.
-
auto tryCreate(const Vector2i& size,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> bool - Try to create the user interface with an unscaled size and a subset of the style.
-
auto setRendererInstance(Containers::
Pointer<RendererGL>&& instance) -> UserInterfaceGL& - Set renderer instance.
- auto renderer() -> RendererGL&
- Renderer instance.
- auto renderer() const -> const RendererGL&
-
auto setStyle(const AbstractStyle& style,
StyleFeatures features,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> UserInterfaceGL& - Set features from a style.
-
auto setStyle(const AbstractStyle& style,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> UserInterfaceGL& - Set all features from a style.
-
auto trySetStyle(const AbstractStyle& style,
StyleFeatures features,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> bool - Try to set features from a style.
-
auto trySetStyle(const AbstractStyle& style,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager = nullptr, PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) -> bool - Try to set all features from a style.
-
auto setBaseLayerInstance(Containers::
Pointer<BaseLayerGL>&& instance) -> UserInterfaceGL& - Set a base layer instance.
-
auto setTextLayerInstance(Containers::
Pointer<TextLayerGL>&& instance) -> UserInterfaceGL& - Set a text layer instance.
Function documentation
Magnum:: Ui:: UserInterfaceGL:: UserInterfaceGL(NoCreateT) explicit
Construct without creating the user interface.
You're expected to call create() or tryCreate() afterwards in order to define the UI size and coordinate scaling and set up a style.
Magnum:: Ui:: UserInterfaceGL:: UserInterfaceGL(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit
Construct.
Parameters | |
---|---|
size | Size of the user interface to which everything is positioned |
windowSize | Size of the window to which all input events are related |
framebufferSize | Size of the window framebuffer. On some platforms with HiDPI screens may be different from window size. |
style | Style instance to use |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Equivalent to constructing with UserInterfaceGL(NoCreateT) and then calling create(const Vector2&, const Vector2&, const Vector2i&, const AbstractStyle&, PluginManager::
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std:: declval<AbstractUserInterface&>(), std:: declval<const Application&>()))>
Magnum:: Ui:: UserInterfaceGL:: UserInterfaceGL(const Application& application,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit
Construct with properties taken from an application instance.
Parameters | |
---|---|
application | Application instance to query properties from |
style | Style instance to use |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Equivalent to constructing with UserInterfaceGL(NoCreateT) and then calling create(const Application&, const AbstractStyle&, PluginManager::
Magnum:: Ui:: UserInterfaceGL:: UserInterfaceGL(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit
Construct with a subset of the style.
Parameters | |
---|---|
size | Size of the user interface to which everything is positioned |
windowSize | Size of the window to which all input events are related |
framebufferSize | Size of the window framebuffer. On some platforms with HiDPI screens may be different from window size. |
style | Style instance to use |
styleFeatures | Style features to apply |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Equivalent to constructing with UserInterfaceGL(NoCreateT) and then calling create(const Vector2&, const Vector2&, const Vector2i&, const AbstractStyle&, StyleFeatures, PluginManager::
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std:: declval<AbstractUserInterface&>(), std:: declval<const Application&>()))>
Magnum:: Ui:: UserInterfaceGL:: UserInterfaceGL(const Application& application,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit
Construct with a subset of the style with properties taken from an application instance.
Parameters | |
---|---|
application | Application instance to query properties from |
style | Style instance to use |
styleFeatures | Style features to apply |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Equivalent to constructing with UserInterfaceGL(NoCreateT) and then calling create(const Application&, const AbstractStyle&, PluginManager::
Magnum:: Ui:: UserInterfaceGL:: UserInterfaceGL(const Vector2i& size,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit
Construct with an unscaled size.
Delegates to UserInterfaceGL(const Vector2&, const Vector2&, const Vector2i&, const AbstractStyle&, PluginManager::size
. Doing so assumes that the coordinate system in which events are passed matches framebuffer size.
Magnum:: Ui:: UserInterfaceGL:: UserInterfaceGL(const Vector2i& size,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr) explicit
Construct with an unscaled size and a subset of the style.
Delegates to UserInterfaceGL(const Vector2&, const Vector2&, const Vector2i&, const AbstractStyle&, StyleFeatures features, PluginManager::size
. Doing so assumes that the coordinate system in which events are passed matches framebuffer size.
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: create(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Create the user interface.
Parameters | |
---|---|
size | Size of the user interface to which everything is positioned |
windowSize | Size of the window to which all input events are related |
framebufferSize | Size of the window framebuffer. On some platforms with HiDPI screens may be different from window size. |
style | Style instance to use |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Returns | Reference to self (for method chaining) |
Expects that none of create(), tryCreate(), setBaseLayerInstance(), setTextLayerInstance(), setEventLayerInstance() or setRendererInstance() was called yet. Equivalent to calling setSize(const Vector2&, const Vector2&, const Vector2i&) followed by setStyle(const AbstractStyle&, PluginManager::
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std:: declval<AbstractUserInterface&>(), std:: declval<const Application&>()))>
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: create(const Application& application,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Create the user interface with properties taken from an application instance.
Parameters | |
---|---|
application | Application instance to query properties from |
style | Style instance to use |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Returns | Reference to self (for method chaining) |
Expects that none of create(), tryCreate(), setBaseLayerInstance(), setTextLayerInstance(), setEventLayerInstance() or setRendererInstance() was called yet. Equivalent to calling setSize(const ApplicationOrViewportEvent&) followed by setStyle(const AbstractStyle&, PluginManager::
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: create(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Create the user interface with a subset of the style.
Parameters | |
---|---|
size | Size of the user interface to which everything is positioned |
windowSize | Size of the window to which all input events are related |
framebufferSize | Size of the window framebuffer. On some platforms with HiDPI screens may be different from window size. |
style | Style instance to use |
styleFeatures | Style features to apply |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Returns | Reference to self (for method chaining) |
Expects that none of create(), tryCreate(), setBaseLayerInstance(), setTextLayerInstance(), setEventLayerInstance(), setSnapLayouterInstance() or setRendererInstance() was called yet. Equivalent to calling setSize(const Vector2&, const Vector2&, const Vector2i&) followed by setStyle(const AbstractStyle&, StyleFeatures, PluginManager::
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std:: declval<AbstractUserInterface&>(), std:: declval<const Application&>()))>
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: create(const Application& application,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Create the user interface with a subset of the style with properties taken from an application instance.
Parameters | |
---|---|
application | Application instance to query properties from |
style | Style instance to use |
styleFeatures | Style features to apply |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Returns | Reference to self (for method chaining) |
Expects that none of create(), tryCreate(), setBaseLayerInstance(), setTextLayerInstance(), setEventLayerInstance() or setRendererInstance() was called yet. Equivalent to calling setSize(const ApplicationOrViewportEvent&) followed by setStyle(const AbstractStyle&, PluginManager::
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: create(const Vector2i& size,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Create the user interface with an unscaled size.
Delegates to create(const Vector2&, const Vector2&, const Vector2i&, const AbstractStyle&, PluginManager::size
. Doing so assumes that the coordinate system in which events are passed matches framebuffer size.
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: create(const Vector2i& size,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Create the user interface with an unscaled size and a subset of the style.
Delegates to create(const Vector2&, const Vector2&, const Vector2i&, const AbstractStyle&, StyleFeatures, PluginManager::size
. Doing so assumes that the coordinate system in which events are passed matches framebuffer size.
bool Magnum:: Ui:: UserInterfaceGL:: tryCreate(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Try to create the user interface.
Unlike create(const Vector2&, const Vector2&, const Vector2i&, const AbstractStyle&, PluginManager::false
if AbstractStyle::true
otherwise. Equivalent to calling setSize(const Vector2&, const Vector2&, const Vector2i&) followed by trySetStyle(const AbstractStyle&, PluginManager::
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std:: declval<AbstractUserInterface&>(), std:: declval<const Application&>()))>
bool Magnum:: Ui:: UserInterfaceGL:: tryCreate(const Application& application,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Try to create the user interface with properties taken from an application instance.
Unlike create(const Application&, const AbstractStyle&, PluginManager::false
if AbstractStyle::true
otherwise. Equivalent to calling setSize(const ApplicationOrViewportEvent&) followed by trySetStyle(const AbstractStyle&, PluginManager::
bool Magnum:: Ui:: UserInterfaceGL:: tryCreate(const Vector2& size,
const Vector2& windowSize,
const Vector2i& framebufferSize,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Try to create the user interface with a subset of the style.
Unlike create(const Vector2&, const Vector2&, const Vector2i&, const AbstractStyle&, StyleFeatures, PluginManager::false
if AbstractStyle::true
otherwise. Equivalent to calling setSize(const Vector2&, const Vector2&, const Vector2i&) followed by trySetStyle(const AbstractStyle&, StyleFeatures, PluginManager::
template<class Application, class = decltype(Implementation::ApplicationSizeConverter<Application>::set(std:: declval<AbstractUserInterface&>(), std:: declval<const Application&>()))>
bool Magnum:: Ui:: UserInterfaceGL:: tryCreate(const Application& application,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Try to create the user interface with a subset of the style with properties taken from an application instance.
Unlike create(const Application&, const AbstractStyle&, StyleFeatures, PluginManager::false
if AbstractStyle::true
otherwise. Equivalent to calling setSize(const ApplicationOrViewportEvent&) followed by trySetStyle(const AbstractStyle&, StyleFeatures, PluginManager::
bool Magnum:: Ui:: UserInterfaceGL:: tryCreate(const Vector2i& size,
const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Try to create the user interface with an unscaled size.
Unlike create(const Vector2i&, const AbstractStyle&, PluginManager::false
if AbstractStyle::true
otherwise. Equivalent to calling setSize(const Vector2i&) followed by trySetStyle(const AbstractStyle&, PluginManager::
bool Magnum:: Ui:: UserInterfaceGL:: tryCreate(const Vector2i& size,
const AbstractStyle& style,
StyleFeatures styleFeatures,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Try to create the user interface with an unscaled size and a subset of the style.
Unlike create(const Vector2i&, const AbstractStyle&, StyleFeatures, PluginManager::false
if AbstractStyle::true
otherwise. Equivalent to calling setSize(const Vector2i&) followed by trySetStyle(const AbstractStyle&, StyleFeatures, PluginManager::
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: setRendererInstance(Containers:: Pointer<RendererGL>&& instance)
Set renderer instance.
Returns | Reference to self (for method chaining) |
---|
Expects that the instance hasn't been set yet, either by this function or transitively either by UserInterfaceGL::
RendererGL& Magnum:: Ui:: UserInterfaceGL:: renderer()
Renderer instance.
Expects that an instance has been set, either by setRendererInstance() or transitively by UserInterfaceGL::
const RendererGL& Magnum:: Ui:: UserInterfaceGL:: renderer() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: setStyle(const AbstractStyle& style,
StyleFeatures features,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Set features from a style.
Parameters | |
---|---|
style | Style instance |
features | Style features to apply |
importerManager | Optional plugin manager instance for image loading |
fontManager | Optional plugin manager instance for font loading |
Returns | Reference to self (for method chaining) |
If a renderer isn't present yet, sets its instance. Then creates layer instances corresponding to all features
with style uniform count, style count and other parameters coming from style
. If features
contain StyleFeature::fontManager
is nullptr
, an internal font plugin manager instance is created. The function then calls AbstractStyle::
Expects that user interface size is already set, either using the constructor or by calling setSize(). Expects that features
are a subset of AbstractStyle::style
, contain at least one feature and that the user interface doesn't yet contain any layers or layouters corresponding to features
as documented in the StyleFeature enum values.
While it's not allowed to set style features more than once for one particular layer, it's possible to call this function multiple times with mutually disjoint features
. To replace a layer style with another compatible style, call AbstractStyle::
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: setStyle(const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Set all features from a style.
Returns | Reference to self (for method chaining) |
---|
Equivalent to calling setStyle(const AbstractStyle&, StyleFeatures, PluginManager::features
set to AbstractStyle::style
.
bool Magnum:: Ui:: UserInterfaceGL:: trySetStyle(const AbstractStyle& style,
StyleFeatures features,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Try to set features from a style.
Unlike setStyle(const AbstractStyle&, StyleFeatures, PluginManager::false
if AbstractStyle::true
otherwise.
bool Magnum:: Ui:: UserInterfaceGL:: trySetStyle(const AbstractStyle& style,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager = nullptr,
PluginManager:: Manager<Text:: AbstractFont>* fontManager = nullptr)
Try to set all features from a style.
Unlike setStyle(const AbstractStyle&, PluginManager::false
if AbstractStyle::true
otherwise.
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: setBaseLayerInstance(Containers:: Pointer<BaseLayerGL>&& instance)
Set a base layer instance.
Returns | Reference to self (for method chaining) |
---|
Expects that the instance hasn't been set yet, either by this function or transitively either by setStyle() or a constructor taking a style instance. The instance is subsequently available through baseLayer().
UserInterfaceGL& Magnum:: Ui:: UserInterfaceGL:: setTextLayerInstance(Containers:: Pointer<TextLayerGL>&& instance)
Set a text layer instance.
Returns | Reference to self (for method chaining) |
---|
Expects that the instance hasn't been set yet, either by this function or transitively either by UserInterfaceGL::