Class TTheme
TTheme class
TTheme represents a particular theme. It is merely a collection of skins that are applicable to the corresponding controls. Each theme is stored as a directory and files under that directory. The theme name is the directory name. When TTheme is created, the files whose name has the extension ".skin" are parsed and saved as controls skins. A skin is essentially a list of initial property values that are to be applied to a control when the skin is applied. Each type of control can have multiple skins identified by the SkinID. If a skin does not have SkinID, it is the default skin that will be applied to controls that do not specify particular SkinID. Whenever possible, TTheme will try to make use of available cache to save the parsing time. To apply a theme to a particular control, call applySkin.
| Constructor Summary |
| public |
Constructor.
|
| Method Summary |
|
boolean
|
Applies the theme to a particular control.
|
|
string
|
|
|
string
|
|
|
array
|
|
|
string
|
|
|
array
|
|
|
array
|
|
|
protected
void
|
|
|
protected
void
|
|
|
protected
void
|
|
|
protected
void
|
|
|
protected
void
|
|
|
protected
void
|
|
| Methods Inherited From TComponent |
|
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__call(), TComponent::__get(), TComponent::__set(), TComponent::__sleep(), TComponent::__wakeup()
|
| Constructor Details |
__construct
Constructor.
Throws:
TConfigurationException if theme path does not exist or any parsing error of the skin files
|
| Method Details |
applySkin
| public boolean applySkin |
(TControl $control ) |
Applies the theme to a particular control.
The control's class name and SkinID value will be used to identify which skin to be applied. If the control's SkinID is empty, the default skin will be applied.
| Input |
| TControl | $control | the control to be applied with a skin |
| Output |
|
boolean
| if a skin is successfully applied |
| Exception |
| throws | TConfigurationException if any error happened during the skin application |
|
getBasePath
| public string getBasePath |
() |
| Output |
|
string
| the file path to the theme folder |
| Exception |
|
getBaseUrl
| public string getBaseUrl |
() |
| Output |
|
string
| the URL to the theme folder (without ending slash) |
| Exception |
|
getJavaScriptFiles
| public array getJavaScriptFiles |
() |
| Output |
|
array
| list of Javascript files (URL) in the theme |
| Exception |
|
getName
| Output |
|
string
| theme name |
| Exception |
|
getSkins
| Output |
|
array
| list of skins for the theme |
| Exception |
|
getStyleSheetFiles
| public array getStyleSheetFiles |
() |
| Output |
|
array
| list of CSS files (URL) in the theme |
| Exception |
|
setBasePath
| protected void setBasePath |
(string $value ) |
| Input |
| string | $value | tthe file path to the theme folder |
| Output |
| Exception |
|
setBaseUrl
| protected void setBaseUrl |
(string $value ) |
| Input |
| string | $value | the URL to the theme folder |
| Output |
| Exception |
|
setJavaScriptFiles
| protected void setJavaScriptFiles |
(array $value ) |
| Input |
| array | $value | list of Javascript files (URL) in the theme |
| Output |
| Exception |
|
setName
| protected void setName |
(string $value ) |
| Input |
| string | $value | theme name |
| Output |
| Exception |
|
setSkins
| protected void setSkins |
(array $value ) |
| Input |
| array | $value | list of skins for the theme |
| Output |
| Exception |
|
setStyleSheetFiles
| protected void setStyleSheetFiles |
(array $value ) |
| Input |
| array | $value | list of CSS files (URL) in the theme |
| Output |
| Exception |
|
| Constant Details |
SKIN_FILE_EXT
Extension name of skin files
Type:
string
Value:
'.skin'
|
THEME_CACHE_PREFIX
prefix for cache variable name used to store parsed themes
Type:
string
Value:
'prado:theme:'
|
|