| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
############################################################################# |
|
2
|
|
|
|
|
|
|
## Name: lib/Wx/DemoModules/wxHtmlWindow.pm |
|
3
|
|
|
|
|
|
|
## Purpose: wxPerl demo helper for wxHtmlWindow |
|
4
|
|
|
|
|
|
|
## Author: Mattia Barbon |
|
5
|
|
|
|
|
|
|
## Modified by: |
|
6
|
|
|
|
|
|
|
## Created: 12/09/2001 |
|
7
|
|
|
|
|
|
|
## RCS-ID: $Id: wxHtmlWindow.pm 3120 2011-11-18 18:50:54Z mdootson $ |
|
8
|
|
|
|
|
|
|
## Copyright: (c) 2001, 2004, 2006 Mattia Barbon |
|
9
|
|
|
|
|
|
|
## Licence: This program is free software; you can redistribute it and/or |
|
10
|
|
|
|
|
|
|
## modify it under the same terms as Perl itself |
|
11
|
|
|
|
|
|
|
############################################################################# |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
1790
|
use Wx::Html; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Wx::DemoModules::wxHtmlWindow; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use strict; |
|
18
|
|
|
|
|
|
|
use base qw(Wx::Panel); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Wx qw(:sizer); |
|
21
|
|
|
|
|
|
|
use Wx::Event qw)EVT_BUTTON); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
|
24
|
|
|
|
|
|
|
my $class = shift; |
|
25
|
|
|
|
|
|
|
my $this = $class->SUPER::new( $_[0], -1 ); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $html = $this->{HTML} = |
|
28
|
|
|
|
|
|
|
Wx::DemoModules::wxHtmlWindow::Derived->new( $this, -1 ); |
|
29
|
|
|
|
|
|
|
my $top_s = Wx::BoxSizer->new( wxVERTICAL ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $but_s = Wx::BoxSizer->new( wxHORIZONTAL ); |
|
32
|
|
|
|
|
|
|
my $print = Wx::Button->new( $this, -1, 'Print' ); |
|
33
|
|
|
|
|
|
|
my $forward = Wx::Button->new( $this, -1, 'Forward' ); |
|
34
|
|
|
|
|
|
|
my $back = Wx::Button->new( $this, -1, 'Back' ); |
|
35
|
|
|
|
|
|
|
my $preview = Wx::Button->new( $this, -1, 'Preview' ); |
|
36
|
|
|
|
|
|
|
my $pages = Wx::Button->new( $this, -1, 'Page Setup' ); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# my $prints = Wx::Button->new( $this, -1, 'Printer Setup' ); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$but_s->Add( $back ); |
|
41
|
|
|
|
|
|
|
$but_s->Add( $forward ); |
|
42
|
|
|
|
|
|
|
$but_s->Add( $preview ); |
|
43
|
|
|
|
|
|
|
$but_s->Add( $print ); |
|
44
|
|
|
|
|
|
|
$but_s->Add( $pages ); |
|
45
|
|
|
|
|
|
|
# $but_s->Add( $prints ); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$top_s->Add( $html, 1, wxGROW|wxALL, 5 ); |
|
48
|
|
|
|
|
|
|
$top_s->Add( $but_s, 0, wxALL, 5 ); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$this->SetSizer( $top_s ); |
|
51
|
|
|
|
|
|
|
$this->SetAutoLayout( 1 ); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
EVT_BUTTON( $this, $print, \&OnPrint ); |
|
54
|
|
|
|
|
|
|
EVT_BUTTON( $this, $preview, \&OnPreview ); |
|
55
|
|
|
|
|
|
|
EVT_BUTTON( $this, $forward, \&OnForward ); |
|
56
|
|
|
|
|
|
|
EVT_BUTTON( $this, $back, \&OnBack ); |
|
57
|
|
|
|
|
|
|
EVT_BUTTON( $this, $pages, \&OnPageSetup ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# EVT_BUTTON( $this, $prints, \&OnPrinterSetup ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$this->{PRINTER} = Wx::HtmlEasyPrinting->new( 'wxPerl demo' ); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return $this; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub html { $_[0]->{HTML} } |
|
67
|
|
|
|
|
|
|
sub printer { $_[0]->{PRINTER} } |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub OnPrint { |
|
70
|
|
|
|
|
|
|
my( $this, $event ) = @_; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$this->printer->PrintFile( $this->html->GetOpenedPage ); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub OnPageSetup { |
|
76
|
|
|
|
|
|
|
my $this = shift; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$this->printer->PageSetup(); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#sub OnPrinterSetup { |
|
82
|
|
|
|
|
|
|
# my $this = shift; |
|
83
|
|
|
|
|
|
|
# |
|
84
|
|
|
|
|
|
|
# $this->printer->PrinterSetup(); |
|
85
|
|
|
|
|
|
|
#} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub OnPreview { |
|
88
|
|
|
|
|
|
|
my( $this, $event ) = @_; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$this->printer->PreviewFile( $this->html->GetOpenedPage ); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub OnForward { |
|
94
|
|
|
|
|
|
|
my( $this, $event ) = @_; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$this->html->HistoryForward(); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub OnBack { |
|
100
|
|
|
|
|
|
|
my( $this, $event ) = @_; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
$this->html->HistoryBack(); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub tags { [ 'windows/html' => 'wxHtmlWindow' ] } |
|
106
|
|
|
|
|
|
|
sub add_to_tags { 'windows/html' } |
|
107
|
|
|
|
|
|
|
sub title { 'Simple' } |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
package Wx::DemoModules::wxHtmlWindow::Derived; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
use strict; |
|
112
|
|
|
|
|
|
|
use base qw(Wx::HtmlWindow); |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub new { |
|
115
|
|
|
|
|
|
|
my $class = shift; |
|
116
|
|
|
|
|
|
|
my $this = $class->SUPER::new( @_ ); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
$this->LoadPage( Wx::Demo->get_data_file( 'html/index.html' ) ); |
|
119
|
|
|
|
|
|
|
print $this->ToText, "\n"; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Wx::LogMessage( Wx::Demo->get_data_file( 'html/index.html' ) ); |
|
122
|
|
|
|
|
|
|
return $this; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub OnLinkClicked { |
|
126
|
|
|
|
|
|
|
my( $this, $link ) = @_; |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Wx::LogMessage( 'Link clicked: href="%s"', $link->GetHref() ); |
|
129
|
|
|
|
|
|
|
$this->SUPER::OnLinkClicked( $link ); |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |