| 1 | package App::XUL::Object; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | our $AUTOLOAD; | |||||||||||||
| 4 | |||||||||||||||
| 5 | sub new | ||||||||||||||
| 6 | 0 | ▶ | { | ||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 7 | 0 | my ($class, @args) = @_; | |||||||||||||
| 8 | 0 | my $self = bless {}, $class; | |||||||||||||
| 9 | 0 | return $self->init(@args); | |||||||||||||
| 10 | } | ||||||||||||||
| 11 | |||||||||||||||
| 12 | sub init | ||||||||||||||
| 13 | 0 | ▶ | { | ||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 14 | 0 | my ($self, $id) = @_; | |||||||||||||
| 15 | 0 | $self->{'id'} = $id; | |||||||||||||
| 16 | 0 | return $self | |||||||||||||
| 17 | } | ||||||||||||||
| 18 | |||||||||||||||
| 19 | sub child | ||||||||||||||
| 20 | 0 | ▶ | { | ||||||||||||
|
Subroutine
child: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 21 | 0 | my ($self, $num) = @_; | |||||||||||||
| 22 | 0 | my $id = main::push({'action' => 'child', 'id' => $self->{'id'}, 'number' => $num}); | |||||||||||||
| 23 | #print STDERR "($id)\n"; | ||||||||||||||
| 24 | 0 | return new App::XUL::Object($id); | |||||||||||||
| 25 | } | ||||||||||||||
| 26 | |||||||||||||||
| 27 | sub numchildren | ||||||||||||||
| 28 | 0 | ▶ | { | ||||||||||||
|
Subroutine
numchildren: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 29 | 0 | my ($self) = @_; | |||||||||||||
| 30 | 0 | return main::push({'action' => 'numchildren', 'id' => $self->{'id'}}); | |||||||||||||
| 31 | } | ||||||||||||||
| 32 | |||||||||||||||
| 33 | sub insert | ||||||||||||||
| 34 | 0 | ▶ | { | ||||||||||||
|
Subroutine
insert: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 35 | 0 | my ($self, $xml, $pos) = @_; | |||||||||||||
| 36 | 0 | ▶ | $pos = 'end' unless defined $pos; # pos: end|start|... | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 37 | 0 | return main::push({'action' => 'insert', 'id' => $self->{'id'}, 'position' => $pos, 'content' => $xml}); | |||||||||||||
| 38 | } | ||||||||||||||
| 39 | |||||||||||||||
| 40 | sub update | ||||||||||||||
| 41 | 0 | ▶ | { | ||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 42 | 0 | my ($self, @xml) = @_; | |||||||||||||
| 43 | 0 | my $xml = join '', @xml; | |||||||||||||
| 44 | 0 | return main::push({'action' => 'update', 'id' => $self->{'id'}, 'content' => $xml}); | |||||||||||||
| 45 | } | ||||||||||||||
| 46 | |||||||||||||||
| 47 | sub remove | ||||||||||||||
| 48 | 0 | ▶ | { | ||||||||||||
|
Subroutine
remove: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 49 | 0 | my ($self) = @_; | |||||||||||||
| 50 | 0 | return main::push({'action' => 'remove', 'id' => $self->{'id'}}); | |||||||||||||
| 51 | } | ||||||||||||||
| 52 | |||||||||||||||
| 53 | # attribute/content setting function | ||||||||||||||
| 54 | sub AUTOLOAD | ||||||||||||||
| 55 | 0 | ▶ | { | ||||||||||||
|
Subroutine
AUTOLOAD: not called CC=7 SCAR=40.3
| |||||||||||||||
| 56 | 0 | my ($self, $x) = @_; | |||||||||||||
| 57 | 0 | my $name = $AUTOLOAD; | |||||||||||||
| 58 | 0 | $name =~ s/.*://; | |||||||||||||
| 59 | |||||||||||||||
| 60 | 0 | ▶ | return if $name eq 'DESTROY'; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 61 | |||||||||||||||
| 62 | 0 | my @events = | |||||||||||||
| 63 | qw(abort | ||||||||||||||
| 64 | blur | ||||||||||||||
| 65 | change click | ||||||||||||||
| 66 | dblclick dragdrop | ||||||||||||||
| 67 | error | ||||||||||||||
| 68 | focus | ||||||||||||||
| 69 | keydown keypress keyup | ||||||||||||||
| 70 | load | ||||||||||||||
| 71 | mousedown mousemove mouseout mouseover mouseup move | ||||||||||||||
| 72 | reset resize | ||||||||||||||
| 73 | select submit | ||||||||||||||
| 74 | unload); | ||||||||||||||
| 75 | |||||||||||||||
| 76 | 0 | ▶ | if (scalar grep { $_ eq $name } @events) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 77 | # trigger event | ||||||||||||||
| 78 | 0 | return main::push({'action' => 'trigger', 'id' => $self->{'id'}, 'name' => $name}); | |||||||||||||
| 79 | } | ||||||||||||||
| 80 | 0 | elsif (scalar grep { $_ eq 'on'.$name } @events) { | |||||||||||||
| 81 | # register/unregister event handler | ||||||||||||||
| 82 | 0 | ▶ | my $action = (defined $x ? 'register' : 'unregister'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 83 | return | ||||||||||||||
| 84 | main::push( | ||||||||||||||
| 85 | 0 | ▶ | {'action' => $action, 'id' => $self->{'id'}, 'name' => $name, | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 86 | ($action eq 'register' ? ('callback' => $x) : ())}); | ||||||||||||||
| 87 | } | ||||||||||||||
| 88 | else { | ||||||||||||||
| 89 | # get/set attribute | ||||||||||||||
| 90 | 0 | ▶ | if (defined $x) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 91 | # set attribute & return self | ||||||||||||||
| 92 | main::push( | ||||||||||||||
| 93 | 0 | {'action' => 'setattr', 'id' => $self->{'id'}, 'name' => $name, 'value' => $x}); | |||||||||||||
| 94 | 0 | return $self; | |||||||||||||
| 95 | } else { | ||||||||||||||
| 96 | # get attribute | ||||||||||||||
| 97 | return main::push( | ||||||||||||||
| 98 | 0 | {'action' => 'getattr', 'id' => $self->{'id'}, 'name' => $name}); | |||||||||||||
| 99 | } | ||||||||||||||
| 100 | } | ||||||||||||||
| 101 | } | ||||||||||||||
| 102 | |||||||||||||||
| 103 | 1 | 1; | |||||||||||||