- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
IBroadcastEventReceiver
IButtonControl
INamingContainer
IPageStatePersister
IPostBackDataHandler
IPostBackEventHandler
ISurroundable
ITemplate
ITheme
IValidatable
IValidator
TBroadcastEventParameter
TCachePageStatePersister
TClientScriptManager
TClientSideOptions
TCommandEventParameter
TCompositeControl
TCompositeLiteral
TControl
TControlAdapter
TControlCollection
TEmptyControlCollection
TForm
THead
THtmlWriter
TPage
TPageStateFormatter
TPageStatePersister
TSessionPageStatePersister
TTemplate
TTemplateControl
TTemplateManager
TTextProcessor
TTheme
TThemeManager

Keyword

# Class TTheme

    TComponent
       |
       --TApplicationComponent
          |
          --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.

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Constructor Summary
public | __construct Array Constructor.

Method Summary
boolean | applySkin ( TControl $control) Applies the theme to a particular control.
string | getBasePath ()
string | getBaseUrl ()
array | getJavaScriptFiles ()
string | getName ()
array | getSkins ()
array | getStyleSheetFiles ()
protected void | setBasePath ( string $value)
protected void | setBaseUrl ( string $value)
protected void | setJavaScriptFiles ( array $value)
protected void | setName ( string $value)
protected void | setSkins ( array $value)
protected void | setStyleSheetFiles ( array $value)

Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()

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::__get(), TComponent::__set()

Constant Summary
string | SKIN_FILE_EXT | Extension name of skin files
string | THEME_CACHE_PREFIX | prefix for cache variable name used to store parsed themes

Constructor Details

## __construct

public __construct | Array

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

public string getName | ()

Output
string | theme name
Exception

## getSkins

public array 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:'