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

NameTypegetsetDescripton
defaultThemeBiThemecheckedcheckedThe theme that is currently being used
themesBiTheme[]checkedThis is an array containing the added themes.

Methods

NameDescription
addAppearanceThis assigns the appearance to a component and adds event listeners that allows the look and feel to change based on the states
addAppearanceListenersThis adds event listeners to the component so that the interactive appearance states are applied as needed.
addCssRuleAdds a CSS rule to the document
addStateAdds 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.
addThemeAdds a theme to the theme manager
applyAppearanceUpdates the appearance of the given component. This basically updates the CSS class name to reflect the current state.
applyThemeApplys current theme to a component
getAppearanceStatesThis returns the states that the appearance supports
getAppearanceTagThis returns a string that is added to the CSS class name for the element representing a component.
getCurrentStateReturns the current state of the component
removeAppearanceListenersThis removes event listeners from the component so that the interactive appearance states are no longer automatically applied.
removeCssRuleRemoves all CSS rule that matches the given selector
removeStateRemoves a pseudo state to the appearance for the given component.
removeThemeRemoves a theme from the theme manager
setAppearanceMakes the component use a certain appearance
setClassAppearanceMakes all component of this class use a certain appearance
setStateValueAdds or removes a pseudo state from the appearance for the given component.

Events

NameTypeBubblesDescripton
themechangedBiEventThis event is fired when the default theme changes.

Static Methods

None.

Static Fields

None.

Remarks

None.

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

NameTypeOptionalDefaultDescripton
oCompBiComponentThe 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

NameTypeOptionalDefaultDescripton
oCompBiComponentThe component to add the event listeners to

Return Type

void

addCssRule

Adds a CSS rule to the document

Syntax

object.addCssRule ( sSelector,sStyle )

Parameters

NameTypeOptionalDefaultDescripton
sSelectorStringThe selector describing which elements the rule applies to
sStyleStringThe 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

NameTypeOptionalDefaultDescripton
oCompBiComponentThe component to add the appearance state to
sPseudoStringThe pseudo state to add to the appearance

Return Type

void

addTheme

Adds a theme to the theme manager

Syntax

object.addTheme ( oTheme )

Parameters

NameTypeOptionalDefaultDescripton
oThemeBiThemeThe 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

NameTypeOptionalDefaultDescripton
oCompBiComponentThe component to apply the appearance to.

Return Type

void

applyTheme

Applys current theme to a component

Syntax

object.applyTheme ( oComponent )

Parameters

NameTypeOptionalDefaultDescripton
oComponentBiComponentComponent to apply theme to

Return Type

void

getAppearanceStates

This returns the states that the appearance supports

Syntax

object.getAppearanceStates ( sName )

Parameters

NameTypeOptionalDefaultDescripton
sNameStringThe 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

NameTypeOptionalDefaultDescripton
oCompBiComponentThe component to get the appearance tag for.

Return Type

String

getCurrentState

Returns the current state of the component

Syntax

object.getCurrentState ( oComp )

Parameters

NameTypeOptionalDefaultDescripton
oCompBiComponentThe component to get the 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

NameTypeOptionalDefaultDescripton
oCompBiComponentThe 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

NameTypeOptionalDefaultDescripton
sSelectorStringThe 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

NameTypeOptionalDefaultDescripton
oCompBiComponentThe component to remove the appearance state from
sPseudoStringThe pseudo state to remove from the appearance

Return Type

void

removeTheme

Removes a theme from the theme manager

Syntax

object.removeTheme ( oTheme )

Parameters

NameTypeOptionalDefaultDescripton
oThemeBiThemeThe theme object to remove

Return Type

void

setAppearance

Makes the component use a certain appearance

Syntax

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

Parameters

NameTypeOptionalDefaultDescripton
oCompBiComponentThe compoent to set the appearance to
sNameStringThe name of the appearance to use
bManualBooleancheckedfalse 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

NameTypeOptionalDefaultDescripton
fClassFunctionThe constructor function for the class
sNameStringThe name of the appearance to use
bManualBooleancheckedfalse 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

NameTypeOptionalDefaultDescripton
oCompBiComponentThe component to change the appearance state for
sPseudoStringThe pseudo state to add to/remove from the component
bAddBooleanWhether to add or remove the pseudo state

Return Type

void