Class: Theme

Theme

Theme

new GOWN.Theme(global)

Basic theming/skinning.
Name Type Default Description
global true optional Set theme as the global GOWN.theme

Members

static,readonlyGOWN.Theme.COMPLETEString

Dispatched when a theme texture has been loaded and all controls have an assigned skin

static,readonlyGOWN.Theme.LOADEDString

Dispatched when a theme texture has loaded

static,readonlyGOWN.Theme.SKIN_CHANGEDString

Dispatched when a skin has changed

hoverSkinbool

Desktop themes have a hover skin if the mouse moves over the button
Default Value:
  • true

textStyleGOWN.ThemeFont

The default font for all labels (e.g. button label)

textureCacheArray.<PIXI.Texture>

The cache for the theme textures

thumbSkinbool

Use an own skin for scroll/slider track (uses the default button skin otherwise)
Default Value:
  • true

Methods

staticGOWN.Theme.removeTheme()

Shortcut to remove the theme from the global context

addImage(jsonPath)

Set up the asset loader and load files
Name Type Description
jsonPath String The path to the json file

applyTheme()

Apply the theme to the controls (normally executed only once after the texture has been loaded)

getImage(name){function}

Create a new Sprite from an image name
Name Type Description
name String Id defined in the asset loader
Returns:
Type Description
function

getScaleContainer(name, grid, middleWidth, centerHeight){function}

Create a new Scalable Container
Name Type Description
name String Id defined in the asset loader
grid PIXI.Rectangle Grid defining the inner square of the scalable container
middleWidth Number optional The alternative width to crop the center piece (only needed if we want to scale the image smaller than the original)
centerHeight Number optional The alternative height to crop the center piece (only needed if we want to scale the image smaller than the original)
Returns:
Type Description
function

getSkin(comp, state){PIXI.DisplayObject}

Get a skin by a component name and state (or type)
Name Type Description
comp String Name of the component (e.g. button)
state String State or type of the skin (e.g. "up")
Returns:
Type Description
PIXI.DisplayObject

loadComplete(loader, resources)

Executed when the image has been loaded. Sets cache and emits events.
Name Type Description
loader Loader The loader
resources Object The loaded resources
See:
  • addImage
  • resource-loader https://github.com/englercj/resource-loader

setCache(resources)

Set the texture cache (normally called when loading is complete)
Name Type Description
resources Object The loaded resources

setSkin(comp, id, skin)

Set the skin for a UI component
Name Type Description
comp String UI component that we want to skin, e.g. "button"
id String Id for the skin (e.g. state when the skinning function will be applied
skin function skin-function that will executed once the component gets updated