dtRdr::HTMLWidget - Generic HTML widget interface
Provides a browser-independent widget. Uses a platform-specific adapter (shim), or the basic WxHTML widget if that fails.
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)
Returns the base class of the widget. Subclass must override this.
$widget->init($parent, url_handler => $handler);
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:.
Grabs the widget's internal state variables, runs $subref, and resets the state variables.
$html = $hw->filter_HTML($html, $datahandle);
Enable or disable OS copy-to-clipboard functionality
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.
$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)
$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.
callback implement in html shim $position = $widget->get_cursor_pos(); Returns the current vertical scroll bar position for the HTML widget
callback implement in html shim $widget->set_scroll_pos(200); Sets the current vertical scroll bar position for the HTML widget
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
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
callback implement in html shim scroll_page_bottom scrolls the browser to the bottom of the page
callback implement in html shim Decreases the font size $widget->increase_font
callback implement in html shim Decreases the font size $widget->decrease_font
$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.
$old_callback = $widget->register_form_post(&callback) This is the callback that's called when the browser pane does a form POST request.
$old_callback = $widget->register_form_get(&callback) This is the callback that's called when the browser pane does a form GET request.
Navigates to the next state in history
Navigates to the previous state in history
Print the current page
Returns selected text my $string = $hw->get_selection;
my $html = $hw->get_selection_as_html;
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);
Dan Sugalski, <firstname.lastname@example.org>
Copyright (C) 2006 by Dan Sugalski, Eric Wilhelm, and OSoft, All Rights Reserved.
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.
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.