HtmlWindow is a widget for displaying simple HTML. IT supports key HTML
features like links, images, tables and headings, but does not support
all the features of modern browsers such as CSS and Javascript. It’s well
suited for creating hypertext-based applications, but not for creating a
complete web browser.
Once the window is created you can set its content by calling
set_page,
load_page or
load_file. The width of the window is
constant – given in the constructor – and virtual height is changed
dynamically depending on page size.
HW_SCROLLBAR_NEVER |
Never display scrollbars, noteven when the page is larger than the window. |
HW_SCROLLBAR_AUTO |
Display scrollbars only ifpage’s size exceeds window’s size. |
HW_NO_SELECTION |
Don’t allow the user to selecttext. |
To process user interaction with an HtmlWindow, use these event handlers
to direct input to blocks that take a HtmlCellEvent
argument or a HtmlLinkEvent.
evt_html_cell_clicked(id) { | event | … } | A HtmlCell was clicked. |
evt_html_cell_hover(id) { | event | … } | The mouse passed over a HtmlCell. |
evt_html_link_clicked(id) { | event | … } | A HtmlCell which contains an hyperlink was clicked. |
Constructor. The parameters are the same as for the ScrolledWindow constructor.
Adds input filter to the static list of available
filters. These filters are present by default:
text/html
MIME typeimage/*
MIME typesAppends HTML fragment to currently displayed text and refreshes the window.
false if an error occurred, true otherwise.
Returns pointer to the top-level container.
See also: Cells Overview,
Printing Overview
Returns anchor within currently opened page
(see get_opened_page).
If no page is opened or if the displayed page wasn’t
produced by call to LoadPage, empty string is returned.
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.
Returns title of the opened page or EmptyString if current page does not contain <TITLE>
tag.
Returns the related frame.
Moves back to the previous page. (each page displayed using
load_page is stored in history list.)
Returns true if it is possible to go back in the history (i.e. HistoryBack()
won’t fail).
Returns true if it is possible to go forward in the history (i.e. HistoryBack()
won’t fail).
Clears history.
Moves to next page in history.
Loads HTML page from file and displays it.
false if an error occurred, true otherwise
Unlike SetPage this function first loads HTML page from location
and then displays it. See example:
false if an error occurred, true otherwise
This method is called whenever the HtmlWindow attempts to open a URL,
either a page, or an image within a page. It can be used to block access
to certain URLs, or rewrite them. This method should return true
, if
access to the URL should be allowed or false
if it should be
blocked. It may also return a string containing a new URL to which the
request should be redirected.
Note that if redirecting, the method will immediately be called again
with the new URL, so to avoid entering an endless loop, you should test
for this and return true if no rewriting is to be done.
The default implementation in the standard Wx::HtmlWindow class always
returns true
, ie allow the URL.
Called on parsing
This reads custom settings from Config. It uses the path ‘path’
if given, otherwise it saves info into currently selected path.
The values are stored in sub-path HtmlWindow
Read values: all things set by SetFonts, SetBorders.
Selects all text in the window.
Returns current selection as plain text. Returns empty string if no text
is currently selected.
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
calc_unscrolled_position
to convert physical coordinate.
Selects the word at position pos. Note that pos
is relative to the top of displayed page, not to window’s origin, use
calc_unscrolled_position
to convert physical coordinate.
This function sets the space between border of window and HTML
contents.
This function sets font sizes and faces.
Default font sizes are defined by constants HTML_FONT_SIZE_1,
HTML_FONT_SIZE_2, …, HTML_FONT_SIZE_7. Note that they differ among
platforms. Default face names are empty strings.
Sets HTML page and display it. This doesn’t load the page!
It parses and displays the HTML in the string source.
If you want to load a document from some location use
load_page instead.
false if an error occurred, true otherwise.
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.
After calling set_related_frame,
this sets statusbar slot where messages will be displayed.
(Default is -1 = no messages.)
Returns content of currently displayed page as plain text.
Saves custom settings into Config. 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
HtmlWindow
.
Saved values: all things set by SetFonts, SetBorders.
[This page automatically generated from the Textile source at 2023-06-03 08:07:29 +0000]