wxRuby Documentation Home

# Wx::HtmlWinParser

This class is derived from HtmlParser and
its main goal is to parse HTML input so that it can be displayed in
HtmlWindow. It uses a special
HtmlWinTagHandler.

## Notes

The product of parsing is a HtmlCell (resp. HtmlContainer) object.

## Derived from

HtmlParser

## See Also

Handlers overview

## Methods

- HtmlWinParser.new
- HtmlWinParser#add_module
- HtmlWinParser#close_container
- HtmlWinParser#create_current_font
- HtmlWinParser#get_actual_color
- HtmlWinParser#get_align
- HtmlWinParser#get_char_height
- HtmlWinParser#get_char_width
- HtmlWinParser#get_container
- HtmlWinParser#get_dc
- HtmlWinParser#get_encoding_converter
- HtmlWinParser#get_font_bold
- HtmlWinParser#get_font_face
- HtmlWinParser#get_font_fixed
- HtmlWinParser#get_font_italic
- HtmlWinParser#get_font_size
- HtmlWinParser#get_font_underlined
- HtmlWinParser#get_input_encoding
- HtmlWinParser#get_link
- HtmlWinParser#get_link_color
- HtmlWinParser#get_output_encoding
- HtmlWinParser#get_window
- HtmlWinParser#open_container
- HtmlWinParser#set_actual_color
- HtmlWinParser#set_align
- HtmlWinParser#set_container
- HtmlWinParser#set_dc
- HtmlWinParser#set_font_bold
- HtmlWinParser#set_font_face
- HtmlWinParser#set_font_fixed
- HtmlWinParser#set_font_italic
- HtmlWinParser#set_font_size
- HtmlWinParser#set_font_underlined
- HtmlWinParser#set_fonts
- HtmlWinParser#set_input_encoding
- HtmlWinParser#set_link
- HtmlWinParser#set_link_color

### HtmlWinParser.new

HtmlWinParser.new(%(arg-type)HtmlWindow% wnd)

Constructor. Don’t use the default one, use constructor with
wnd parameter (wnd is pointer to associated HtmlWindow)

### HtmlWinParser#add_module

add_module(%(arg-type)HtmlTagsModule% module)

Adds module to the list of HtmlWinParser tag handler.

### HtmlWinParser#close_container

HtmlContainerCell close_container()

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

### HtmlWinParser#create_current_font

Font create_current_font()

Creates font based on current setting (see
set_font_size,
set_font_bold,
set_font_italic,
set_font_fixed,
set_font_underlined)
and returns pointer to it.
If the font was already created only a pointer is returned.

### HtmlWinParser#get_actual_color

Colour get_actual_color()

Returns actual text colour.

### HtmlWinParser#get_align

Integer get_align()

Returns default horizontal alignment.

### HtmlWinParser#get_char_height

Integer get_char_height()

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

### HtmlWinParser#get_char_width

Integer get_char_width()

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

### HtmlWinParser#get_container

HtmlContainerCell get_container()

Returns pointer to the currently opened container (see Overview).
Common use:

m_WParser → GetContainer() → InsertCell(new …);

### HtmlWinParser#get_dc

DC get_dc()

Returns pointer to the DC used during parsing.

### HtmlWinParser#get_encoding_converter

EncodingConverter get_encoding_converter()

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

### HtmlWinParser#get_font_bold

Integer get_font_bold()

Returns true if actual font is bold, false otherwise.

### HtmlWinParser#get_font_face

String get_font_face()

Returns actual font face name.

### HtmlWinParser#get_font_fixed

Integer get_font_fixed()

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

### HtmlWinParser#get_font_italic

Integer get_font_italic()

Returns true if actual font is italic, false otherwise.

### HtmlWinParser#get_font_size

Integer get_font_size()

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

### HtmlWinParser#get_font_underlined

Integer get_font_underlined()

Returns true if actual font is underlined, false otherwise.

### HtmlWinParser#get_input_encoding

FontEncoding get_input_encoding()

Returns input encoding.

### HtmlWinParser#get_link

HtmlLinkInfo get_link()

Returns actual hypertext link. (This value has a non-empty
Href string
if the parser is between `<A>` and `</A>` tags,
EmptyString otherwise.)

### HtmlWinParser#get_link_color

Colour get_link_color()

Returns the colour of hypertext link text.

### HtmlWinParser#get_output_encoding

FontEncoding get_output_encoding()

Returns output encoding, i.e. closest match to document’s input encoding
that is supported by operating system.

### HtmlWinParser#get_window

HtmlWindow get_window()

Returns associated window (HtmlWindow). 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)

### HtmlWinParser#open_container

HtmlContainerCell open_container()

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

### HtmlWinParser#set_actual_color

set_actual_color(%(arg-type)Colour% clr)

Sets actual text colour. Note: this DOESN’T change the colour!
You must create HtmlColourCell yourself.

### HtmlWinParser#set_align

set_align(%(arg-type)Integer% a)

Sets default horizontal alignment (see
HtmlContainerCell#set_align_hor.)
Alignment of newly opened container is set to this value.

### HtmlWinParser#set_container

HtmlContainerCell set_container(%(arg-type)HtmlContainerCell% c)

Allows you to directly set opened container. This is not recommended – you should use OpenContainer
wherever possible.

### HtmlWinParser#set_dc

set_dc(%(arg-type)DC% dc, Float pixel_scale = 1.0)

Sets the DC. This must be called before 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. 300×300 image would be only one
inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)

### HtmlWinParser#set_font_bold

set_font_bold(%(arg-type)Integer% x)

Sets bold flag of actualfont. x is either true of false.

### HtmlWinParser#set_font_face

set_font_face(%(arg-type)String% 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).

### HtmlWinParser#set_font_fixed

set_font_fixed(%(arg-type)Integer% x)

Sets fixed face flag of actualfont. x is either true of false.

### HtmlWinParser#set_font_italic

set_font_italic(%(arg-type)Integer% x)

Sets italic flag of actualfont. x is either true of false.

### HtmlWinParser#set_font_size

set_font_size(%(arg-type)Integer% s)

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

### HtmlWinParser#set_font_underlined

set_font_underlined(%(arg-type)Integer% x)

Sets underlined flag of actualfont. x is either true of false.

### HtmlWinParser#set_fonts

set_fonts(%(arg-type)String% normal_face, String fixed_face, Integer sizes = nil)

Sets fonts. See HtmlWindow#set_fonts for
detailed description.

### HtmlWinParser#set_input_encoding

set_input_encoding(%(arg-type)FontEncoding% enc)

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

### HtmlWinParser#set_link

set_link(%(arg-type)HtmlLinkInfo% link)

Sets actual hypertext link. Empty link is represented
by HtmlLinkInfo with Href equal
to EmptyString.

### HtmlWinParser#set_link_color

set_link_color(%(arg-type)Colour% clr)

Sets colour of hypertext link.

[This page automatically generated from the Textile source at 2023-06-09 00:45:25 +0000]