line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::XUL::TWindow; |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# Copyright Philip Gwyn 2007-2010. All rights reserved. |
4
|
|
|
|
|
|
|
|
5
|
21
|
|
|
21
|
|
68
|
use strict; |
|
21
|
|
|
|
|
22
|
|
|
21
|
|
|
|
|
465
|
|
6
|
21
|
|
|
21
|
|
62
|
use warnings; |
|
21
|
|
|
|
|
24
|
|
|
21
|
|
|
|
|
379
|
|
7
|
21
|
|
|
21
|
|
60
|
use Carp; |
|
21
|
|
|
|
|
21
|
|
|
21
|
|
|
|
|
856
|
|
8
|
|
|
|
|
|
|
|
9
|
21
|
|
|
21
|
|
71
|
use POE::XUL::Node; |
|
21
|
|
|
|
|
31
|
|
|
21
|
|
|
|
|
359
|
|
10
|
21
|
|
|
21
|
|
62
|
use Scalar::Util qw( blessed ); |
|
21
|
|
|
|
|
19
|
|
|
21
|
|
|
|
|
783
|
|
11
|
|
|
|
|
|
|
|
12
|
21
|
|
|
21
|
|
74
|
use constant DEBUG => 0; |
|
21
|
|
|
|
|
22
|
|
|
21
|
|
|
|
|
9036
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.0601'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
############################################################## |
17
|
0
|
|
|
0
|
0
|
0
|
sub is_window { 1 } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
############################################################## |
20
|
|
|
|
|
|
|
sub new |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
0
|
0
|
0
|
my( $package, %atts ) = @_; |
23
|
0
|
|
|
|
|
0
|
my $self = bless { attributes => { %atts }, |
24
|
|
|
|
|
|
|
events => {} |
25
|
|
|
|
|
|
|
}, $package; |
26
|
0
|
|
|
|
|
0
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
############################################################## |
30
|
0
|
|
|
0
|
|
0
|
*tag = sub { 'twindow' }; |
31
|
|
|
|
|
|
|
*id = _mk_accessor( 'id' ); |
32
|
|
|
|
|
|
|
*width = _mk_accessor( 'width' ); |
33
|
|
|
|
|
|
|
*height = _mk_accessor( 'height' ); |
34
|
|
|
|
|
|
|
*status = _mk_accessor( 'status' ); |
35
|
|
|
|
|
|
|
*menubar = _mk_accessor( 'menubar' ); |
36
|
|
|
|
|
|
|
*toolbar = _mk_accessor( 'toolbar' ); |
37
|
|
|
|
|
|
|
*scollbars = _mk_accessor( 'scrollbars' ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _mk_accessor |
40
|
|
|
|
|
|
|
{ |
41
|
147
|
|
|
147
|
|
139
|
my( $tag ) = @_; |
42
|
|
|
|
|
|
|
return sub { |
43
|
0
|
|
|
0
|
|
|
my( $self, $value ) = @_; |
44
|
0
|
0
|
|
|
|
|
if( @_ == 2 ) { |
45
|
0
|
|
|
|
|
|
return $self->{attributes}{$tag} = $value; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else { |
48
|
0
|
|
|
|
|
|
return $self->{attributes}{$tag}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
147
|
|
|
|
|
297
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
############################################################## |
54
|
|
|
|
|
|
|
sub attach |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
0
|
0
|
|
my( $self, $name, $what ) = @_; |
57
|
0
|
|
|
|
|
|
POE::XUL::Node::attach( $self, $name, $what ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
*addEventListener = \&attach; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub detach |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_; |
64
|
0
|
|
|
|
|
|
POE::XUL::Node::detach( $self, $name ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
*removeEventListener = \&detach; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub event |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_; |
71
|
0
|
|
|
|
|
|
POE::XUL::Node::event( $self, $name ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
############################################################## |
75
|
|
|
|
|
|
|
sub dispose |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
0
|
0
|
|
my( $self ) = @_; |
78
|
|
|
|
|
|
|
# events might cause cyclic references |
79
|
0
|
|
|
|
|
|
$self->{events} = {}; |
80
|
0
|
|
|
|
|
|
return; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
############################################################## |
84
|
|
|
|
|
|
|
## Create the final Window object |
85
|
|
|
|
|
|
|
sub create_window |
86
|
|
|
|
|
|
|
{ |
87
|
0
|
|
|
0
|
0
|
|
my( $self ) = @_; |
88
|
0
|
|
|
|
|
|
my $id = $self->id; |
89
|
0
|
|
|
|
|
|
my $window = POE::XUL::Window->new( %{ $self->{attributes} }, |
|
0
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
tag => 'window', id => $id, name => $id |
91
|
|
|
|
|
|
|
); |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
while( my( $name, $what ) = each %{ $self->{events} } ) { |
|
0
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
$window->attach( $name, $what ); |
95
|
|
|
|
|
|
|
} |
96
|
0
|
|
|
|
|
|
return $window; |
97
|
|
|
|
|
|
|
} |