.\" This is a wxWidgets manpage page generated from the XML docs
.TH wxHtmlWindow 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation"
.SH NAME
wxHtmlWindow \-
HTML window class
.SH DESCRIPTION
wxHtmlWindow is probably the only class you will directly use unless you want
to do something special (like adding new tag handlers or MIME filters).
The purpose of this class is to display HTML pages (either local file or
downloaded via HTTP protocol) in a window. The width of the window is
constant - given in the constructor - and virtual height is changed
dynamically depending on page size. Once the window is created you can set
its content by calling
SetPage(text)
,
LoadPage(filename)
or
LoadFile
.
.SH NOTE
wxHtmlWindow uses the
wxImage
class for displaying images. Don't forget to initialize all image formats you need before loading any page! (See
wxInitAllImageHandlers
and
wxImage::AddHandler
.)
.SH "PARENTS"
wxScrolledWindow
.SH "INCLUDE FILES"
wx/html/htmlwin.h
.SH MEMBERS
.SS wxHtmlWindow ()
Default constructor.
.SS wxHtmlWindow (wxWindow *parentwxWindowID id = -1const wxPoint& pos = wxDefaultPositionconst wxSize& size = wxDefaultSizelong style = wxHW_DEFAULT_STYLEconst wxString& name = "htmlWindow")
Constructor. The parameters are the same as for the
wxScrolledWindow
constructor.
.SS static void AddFilter (wxHtmlFilter *filter)
Adds
input filter
to the static list of available filters. These filters are present by
default:
text/html
MIME type
image/*
MIME types
Plain Text filter (this filter is used if no other filter matches)
.SS bool AppendToPage (const wxString& source)
Appends HTML fragment to currently displayed text and refreshes the
window.
.SS wxHtmlContainerCell* GetInternalRepresentation ()
Returns pointer to the top-level container.
See also
Cells Overview
,
Printing Overview
.SS wxString GetOpenedAnchor ()
Returns anchor within currently opened page (see
GetOpenedPage
). If no page is opened or if the displayed page wasn't produced by call
to LoadPage, empty string is returned.
.SS wxString GetOpenedPage ()
Returns full location of the opened page. If no page is opened or if the
displayed page wasn't produced by call to LoadPage, empty string is
returned.
.SS wxString GetOpenedPageTitle ()
Returns title of the opened page or wxEmptyString if current page does not
contain
tag.
.SS wxFrame* GetRelatedFrame ()
Returns the related frame.
.SS bool HistoryBack ()
Moves back to the previous page. (each page displayed using
LoadPage
is stored in history list.)
.SS bool HistoryCanBack ()
Returns true if it is possible to go back in the history (i.e.
HistoryBack() won't fail).
.SS bool HistoryCanForward ()
Returns true if it is possible to go forward in the history (i.e.
HistoryBack() won't fail).
.SS void HistoryClear ()
Clears history.
.SS bool HistoryForward ()
Moves to next page in history.
.SS virtual bool LoadFile (const wxFileName& filename)
Loads HTML page from file and displays it.
.SS virtual bool LoadPage (const wxString& location)
Unlike SetPage this function first loads HTML page from
location
and then displays it. See example:
htmlwin->LoadPage("help/myproject/index.htm");
.SS virtual void OnCellClicked (wxHtmlCell *cellwxCoord xwxCoord yconst wxMouseEvent& event)
This method is called when a mouse button is clicked inside wxHtmlWindow.
The default behaviour is to call
OnLinkClicked
if the cell contains a hypertext link.
.SS virtual void OnCellMouseHover (wxHtmlCell *cellwxCoord xwxCoord y)
This method is called when a mouse moves over an HTML cell.
.SS virtual void OnLinkClicked (const wxHtmlLinkInfo& link)
Called when user clicks on hypertext link. Default behaviour is to call
LoadPage
and do nothing else.
Also see
wxHtmlLinkInfo
.
.SS virtual wxHtmlOpeningStatus OnOpeningURL (wxHtmlURLType typeconst wxString& urlwxString *redirect)
Called when an URL is being opened (either when the user clicks on a link
or an image is loaded). The URL will be opened only if OnOpeningURL
returns
wxHTML_OPEN
. This method is called by
wxHtmlParser::OpenURL
. You can override OnOpeningURL to selectively block some URLs (e.g. for
security reasons) or to redirect them elsewhere. Default behaviour is to
always return
wxHTML_OPEN
.
.SS virtual void OnSetTitle (const wxString& title)
Called on parsing
tag.
.SS virtual void ReadCustomization (wxConfigBase *cfgwxString path = wxEmptyString)
This reads custom settings from wxConfig. It uses the path 'path' if
given, otherwise it saves info into currently selected path. The values
are stored in sub-path
wxHtmlWindow
Read values: all things set by SetFonts, SetBorders.
.SS void SelectAll ()
Selects all text in the window.
.SS wxString SelectionToText ()
Returns current selection as plain text. Returns empty string if no text
is currently selected.
.SS void SelectLine (const wxPoint& pos)
Selects the line of text that
pos
points at. Note that
pos
is relative to the top of displayed page, not to window's origin, use
CalcUnscrolledPosition
to convert physical coordinate.
.SS void SelectWord (const wxPoint& pos)
Selects the word at position
pos
. Note that
pos
is relative to the top of displayed page, not to window's origin, use
CalcUnscrolledPosition
to convert physical coordinate.
.SS void SetBorders (int b)
This function sets the space between border of window and HTML contents.
See image:
\helponly{\image{}{border.bmp}}
.SS void SetFonts (const wxString& normal_faceconst wxString& fixed_faceconst int *sizes = NULL)
This function sets font sizes and faces.
\wxheading{Defaults}
Default font sizes are defined by constants wxHTML_FONT_SIZE_1,
wxHTML_FONT_SIZE_2, ..., wxHTML_FONT_SIZE_7. Note that they differ among
platforms. Default face names are empty strings.
.SS bool SetPage (const wxString& source)
Sets HTML page and display it. This won't
load
the page!! It will display the
source
. See example:
htmlwin -> SetPage("Hello, world!");
If you want to load a document from some location use
LoadPage
instead.
.SS void SetRelatedFrame (wxFrame* frameconst wxString& format)
Sets the frame in which page title will be displayed.
format
is format of frame title, e.g. "HtmlHelp : %s". It must contain
exactly one %s. This %s is substituted with HTML page title.
.SS void SetRelatedStatusBar (int bar)
After
calling
SetRelatedFrame
, this sets statusbar slot where messages will be displayed. (Default is
-1 = no messages.)
.SS wxString ToText ()
Returns content of currently displayed page as plain text.
.SS virtual void WriteCustomization (wxConfigBase *cfgwxString path = wxEmptyString)
Saves custom settings into wxConfig. It uses the path 'path' if given,
otherwise it saves info into currently selected path. Regardless of
whether the path is given or not, the function creates sub-path
wxHtmlWindow
.
Saved values: all things set by SetFonts, SetBorders.
.SH "WINDOW STYLES"
.SS wxHW_SCROLLBAR_NEVER
wxHW_SCROLLBAR_NEVER
.SS wxHW_SCROLLBAR_AUTO
wxHW_SCROLLBAR_AUTO
.SS wxHW_NO_SELECTION
wxHW_NO_SELECTION
.SH "SEE ALSO"
wxScrolledWindow
.SH "AUTHORS"
Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al
Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.