dotReader

 view release on metacpan or  search on metacpan

lib/dtRdr/HTMLWidget.pm  view on Meta::CPAN


  $data_handle->get_member_string($relative_uri)

=cut

sub render_HTML {
  my $self = shift;
  my ($html, $dh) = @_;

  $self->{load_in_progress} = 1;
  # XXX shouldn't need this filtering anymore
  # $html = $self->filter_HTML($html, $dh);
  DBG_DUMP('FILTERED', 'filtered.html', sub {$html});
  my $status = $self->SetPage($html);
  $self->$set_html_source($html);
  $self->{load_in_progress} = 0;
  return $status;
} # end subroutine render_HTML definition
########################################################################

=head2 reset_wrap

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

  $hw->reset_wrap($subref);

=cut

sub reset_wrap {
  my $self = shift;
  my ($subref) = @_;
  my $yscroll = $self->get_scroll_pos();
  #L->debug("scroll pos $yscroll");
  my $zoom = $self->get_zoom;
  #L->debug("zoom $zoom");
  $subref->();
  my $new_pos = $self->set_scroll_pos($yscroll);
  #L->debug("set scroll pos to $new_pos");
  $self->set_zoom($zoom);
} # end subroutine reset_wrap definition
########################################################################

=head2 filter_HTML

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

=cut

sub filter_HTML {
  my $self = shift;
  my ($html, $dh) = @_;
  return($html);
} # end subroutine filter_HTML definition
########################################################################

=head2 allow_copy

  $widget->allow_copy($bool)

Enable or disable OS copy-to-clipboard functionality

=cut

sub allow_copy {
  my ($self, $allow) = @_;
  my $style = $self->GetWindowStyleFlag();
  if (!$allow) {
    $style = $style | wxHW_NO_SELECTION;
    $self->SetWindowStyleFlag($style);
  } else {
    $style = $style & (~wxHW_NO_SELECTION);
    $self->SetWindowStyleFlag($style);
  }
} # end subroutine allow_copy definition
########################################################################

=head1 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.

=head2 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)

=cut

sub register_get_file { my $self = shift; $self->NOT_IMPLEMENTED; }
########################################################################

=head2 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.

=cut

# accessor
########################################################################

=head2 get_scroll_pos

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

=cut

sub get_scroll_pos { my $self = shift; $self->NOT_IMPLEMENTED; }
########################################################################

=head2 set_scroll_pos



( run in 0.774 second using v1.01-cache-2.11-cpan-81fc1098f69 )