| 1 | package TUI::Drivers::HWMouse; | ||||||||||||||||||||
| 2 | # ABSTRACT: defines the class THWMouse | ||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 136 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 136 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 136 | our $VERSION = '2.000003'; | |||||||||||||||||||
| 8 | 136 | $VERSION =~ tr/_//d; | |||||||||||||||||||
| 9 | 136 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 136 | ▶ | use Exporter 'import'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 136 | our @EXPORT = qw( | |||||||||||||||||||
| 13 | THWMouse | ||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 136 | ▶ | use PerlX::Assert::PP; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | 136 | ▶ | use Scalar::Util qw( looks_like_number ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 136 | ▶ | use TUI::toolkit::boolean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 136 | ▶ | use TUI::Drivers::HardwareInfo; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | sub THWMouse() { __PACKAGE__ } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | # predeclare global variable names | ||||||||||||||||||||
| 25 | 136 | our $buttonCount = 0; | |||||||||||||||||||
| 26 | 136 | our $handlerInstalled = false; | |||||||||||||||||||
| 27 | 136 | our $noMouse = false; | |||||||||||||||||||
| 28 | 136 | our $mouseRangeX = 0; | |||||||||||||||||||
| 29 | 136 | our $mouseRangeY = 0; | |||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 136 | ▶ | INIT { | ||||||||||||||||||
|
Subroutine
INIT: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | 136 | THWMouse->resume(); | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 136 | ▶ | END { | ||||||||||||||||||
|
Subroutine
END: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 36 | 136 | THWMouse->suspend(); | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 136 | ▶ | sub show { # void ($class) | ||||||||||||||||||
|
Subroutine
show: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 40 | 136 | ▶ | assert ( $_[0] and !ref $_[0] ); | ||||||||||||||||||
|
Condition33%1/3
$_[0] && !ref($_[0])
MC/DC0%0/2
$_[0] && !ref($_[0])
$_[0]
!ref($_[0])
Truth table33%1/3
A && not(B)
A= $_[0]B= !ref($_[0])
| |||||||||||||||||||||
| 41 | 136 | THardwareInfo->cursorOn(); | |||||||||||||||||||
| 42 | 1 | return; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 193 | ▶ | sub hide { # void ($class) | ||||||||||||||||||
|
Subroutine
hide: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 46 | 193 | ▶ | assert ( $_[0] and !ref $_[0] ); | ||||||||||||||||||
|
Condition33%1/3
$_[0] && !ref($_[0])
MC/DC0%0/2
$_[0] && !ref($_[0])
$_[0]
!ref($_[0])
Truth table33%1/3
A && not(B)
A= $_[0]B= !ref($_[0])
| |||||||||||||||||||||
| 47 | 193 | THardwareInfo->cursorOff(); | |||||||||||||||||||
| 48 | 1 | return; | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | ▶ | sub setRange { # void ($class, $rx, $ry) | ||||||||||||||||||
|
Subroutine
setRange: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 52 | 0 | my ( $class, $rx, $ry ) = @_; | |||||||||||||||||||
| 53 | 0 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||
|
Condition0%0/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table0%0/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||
| 54 | 0 | assert ( looks_like_number $rx ); | |||||||||||||||||||
| 55 | 0 | assert ( looks_like_number $ry ); | |||||||||||||||||||
| 56 | 0 | $mouseRangeX = $rx; | |||||||||||||||||||
| 57 | 0 | $mouseRangeY = $ry; | |||||||||||||||||||
| 58 | 0 | return; | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 0 | ▶ | sub getEvent { # void ($class, \%me) | ||||||||||||||||||
|
Subroutine
getEvent: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 62 | 0 | my ( $class, $me ) = @_; | |||||||||||||||||||
| 63 | 0 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||
|
Condition0%0/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table0%0/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||
| 64 | 0 | assert ( ref $me ); | |||||||||||||||||||
| 65 | 0 | $me->{buttons} = 0; | |||||||||||||||||||
| 66 | 0 | $me->{where}{x} = 0; | |||||||||||||||||||
| 67 | 0 | $me->{where}{y} = 0; | |||||||||||||||||||
| 68 | 0 | $me->{eventFlags} = 0; | |||||||||||||||||||
| 69 | 0 | return; | |||||||||||||||||||
| 70 | } | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 0 | ▶ | sub present { # $bool ($class) | ||||||||||||||||||
|
Subroutine
present: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 73 | 0 | ▶ | assert ( $_[0] and !ref $_[0] ); | ||||||||||||||||||
|
Condition0%0/3
$_[0] && !ref($_[0])
MC/DC0%0/2
$_[0] && !ref($_[0])
$_[0]
!ref($_[0])
Truth table0%0/3
A && not(B)
A= $_[0]B= !ref($_[0])
| |||||||||||||||||||||
| 74 | 0 | return $buttonCount != 0; | |||||||||||||||||||
| 75 | } | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 193 | ▶ | sub suspend { # void ($class) | ||||||||||||||||||
|
Subroutine
suspend: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 78 | 193 | my $class = shift; | |||||||||||||||||||
| 79 | 193 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||
|
Condition33%1/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||
| 80 | 193 | $class->hide(); | |||||||||||||||||||
| 81 | 1 | $buttonCount = false; | |||||||||||||||||||
| 82 | 1 | return; | |||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 136 | ▶ | sub resume { # void ($class) | ||||||||||||||||||
|
Subroutine
resume: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 86 | 136 | my $class = shift; | |||||||||||||||||||
| 87 | 136 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||
|
Condition33%1/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||
| 88 | 136 | $buttonCount = THardwareInfo->getButtonCount(); | |||||||||||||||||||
| 89 | 136 | $class->show(); | |||||||||||||||||||
| 90 | 1 | return; | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 0 | ▶ | sub inhibit { # void ($class) | ||||||||||||||||||
|
Subroutine
inhibit: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 94 | 0 | ▶ | assert ( $_[0] and !ref $_[0] ); | ||||||||||||||||||
|
Condition0%0/3
$_[0] && !ref($_[0])
MC/DC0%0/2
$_[0] && !ref($_[0])
$_[0]
!ref($_[0])
Truth table0%0/3
A && not(B)
A= $_[0]B= !ref($_[0])
| |||||||||||||||||||||
| 95 | 0 | $noMouse = true; | |||||||||||||||||||
| 96 | 0 | return; | |||||||||||||||||||
| 97 | } | ||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | 136 | 1 | |||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | __END__ | ||||||||||||||||||||