NAME

dtRdr::HTMLWidget - Generic HTML widget interface

SYNOPSIS

use dtRdr::HTMLWidget;

DESCRIPTION

Provides a browser-independent widget. Uses a platform-specific adapter (shim), or the basic WxHTML widget if that fails.

CONSTRUCTOR

new

Constructor / Factory method.

Create and return a new HTML rendering widget.

Base classes may inherit this.

Calling classes should call this (do not call the base class constructor directly.)

my @wx_args = (
  # from http://www.wxwindows.org/manuals/2.6.3/wx_wxhtmlwindow.html
  $parent, # wxWindow *parent,
  $id,     # wxWindowID id = -1,
  $pos,    # const wxPoint& pos = wxDefaultPosition,
  $size,   # const wxSize& size = wxDefaultSize,
  $style,  # long style = wxHW_DEFAULT_STYLE,
  $name,   # const wxString& name = "htmlWindow"
  );
$widget = dtRdr::HTMLWidget->new(\@wx_args, \%opts);

ASIDE: this is the old interface:

$widget = dtRdr::HTMLWidget->new($parent, $id, $position, $size, $style)

Class Methods

base

Returns the base class of the widget. Subclass must override this.

$widget->base;

Callback Methods

init

Initialization callback.

$widget->init($parent, url_handler => $handler);

...Methods

render_HTML

Render the HTML in the widget.

$bool = $widget->render_HTML($html, $data_handle);

$data_handle must respond to requests for related URIs. Note that the URIs may have a dotReader specific prefix, such as book:.

$data_handle->get_member_string($relative_uri)

reset_wrap

Grabs the widget's internal state variables, runs $subref, and resets the state variables.

$hw->reset_wrap($subref);

filter_HTML

$html = $hw->filter_HTML($html, $datahandle);

allow_copy

$widget->allow_copy($bool)

Enable or disable OS copy-to-clipboard functionality

Handlers

These are the callbacks that the widget shims must implement. In all cases, registering a callback for a widget returns the previously registered callback, on the off-chance that your code's doing a temporary override of the callback.

register_get_file

$old_callback = $widget->register_get_file(&callback)

This is the function called when the widget needs to fetch a file
that's embedded within a webpage. (This is for E<lt>imgE<gt> tag
fetches and suchlike things)

load_in_progress

$bool = $widget->load_in_progress;

Returns true if the widget is currently fetching information or working on rendering the HTML contents, false if it is not.

get_scroll_pos

callback implement in html shim
$position = $widget->get_cursor_pos();
Returns the current vertical scroll bar position for the HTML widget

set_scroll_pos

callback implement in html shim
$widget->set_scroll_pos(200);

Sets the current vertical scroll bar position for the HTML widget

scroll_page_down

callback implement in html shim
scroll_page_down();
scrolls the browser widget down 1 page.
equivilent to [Page Down]
Returns 1 if successfull or 0 if it can't scroll

scroll_page_up

callback implement in html shim
scroll_page_up();
scrolls the browser widget down 1 page.
equivilent to [Page Up]
Returns 1 if successfull or 0 if it can't scroll

scroll_page_bottom

callback implement in html shim
scroll_page_bottom
scrolls the browser to the bottom of the page

increase_font

callback implement in html shim Decreases the font size $widget->increase_font

decrease_font

callback implement in html shim Decreases the font size $widget->decrease_font

register_url_changed XXX NOT USED XXX

$old_callback = $widget->register_url_changed(&callback)

This is the callback that's called when the browser pane is about to
change to a new page because someone clicked on a link.

register_form_post

$old_callback = $widget->register_form_post(&callback)

This is the callback that's called when the browser pane does a form
POST request.

register_form_get

$old_callback = $widget->register_form_get(&callback)

This is the callback that's called when the browser pane does a form
GET request.

history

history_next

Navigates to the next state in history

history_back

Navigates to the previous state in history

Print

Print the current page

Selection

get_selection

Returns selected text

my $string = $hw->get_selection;

get_selection_as_html

my $html = $hw->get_selection_as_html;

get_selection_context

Returns ($pre, $str, $post)
where pre and post text are $context_length or less if the selected
text is near the begining or end of the document

my ($pre, $str, $post) = $hw->get_selection_context($context_length);

AUTHOR

Dan Sugalski, <dan@sidhe.org>

Eric Wilhelm

Gary Varnell

COPYRIGHT

Copyright (C) 2006 by Dan Sugalski, Eric Wilhelm, and OSoft, All Rights Reserved.

NO WARRANTY

Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.

LICENSE

The dotReader(TM) is OSI Certified Open Source Software licensed under the GNU General Public License (GPL) Version 2, June 1991. Non-encrypted and encrypted packages are usable in connection with the dotReader(TM). The ability to create, edit, or otherwise modify content of such encrypted packages is self-contained within the packages, and NOT provided by the dotReader(TM), and is addressed in a separate commercial license.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.