class new in Git master
#include <Magnum/Ui/BaseLayer.h>
BaseLayer Base layer.
Draws quads with a color gradient, variable rounded corners and outline. You'll most likely instantiate the class through BaseLayerGL, which contains a concrete OpenGL implementation.
Base classes
- class AbstractVisualLayer new in Git master
- Base for visual data layers.
Derived classes
- class BaseLayerGL new in Git master
- OpenGL implementation of the base layer.
Public types
- class Shared
- Shared state for the base layer.
Public functions
- auto shared() -> Shared&
- Shared state used by this layer.
- auto shared() const -> const Shared&
- auto backgroundBlurPassCount() const -> UnsignedInt
- Background blur pass count.
- auto setBackgroundBlurPassCount(UnsignedInt count) -> BaseLayer&
- Set background blur pass count.
- auto assignAnimator(BaseLayerStyleAnimator& animator) -> BaseLayer&
- Assign a style animator to this layer.
- auto defaultStyleAnimator() const -> BaseLayerStyleAnimator*
- Default style animator for this layer.
- auto setDefaultStyleAnimator(BaseLayerStyleAnimator* animator) -> BaseLayer&
- Set a default style animator for this layer.
-
auto dynamicStyleUniforms() const -> Containers::
ArrayView<const BaseLayerStyleUniform> - Dynamic style uniforms.
-
auto dynamicStylePaddings() const -> Containers::
StridedArrayView1D<const Vector4> - Dynamic style paddings.
- void setDynamicStyle(UnsignedInt id, const BaseLayerStyleUniform& uniform, const Vector4& padding)
- Set a dynamic style.
-
auto create(UnsignedInt style,
NodeHandle node = NodeHandle::
Null) -> DataHandle - Create a quad.
-
template<class StyleIndex>auto create(StyleIndex style, NodeHandle node = NodeHandle::
Null) -> DataHandle - Create a quad with a style index in a concrete enum type.
- void remove(DataHandle handle)
- Remove a quad.
- void remove(LayerDataHandle handle)
- Remove a quad assuming it belongs to this layer.
- auto color(DataHandle handle) const -> Color4
- Quad custom base color.
- auto color(LayerDataHandle handle) const -> Color4
- Quad custom base color assuming it belongs to this layer.
- void setColor(DataHandle handle, const Color4& color)
- Set quad custom base color.
- void setColor(LayerDataHandle handle, const Color4& color)
- Set quad custom base color assuming it belongs to this layer.
- auto outlineWidth(DataHandle handle) const -> Vector4
- Quad custom outline width.
- auto outlineWidth(LayerDataHandle handle) const -> Vector4
- Quad custom outline width assuming it belongs to this layer.
- void setOutlineWidth(DataHandle handle, const Vector4& width)
- Set quad custom outline width.
- void setOutlineWidth(DataHandle handle, Float width)
- Set quad custom outline width with all edges having the same value.
- void setOutlineWidth(LayerDataHandle handle, const Vector4& width)
- Set quad custom outline width assuming it belongs to this layer.
- void setOutlineWidth(LayerDataHandle handle, Float width)
- Set quad custom outline width with all edges having the same value assuming it belongs to this layer.
- auto padding(DataHandle handle) const -> Vector4
- Quad custom padding.
- auto padding(LayerDataHandle handle) const -> Vector4
- Quad custom padding assuming it belongs to this layer.
- void setPadding(DataHandle handle, const Vector4& padding)
- Set quad custom padding.
- void setPadding(LayerDataHandle handle, const Vector4& padding)
- Set quad custom padding assuming it belongs to this layer.
- void setPadding(DataHandle handle, Float padding)
- Set quad custom padding with all edges having the same value.
- void setPadding(LayerDataHandle handle, Float padding)
- Set quad custom padding with all edges having the same value assuming it belongs to this layer.
- auto textureCoordinateOffset(DataHandle handle) const -> Vector3
- Quad texture coordinate offset.
- auto textureCoordinateOffset(LayerDataHandle handle) const -> Vector3
- Quad texture coordinate offset assuming it belongs to this layer.
- auto textureCoordinateSize(DataHandle handle) const -> Vector2
- Quad texture coordinate size.
- auto textureCoordinateSize(LayerDataHandle handle) const -> Vector2
- Quad texture coordinate size assuming it belongs to this layer.
- void setTextureCoordinates(DataHandle handle, const Vector3& offset, const Vector2& size)
- Set quad texture coordinates.
- void setTextureCoordinates(LayerDataHandle handle, const Vector3& offset, const Vector2& size)
- Set quad texture coordinates assuming it belongs to this layer.
Function documentation
Shared& Magnum:: Ui:: BaseLayer:: shared()
Shared state used by this layer.
Reference to the instance passed to BaseLayerGL::
UnsignedInt Magnum:: Ui:: BaseLayer:: backgroundBlurPassCount() const
Background blur pass count.
Expects that BaseLayerSharedFlag::
BaseLayer& Magnum:: Ui:: BaseLayer:: setBackgroundBlurPassCount(UnsignedInt count)
Set background blur pass count.
Returns | Reference to self (for method chaining) |
---|
Expects that BaseLayerSharedFlag::count
is at least 1
. Higher values will perform the blurring process several times, which has the same effect as applying a single, larger, Gaussian blur. With being the radius configured by Shared::count
, the relation to the larger radius is as follows:
Thus by combining the radius and pass count it's possible to achieve blurring in radii larger than the limit of 31
in Shared::
Default pass count is 1
.
Calling this function causes LayerState::
BaseLayer& Magnum:: Ui:: BaseLayer:: assignAnimator(BaseLayerStyleAnimator& animator)
Assign a style animator to this layer.
Returns | Reference to self (for method chaining) |
---|
Expects that Shared::animator
wasn't passed to assignAnimator() on any layer yet. On the other hand, it's possible to associate multiple different animators with the same layer.
BaseLayerStyleAnimator* Magnum:: Ui:: BaseLayer:: defaultStyleAnimator() const
Default style animator for this layer.
If a style animator hasn't been set, returns nullptr
. If not nullptr
, the returned animator is guaranteed to be assigned to this layer, i.e. that BaseLayerStyleAnimator::
BaseLayer& Magnum:: Ui:: BaseLayer:: setDefaultStyleAnimator(BaseLayerStyleAnimator* animator)
Set a default style animator for this layer.
Returns | Reference to self (for method chaining) |
---|
Makes animator
used in style transitions in response to events. Expects that animator
is either nullptr
or is already assigned to this layer, i.e. that assignAnimator() was called on this layer with animator
before. Calling this function again with a different animator or with nullptr
replaces the previous one.
Containers:: ArrayView<const BaseLayerStyleUniform> Magnum:: Ui:: BaseLayer:: dynamicStyleUniforms() const
Dynamic style uniforms.
Size of the returned view is Shared::
Containers:: StridedArrayView1D<const Vector4> Magnum:: Ui:: BaseLayer:: dynamicStylePaddings() const
Dynamic style paddings.
Size of the returned view is Shared::
void Magnum:: Ui:: BaseLayer:: setDynamicStyle(UnsignedInt id,
const BaseLayerStyleUniform& uniform,
const Vector4& padding)
Set a dynamic style.
Parameters | |
---|---|
id | Dynamic style ID |
uniform | Style uniform |
padding | Padding inside the node in order left, top, right, bottom |
Expects that the id
is less than Shared::id
is then a style index that can be passed to create() or setStyle() in order to use this style. Compared to Shared::
Calling this function causes LayerState::padding
changed, LayerState::
DataHandle Magnum:: Ui:: BaseLayer:: create(UnsignedInt style,
NodeHandle node = NodeHandle:: Null)
Create a quad.
Parameters | |
---|---|
style | Style index |
node | Node to attach to |
Returns | New data handle |
Expects that style
is less than Shared::style
.
template<class StyleIndex>
DataHandle Magnum:: Ui:: BaseLayer:: create(StyleIndex style,
NodeHandle node = NodeHandle:: Null)
Create a quad with a style index in a concrete enum type.
Casts style
to UnsignedInt and delegates to create(UnsignedInt, NodeHandle).
void Magnum:: Ui:: BaseLayer:: remove(DataHandle handle)
Remove a quad.
Delegates to AbstractLayer::
void Magnum:: Ui:: BaseLayer:: remove(LayerDataHandle handle)
Remove a quad assuming it belongs to this layer.
Delegates to AbstractLayer::
Color4 Magnum:: Ui:: BaseLayer:: color(DataHandle handle) const
Quad custom base color.
Expects that handle
is valid.
Color4 Magnum:: Ui:: BaseLayer:: color(LayerDataHandle handle) const
Quad custom base color assuming it belongs to this layer.
Expects that handle
is valid.
void Magnum:: Ui:: BaseLayer:: setColor(DataHandle handle,
const Color4& color)
Set quad custom base color.
Expects that handle
is valid. BaseLayerStyleUniform::color
. By default, the custom color is 0xffffffff_srgbaf
, i.e. not affecting the style in any way.
Calling this function causes LayerState::
void Magnum:: Ui:: BaseLayer:: setColor(LayerDataHandle handle,
const Color4& color)
Set quad custom base color assuming it belongs to this layer.
Like setColor(DataHandle, const Color4&) but without checking that handle
indeed belongs to this layer. See its documentation for more information.
Vector4 Magnum:: Ui:: BaseLayer:: outlineWidth(DataHandle handle) const
Quad custom outline width.
In order left, top. right, bottom. Expects that handle
is valid.
Vector4 Magnum:: Ui:: BaseLayer:: outlineWidth(LayerDataHandle handle) const
Quad custom outline width assuming it belongs to this layer.
In order left, top. right, bottom. Expects that handle
is valid.
void Magnum:: Ui:: BaseLayer:: setOutlineWidth(DataHandle handle,
const Vector4& width)
Set quad custom outline width.
Expects that handle
is valid. The width
is in order left, top, right, bottom and is added to BaseLayerStyleUniform::
Calling this function causes LayerState::
void Magnum:: Ui:: BaseLayer:: setOutlineWidth(DataHandle handle,
Float width)
Set quad custom outline width with all edges having the same value.
Expects that handle
is valid. The width
is added to BaseLayerStyleUniform::
Calling this function causes LayerState::
void Magnum:: Ui:: BaseLayer:: setOutlineWidth(LayerDataHandle handle,
const Vector4& width)
Set quad custom outline width assuming it belongs to this layer.
Like setOutlineWidth(DataHandle, const Vector4&) but without checking that handle
indeed belongs to this layer. See its documentation for more information.
void Magnum:: Ui:: BaseLayer:: setOutlineWidth(LayerDataHandle handle,
Float width)
Set quad custom outline width with all edges having the same value assuming it belongs to this layer.
Like setOutlineWidth(DataHandle, Float) but without checking that handle
indeed belongs to this layer. See its documentation for more information.
Vector4 Magnum:: Ui:: BaseLayer:: padding(DataHandle handle) const
Quad custom padding.
In order left, top. right, bottom. Expects that handle
is valid.
Vector4 Magnum:: Ui:: BaseLayer:: padding(LayerDataHandle handle) const
Quad custom padding assuming it belongs to this layer.
In order left, top. right, bottom. Expects that handle
is valid.
void Magnum:: Ui:: BaseLayer:: setPadding(DataHandle handle,
const Vector4& padding)
Set quad custom padding.
Expects that handle
is valid. The padding
is in order left, top, right, bottom and is added to the per-style padding values specified in Shared::
Calling this function causes LayerState::
void Magnum:: Ui:: BaseLayer:: setPadding(LayerDataHandle handle,
const Vector4& padding)
Set quad custom padding assuming it belongs to this layer.
Like setPadding(DataHandle, const Vector4&) but without checking that handle
indeed belongs to this layer. See its documentation for more information.
void Magnum:: Ui:: BaseLayer:: setPadding(DataHandle handle,
Float padding)
Set quad custom padding with all edges having the same value.
Expects that handle
is valid. The padding
is added to the per-style padding values specified in Shared::
Calling this function causes LayerState::
void Magnum:: Ui:: BaseLayer:: setPadding(LayerDataHandle handle,
Float padding)
Set quad custom padding with all edges having the same value assuming it belongs to this layer.
Like setPadding(DataHandle, Float) but without checking that handle
indeed belongs to this layer. See its documentation for more information.
Vector3 Magnum:: Ui:: BaseLayer:: textureCoordinateOffset(DataHandle handle) const
Quad texture coordinate offset.
The third coordinate is array layer. Expects that handle
is valid and that BaseLayerSharedFlag::
Vector3 Magnum:: Ui:: BaseLayer:: textureCoordinateOffset(LayerDataHandle handle) const
Quad texture coordinate offset assuming it belongs to this layer.
The third coordinate is array layer. Expects that handle
is valid and that BaseLayerSharedFlag::
Vector2 Magnum:: Ui:: BaseLayer:: textureCoordinateSize(DataHandle handle) const
Quad texture coordinate size.
Expects that handle
is valid and that BaseLayerSharedFlag::
Vector2 Magnum:: Ui:: BaseLayer:: textureCoordinateSize(LayerDataHandle handle) const
Quad texture coordinate size assuming it belongs to this layer.
Expects that handle
is valid and that BaseLayerSharedFlag::
void Magnum:: Ui:: BaseLayer:: setTextureCoordinates(DataHandle handle,
const Vector3& offset,
const Vector2& size)
Set quad texture coordinates.
The third coordinate of offset
is array layer. Expects that handle
is valid and that BaseLayerSharedFlag::{0.0f, 0.0f, 0.0f}
and size is {1.0f, 1.0f}
, i.e. covering the whole first slice of the texture.
Calling this function causes LayerState::
void Magnum:: Ui:: BaseLayer:: setTextureCoordinates(LayerDataHandle handle,
const Vector3& offset,
const Vector2& size)
Set quad texture coordinates assuming it belongs to this layer.
Like setTextureCoordinates(DataHandle, const Vector3&, const Vector2&) but without checking that handle
indeed belongs to this layer. See its documentation for more information.