dotReader
view release on metacpan or search on metacpan
lib/dtRdr/HTMLShim/WxMozilla.pm view on Meta::CPAN
package dtRdr::HTMLShim::WxMozilla;
$VERSION = eval{require version}?version::qv($_):$_ for(0.0.1);
use warnings;
use strict;
BEGIN { # TODO fix this
package Wx::MozillaBrowser;
our @ISA = qw(Wx::ScrolledWindow);
}
use Wx qw(
wxTheClipboard
);
use Wx::DND; # clipboard+drag-n-drop support
use Wx::Event qw(
EVT_MOUSE_EVENTS
EVT_KEY_UP
);
use Wx::Html;
use Wx::Mozilla;
use Wx::Mozilla::Event qw(:all);
sub base { 'Wx::MozillaBrowser' };
use base 'dtRdr::HTMLWidget';
# TEMPORARY {{{
use dtRdr::Traits::Class qw(
WARN_NOT_IMPLEMENTED
);
use dtRdr::HTMLWidget::Shared qw(
get_scroll_pos
set_scroll_pos
scroll_page_down
scroll_page_up
jump_to_anchor
); # these are just temporary imports
# TEMPORARY }}}
# Mozilla cannot display file:// images, so we base64 encode them.
use dtRdr::HTMLWidget::Shared;
*img_src_rewrite_sub =
\&dtRdr::HTMLWidget::Shared::base64_images_rewriter;
########################################################################
use dtRdr::Logger;
our @ISA;
my @events = (qw(
EVT_MOZILLA_URL_CHANGED
EVT_MOZILLA_BEFORE_LOAD
),
'EVT_MOZILLA_STATE_CHANGED',
#EVT_MOZILLA_SECURITY_CHANGED
qw(
EVT_MOZILLA_STATUS_CHANGED
EVT_MOZILLA_TITLE_CHANGED
EVT_MOZILLA_LOAD_COMPLETE
EVT_MOZILLA_PROGRESS
EVT_MOZILLA_RIGHT_CLICK
));
=head1 NAME
dtRdr::HTMLShim::WxMozilla - a linux-only widget shim
=head1 SYNOPSIS
This uses Wx::Mozilla, which still needs work, but the underlying C++
library is basically abandoned. Please look into webcore.
lib/dtRdr/HTMLShim/WxMozilla.pm view on Meta::CPAN
#$event->Skip;
};
my $url = $event->GetLink;
$url or return; # only because this is a silly way to handle links
if($self->url_handler->load_url($url, $killit)) {
#$event->Skip;
}
} # end subroutine event_right_click definition
########################################################################
=head2 load_url
$self->load_url($url);
=cut
sub load_url {
my $self = shift;
my ($url) = @_;
$self->LoadURL($url);
} # end subroutine load_url definition
########################################################################
=head2 SetPage
$widget->SetPage($content);
=cut
sub SetPage {
my $self = shift;
my ($html) = @_;
$self->SUPER::SetPage($html);
} # end subroutine SetPage definition
########################################################################
=head2 load_in_progress
Just IsBusy(). Possibly incorrect, not heavily used?
=cut
sub load_in_progress {
my $self = shift;
# XXX is this Mozilla's internal state? We may need our own too
return $self->IsBusy();
}
########################################################################
=head2 get_selection_context
my ($pre, $str, $post) = $hw->get_selection_context($context_length);
=cut
sub get_selection_context {
my $self = shift;
my ($blength) = @_;
# XXX ignoring that ATM because all I got is this stupid clipboard
my $string = $self->GetSelection;
return('',$string, '');
} # end subroutine get_selection_context definition
########################################################################
=head2 decrease_font
$self->decrease_font;
=cut
sub decrease_font {
my $self = shift;
# TODO hook to get_zoom/set_zoom for statefulness
$self->SetZoom( $self->GetZoom() - 0.2);
} # end subroutine decrease_font definition
########################################################################
=head2 increase_font
$self->increase_font;
=cut
sub increase_font {
my $self = shift;
# TODO hook to get_zoom/set_zoom for statefulness
$self->SetZoom( $self->GetZoom() + 0.2);
} # end subroutine increase_font definition
########################################################################
# NOT DONE? {{{
# XXX I guess all of these just aren't done yet? --Eric
sub get_cursor_pos {
do('./util/BREAK_THIS') or die;
}
sub register_get_file {
do('./util/BREAK_THIS') or die;
}
sub register_url_changed {
do('./util/BREAK_THIS') or die;
}
sub register_form_post {
do('./util/BREAK_THIS') or die;
}
sub register_form_get {
do('./util/BREAK_THIS') or die;
}
# NOT DONE? }}}
=head1 AUTHOR
Dan Sugalski <dan@sidhe.org>
Eric Wilhelm <ewilhelm at cpan dot org>
( run in 1.014 second using v1.01-cache-2.11-cpan-81fc1098f69 )