BiThemeManager

This singleton class is used for theme support in Bindows

This class extends BiEventTarget and therefore all methods and fields available for BiEventTarget are also available for BiThemeManager .

Constructor

new BiThemeManager ( )

Parameters

No parameters.

Properties

Name Type get set Descripton
defaultTheme BiTheme checked checked The theme that is currently being used
themes BiTheme[] checked This is an array containing the added themes.

Methods

Name Description
addAppearance This assigns the appearance to a component and adds event listeners that allows the look and feel to change based on the states
addAppearanceListeners This adds event listeners to the component so that the interactive appearance states are applied as needed.
addCssRule Adds a CSS rule to the document
addState Adds a pseudo state to the appearance for the given component. For example adding "active" to the component will result in taking the look of an active appearance the next time applyAppearance is called.
addTheme Adds a theme to the theme manager
applyAppearance Updates the appearance of the given component. This basically updates the CSS class name to reflect the current state.
getAppearanceStates This returns the states that the appearance supports
getAppearanceTag This returns a string that is added to the CSS class name for the element representing a component.
getCurrentState Returns the current state of the component
getHasInteractiveTheme This returns true if the given component has any interactive appearance states
getThemeStates This returns a hash (Object) containing the names of the interactive appearance states that the component has.
removeAppearanceListeners This removes event listeners from the component so that the interactive appearance states are no longer automatically applied.
removeCssRule Removes all CSS rule that matches the given selector
removeState Removes a pseudo state to the appearance for the given component.
removeTheme Removes a theme from the theme manager
setAppearance Makes the component use a certain appearance
setClassAppearance Makes all component of this class use a certain appearance
setStateValue Adds or removes a pseudo state from the appearance for the given component.

Events

Name Type Bubbles Descripton
themechanged BiEvent This event is fired when the default theme changes.

Static Methods

None.

Static Fields

None.

Remarks

Method Details

addAppearance

This assigns the appearance to a component and adds event listeners that allows the look and feel to change based on the states

Syntax

object.addAppearance
 (
 oComp
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to set the appearance on

Return Type

void

addAppearanceListeners

This adds event listeners to the component so that the interactive appearance states are applied as needed.

Syntax

object.addAppearanceListeners
 (
 oComp
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to add the event listeners to

Return Type

void

addCssRule

Adds a CSS rule to the document

Syntax

object.addCssRule
 (
 sSelector,sStyle
 )
 

Parameters

Name Type Optional Default Descripton
sSelector String The selector describing which elements the rule applies to
sStyle String The CSS text describing the style of the rule.

Return Type

void

addState

Adds a pseudo state to the appearance for the given component. For example adding "active" to the component will result in taking the look of an active appearance the next time applyAppearance is called.

Syntax

object.addState
 (
 oComp,sPseudo
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to add the appearance state to
sPseudo String The pseudo state to add to the appearance

Return Type

void

addTheme

Adds a theme to the theme manager

Syntax

object.addTheme
 (
 oTheme
 )
 

Parameters

Name Type Optional Default Descripton
oTheme BiTheme The theme object to add

Return Type

void

applyAppearance

Updates the appearance of the given component. This basically updates the CSS class name to reflect the current state.

Syntax

object.applyAppearance
 (
 oComp
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to apply the appearance to.

Return Type

void

getAppearanceStates

This returns the states that the appearance supports

Syntax

object.getAppearanceStates
 (
 sName
 )
 

Parameters

Name Type Optional Default Descripton
sName String The name of the appearance

Return Type

Number

getAppearanceTag

This returns a string that is added to the CSS class name for the element representing a component.

Syntax

object.getAppearanceTag
 (
 oComp
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to get the appearance tag for.

Return Type

String

getCurrentState

Returns the current state of the component

Syntax

object.getCurrentState
 (
 oComp
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to get the states for.

Return Type

Object

getHasInteractiveTheme

This returns true if the given component has any interactive appearance states

Syntax

object.getHasInteractiveTheme
 (
 oComp
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to test for interactive appearance.

Return Type

Boolean

getThemeStates

This returns a hash (Object) containing the names of the interactive appearance states that the component has.

Syntax

object.getThemeStates
 (
 oComp
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to get the theme states for.

Return Type

Object

removeAppearanceListeners

This removes event listeners from the component so that the interactive appearance states are no longer automatically applied.

Syntax

object.removeAppearanceListeners
 (
 oComp
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to remove the event listeners from

Return Type

void

removeCssRule

Removes all CSS rule that matches the given selector

Syntax

object.removeCssRule
 (
 sSelector
 )
 

Parameters

Name Type Optional Default Descripton
sSelector String The selector describing which rule to removee.

Return Type

void

removeState

Removes a pseudo state to the appearance for the given component.

Syntax

object.removeState
 (
 oComp,sPseudo
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to remove the appearance state from
sPseudo String The pseudo state to remove from the appearance

Return Type

void

removeTheme

Removes a theme from the theme manager

Syntax

object.removeTheme
 (
 oTheme
 )
 

Parameters

Name Type Optional Default Descripton
oTheme BiTheme The theme object to remove

Return Type

void

setAppearance

Makes the component use a certain appearance

Syntax

object.setAppearance
 (
 oComp,sName
 [
 ,bManual
 ]
 
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The compoent to set the appearance to
sName String The name of the appearance to use
bManual Boolean checked false Whether the component handles the events manually

Return Type

void

setClassAppearance

Makes all component of this class use a certain appearance

Syntax

object.setClassAppearance
 (
 fClass,sName
 [
 ,bManual
 ]
 
 )
 

Parameters

Name Type Optional Default Descripton
fClass Function The constructor function for the class
sName String The name of the appearance to use
bManual Boolean checked false Whether the component handles the events manually

Return Type

void

setStateValue

Adds or removes a pseudo state from the appearance for the given component.

Syntax

object.setStateValue
 (
 oComp,sPseudo,bAdd
 )
 

Parameters

Name Type Optional Default Descripton
oComp BiComponent The component to change the appearance state for
sPseudo String The pseudo state to add to/remove from the component
bAdd Boolean Whether to add or remove the pseudo state

Return Type

void