| Version: 3.2.8

Public Member Functions | Static Public Member Functions | List of all members
wxHtmlWinParser Class Reference
Class List by Category » HTML

`#include <wx/html/winpars.h>`

Inheritance diagram for wxHtmlWinParser:
[legend]

## 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...
wxHtmlContainerCell * | CloseContainer ()
| Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers). More...
virtual wxFont * | CreateCurrentFont ()
| Creates font based on current setting (see SetFontSize(), SetFontBold(), SetFontItalic(), SetFontFixed(), wxHtmlWinParser::SetFontUnderlined) and returns pointer to it. More...
const wxColour & | GetActualColor () 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...
wxHtmlContainerCell * | GetContainer () const
| Returns pointer to the currently opened container (see Cells and Containers). More...
wxDC * | GetDC ()
| Returns pointer to the DC used during parsing. More...
wxEncodingConverter * | GetEncodingConverter () 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 wxHtmlLinkInfo & | GetLink () const
| Returns actual hypertext link. More...
const wxColour & | GetLinkColor () const
| Returns the colour of hypertext link text. More...
wxFontEncoding | GetOutputEncoding () const
| Returns output encoding, i.e. More...
wxHtmlWindowInterface * | GetWindowInterface ()
| Returns associated window (wxHtmlWindow). More...
wxHtmlContainerCell * | OpenContainer ()
| 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...
wxHtmlContainerCell * | SetContainer (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...
wxFileSystem * | GetFS () const
| Returns pointer to the file system. More...
virtual wxObject * | GetProduct ()=0
| Returns product of parsing. More...
const wxString * | GetSource ()
| Returns pointer to the source being parsed. More...
virtual void | InitParser (const wxString &source)
| Setups the parser for parsing the source string. More...
virtual wxFSFile * | OpenURL (wxHtmlURLType type, const wxString &url) const
| Opens given URL and returns `wxFSFile` object that can be used to read data from it. More...
wxObject * | Parse (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::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

## ◆ AddModule()

static void wxHtmlWinParser::AddModule | ( | wxHtmlTagsModule * | module | ) |
| static

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

## ◆ CloseContainer()

wxHtmlContainerCell* wxHtmlWinParser::CloseContainer | ( |  | ) |

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

## ◆ CreateCurrentFont()

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.

## ◆ GetActualColor()

const wxColour& wxHtmlWinParser::GetActualColor | ( |  | ) | const

Returns actual text colour.

## ◆ GetAlign()

int wxHtmlWinParser::GetAlign | ( |  | ) | const

Returns default horizontal alignment.

## ◆ GetCharHeight()

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()`.

## ◆ GetCharWidth()

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()`.

## ◆ GetContainer()

wxHtmlContainerCell* wxHtmlWinParser::GetContainer | ( |  | ) | const

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

Common use:

m_WParser -> GetContainer() -> InsertCell(new ...);
wxHtmlWinParser::GetContainer
wxHtmlContainerCell * GetContainer() const
Returns pointer to the currently opened container (see Cells and Containers).

## ◆ GetDC()

wxDC* wxHtmlWinParser::GetDC | ( |  | ) |

Returns pointer to the DC used during parsing.

## ◆ GetEncodingConverter()

wxEncodingConverter* wxHtmlWinParser::GetEncodingConverter | ( |  | ) | const

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

## ◆ GetFontBold()

int wxHtmlWinParser::GetFontBold | ( |  | ) | const

Returns true if actual font is bold, false otherwise.

## ◆ GetFontFace()

wxString wxHtmlWinParser::GetFontFace | ( |  | ) | const

Returns actual font face name.

## ◆ GetFontFixed()

int wxHtmlWinParser::GetFontFixed | ( |  | ) | const

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

## ◆ GetFontItalic()

int wxHtmlWinParser::GetFontItalic | ( |  | ) | const

Returns true if actual font is italic, false otherwise.

## ◆ GetFontSize()

int wxHtmlWinParser::GetFontSize | ( |  | ) | const

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

## ◆ GetFontUnderlined()

int wxHtmlWinParser::GetFontUnderlined | ( |  | ) | const

Returns true if actual font is underlined, false otherwise.

## ◆ GetInputEncoding()

wxFontEncoding wxHtmlWinParser::GetInputEncoding | ( |  | ) | const

Returns input encoding.

## ◆ GetLink()

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.)

## ◆ GetLinkColor()

const wxColour& wxHtmlWinParser::GetLinkColor | ( |  | ) | const

Returns the colour of hypertext link text.

## ◆ GetOutputEncoding()

wxFontEncoding wxHtmlWinParser::GetOutputEncoding | ( |  | ) | const

Returns output encoding, i.e.

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

## ◆ GetWindowInterface()

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.

## ◆ OpenContainer()

wxHtmlContainerCell* wxHtmlWinParser::OpenContainer | ( |  | ) |

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

## ◆ SetActualColor()

void wxHtmlWinParser::SetActualColor | ( | const wxColour & | clr | ) |

Sets actual text colour.

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

## ◆ SetAlign()

void wxHtmlWinParser::SetAlign | ( | int | a | ) |

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

Alignment of newly opened container is set to this value.

## ◆ SetContainer()

wxHtmlContainerCell* wxHtmlWinParser::SetContainer | ( | wxHtmlContainerCell * | c | ) |

Allows you to directly set opened container.

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

## ◆ SetDC()

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.)

## ◆ SetFontBold()

void wxHtmlWinParser::SetFontBold | ( | int | x | ) |

Sets bold flag of actualfont.

x is either true of false.

## ◆ SetFontFace()

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).

## ◆ SetFontFixed()

void wxHtmlWinParser::SetFontFixed | ( | int | x | ) |

Sets fixed face flag of actualfont.

x is either true of false.

## ◆ SetFontItalic()

void wxHtmlWinParser::SetFontItalic | ( | int | x | ) |

Sets italic flag of actualfont.

x is either true of false.

## ◆ SetFonts()

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

Sets fonts.

See wxHtmlWindow::SetFonts for detailed description.

## ◆ SetFontSize()

void wxHtmlWinParser::SetFontSize | ( | int | s | ) |

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

## ◆ SetFontUnderlined()

void wxHtmlWinParser::SetFontUnderlined | ( | int | x | ) |

Sets underlined flag of actualfont.

x is either true of false.

## ◆ SetInputEncoding()

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.

## ◆ SetLink()

void wxHtmlWinParser::SetLink | ( | const wxHtmlLinkInfo & | link | ) |

Sets actual hypertext link.

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

## ◆ SetLinkColor()

void wxHtmlWinParser::SetLinkColor | ( | const wxColour & | clr | ) |

Sets colour of hypertext link.