SystemDefaults

Since: BlackBerry 10.0.0

#include <bb/cascades/SystemDefaults>

Provides access to system defaults for texts and colors.

Note:

At this point the collection of SystemDefaults is very limited and only gives access to a couple of default resources. This makes it difficult to give a really meaningful example. SystemDefaults still serve to train the developer to not have access to the actual color values in the default appearance.

Here's a scenario for where system defaults are useful. In a UI scene, there's a container that the developer wants to color using the same color as labels use for text, for whatever reason. If the actual color of label text would be known, the developer could just set that as the background of his container. However, if the visual appearance is updated (in a new release of the UI framework), his container would no longer have the same color as labels, and his application would be broken. So what he needs to do is:
 Container *container = Container::create()
         .background(SystemDefaults::Paints::defaultText());

The container will now always have the same color as the default labels.

This example shows how to access SystemDefaults from QML:
 Container {
     background: SystemDefaults.Paints.DefaultText
 }
Warning!

The set of paints and colors in this collection will change.


Overview

Classes

Paints

Provides access to the system's defaults for colors.

TextStyles

Provides access to the system's defaults for text styles.

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus