Tizen Native API
4.0
|
StyleManager informs applications of system theme change, and supports application theme change at runtime. More...
Public Types | |
typedef Signal< void(StyleManager, StyleChange::Type) > | StyleChangedSignalType |
Style Changed signal. Emitted after controls have been updated. | |
Public Member Functions | |
StyleManager () | |
Creates a StyleManager handle; this can be initialized with StyleManager::Get(). | |
~StyleManager () | |
Destructor. | |
void | ApplyTheme (const std::string &themeFile) |
Applies a new theme to the application. This will be merged on top of the default Toolkit theme. | |
void | ApplyDefaultTheme () |
Applies the default Toolkit theme. | |
void | SetStyleConstant (const std::string &key, const Property::Value &value) |
Sets a constant for use when building styles. | |
bool | GetStyleConstant (const std::string &key, Property::Value &valueOut) |
Returns the style constant set for a specific key. | |
void | ApplyStyle (Toolkit::Control control, const std::string &jsonFileName, const std::string &styleName) |
Applies the specified style to the control. | |
StyleChangedSignalType & | StyleChangedSignal () |
This signal is emitted after the style (e.g. theme/font change) has changed and the controls have been informed. | |
Static Public Member Functions | |
static StyleManager | Get () |
Gets the singleton of StyleManager object. |
StyleManager informs applications of system theme change, and supports application theme change at runtime.
Applies various styles to Controls using the properties system.
On theme change, it automatically updates all controls, then raises a signal to inform the application.
The default theme is automatically loaded and applied, followed by any application specific theme defined in Application::New().
If the application wants to customize the theme, RequestThemeChange needs to be called.
To supply resource paths ( in json ) the following constant is available: APPLICATION_RESOURCE_PATH. It provides the path to the application resource root folder, from there the filename can an be specified along with any sub folders, e.g Images, Models etc. The APPLICATION_RESOURCE_PATH can be retrieved using Application::GetResourcePath()
Signals | Signal Name | Method | |------------------------------------------------------------| | styleChanged | StyleChangedSignal() |
Creates a StyleManager handle; this can be initialized with StyleManager::Get().
Calling member functions with an uninitialized handle is not allowed.
Destructor.
This is non-virtual since derived Handle types must not contain data or virtual methods.
void Dali::Toolkit::StyleManager::ApplyStyle | ( | Toolkit::Control | control, |
const std::string & | jsonFileName, | ||
const std::string & | styleName | ||
) |
Applies the specified style to the control.
[in] | control | The control to which to apply the style |
[in] | jsonFileName | The name of the JSON style file to apply. If a relative path is specified, then this is relative to the directory returned by Application::GetResourcePath() |
[in] | styleName | The name of the style within the JSON file to apply |
void Dali::Toolkit::StyleManager::ApplyTheme | ( | const std::string & | themeFile | ) |
Applies a new theme to the application. This will be merged on top of the default Toolkit theme.
If the application theme file doesn't style all controls that the application uses, then the default Toolkit theme will be used instead for those controls.
On application startup, it is suggested that the theme file name is passed to Application::New instead of using this API to prevent controls being styled more than once.
[in] | themeFile | If a relative path is specified, then this is relative to the directory returned by Application::GetResourcePath() |
static StyleManager Dali::Toolkit::StyleManager::Get | ( | ) | [static] |
Gets the singleton of StyleManager object.
bool Dali::Toolkit::StyleManager::GetStyleConstant | ( | const std::string & | key, |
Property::Value & | valueOut | ||
) |
Returns the style constant set for a specific key.
[in] | key | The key of the constant |
[out] | valueOut | The value of the constant if it exists |
void Dali::Toolkit::StyleManager::SetStyleConstant | ( | const std::string & | key, |
const Property::Value & | value | ||
) |
Sets a constant for use when building styles.
A constant is used in JSON files e.g. "myImage":"{RELATIVE_PATH}/image.jpg" where the string "{RELATIVE_PATH}" is substituted with the value.
[in] | key | The key of the constant |
[in] | value | The value of the constant |
This signal is emitted after the style (e.g. theme/font change) has changed and the controls have been informed.
void YourCallbackName( StyleManager styleManager, StyleChange change );