AbstractStyle class new in Git master
#include <Magnum/Ui/AbstractStyle.h>
Base for UserInterface styles.
Subclassing
A subclass implements at least doFeatures() and doApply(), and then a subset of the other virtual functions based on what features are actually supplied by the style. See their documentation for more information.
Derived classes
- class McssDarkStyle new in Git master
- Style for builtin widgets based on the m.css dark theme.
Public functions
- auto features() const -> StyleFeatures
- Features supplied by a style.
- auto backgroundLayerStyleUniformCount() const -> UnsignedInt
- Style uniform count for the background layer.
- auto backgroundLayerStyleCount() const -> UnsignedInt
- Style count for the background layer.
- auto backgroundLayerDynamicStyleCount() const -> UnsignedInt
- Dynamic style count for the background layer.
- auto setBackgroundLayerDynamicStyleCount(UnsignedInt count) -> AbstractStyle&
- Request more background layer dynamic styles.
- auto backgroundLayerFlags() const -> BaseLayerSharedFlags
- Additional flags for the background layer.
- auto setBackgroundLayerFlags(BaseLayerSharedFlags add, BaseLayerSharedFlags clear) -> AbstractStyle&
- Set additional background layer flags.
- auto backgroundLayerBlurRadius() const -> UnsignedInt
- Background blur radius.
- auto backgroundLayerBlurCutoff() const -> Float
- Background blur sampling cutoff.
- auto baseLayerStyleUniformCount() const -> UnsignedInt
- Style uniform count for the base layer.
- auto baseLayerStyleCount() const -> UnsignedInt
- Style count for the base layer.
- auto baseLayerDynamicStyleCount() const -> UnsignedInt
- Dynamic style count for the base layer.
- auto setBaseLayerDynamicStyleCount(UnsignedInt count) -> AbstractStyle&
- Request more base layer dynamic styles.
- auto baseLayerFlags() const -> BaseLayerSharedFlags
- Additional flags for the base layer.
- auto setBaseLayerFlags(BaseLayerSharedFlags add, BaseLayerSharedFlags clear) -> AbstractStyle&
- Set additional base layer flags.
- auto textLayerStyleUniformCount() const -> UnsignedInt
- Style uniform count for the text layer.
- auto textLayerStyleCount() const -> UnsignedInt
- Style count for the text layer.
- auto textLayerEditingStyleUniformCount() const -> UnsignedInt
- Editing style uniform count for the text layer.
- auto textLayerEditingStyleCount() const -> UnsignedInt
- Editing style count for the text layer.
- auto textLayerDynamicStyleCount() const -> UnsignedInt
- Dynamic style count for the text layer.
- auto setTextLayerDynamicStyleCount(UnsignedInt count) -> AbstractStyle&
- Request more text layer dynamic styles.
- auto textLayerGlyphCacheFormat() const -> PixelFormat
- Text layer glyph cache format.
- auto textLayerGlyphCacheSize(StyleFeatures features) const -> Vector3i
- Text layer glyph cache size.
- auto textLayerGlyphCachePadding() const -> Vector2i
- Text layer glyph cache padding.
- auto setTextLayerGlyphCacheSize(const Vector3i& size, const Vector2i& padding = {}) -> AbstractStyle&
- Request a larger glyph cache size.
- auto layoutLayerStyleCount() const -> UnsignedInt
- Style count for the layout layer.
-
auto apply(UserInterface& ui,
StyleFeatures features,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager, PluginManager:: Manager<Text:: AbstractFont>* fontManager) const -> bool - Apply the style.
Private functions
- auto doFeatures() const -> StyleFeatures pure virtual
- Implementation for features()
- auto doBackgroundLayerStyleUniformCount() const -> UnsignedInt virtual
- Implementation for backgroundLayerStyleUniformCount()
- auto doBackgroundLayerStyleCount() const -> UnsignedInt virtual
- Implementation for backgroundLayerStyleCount()
- auto doBackgroundLayerDynamicStyleCount() const -> UnsignedInt virtual
- Implementation for backgroundLayerDynamicStyleCount()
- auto doBackgroundLayerFlags() const -> BaseLayerSharedFlags virtual
- Implementation for backgroundLayerFlags()
- auto doBackgroundLayerBlurRadius() const -> UnsignedInt virtual
- Implementation for backgroundLayerBlurRadius()
- auto doBackgroundLayerBlurCutoff() const -> Float virtual
- Implementation for backgroundLayerBlurCutoff()
- auto doBaseLayerStyleUniformCount() const -> UnsignedInt virtual
- Implementation for baseLayerStyleUniformCount()
- auto doBaseLayerStyleCount() const -> UnsignedInt virtual
- Implementation for baseLayerStyleCount()
- auto doBaseLayerDynamicStyleCount() const -> UnsignedInt virtual
- Implementation for baseLayerDynamicStyleCount()
- auto doBaseLayerFlags() const -> BaseLayerSharedFlags virtual
- Implementation for baseLayerFlags()
- auto doTextLayerStyleUniformCount() const -> UnsignedInt virtual
- Implementation for textLayerStyleUniformCount()
- auto doTextLayerStyleCount() const -> UnsignedInt virtual
- Implementation for textLayerStyleCount()
- auto doTextLayerEditingStyleUniformCount() const -> UnsignedInt virtual
- Implementation for textLayerEditingStyleUniformCount()
- auto doTextLayerEditingStyleCount() const -> UnsignedInt virtual
- Implementation for textLayerEditingStyleCount()
- auto doTextLayerDynamicStyleCount() const -> UnsignedInt virtual
- Implementation for textLayerDynamicStyleCount()
- auto doTextLayerGlyphCacheFormat() const -> PixelFormat virtual
- Implementation for textLayerGlyphCacheFormat()
- auto doTextLayerGlyphCacheSize(StyleFeatures features) const -> Vector3i virtual
- Implementation for textLayerGlyphCacheSize()
- auto doTextLayerGlyphCachePadding() const -> Vector2i virtual
- Implementation for textLayerGlyphCacheFormat()
- auto doLayoutLayerStyleCount() const -> UnsignedInt virtual
- Implementation for layoutLayerStyleCount()
-
auto doApply(UserInterface& ui,
StyleFeatures features,
PluginManager::
Manager<Trade:: AbstractImporter>* importerManager, PluginManager:: Manager<Text:: AbstractFont>* fontManager) const -> bool pure virtual - Implementation for apply()
Function documentation
StyleFeatures Magnum:: Ui:: AbstractStyle:: features() const
Features supplied by a style.
Guaranteed to return at least one StyleFeature.
UnsignedInt Magnum:: Ui:: AbstractStyle:: backgroundLayerStyleUniformCount() const
Style uniform count for the background layer.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: backgroundLayerStyleCount() const
Style count for the background layer.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: backgroundLayerDynamicStyleCount() const
Dynamic style count for the background layer.
Expects that StyleFeature::
AbstractStyle& Magnum:: Ui:: AbstractStyle:: setBackgroundLayerDynamicStyleCount(UnsignedInt count)
Request more background layer dynamic styles.
| Returns | Reference to self (for method chaining) |
|---|
Expects that StyleFeature::
BaseLayerSharedFlags Magnum:: Ui:: AbstractStyle:: backgroundLayerFlags() const
Additional flags for the background layer.
Expects that StyleFeature::
AbstractStyle& Magnum:: Ui:: AbstractStyle:: setBackgroundLayerFlags(BaseLayerSharedFlags add,
BaseLayerSharedFlags clear)
Set additional background layer flags.
| Returns | Reference to self (for method chaining) |
|---|
Expects that StyleFeature::add is a subset of BaseLayerSharedFlag::clear is a subset of BaseLayerSharedFlag::add, with everything in clear cleared from the set.
UnsignedInt Magnum:: Ui:: AbstractStyle:: backgroundLayerBlurRadius() const
Background blur radius.
Expects that StyleFeature::
Float Magnum:: Ui:: AbstractStyle:: backgroundLayerBlurCutoff() const
Background blur sampling cutoff.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: baseLayerStyleUniformCount() const
Style uniform count for the base layer.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: baseLayerStyleCount() const
Style count for the base layer.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: baseLayerDynamicStyleCount() const
Dynamic style count for the base layer.
Expects that StyleFeature::
AbstractStyle& Magnum:: Ui:: AbstractStyle:: setBaseLayerDynamicStyleCount(UnsignedInt count)
Request more base layer dynamic styles.
| Returns | Reference to self (for method chaining) |
|---|
Expects that StyleFeature::
BaseLayerSharedFlags Magnum:: Ui:: AbstractStyle:: baseLayerFlags() const
Additional flags for the base layer.
Expects that StyleFeature::
AbstractStyle& Magnum:: Ui:: AbstractStyle:: setBaseLayerFlags(BaseLayerSharedFlags add,
BaseLayerSharedFlags clear)
Set additional base layer flags.
| Returns | Reference to self (for method chaining) |
|---|
Expects that StyleFeature::add is a subset of BaseLayerSharedFlag::clear is a subset of BaseLayerSharedFlag::add, with everything in clear cleared from the set.
UnsignedInt Magnum:: Ui:: AbstractStyle:: textLayerStyleUniformCount() const
Style uniform count for the text layer.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: textLayerStyleCount() const
Style count for the text layer.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: textLayerEditingStyleUniformCount() const
Editing style uniform count for the text layer.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: textLayerEditingStyleCount() const
Editing style count for the text layer.
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: textLayerDynamicStyleCount() const
Dynamic style count for the text layer.
Expects that StyleFeature::
AbstractStyle& Magnum:: Ui:: AbstractStyle:: setTextLayerDynamicStyleCount(UnsignedInt count)
Request more text layer dynamic styles.
| Returns | Reference to self (for method chaining) |
|---|
Expects that StyleFeature::
PixelFormat Magnum:: Ui:: AbstractStyle:: textLayerGlyphCacheFormat() const
Text layer glyph cache format.
Expects that StyleFeature::
Vector3i Magnum:: Ui:: AbstractStyle:: textLayerGlyphCacheSize(StyleFeatures features) const
Text layer glyph cache size.
Expects that StyleFeature::features are a subset of features() and contain at least StyleFeature::features or not. The returned value is passed to text layer's Text::
Vector2i Magnum:: Ui:: AbstractStyle:: textLayerGlyphCachePadding() const
Text layer glyph cache padding.
Expects that StyleFeature::
AbstractStyle& Magnum:: Ui:: AbstractStyle:: setTextLayerGlyphCacheSize(const Vector3i& size,
const Vector2i& padding = {})
Request a larger glyph cache size.
| Returns | Reference to self (for method chaining) |
|---|
Expects that StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: layoutLayerStyleCount() const
Style count for the layout layer.
Expects that StyleFeature::
bool Magnum:: Ui:: AbstractStyle:: apply(UserInterface& ui,
StyleFeatures features,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager,
PluginManager:: Manager<Text:: AbstractFont>* fontManager) const
Apply the style.
Used internally from UserInterfaceGL::
Expects that ui has user interface size already set, either using the constructor or by calling UserInterface::features are a subset of features() and contain at least one feature, that ui already contains all layers, layouters and animators corresponding to features, that the layer shared state style uniform and style count matches the subset of backgroundLayerStyleUniformCount(), backgroundLayerStyleCount(), baseLayerStyleUniformCount(), baseLayerStyleCount(), textLayerStyleUniformCount(), textLayerStyleCount(), textLayerEditingStyleUniformCount(), textLayerEditingStyleCount(), layoutLayerStyleCount() matching features and the layer shared state dynamic style count is at least the subset of backgroundLayerDynamicStyleCount(), baseLayerDynamicStyleCount(), textLayerDynamicStyleCount() matching features. Additionally, if StyleFeature::features, expects that the TextLayer::features and padding at least textLayerGlyphCachePadding() and that fontManager is not nullptr; and if StyleFeature::features, expects that either the TextLayer is already present in the user interface or that StyleFeature::features as well, and that importerManager is not nullptr. Returns true on success, prints a message to Error and returns false if some run-time error happened during style preparation, such as a plugin not being found or external data failing to load.
StyleFeatures Magnum:: Ui:: AbstractStyle:: doFeatures() const pure virtual private
Implementation for features()
Is expected to return at least one StyleFeature.
UnsignedInt Magnum:: Ui:: AbstractStyle:: doBackgroundLayerStyleUniformCount() const virtual private
Implementation for backgroundLayerStyleUniformCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doBackgroundLayerStyleCount() const virtual private
Implementation for backgroundLayerStyleCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doBackgroundLayerDynamicStyleCount() const virtual private
Implementation for backgroundLayerDynamicStyleCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::0. If StyleFeature::
BaseLayerSharedFlags Magnum:: Ui:: AbstractStyle:: doBackgroundLayerFlags() const virtual private
Implementation for backgroundLayerFlags()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doBackgroundLayerBlurRadius() const virtual private
Implementation for backgroundLayerBlurRadius()
Guaranteed to be called only if doFeatures() contains StyleFeature::4, consistent with BaseLayer::
Float Magnum:: Ui:: AbstractStyle:: doBackgroundLayerBlurCutoff() const virtual private
Implementation for backgroundLayerBlurCutoff()
Guaranteed to be called only if doFeatures() contains StyleFeature::0.5f/255.0f, consistent with BaseLayer::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doBaseLayerStyleUniformCount() const virtual private
Implementation for baseLayerStyleUniformCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doBaseLayerStyleCount() const virtual private
Implementation for baseLayerStyleCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doBaseLayerDynamicStyleCount() const virtual private
Implementation for baseLayerDynamicStyleCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::0. If StyleFeature::
BaseLayerSharedFlags Magnum:: Ui:: AbstractStyle:: doBaseLayerFlags() const virtual private
Implementation for baseLayerFlags()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doTextLayerStyleUniformCount() const virtual private
Implementation for textLayerStyleUniformCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doTextLayerStyleCount() const virtual private
Implementation for textLayerStyleCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doTextLayerEditingStyleUniformCount() const virtual private
Implementation for textLayerEditingStyleUniformCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doTextLayerEditingStyleCount() const virtual private
Implementation for textLayerEditingStyleCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::0.
UnsignedInt Magnum:: Ui:: AbstractStyle:: doTextLayerDynamicStyleCount() const virtual private
Implementation for textLayerDynamicStyleCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::0. If StyleFeature::
PixelFormat Magnum:: Ui:: AbstractStyle:: doTextLayerGlyphCacheFormat() const virtual private
Implementation for textLayerGlyphCacheFormat()
Guaranteed to be called only if doFeatures() contains StyleFeature::
Vector3i Magnum:: Ui:: AbstractStyle:: doTextLayerGlyphCacheSize(StyleFeatures features) const virtual private
Implementation for textLayerGlyphCacheSize()
Guaranteed to be called only if doFeatures() contains StyleFeature::features are guaranteed to be a subset of features() and contain at least StyleFeature::
Vector2i Magnum:: Ui:: AbstractStyle:: doTextLayerGlyphCachePadding() const virtual private
Implementation for textLayerGlyphCacheFormat()
Guaranteed to be called only if doFeatures() contains StyleFeature::{1, 1}, consistently with default padding in Text::
UnsignedInt Magnum:: Ui:: AbstractStyle:: doLayoutLayerStyleCount() const virtual private
Implementation for layoutLayerStyleCount()
Guaranteed to be called only if doFeatures() contains StyleFeature::
bool Magnum:: Ui:: AbstractStyle:: doApply(UserInterface& ui,
StyleFeatures features,
PluginManager:: Manager<Trade:: AbstractImporter>* importerManager,
PluginManager:: Manager<Text:: AbstractFont>* fontManager) const pure virtual private
Implementation for apply()
Should call BaseLayer::features are passed and return true. If some runtime error happens, should print a message to Error and return false.
The ui is guaranteed to have user interface set for the style to use to calculate font rasterization and icon sizes, for example. The features are guaranteed to be a subset of features() and contain at least one feature, that ui already contains all layers, layouters and animators corresponding to features, that the layer shared state style uniform and style count matches the subset of baseLayerStyleUniformCount(), baseLayerStyleCount(), textLayerStyleUniformCount(), textLayerStyleCount(), textLayerEditingStyleUniformCount(), textLayerEditingStyleCount(), layoutLayerStyleCount() matching features and the layer shared state dynamic style count is at least the subset of baseLayerDynamicStyleCount(), textLayerDynamicStyleCount() matching features. Additionally, if StyleFeature::features, the TextLayer::features and padding at least textLayerGlyphCachePadding(), and fontManager is guaranteed to not be nullptr; and if StyleFeature::features, the importerManager is guaranteed to not be nullptr.