Detailed Description

Holds a set of selector styles. A selector is something like .name or #name.

Public Member Functions

 StyleSheet (Document document)
 Creates an empty stylesheet that belongs to the given document. More...
 
 StyleSheet (Document document, string text)
 Creates a new stylesheet that belongs to the given document. Sets the given css text to it. More...
 
Css.SelectorStyle GetStyleBySelector (string selector)
 Attempts to get a style from this sheet by selector. More...
 
void AddModified (string selector, Css.SelectorStyle style)
 Adds a modified form of the given selector. E.g. style might be the input:hover style. That style is a modified form of the "input" selector. More...
 
List< Css.SelectorStyleGetModifiers (string selector)
 Gets all the modified forms of the given selector. E.g. selector could be "input", in which case there may be ":hover",":focus" etc. More...
 
SelectorStyle StartSelector (string selector, string modifier)
 Creates a new selector block for the given selector/modifier combo. More...
 
void ParseCss (string css)
 Keeps reading selectors and their properties until a > or the end of the css is reached. More...
 

Public Attributes

Document Document
 The html document that this sheet belongs to. More...
 
Dictionary< string, List
< Css.SelectorStyle > > 
ModifiedSelectors
 A lookup of the selectors that have modified forms. E.g. input:hover will add the selector to a key of "input". More...
 
Dictionary< string,
Css.SelectorStyle
Selectors =new Dictionary<string,Css.SelectorStyle>()
 A lookup of the selectors contained in this sheet to their parsed styles. More...
 

Private Member Functions

bool TryReadBlockComment (MLLexer lexer, char currentCharacter)
 Attempts to read a block comment from the given lexer. More...
 

Constructor & Destructor Documentation

PowerUI.Css.StyleSheet.StyleSheet ( Document  document)
inline

Creates an empty stylesheet that belongs to the given document.

Parameters
documentThe html document that this sheet belongs to.
PowerUI.Css.StyleSheet.StyleSheet ( Document  document,
string  text 
)
inline

Creates a new stylesheet that belongs to the given document. Sets the given css text to it.

Parameters
documentThe html document that this sheet belongs to.
textSome css text structured into selectors and their properties that should be set into this stylesheet.

Member Function Documentation

void PowerUI.Css.StyleSheet.AddModified ( string  selector,
Css.SelectorStyle  style 
)
inline

Adds a modified form of the given selector. E.g. style might be the input:hover style. That style is a modified form of the "input" selector.

Parameters
selectorThe modified selector, e.g. "input".
styleThe style.
List<Css.SelectorStyle> PowerUI.Css.StyleSheet.GetModifiers ( string  selector)
inline

Gets all the modified forms of the given selector. E.g. selector could be "input", in which case there may be ":hover",":focus" etc.

Parameters
selectorThe selector to search for.
Returns
The set of modified styles, if found. Null otherwise.
Css.SelectorStyle PowerUI.Css.StyleSheet.GetStyleBySelector ( string  selector)
inline

Attempts to get a style from this sheet by selector.

Parameters
selectorThe selector to lookup.
Returns
A style for the selector if its found; null otherwise.
void PowerUI.Css.StyleSheet.ParseCss ( string  css)
inline

Keeps reading selectors and their properties until a > or the end of the css is reached.

Parameters
cssThe css text to parse.
SelectorStyle PowerUI.Css.StyleSheet.StartSelector ( string  selector,
string  modifier 
)
inline

Creates a new selector block for the given selector/modifier combo.

bool PowerUI.Css.StyleSheet.TryReadBlockComment ( MLLexer  lexer,
char  currentCharacter 
)
inlineprivate

Attempts to read a block comment from the given lexer.

Parameters
lexerThe lexer to read it from.
currentCharacterThe next character in the lexer.
Returns
True if a block comment was read.

Member Data Documentation

Document PowerUI.Css.StyleSheet.Document

The html document that this sheet belongs to.

Dictionary<string,List<Css.SelectorStyle> > PowerUI.Css.StyleSheet.ModifiedSelectors

A lookup of the selectors that have modified forms. E.g. input:hover will add the selector to a key of "input".

Dictionary<string,Css.SelectorStyle> PowerUI.Css.StyleSheet.Selectors =new Dictionary<string,Css.SelectorStyle>()

A lookup of the selectors contained in this sheet to their parsed styles.