Detailed Description

Holds a set of css style properties.

Inheritance diagram for PowerUI.Css.Style:
PowerUI.Css.ComputedStyle PowerUI.Css.ElementStyle PowerUI.Css.ElementStyle PowerUI.Css.SelectorStyle

Public Member Functions

 Style (Element element)
 Creates a new style for the given element. More...
 
 Style ()
 Creates a new, empty style definition. More...
 
 Style (string text)
 Creates a new style with the given css text string seperated by semicolons. More...
 
void SetDirect (string property, string value)
 Directly sets the named property to the given value. Note that this does not refresh the style onscreen in anyway - it simply writes the new property value. Internal to the layout engine only. More...
 
Value Get (string cssProperty)
 Gets the value of the given property, if any. More...
 
void Set (string property, string value)
 Sets the named property on this style to the given value. More...
 
virtual ComputedStyle GetComputed ()
 Gets the computed form of this style. More...
 
Css.Value GetRawValue (CssProperty property, ValueType type)
 Gets or creates the base value for the given property. The base value is essentially the value held directly in this style sheet. E.g. if the value you're setting is the R channel of color-overlay, this sets up the color-overlay value for you. More...
 
virtual void OnChanged (CssProperty property, Value newValue)
 called when the named property changes. More...
 
virtual string GetString (string cssProperty, int innerIndex)
 Gets the given property as a css string. May optionally read the given inner index of it as a css string. More...
 
virtual string GetString (string cssProperty)
 Gets the given property as a css string. More...
 

Public Attributes

Element Element
 The element that this style belongs to, if any. More...
 
Dictionary< CssProperty, ValueProperties =new Dictionary<CssProperty,Value>()
 The mapping of css property (e.g. display) to value ("none" as a PowerUI.Css.Value). More...
 

Static Public Attributes

static char[] Delimiter =new char[]{':'}
 The delimiter that seperates the property name from its value in css. More...
 

Properties

string cssText [set]
 Sets the css text of this style as a css string seperated by semicolons (;). More...
 
Value this[string cssProperty] [get, set]
 Gets or sets the parsed value of this style by property name. More...
 
Value this[CssProperty property] [get, set]
 Gets or sets the parsed value of this style by property name. More...
 

Private Member Functions

void Set (string cssProperty, string value, int innerIndex, bool important)
 Sets the named property on this style to the given value. An inner value may be set; For example, setting the red component of color-overlay (color-overlay-r) becomes color-overlay and an innerIndex of 0. More...
 

Constructor & Destructor Documentation

PowerUI.Css.Style.Style ( Element  element)
inline

Creates a new style for the given element.

Parameters
elementThe element this style is for.
PowerUI.Css.Style.Style ( )
inline

Creates a new, empty style definition.

PowerUI.Css.Style.Style ( string  text)
inline

Creates a new style with the given css text string seperated by semicolons.

Parameters
textA css text string to apply to this style.

Member Function Documentation

Value PowerUI.Css.Style.Get ( string  cssProperty)
inline

Gets the value of the given property, if any.

Parameters
cssPropertyThe property to get the value of, e.g. "display".
Returns
The value of the property if found. Null otherwise.
virtual ComputedStyle PowerUI.Css.Style.GetComputed ( )
inlinevirtual

Gets the computed form of this style.

Returns
The computed style.

Reimplemented in PowerUI.Css.ElementStyle.

Css.Value PowerUI.Css.Style.GetRawValue ( CssProperty  property,
ValueType  type 
)
inline

Gets or creates the base value for the given property. The base value is essentially the value held directly in this style sheet. E.g. if the value you're setting is the R channel of color-overlay, this sets up the color-overlay value for you.

Returns
The raw value (which may have just been created).
virtual string PowerUI.Css.Style.GetString ( string  cssProperty,
int  innerIndex 
)
inlinevirtual

Gets the given property as a css string. May optionally read the given inner index of it as a css string.

Parameters
propertyThe property to get as a string.
innerIndexThe inner value to get from the property. -1 for the whole property.
Returns
The property as a css string, e.g. color-overlay may return "#ffffff".

Reimplemented in PowerUI.Css.ElementStyle.

virtual string PowerUI.Css.Style.GetString ( string  cssProperty)
inlinevirtual

Gets the given property as a css string.

Parameters
propertyThe property to get as a string.
Returns
The property as a css string, e.g. color-overlay may return "#ffffff".

Reimplemented in PowerUI.Css.ElementStyle.

virtual void PowerUI.Css.Style.OnChanged ( CssProperty  property,
Value  newValue 
)
inlinevirtual

called when the named property changes.

Parameters
propertyThe property that changed.
newValueIt's new fully parsed value. May be null.

Reimplemented in PowerUI.Css.SelectorStyle, and PowerUI.Css.ElementStyle.

void PowerUI.Css.Style.Set ( string  property,
string  value 
)
inline

Sets the named property on this style to the given value.

Parameters
propertyThe property to set or overwrite. e.g. "display".
valueThe value to set the property to, e.g. "none".
void PowerUI.Css.Style.Set ( string  cssProperty,
string  value,
int  innerIndex,
bool  important 
)
inlineprivate

Sets the named property on this style to the given value. An inner value may be set; For example, setting the red component of color-overlay (color-overlay-r) becomes color-overlay and an innerIndex of 0.

Parameters
propertyThe property to set or overwrite. e.g. "display".
valueThe value to set the property to, e.g. "none".
innerIndexThe index of the inner value to set, if any. -1 to set the whole property.
void PowerUI.Css.Style.SetDirect ( string  property,
string  value 
)
inline

Directly sets the named property to the given value. Note that this does not refresh the style onscreen in anyway - it simply writes the new property value. Internal to the layout engine only.

Parameters
propertyThe property to set the value of.
valueThe new value for the property.

Member Data Documentation

char [] PowerUI.Css.Style.Delimiter =new char[]{':'}
static

The delimiter that seperates the property name from its value in css.

Element PowerUI.Css.Style.Element

The element that this style belongs to, if any.

Dictionary<CssProperty,Value> PowerUI.Css.Style.Properties =new Dictionary<CssProperty,Value>()

The mapping of css property (e.g. display) to value ("none" as a PowerUI.Css.Value).

Property Documentation

string PowerUI.Css.Style.cssText
set

Sets the css text of this style as a css string seperated by semicolons (;).

Value PowerUI.Css.Style.this[CssProperty property]
getset

Gets or sets the parsed value of this style by property name.

Parameters
propertyThe property to get the value for.
Value PowerUI.Css.Style.this[string cssProperty]
getset

Gets or sets the parsed value of this style by property name.

Parameters
propertyThe property to get the value for.