NAME
Fl::HtmlView - HTML Display Widget
Description
The Fl::HtmlView widget displays HTML text. It's based on Fl_Help_View. Why is the widget not Fl_Html_View upstream? I don't know either... Anwyay! Here we go!
Most HTML 2.0 elements are supported, as well as a primitive implementation of tables. GIF, JPEG, and PNG images are displayed inline.
Supported HTML Tags
- A: HREF/NAME
- B
- BODY: BGCOLOR/TEXT/LINK
- BR
- CENTER
- CODE
- DD
- DL
- DT
- EM
- FONT: COLOR/SIZE/FACE=(helvetica/arial/sans/times/serif/symbol/courier)
- H1/H2/H3/H4/H5/H6
- HEAD
- HR
- I
- IMG: SRC/WIDTH/HEIGHT/ALT
- KBD
- LI
- OL
- P
- PRE
- STRONG
- TABLE: TH/TD/TR/BORDER/BGCOLOR/COLSPAN/ALIGN=CENTER|RIGHT|LEFT
- TITLE
- TT
- U
- UL
- VAR
Supported Color Names
- black
- red
- green
- yellow
- blue
- magenta
- fuchsia
- cyan
- aqua
- white
- gray
- grey
- lime
- maroon
- olive
- purple
- silver
- teal
Supported URLs
Methods
Fl::HtmlView inherits from Fl::Group and Fl::Widget. On top of that, it exposes the following methods...
new(...)
my $hv_a = Fl::HtmlView->new(0, 0, 250, 500, 'Important Stuff');
my $hv_b = Fl::HtmlView->new(0, 0, 250, 500);
The constructor creates a new widget using the given position, size, and label.
The destructor removes the widget.
clear_selection(...)
$hv_b->clear_selection();
Removes the current text selection.
directory(...)
$hv_b->directory();
Returns the current directory for the text in the buffer.
filename(...)
$hv_b->filename();
Returns the current filename for the text in the buffer.
find(...)
my $position = $hv_b->find('summer');
$position = $hv_b->find('summer', $position);
Finds the specified string at starting $position
. Default value for $position
is zero (0
) which would obviously start the search at the beginning.
The return value is the matching position or -1
if the search string is not found.
leftline(...)
my $position = $hv_b->leftline( );
Gets the left position in pixels.
$hv_b->leftline( 20 );
Scrolls the text to the indicated position, given a pixel column.
If the given pixel value left is out of range, then the text is scrolled to the left or right side of the document.
link(...)
This method assigns a callback function to use when a link is followed or a file is loaded (via Fl::HtmlView->load()) that requires a different file or path.
The callback function receives a pointer to the Fl::HtmlView widget and the URI or full pathname for the file in question. It must return a pathname that can be opened as a local file or undef
.
The link function can be used to retrieve remote or virtual documents, returning a temporary file that contains the actual data. If the link function returns undef
, the value of the Fl::HtmlView widget will remain unchanged.
If the link callback cannot handle the URI scheme, it should return the uri value unchanged or set the value() of the widget before returning undef
.
LICENSE
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Sanko Robinson <sanko@cpan.org>