TKTheme Class Reference
[Core Classes]

Base class for all Toolkit themes. More...

Inheritance diagram for TKTheme:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 __construct ()
 INSERT BRIEF DESCRIPTION HERE.
 getDefault ($comp, $ctype, $prop)
 Retrieves default property value for a component/class.
 initComponent ($comp)
 Initializes component properties based on theme defaults.

Protected Member Functions

 inherit ($new, $old, $prop=true, $ctype= 'default')
 Inherits theme defaults from other components.
 initialize ()
 Override this method and set theme defaults in it.
 setThemeDefault ($comp, $ctype, $prop, $val=null)
 Sets the default value for this theme.


Detailed Description

Base class for all Toolkit themes.

For internal use only.

See Themes for more on creating themes

Definition at line 11 of file TKTheme.php5.


Constructor & Destructor Documentation

TKTheme::__construct (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Reimplemented from SObject.

Reimplemented in TKDefaultTheme.

Definition at line 14 of file TKTheme.php5.

References initialize().


Member Function Documentation

TKTheme::getDefault ( comp,
ctype,
prop 
)

Retrieves default property value for a component/class.

For internal use only.

The method first checks to see if there is an entry for the theme class of the given component. If not, it checks to see if the "default" theme class has an entry. If that doesn't, then it just returns false.

Parameters:
$comp [string]: name of component (e.g., 'TKButton')
$ctype [string]: theme class (e.g., 'small_button')
$prop [string]: default value for property to retrieve (e.g., 'inner_class')
Returns:
[mixed]: value of theme default for the component/class/property combo, or false if there is no default

Definition at line 32 of file TKTheme.php5.

Referenced by initComponent().

TKTheme::inherit ( new,
old,
prop = true,
ctype = 'default' 
) [protected]

Inherits theme defaults from other components.

For internal use only.

This function is useful for when you have derived a class from a TK class and need it to use the same theme settings. In that case, you would create your own theme and in the initialize() method of that theme class, after calling parent::initialize() you would have a series of inherit() calls to inherit the theme settings from the parent TK classes to your child TK classes.

Parameters:
$new [string]: name of new TK class (this class inherits from the old one)
$old [string]: name of TK class to inherit settings from
$prop [mixed]: property or list of properties to inherit, or true to inherit all (the default)
$ctype [string]: theme class to inherit; defaults to 'default'
Returns:
[boolean]: false if there is nothing to inherit, true otherwise

Definition at line 123 of file TKTheme.php5.

Referenced by TKDefaultTheme::initialize().

TKTheme::initComponent ( comp  ) 

Initializes component properties based on theme defaults.

For internal use only.

This method is called by TKComponent::render() to set up the properties of the component. It preserves the existing values of the properties while prepending the defaults, inasmuch as that makes sense given the type.

Parameters:
$comp [TKComponent]: component to initialize

Definition at line 54 of file TKTheme.php5.

References getDefault().

TKTheme::initialize (  )  [abstract, protected]

Override this method and set theme defaults in it.

For internal use only.

See TKDefaultTheme::initialize() for an example of what an initialize() method should look like. Note that if you derive from TKDefaultTheme (which you probably should), or another theme, you need to call parent::initialize() at the beginning of your initialize() method.

Reimplemented in TKDefaultTheme.

Referenced by __construct().

TKTheme::setThemeDefault ( comp,
ctype,
prop,
val = null 
) [protected]

Sets the default value for this theme.

For internal use only.

This function lets the theme set the default value for a given property of a given component for a given theme class of that component. For example, you can set the default css class of TKLabel. Or you can set the default css class of TKLabel if that label has a theme class named 'special'. So only TKLabel's that have a theme class of 'special' will get these defaults.

Note that defaults can be modified by setting the relevant properties on the object itself. To actually completely override the theme default, you must set the object's theme to null.

If you want to use the default theme class, just omit the theme class parameter altogether.

Parameters:
$comp [string]: name of component
$ctype [string]: name of theme class for component
$prop [string]: name of property to set
$val [mixed]: value to set property to

Definition at line 94 of file TKTheme.php5.

Referenced by TKDefaultTheme::initialize().


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:07:18 2010 for Common by  doxygen 1.5.6