qnx.fuse.ui.theme.ThemeBase

ThemeBase

Properties | Methods


Packageqnx.fuse.ui.theme
Classpublic class ThemeBase
InheritanceThemeBase Inheritance Object
Subclasses ThemeBlack, ThemeWhite

The ThemeBase provides the base functionality for any theme.

Class information:
BlackBerry 10 Version:   10.0.0



Protected Properties

 PropertyDefined By
  assetMapping : Dictionary
Stores a mapping that maps an asset to the class of the asset to be used.
ThemeBase
  oled : Boolean
ThemeBase

Public Methods

 MethodDefined By
  
ThemeBase(_css:CSS, _useOLED:Boolean = false)
Creates a ThemeBase instance.
ThemeBase
  
getCSS():CSS
Returns a CSS object that provides styles for components in your theme.
ThemeBase
  
getSkinAsset(identifier:String):DisplayObject
Returns an instance of the asset as defined in the assetMapping dictionary.
ThemeBase

Protected Methods

 MethodDefined By
  
Themes should override this method to provide a lookup of assets for their theme.
ThemeBase

Property Detail

assetMapping


protected var assetMapping:Dictionary

Stores a mapping that maps an asset to the class of the asset to be used.

See also

registerMapping()
getSkinAsset()

oled


protected var oled:Boolean

Constructor Detail

ThemeBase()


public function ThemeBase(_css:CSS, _useOLED:Boolean = false)

Creates a ThemeBase instance.

Parameters

_css:CSS — The CSS instance for the theme.
_useOLED:Boolean (default = false)

Method Detail

getCSS()


public function getCSS():CSS

Returns a CSS object that provides styles for components in your theme.

Returns

CSS — A CSS object that contains styles to apply to components in your theme.

getSkinAsset()


public function getSkinAsset(identifier:String):DisplayObject

Returns an instance of the asset as defined in the assetMapping dictionary.

This method uses the DisplayObjectUtils.getDisplayAsset() method to create the asset. This allows all bitmap assets to be cached so they are only created once. This helps greatly reduce the overall memory of your application as it allows for fewer instances to be created.

Parameters

identifier:String — The key of the asset.

Returns

DisplayObject — An instantiated asset.

Throws

Error — If the identifier key cannot be found in the assetMapping dictionary.

See also

qnx.fuse.ui.utils.DisplayObjectUtils.getDisplayAsset()

registerAssetMapping()


protected function registerAssetMapping():void

Themes should override this method to provide a lookup of assets for their theme.

For example, if you where creating a ThemeRed class this method might look like this.

override protected function registerAssetMapping():void 
{
    assetMapping[SkinAssetConstants.BUTTON_UP] = SkinAssets.ButtonUpRed;
    assetMapping[SkinAssetConstants.BUTTON_DOWN] = SkinAssets.ButtonDownRed;
    assetMapping[SkinAssetConstants.BUTTON_DISABLED] = SkinAssets.ButtonDisabledRed;
}
         





comments powered by Disqus