lib/TUI/ColorSel/MonoSelector.pm

filter: Statementstmt 56.8% 50 / 88 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 59.0% 13 / 22 Podpod 88.8% 8 / 9 totaltotal 56.3% 71 / 126 CC 3 SCAR 7.7
CC
3
Cov
54%
handleEvent
7.6
new_TMonoSelector
2.0
BUILDARGS
2.0
CRAP 2.2
« lib/TUI/ColorSel/ColorItem.pm ↑ Summary lib/TUI/toolkit/UO/Base.pm »
1 package TUI::ColorSel::MonoSelector;
2 # ABSTRACT: A selector for monochrome attributes.
3
4 5 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 5 our $VERSION = '2.000002';
9 5 $VERSION =~ tr/_//d;
10 5 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 5 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 our @EXPORT = qw(
14 TMonoSelector
15 new_TMonoSelector
16 );
17
18 5 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19 5 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 5 ▶use TUI::toolkit::Types qw( :types );
Subroutine BEGIN: called CC=1 SCAR=0.0
21
22 5 ▶use TUI::Drivers::Const qw( evBroadcast );
Subroutine BEGIN: called CC=1 SCAR=0.0
23 5 ▶use TUI::Dialogs::Cluster;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 5 ▶use TUI::Dialogs::StrItem;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 5 ▶use TUI::ColorSel::Const qw( :cmXXXX );
Subroutine BEGIN: called CC=1 SCAR=0.0
26 5 ▶use TUI::Views::Util qw( message );
Subroutine BEGIN: called CC=1 SCAR=0.0
27
28 sub TMonoSelector() { __PACKAGE__ }
29 sub name() { 'TMonoSelector' }
30 0 ▶sub new_TMonoSelector { __PACKAGE__->from( @_ ) }
Subroutine new_TMonoSelector: not called CC=1 SCAR=6.9
Pod documented
31
32 5 extends TCluster;
33
34 # declare global variables
35 5 our $button = " ( ) ";
36 5 our $normal = "Normal";
37 5 our $highlight = "Highlight";
38 5 our $underline = "Underline";
39 5 our $inverse = "Inverse";
40
41 # lookup table of monochrome color values
42 5 my @monoColors = ( 0x07, 0x0f, 0x01, 0x70, 0x09 );
43
44 0 ▶sub BUILDARGS { # \%args (%args)
Subroutine BUILDARGS: not called CC=1 SCAR=6.9
Pod documented
45 0 state $sig = signature(
46 method => 1,
47 named => [
48 bounds => Object,
49 ],
50 caller_level => +1,
51 );
52 0 my ( $class, $args1 ) = $sig->( @_ );
53 0 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
54 my $args2 = $class->SUPER::BUILDARGS(
55 bounds => $args1->{bounds},
56 0 strings => new_TSItem( $normal,
57 new_TSItem( $highlight,
58 new_TSItem( $underline,
59 new_TSItem( $inverse, undef )))),
60 );
61 0 return { %$args1, %$args2 };
62 }
63
64 0 ▶sub from { # $obj ($bounds)
Subroutine from: not called CC=1 SCAR=6.9
Pod undocumented
65 0 state $sig = signature(
66 method => 1,
67 pos => [Object],
68 );
69 0 my ( $class, $bounds ) = $sig->( @_ );
70 0 return $class->new( bounds => $bounds );
71 }
72
73 0 ▶sub draw { # void ()
Subroutine draw: not called CC=1 SCAR=6.9
Pod documented
74 0 state $sig = signature(
75 method => Object,
76 pos => [],
77 );
78 0 my ( $self ) = $sig->( @_ );
79 0 $self->drawBox( $button, "\x7" );
80 0 return;
81 }
82
83 0 ▶sub handleEvent { # void ($event)
Subroutine handleEvent: not called CC=3 SCAR=20.3
Pod documented
84 5 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
85 0 state $sig = signature(
86 method => Object,
87 pos => [Object],
88 );
89 0 my ( $self, $event ) = $sig->( @_ );
90 0 $self->SUPER::handleEvent( $event );
91 0 ▶ if ( $event->{what} == evBroadcast
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 512 and $event->{"message"}{"command"} == 73) 0 0 0
Condition0%0/3
$event->{"what"} == 512 and $event->{"message"}{"command"} == 73
!ll&&!rl&&r
000
MC/DC0%0/2
$event->{"what"} == 512 and $event->{"message"}{"command"} == 73
$event->{"what"} == 512 $event->{"message"}{"command"} == 73
Truth table0%0/3
A and B
A= $event->{"what"} == 512B= $event->{"message"}{"command"} == 73
ABresult
0X0
100
111
92 && $event->{message}{command} == cmColorSet
93 ) {
94 0 $self->{value} = $event->{message}{infoByte};
95 0 $self->drawView();
96 }
97 0 return;
98 }
99
100 0 ▶sub mark { # $bool ($item)
Subroutine mark: not called CC=1 SCAR=6.9
Pod documented
101 0 state $sig = signature(
102 method => Object,
103 pos => [Int],
104 );
105 0 my ( $self, $item ) = $sig->( @_ );
106 0 return $monoColors[$item] == $self->{value};
107 }
108
109 0 ▶sub newColor { # void ()
Subroutine newColor: not called CC=1 SCAR=6.9
Pod documented
110 0 state $sig = signature(
111 method => Object,
112 pos => [],
113 );
114 0 my ( $self ) = $sig->( @_ );
115 message( $self->{owner}, evBroadcast, cmColorForegroundChanged,
116 0 $self->{value} & 0x0f );
117 message( $self->{owner}, evBroadcast, cmColorBackgroundChanged,
118 0 ( $self->{value} >> 4 ) & 0x0f );
119 0 return;
120 }
121
122 0 ▶sub press { # void ($item)
Subroutine press: not called CC=1 SCAR=6.9
Pod documented
123 0 state $sig = signature(
124 method => Object,
125 pos => [Int],
126 );
127 0 my ( $self, $item ) = $sig->( @_ );
128 0 $self->{value} = $monoColors[$item];
129 0 $self->newColor();
130 0 return;
131 }
132
133 0 ▶sub movedTo { # void ($item)
Subroutine movedTo: not called CC=1 SCAR=6.9
Pod documented
134 0 state $sig = signature(
135 method => Object,
136 pos => [Int],
137 );
138 0 my ( $self, $item ) = $sig->( @_ );
139 0 $self->{value} = $monoColors[$item];
140 0 $self->newColor();
141 0 return;
142 }
143
144 5 1
145
146 __END__
« lib/TUI/ColorSel/ColorItem.pm ↑ Summary lib/TUI/toolkit/UO/Base.pm »