Version: 3.0.3
wxHtmlWinParser Class Reference

#include <wx/html/winpars.h>

+ Inheritance diagram for wxHtmlWinParser:

Detailed Description

This class is derived from wxHtmlParser and its main goal is to parse HTML input so that it can be displayed in wxHtmlWindow.

It uses a special wxHtmlWinTagHandler.

Note
The product of parsing is a wxHtmlCell (resp. wxHtmlContainer) object.

Library:  wxHTML
Category:  HTML
See also
Tag Handlers

Public Member Functions

 wxHtmlWinParser (wxHtmlWindowInterface *wndIface=NULL)
 Constructor. More...
 
wxHtmlContainerCellCloseContainer ()
 Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers). More...
 
virtual wxFontCreateCurrentFont ()
 Creates font based on current setting (see SetFontSize(), SetFontBold(), SetFontItalic(), SetFontFixed(), wxHtmlWinParser::SetFontUnderlined) and returns pointer to it. More...
 
const wxColourGetActualColor () const
 Returns actual text colour. More...
 
int GetAlign () const
 Returns default horizontal alignment. More...
 
int GetCharHeight () const
 Returns (average) char height in standard font. More...
 
int GetCharWidth () const
 Returns average char width in standard font. More...
 
wxHtmlContainerCellGetContainer () const
 Returns pointer to the currently opened container (see Cells and Containers). More...
 
wxDCGetDC ()
 Returns pointer to the DC used during parsing. More...
 
wxEncodingConverterGetEncodingConverter () const
 Returns wxEncodingConverter class used to do conversion between the input encoding and the output encoding. More...
 
int GetFontBold () const
 Returns true if actual font is bold, false otherwise. More...
 
wxString GetFontFace () const
 Returns actual font face name. More...
 
int GetFontFixed () const
 Returns true if actual font is fixed face, false otherwise. More...
 
int GetFontItalic () const
 Returns true if actual font is italic, false otherwise. More...
 
int GetFontSize () const
 Returns actual font size (HTML size varies from -2 to +4) More...
 
int GetFontUnderlined () const
 Returns true if actual font is underlined, false otherwise. More...
 
wxFontEncoding GetInputEncoding () const
 Returns input encoding. More...
 
const wxHtmlLinkInfoGetLink () const
 Returns actual hypertext link. More...
 
const wxColourGetLinkColor () const
 Returns the colour of hypertext link text. More...
 
wxFontEncoding GetOutputEncoding () const
 Returns output encoding, i.e. More...
 
wxHtmlWindowInterfaceGetWindowInterface ()
 Returns associated window (wxHtmlWindow). More...
 
wxHtmlContainerCellOpenContainer ()
 Opens new container and returns pointer to it (see Cells and Containers). More...
 
void SetActualColor (const wxColour &clr)
 Sets actual text colour. More...
 
void SetAlign (int a)
 Sets default horizontal alignment (see wxHtmlContainerCell::SetAlignHor). More...
 
wxHtmlContainerCellSetContainer (wxHtmlContainerCell *c)
 Allows you to directly set opened container. More...
 
virtual void SetDC (wxDC *dc, double pixel_scale=1.0e+0)
 Sets the DC. More...
 
void SetFontBold (int x)
 Sets bold flag of actualfont. More...
 
void SetFontFace (const wxString &face)
 Sets current font face to face. More...
 
void SetFontFixed (int x)
 Sets fixed face flag of actualfont. More...
 
void SetFontItalic (int x)
 Sets italic flag of actualfont. More...
 
void SetFontSize (int s)
 Sets actual font size (HTML size varies from 1 to 7). More...
 
void SetFontUnderlined (int x)
 Sets underlined flag of actualfont. More...
 
void SetFonts (const wxString &normal_face, const wxString &fixed_face, const int *sizes=0)
 Sets fonts. More...
 
void SetInputEncoding (wxFontEncoding enc)
 Sets input encoding. More...
 
void SetLink (const wxHtmlLinkInfo &link)
 Sets actual hypertext link. More...
 
void SetLinkColor (const wxColour &clr)
 Sets colour of hypertext link. More...
 
- Public Member Functions inherited from wxHtmlParser
 wxHtmlParser ()
 Constructor. More...
 
virtual void AddTagHandler (wxHtmlTagHandler *handler)
 Adds handler to the internal list ( hash table) of handlers. More...
 
virtual void AddWord (const wxString &txt)
 Must be overwritten in derived class. More...
 
void DoParsing (const const_iterator &begin_pos, const const_iterator &end_pos)
 Parses the m_Source from begin_pos to end_pos - 1. More...
 
void DoParsing ()
 Parses the whole m_Source. More...
 
virtual void DoneParser ()
 This must be called after DoParsing(). More...
 
wxFileSystemGetFS () const
 Returns pointer to the file system. More...
 
virtual wxObjectGetProduct ()=0
 Returns product of parsing. More...
 
const wxStringGetSource ()
 Returns pointer to the source being parsed. More...
 
virtual void InitParser (const wxString &source)
 Setups the parser for parsing the source string. More...
 
virtual wxFSFileOpenURL (wxHtmlURLType type, const wxString &url) const
 Opens given URL and returns wxFSFile object that can be used to read data from it. More...
 
wxObjectParse (const wxString &source)
 Proceeds parsing of the document. More...
 
void PopTagHandler ()
 Restores parser's state before last call to PushTagHandler(). More...
 
void PushTagHandler (wxHtmlTagHandler *handler, const wxString &tags)
 Forces the handler to handle additional tags (not returned by wxHtmlTagHandler::GetSupportedTags). More...
 
void SetFS (wxFileSystem *fs)
 Sets the virtual file system that will be used to request additional files. More...
 
virtual void StopParsing ()
 Call this function to interrupt parsing from a tag handler. More...
 

Static Public Member Functions

static void AddModule (wxHtmlTagsModule *module)
 Adds module() to the list of wxHtmlWinParser tag handler. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wxHtmlParser
virtual void AddTag (const wxHtmlTag &tag)
 This may (and may not) be overwritten in derived class. More...
 

Constructor & Destructor Documentation

wxHtmlWinParser::wxHtmlWinParser ( wxHtmlWindowInterface wndIface = NULL)

Constructor.

Don't use the default one, use the constructor with wndIface parameter (wndIface is a pointer to interface object for the associated wxHtmlWindow or other HTML rendering window such as wxHtmlListBox).

Member Function Documentation

static void wxHtmlWinParser::AddModule ( wxHtmlTagsModule module)
static

Adds module() to the list of wxHtmlWinParser tag handler.

wxHtmlContainerCell* wxHtmlWinParser::CloseContainer ( )

Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers).

virtual wxFont* wxHtmlWinParser::CreateCurrentFont ( )
virtual

Creates font based on current setting (see SetFontSize(), SetFontBold(), SetFontItalic(), SetFontFixed(), wxHtmlWinParser::SetFontUnderlined) and returns pointer to it.

If the font was already created only a pointer is returned.

const wxColour& wxHtmlWinParser::GetActualColor ( ) const

Returns actual text colour.

int wxHtmlWinParser::GetAlign ( ) const

Returns default horizontal alignment.

int wxHtmlWinParser::GetCharHeight ( ) const

Returns (average) char height in standard font.

It is used as DC-independent metrics.

Note
This function doesn't return the actual height. If you want to know the height of the current font, call GetDC->GetCharHeight().
int wxHtmlWinParser::GetCharWidth ( ) const

Returns average char width in standard font.

It is used as DC-independent metrics.

Note
This function doesn't return the actual width. If you want to know the height of the current font, call GetDC->GetCharWidth().
wxHtmlContainerCell* wxHtmlWinParser::GetContainer ( ) const

Returns pointer to the currently opened container (see Cells and Containers).

Common use:

m_WParser -> GetContainer() -> InsertCell(new ...);
wxDC* wxHtmlWinParser::GetDC ( )

Returns pointer to the DC used during parsing.

wxEncodingConverter* wxHtmlWinParser::GetEncodingConverter ( ) const

Returns wxEncodingConverter class used to do conversion between the input encoding and the output encoding.

int wxHtmlWinParser::GetFontBold ( ) const

Returns true if actual font is bold, false otherwise.

wxString wxHtmlWinParser::GetFontFace ( ) const

Returns actual font face name.

int wxHtmlWinParser::GetFontFixed ( ) const

Returns true if actual font is fixed face, false otherwise.

int wxHtmlWinParser::GetFontItalic ( ) const

Returns true if actual font is italic, false otherwise.

int wxHtmlWinParser::GetFontSize ( ) const

Returns actual font size (HTML size varies from -2 to +4)

int wxHtmlWinParser::GetFontUnderlined ( ) const

Returns true if actual font is underlined, false otherwise.

wxFontEncoding wxHtmlWinParser::GetInputEncoding ( ) const

Returns input encoding.

const wxHtmlLinkInfo& wxHtmlWinParser::GetLink ( ) const

Returns actual hypertext link.

(This value has a non-empty wxHtmlLinkInfo::GetHref Href string if the parser is between <A> and </A> tags, wxEmptyString otherwise.)

const wxColour& wxHtmlWinParser::GetLinkColor ( ) const

Returns the colour of hypertext link text.

wxFontEncoding wxHtmlWinParser::GetOutputEncoding ( ) const

Returns output encoding, i.e.

closest match to document's input encoding that is supported by operating system.

wxHtmlWindowInterface* wxHtmlWinParser::GetWindowInterface ( )

Returns associated window (wxHtmlWindow).

This may be NULL! (You should always test if it is non-NULL. For example TITLE handler sets window title only if some window is associated, otherwise it does nothing.

wxHtmlContainerCell* wxHtmlWinParser::OpenContainer ( )

Opens new container and returns pointer to it (see Cells and Containers).

void wxHtmlWinParser::SetActualColor ( const wxColour clr)

Sets actual text colour.

Note: this DOESN'T change the colour! You must create wxHtmlColourCell yourself.

void wxHtmlWinParser::SetAlign ( int  a)

Sets default horizontal alignment (see wxHtmlContainerCell::SetAlignHor).

Alignment of newly opened container is set to this value.

wxHtmlContainerCell* wxHtmlWinParser::SetContainer ( wxHtmlContainerCell c)

Allows you to directly set opened container.

This is not recommended - you should use OpenContainer() wherever possible.

virtual void wxHtmlWinParser::SetDC ( wxDC dc,
double  pixel_scale = 1.0e+0 
)
virtual

Sets the DC.

This must be called before wxHtmlParser::Parse!

pixel_scale can be used when rendering to high-resolution DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in HTML are given in pixels – e.g. image sizes. 300x300 image would be only one inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)

void wxHtmlWinParser::SetFontBold ( int  x)

Sets bold flag of actualfont.

x is either true of false.

void wxHtmlWinParser::SetFontFace ( const wxString face)

Sets current font face to face.

This affects either fixed size font or proportional, depending on context (whether the parser is inside <TT> tag or not).

void wxHtmlWinParser::SetFontFixed ( int  x)

Sets fixed face flag of actualfont.

x is either true of false.

void wxHtmlWinParser::SetFontItalic ( int  x)

Sets italic flag of actualfont.

x is either true of false.

void wxHtmlWinParser::SetFonts ( const wxString normal_face,
const wxString fixed_face,
const int *  sizes = 0 
)

Sets fonts.

See wxHtmlWindow::SetFonts for detailed description.

void wxHtmlWinParser::SetFontSize ( int  s)

Sets actual font size (HTML size varies from 1 to 7).

void wxHtmlWinParser::SetFontUnderlined ( int  x)

Sets underlined flag of actualfont.

x is either true of false.

void wxHtmlWinParser::SetInputEncoding ( wxFontEncoding  enc)

Sets input encoding.

The parser uses this information to build conversion tables from document's encoding to some encoding supported by operating system.

void wxHtmlWinParser::SetLink ( const wxHtmlLinkInfo link)

Sets actual hypertext link.

Empty link is represented by wxHtmlLinkInfo with Href equal to wxEmptyString.

void wxHtmlWinParser::SetLinkColor ( const wxColour clr)

Sets colour of hypertext link.