HTML::STYLE Class Reference

A style in an HTML document The style keeps track of which members are actually set. More...

#include <mi32/htmlstyle.h>

List of all members.

Classes

class  EDGE
class  SELECTOR

Public Types

enum  BACKGROUND_POS {
  BACKGROUND_POS_Numeric = 0, BACKGROUND_POS_Top, BACKGROUND_POS_Bottom, BACKGROUND_POS_Left,
  BACKGROUND_POS_Right, BACKGROUND_POS_Center
}
enum  BACKGROUND_REPEAT { BACKGROUND_Repeat = 0, BACKGROUND_NoRepeat, BACKGROUND_RepeatX, BACKGROUND_RepeatY }
enum  BORDER_COLLAPSE { BORDER_COLLAPSE_Separate = 0, BORDER_COLLAPSE_Collapse = 1 }
enum  CLEAR { CLEAR_None = 0, CLEAR_Left, CLEAR_Right, CLEAR_Both }
enum  CSSOVERFLOW { OVERFLOW_Visible = 0, OVERFLOW_Hidden }
enum  DISPLAY {
  DISPLAY_Inline = 0, DISPLAY_Block, DISPLAY_None, DISPLAY_InlineBlock,
  DISPLAY_ListItem, DISPLAY_Table, DISPLAY_TableRow, DISPLAY_TableHeaderGroup,
  DISPLAY_TableRowGroup, DISPLAY_TableFooterGroup, DISPLAY_TableColumn, DISPLAY_TableColumnGroup,
  DISPLAY_TableCell, DISPLAY_TableCaption, DISPLAY_Marker
}
enum  EMPTY_CELLS { EMPTY_CELLS_Hide = 0, EMPTY_CELLS_Show = 1 }
enum  FLOAT { FLOAT_None = 0, FLOAT_Left, FLOAT_Right }
enum  LISTPOSITION { LISTPOSITION_Outside = 0, LISTPOSITION_Inside }
enum  LISTTYPE {
  LISTTYPE_None = 0, LISTTYPE_Disc, LISTTYPE_Circle, LISTTYPE_Square,
  LISTTYPE_Decimal, LISTTYPE_LowerRoman, LISTTYPE_UpperRoman, LISTTYPE_LowerAlpha,
  LISTTYPE_UpperAlpha
}
enum  POSITION { POSITION_Static = 0, POSITION_Absolute, POSITION_Relative }
enum  PSEUDO {
  PSEUDO_None = 0, PSEUDO_CurrentState, PSEUDO_FirstChild, PSEUDO_Hover,
  PSEUDO_Active, PSEUDO_Link, PSEUDO_Visited, PSEUDO_Before,
  PSEUDO_After, PSEUDO_FirstLine, PSEUDO_FirstLetter, PSEUDO_NUMPSEUDO
}
enum  TEXT_TRANSFORM { TEXT_TRANSFORM_None = 0, TEXT_TRANSFORM_Capitalize, TEXT_TRANSFORM_UpperCase, TEXT_TRANSFORM_LowerCase }
enum  VALIGN {
  VALIGN_Baseline = 0, VALIGN_Auto, VALIGN_Sub, VALIGN_Super,
  VALIGN_Top, VALIGN_Middle, VALIGN_Bottom, VALIGN_TextTop,
  VALIGN_TextBottom, VALIGN_Numeric
}
enum  VISIBILITY { VISIBILITY_Inherit = 0, VISIBILITY_Visible = 1, VISIBILITY_Hidden }
enum  WHITESPACE { WHITESPACE_Normal = 0, WHITESPACE_NoWrap, WHITESPACE_Pre }

Public Member Functions

 STYLE (const STYLE &)
 STYLE (const char *selector=0, const char *css=0)
void AddRef ()
void Combine (const EDGE &rhs)
void Combine (const STYLE &rhs)
bool CompareSize (const STYLE &other) const
void GenerateCSS (MISTRING &css, bool bInline=true, char quote= '\'') const
const MISTRINGGetBackgroundImage () const
const MEASUREMENTGetBackgroundPosNumX () const
const MEASUREMENTGetBackgroundPosNumY () const
const ENUM< BACKGROUND_POS > & GetBackgroundPosX () const
const ENUM< BACKGROUND_POS > & GetBackgroundPosY () const
const ENUM< BACKGROUND_REPEAT > & GetBackgroundRepeat () const
const COLORGetBGColor () const
const ENUM< BORDER_COLLAPSE > & GetBorderCollapse () const
const MEASUREMENTGetBorderSpacing () const
const EDGEGetBottomEdge () const
const ENUM< CLEAR > & GetClear () const
const MISTRINGGetContent () const
const MISTRINGGetCounterIncrement () const
const MISTRINGGetCounterReset () const
const ENUM< MGUI::CURSORID > & GetCursor () const
const ENUM< DISPLAY > & GetDisplay () const
EDGEGetEdge (int num)
const EDGEGetEdge (int num) const
const ENUM< EMPTY_CELLS > & GetEmptyCells () const
const ENUM< FLOAT > & GetFloat () const
const MEASUREMENTGetFontSize () const
const MEASUREMENTGetHeight () const
const MEASUREMENTGetIndent () const
const EDGEGetLeftEdge () const
const MEASUREMENTGetLineHeight () const
const ENUM< LISTPOSITION > & GetListPosition () const
const MISTRINGGetListStyleImage () const
const ENUM< LISTTYPE > & GetListType () const
const MEASUREMENTGetMarkerOffset () const
const MEASUREMENTGetMeasurement (CSS_PROPERTY property) const
bool GetMinimizeWidth () const
const MISTRINGGetOpenTypeFeatures () const
const ENUM< CSSOVERFLOW > & GetOverflow () const
const ENUM< POSITION > & GetPosition () const
const MISTRINGGetQuotes () const
const EDGEGetRightEdge () const
const SELECTORGetSelector () const
INT32 GetTabStop () const
void GetTextStyle (TEXTSTYLE &TextStyle, MGD::CONTEXT *gc, const ELEMENT *Element) const
const TEXTSTYLEDIFFGetTextStyle () const
const ENUM< TEXT_TRANSFORM > & GetTextTransform () const
const EDGEGetTopEdge () const
const ENUM< VALIGN > & GetVAlign () const
const MEASUREMENTGetVAlignNum () const
const ENUM< VISIBILITY > & GetVisibility () const
const ENUM< WHITESPACE > & GetWhitespace () const
const MEASUREMENTGetWidth () const
INT32 GetZIndex () const
bool IsBGColorSet () const
bool IsInheritable () const
bool IsMinimizeWidthSet () const
bool IsShared () const
bool IsSpecialState () const
void Parse (const MISTRING &str)
bool ParseFont (const MISTRING &mistr)
bool ParseFontSize (const STRUTF8 &str)
bool ParseFontStyle (const STRUTF8 &str)
bool ParseFontVariant (const STRUTF8 &str)
bool ParseFontWeight (const STRUTF8 &str)
void ParseLineHeight (const STRUTF8 &str)
void ParseTildeCodes (const MISTRING &codes, MISTRING &UnhandledCodes)
void Release ()
void SetBGColor (const COLOR &color)
void SetTextStyle (const TEXTSTYLE &TextStyle)

Detailed Description

A style in an HTML document The style keeps track of which members are actually set.


Member Enumeration Documentation

Enumerator:
BACKGROUND_POS_Numeric 
BACKGROUND_POS_Top 
BACKGROUND_POS_Bottom 
BACKGROUND_POS_Left 
BACKGROUND_POS_Right 
BACKGROUND_POS_Center 
Enumerator:
BACKGROUND_Repeat 
BACKGROUND_NoRepeat 
BACKGROUND_RepeatX 
BACKGROUND_RepeatY 
Enumerator:
BORDER_COLLAPSE_Separate 
BORDER_COLLAPSE_Collapse 
Enumerator:
CLEAR_None 
CLEAR_Left 
CLEAR_Right 
CLEAR_Both 
Enumerator:
OVERFLOW_Visible 

(normal)

OVERFLOW_Hidden 

clipped

Enumerator:
DISPLAY_Inline 

Inline.

DISPLAY_Block 

Block layout.

DISPLAY_None 

Not visible. Don't even take up space.

DISPLAY_InlineBlock 

Object is rendered inline, but contents are rendered as a block element.

DISPLAY_ListItem 
DISPLAY_Table 
DISPLAY_TableRow 
DISPLAY_TableHeaderGroup 
DISPLAY_TableRowGroup 
DISPLAY_TableFooterGroup 
DISPLAY_TableColumn 
DISPLAY_TableColumnGroup 
DISPLAY_TableCell 
DISPLAY_TableCaption 
DISPLAY_Marker 
Enumerator:
EMPTY_CELLS_Hide 
EMPTY_CELLS_Show 
Enumerator:
FLOAT_None 
FLOAT_Left 
FLOAT_Right 
Enumerator:
LISTPOSITION_Outside 
LISTPOSITION_Inside 
Enumerator:
LISTTYPE_None 

Not a list item or no marker.

LISTTYPE_Disc 

Default: for lists.

LISTTYPE_Circle 

Outlined circles.

LISTTYPE_Square 

Solid Squares.

LISTTYPE_Decimal 

1, 2, 3 ...

LISTTYPE_LowerRoman 

i, ii, iii, ...

LISTTYPE_UpperRoman 

I, II, III, ...

LISTTYPE_LowerAlpha 

a, b, c, ...

LISTTYPE_UpperAlpha 

A, B, C, ...

Enumerator:
POSITION_Static 

(normal)

POSITION_Absolute 

object is positioned relative to parent's position, or to the body object if parent is not positioned.

POSITION_Relative 

object is positioned according to normal flow, then offset by top and left properties

Enumerator:
PSEUDO_None 
PSEUDO_CurrentState 

The base state.

PSEUDO_FirstChild 

Either None, Hover or Active, depending on current state.

PSEUDO_Hover 

:first-child

PSEUDO_Active 

:hover

PSEUDO_Link 

:active

PSEUDO_Visited 

:link

PSEUDO_Before 

:visited

PSEUDO_After 

:before

PSEUDO_FirstLine 

:after

PSEUDO_FirstLetter 

:first-line

PSEUDO_NUMPSEUDO 

:first-letter

Enumerator:
TEXT_TRANSFORM_None 
TEXT_TRANSFORM_Capitalize 
TEXT_TRANSFORM_UpperCase 
TEXT_TRANSFORM_LowerCase 
Enumerator:
VALIGN_Baseline 
VALIGN_Auto 

Aligns according to the layout-flow setting.

VALIGN_Sub 
VALIGN_Super 
VALIGN_Top 
VALIGN_Middle 
VALIGN_Bottom 
VALIGN_TextTop 
VALIGN_TextBottom 
VALIGN_Numeric 

Baseline set numerically, use GetVAlignNum() to get it.

Enumerator:
VISIBILITY_Inherit 

Inherit from parent element.

VISIBILITY_Visible 

Item is visible.

VISIBILITY_Hidden 

Item is not visible but still takes up space.

Enumerator:
WHITESPACE_Normal 

Default.

WHITESPACE_NoWrap 

Line breaks are suppressed.

WHITESPACE_Pre 

Whitespace is preserved.


Constructor & Destructor Documentation

HTML::STYLE::STYLE ( const char *  selector = 0,
const char *  css = 0 
)

ctor

HTML::STYLE::STYLE ( const STYLE  ) 

Member Function Documentation

void HTML::STYLE::AddRef (  ) 

Increment the refcount of this style.

void HTML::STYLE::Combine ( const EDGE rhs  ) 
void HTML::STYLE::Combine ( const STYLE rhs  ) 

Combine another style into this style.

The members of the rhs style which are set are copied into this style.

bool HTML::STYLE::CompareSize ( const STYLE other  )  const

See if this style would result in the same size as another style.

This compares fonts, positions, margins, padding, borders, etc. and returns true if the styles are the same in all those ways.

void HTML::STYLE::GenerateCSS ( MISTRING css,
bool  bInline = true,
char  quote = '\'' 
) const

Generate the CSS for this style.

If bInline is true (the default), it assumes that the resulting string should be all on one line and that the caller will enclose the string in quotes (caller can specify which type of quotes) If bInline is false, the style will be output on multiple lines in a form suitable for inclusion in a css file or style element.

const MISTRING& HTML::STYLE::GetBackgroundImage (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetBackgroundPosNumX (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetBackgroundPosNumY (  )  const [inline]
const ENUM<BACKGROUND_POS>& HTML::STYLE::GetBackgroundPosX (  )  const [inline]
const ENUM<BACKGROUND_POS>& HTML::STYLE::GetBackgroundPosY (  )  const [inline]
const ENUM<BACKGROUND_REPEAT>& HTML::STYLE::GetBackgroundRepeat (  )  const [inline]
const COLOR& HTML::STYLE::GetBGColor (  )  const [inline]
const ENUM<BORDER_COLLAPSE>& HTML::STYLE::GetBorderCollapse (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetBorderSpacing (  )  const [inline]
const EDGE& HTML::STYLE::GetBottomEdge (  )  const [inline]
const ENUM<CLEAR>& HTML::STYLE::GetClear (  )  const [inline]
const MISTRING& HTML::STYLE::GetContent (  )  const [inline]
const MISTRING& HTML::STYLE::GetCounterIncrement (  )  const [inline]
const MISTRING& HTML::STYLE::GetCounterReset (  )  const [inline]
const ENUM<MGUI::CURSORID>& HTML::STYLE::GetCursor (  )  const [inline]
const ENUM<DISPLAY>& HTML::STYLE::GetDisplay (  )  const [inline]
EDGE& HTML::STYLE::GetEdge ( int  num  ) 
Parameters:
num edge number 0-3 (don't assume anything about order)
const EDGE& HTML::STYLE::GetEdge ( int  num  )  const
Parameters:
num edge number 0-3 (don't assume anything about order)
const ENUM<EMPTY_CELLS>& HTML::STYLE::GetEmptyCells (  )  const [inline]
const ENUM<FLOAT>& HTML::STYLE::GetFloat (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetFontSize (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetHeight (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetIndent (  )  const [inline]
const EDGE& HTML::STYLE::GetLeftEdge (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetLineHeight (  )  const [inline]
const ENUM<LISTPOSITION>& HTML::STYLE::GetListPosition (  )  const [inline]
const MISTRING& HTML::STYLE::GetListStyleImage (  )  const [inline]
const ENUM<LISTTYPE>& HTML::STYLE::GetListType (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetMarkerOffset (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetMeasurement ( CSS_PROPERTY  property  )  const
bool HTML::STYLE::GetMinimizeWidth (  )  const [inline]
const MISTRING& HTML::STYLE::GetOpenTypeFeatures (  )  const [inline]
const ENUM<CSSOVERFLOW>& HTML::STYLE::GetOverflow (  )  const [inline]
const ENUM<POSITION>& HTML::STYLE::GetPosition (  )  const [inline]
const MISTRING& HTML::STYLE::GetQuotes (  )  const [inline]
const EDGE& HTML::STYLE::GetRightEdge (  )  const [inline]
const SELECTOR& HTML::STYLE::GetSelector (  )  const [inline]
INT32 HTML::STYLE::GetTabStop (  )  const [inline]
void HTML::STYLE::GetTextStyle ( TEXTSTYLE TextStyle,
MGD::CONTEXT gc,
const ELEMENT Element 
) const
const TEXTSTYLEDIFF& HTML::STYLE::GetTextStyle (  )  const [inline]
const ENUM<TEXT_TRANSFORM>& HTML::STYLE::GetTextTransform (  )  const [inline]
const EDGE& HTML::STYLE::GetTopEdge (  )  const [inline]
const ENUM<VALIGN>& HTML::STYLE::GetVAlign (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetVAlignNum (  )  const [inline]
const ENUM<VISIBILITY>& HTML::STYLE::GetVisibility (  )  const [inline]
const ENUM<WHITESPACE>& HTML::STYLE::GetWhitespace (  )  const [inline]
const MEASUREMENT& HTML::STYLE::GetWidth (  )  const [inline]
INT32 HTML::STYLE::GetZIndex (  )  const [inline]
bool HTML::STYLE::IsBGColorSet (  )  const [inline]
bool HTML::STYLE::IsInheritable (  )  const

Return true if everything set in this style can be inherited from a parent element.

Returns false if any of the non-inheritable parts are set.

bool HTML::STYLE::IsMinimizeWidthSet (  )  const [inline]
bool HTML::STYLE::IsShared (  )  const [inline]

Returns true if this style is shared by multiple elements.

bool HTML::STYLE::IsSpecialState (  )  const [inline]

Returns true if the style is for a PSEUDO state other than normal.

void HTML::STYLE::Parse ( const MISTRING str  ) 

Parse a bit of CSS into a style.

This can be the parts inside quotes on a style="" attribute of an html element, or the part of the style between { } in the <style> section.

bool HTML::STYLE::ParseFont ( const MISTRING mistr  ) 
bool HTML::STYLE::ParseFontSize ( const STRUTF8 str  ) 
bool HTML::STYLE::ParseFontStyle ( const STRUTF8 str  ) 
bool HTML::STYLE::ParseFontVariant ( const STRUTF8 str  ) 
bool HTML::STYLE::ParseFontWeight ( const STRUTF8 str  ) 
void HTML::STYLE::ParseLineHeight ( const STRUTF8 str  ) 
void HTML::STYLE::ParseTildeCodes ( const MISTRING codes,
MISTRING UnhandledCodes 
)

Convert a series of {~} codes to CSS styles.

Any codes not handled are returned in UnhandledCodes

void HTML::STYLE::Release (  ) 

Decrement the refcount of this style and delete it if no longer used.

Note: you cannot delete a STYLE directly. You *must* use AddRef() and Release()

void HTML::STYLE::SetBGColor ( const COLOR color  )  [inline]
void HTML::STYLE::SetTextStyle ( const TEXTSTYLE TextStyle  )  [inline]

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

Generated on Sun Oct 7 21:35:01 2012 for TNTsdk 2012 by  doxygen 1.6.1