Detailed Description

Holds a set of css style properties.

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

Public Member Functions

 Style (Node element)
 Creates a new style for the given element. More...
 
 Style (string text, Node element)
 Creates a new style with the given css text string seperated by semicolons. More...
 
Style Clone ()
 Clone this style object. More...
 
string getPropertyValue (string property)
 JS API for getting property values. In PowerUI you can just use this[property] instead. More...
 
void CopyTo (Style otherStyle, StyleCopyMode mode)
 Copies this objects properties to the other given style, overwriting existing properties if told to do so. More...
 
void LoadProperties (CssLexer lexer, OnReadProperty onPropertyRead)
 Reads the properties for this style block from the lexer. Essentially treats it like a set of properties only. Terminated by }, null or >. More...
 
Value Get (string cssProperty)
 Gets the value of the given property, if any. More...
 
void CallChange (CssProperty property, Value value)
 Lets the sheet know that a value changed. Non-alias values here only. More...
 
virtual ComputedStyle GetComputed ()
 Gets the computed form of this style. More...
 
Css.Value Set (string cssProperty, string valueText)
 Sets the named property on this style to the given value. More...
 
void SetComposite (string cssProperty, Css.Value newValue, Css.Value composite)
 Sets a property from a composite set. Any new values that are null are set to the initial value and inherit the specifity from the composite value. More...
 
virtual void OnChanged (CssProperty property, Value newValue)
 called when the named property changes. More...
 
virtual string GetString (string cssProperty)
 Gets the given property as a css string. May optionally read the given inner index of it as a css string. More...
 
override string ToString ()
 

Static Public Member Functions

static Style Create (string properties, Node element)
 Creates a style from the given property block with the given parent. More...
 

Public Attributes

Node 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 Css.Value). Do not set values directly into this - use style[property]=value; instead to correctly handle aliases. More...
 

Package Functions

Css.Value GetBaseValue (CssProperty property)
 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...
 

Properties

ReflowDocument document [get]
 The document containing this style. More...
 
string cssText [get, 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...
 
virtual Value this[CssProperty property] [get, set]
 Gets or sets the parsed value of this style by property name. More...
 

Constructor & Destructor Documentation

Css.Style.Style ( Node  element)
inline

Creates a new style for the given element.

Parameters
elementThe element this style is for.
Css.Style.Style ( string  text,
Node  element 
)
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

void Css.Style.CallChange ( CssProperty  property,
Value  value 
)
inline

Lets the sheet know that a value changed. Non-alias values here only.

Style Css.Style.Clone ( )
inline

Clone this style object.

void Css.Style.CopyTo ( Style  otherStyle,
StyleCopyMode  mode 
)
inline

Copies this objects properties to the other given style, overwriting existing properties if told to do so.

Parameters
otherStyleThe style to copy this objects properties into.
overwriteTrue if existing properties should be overwriten.
static Style Css.Style.Create ( string  properties,
Node  element 
)
inlinestatic

Creates a style from the given property block with the given parent.

Value 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.
Css.Value Css.Style.GetBaseValue ( CssProperty  property)
inlinepackage

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). Never an 'inherit' or 'initial' keyword.
virtual ComputedStyle Css.Style.GetComputed ( )
inlinevirtual

Gets the computed form of this style.

Returns
The computed style.

Reimplemented in Css.ElementStyle.

string Css.Style.getPropertyValue ( string  property)
inline

JS API for getting property values. In PowerUI you can just use this[property] instead.

virtual string Css.Style.GetString ( string  cssProperty)
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 Css.ElementStyle.

void Css.Style.LoadProperties ( CssLexer  lexer,
OnReadProperty  onPropertyRead 
)
inline

Reads the properties for this style block from the lexer. Essentially treats it like a set of properties only. Terminated by }, null or >.

virtual void 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 Css.ElementStyle.

Css.Value Css.Style.Set ( string  cssProperty,
string  valueText 
)
inline

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

Parameters
cssPropertyThe property to set or overwrite. e.g. "display".
valueThe value to set the property to, e.g. "none".
void Css.Style.SetComposite ( string  cssProperty,
Css.Value  newValue,
Css.Value  composite 
)
inline

Sets a property from a composite set. Any new values that are null are set to the initial value and inherit the specifity from the composite value.

override string Css.Style.ToString ( )
inline

Member Data Documentation

Node Css.Style.Element

The element that this style belongs to, if any.

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

The mapping of css property (e.g. display) to value ("none" as a Css.Value). Do not set values directly into this - use style[property]=value; instead to correctly handle aliases.

Property Documentation

string Css.Style.cssText
getset

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

ReflowDocument Css.Style.document
get

The document containing this style.

virtual Value 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 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.