lib/TUI/Dialogs/Button.pm

filter: Statementstmt 27.8% 77 / 277 Branchbran 0.0% 0 / 110 Conditioncond 0.0% 0 / 30 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 51.3% 19 / 37 Podpod 91.6% 11 / 12 totaltotal 22.2% 107 / 482 CC 68 SCAR 54.6
CC
68
Cov
18%
handleEvent
698.5
__ANON__
210.0
drawState
182.0
CRAP 236.1
« lib/TUI/Validate/PXPictureValidator.pm ↑ Summary lib/TUI/Views/Frame.pm »
1 package TUI::Dialogs::Button;
2 # ABSTRACT: Pushbutton control for dialogs
3
4 26 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 26 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 26 our $VERSION = '2.000002';
9 26 $VERSION =~ tr/_//d;
10 26 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 26 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 26 our @EXPORT = qw(
14 TButton
15 new_TButton
16 );
17
18 26 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 26 ▶use TUI::toolkit::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
20 :is
21 :types
22 26 );
23
24 26 ▶use TUI::Dialogs::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
25 :bfXXXX
26 :cmXXXX
27 cpButton
28 26 );
29 26 ▶use TUI::Dialogs::Util qw( hotKey );
Subroutine BEGIN: called CC=1 SCAR=0.0
30 26 ▶use TUI::Drivers::Const qw( :evXXXX );
Subroutine BEGIN: called CC=1 SCAR=0.0
31 26 ▶use TUI::Drivers::Event;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 26 ▶use TUI::Drivers::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
33 cstrlen
34 getAltCode
35 26 );
36 26 ▶use TUI::Views::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
37 cmDefault
38 cmCommandSetChanged
39 :ofXXXX
40 phPostProcess
41 :sfXXXX
42 26 );
43 26 ▶use TUI::Views::DrawBuffer;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 26 ▶use TUI::Views::Palette;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 26 ▶use TUI::Views::View;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 26 ▶use TUI::Views::Util qw( message );
Subroutine BEGIN: called CC=1 SCAR=0.0
47
48 sub TButton() { __PACKAGE__ }
49 sub name() { 'TButton' }
50 0 ▶sub new_TButton { __PACKAGE__->from(@_) }
Subroutine new_TButton: not called CC=1 SCAR=6.9
Pod documented
51
52 26 extends TView;
53
54 # declare global variables
55 26 our $shadows = "\xDC\xDB\xDF";
56 26 our $markers = "[]";
57
58 # import global variables
59 26 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
60 $showMarkers
61 $specialChars
62 26 );
63 {
64 26 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
65 26 *showMarkers = \${ TView . '::showMarkers' };
66 26 *specialChars = \${ TView . '::specialChars' };
67 }
68
69 # public attributes
70 0 ▶has title => ( is => 'ro', default => sub { die 'required' } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
71
72 # protected attributes
73 0 ▶has command => ( is => 'ro', default => sub { die 'required' } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
74 0 ▶has flags => ( is => 'ro', default => sub { die 'required' } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
75 26 has amDefault => ( is => 'ro', default => false );
76
77 # predeclare private methods
78 my (
79 26 $drawTitle,
80 $pressButton,
81 $getActiveRect,
82 );
83
84 0 ▶sub BUILDARGS { # \%args (%args)
Subroutine BUILDARGS: not called CC=1 SCAR=6.9
Pod documented
85 0 state $sig = signature(
86 method => 1,
87 named => [
88 bounds => Object,
89 title => Str, { alias => 'aTitle' },
90 command => PositiveOrZeroInt, { alias => 'aCommand' },
91 flags => PositiveOrZeroInt, { alias => 'aFlags' },
92 ],
93 caller_level => +1,
94 );
95 0 my ( $class, $args ) = $sig->( @_ );
96 0 return { %$args };
97 }
98
99 0 ▶sub BUILD { # void (\%args)
Subroutine BUILD: not called CC=4 SCAR=30.0
Pod documented
100 0 my ( $self, $args ) = @_;
101 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
102 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
103 0 $self->{amDefault} = ( $self->{flags} & bfDefault ) != 0;
104 $self->{options} |=
105 0 ofSelectable | ofFirstClick | ofPreProcess | ofPostProcess;
106 0 $self->{eventMask} |= evBroadcast;
107 $self->{state} |= sfDisabled
108 0 ▶ unless TView->commandEnabled( $self->{command} );
Branch: 1 branch
BranchTrueFalseTotal
unless "TUI::Views::View"->commandEnabled($self->{"command"}) 0 0 0
109 0 return;
110 }
111
112 0 ▶sub from { # $obj ($bounds, $aTitle, $aCommand, $aFlags)
Subroutine from: not called CC=1 SCAR=6.9
Pod undocumented
113 0 state $sig = signature(
114 method => 1,
115 pos => [Object, Str, PositiveOrZeroInt, PositiveOrZeroInt],
116 );
117 0 my ( $class, @args ) = $sig->( @_ );
118 0 return $class->new( bounds => $args[0], title => $args[1],
119 command => $args[2], flags => $args[3] );
120 }
121
122 0 ▶sub DEMOLISH { # void ($in_global_destruction)
Subroutine DEMOLISH: not called CC=3 SCAR=24.8
Pod documented
123 0 my ( $self, $in_global_destruction ) = @_;
124 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
125 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
126 0 $self->{title} = undef;
127 0 return;
128 }
129
130 0 ▶sub draw { # void ()
Subroutine draw: not called CC=1 SCAR=6.9
Pod documented
131 0 state $sig = signature(
132 method => Object,
133 pos => [],
134 );
135 0 my ( $self ) = $sig->( @_ );
136 0 $self->drawState( false );
137 0 return;
138 }
139
140 0 ▶sub drawState { # void ($down)
Subroutine drawState: not called CC=13 SCAR=52.0
Pod documented
141 0 state $sig = signature(
142 method => Object,
143 pos => [Bool],
144 );
145 0 my ( $self, $down ) = $sig->( @_ );
146
147 0 my ( $cButton, $cShadow );
148 0 my $ch;
149 0 my $i;
150 0 my $b = TDrawBuffer->new();
151
152 0 ▶ if ( $self->{state} & sfDisabled ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'state'} & 256) { } 0 0 0
153 0 $cButton = $self->getColor( 0x0404 );
154 }
155 else {
156 0 $cButton = $self->getColor( 0x0501 );
157 0 ▶ if ( $self->{state} & sfActive ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"state"} & 16) 0 0 0
158 0 ▶ if ( $self->{state} & sfSelected ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'state'} & 32) { } 0 0 0
elsif ($self->{'amDefault'}) { } 0 0 0
159 0 $cButton = $self->getColor( 0x0703 );
160 }
161 elsif ( $self->{amDefault} ) {
162 0 $cButton = $self->getColor( 0x0602 );
163 }
164 }
165 } #/ else [ if ( $self->{state} ...)]
166
167 0 $cShadow = $self->getColor( 8 );
168
169 0 my $s = $self->{size}{x} - 1;
170 0 my $T = int( $self->{size}{y} / 2 ) - 1;
171
172 0 ▶ for ( my $y = 0 ; $y <= $self->{size}{y} - 2 ; $y++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($y <= $self->{"size"}{"y"} - 2) 0 0 0
173 0 $b->moveChar( 0, ' ', $cButton, $self->{size}{x} );
174 0 $b->putAttribute( 0, $cShadow );
175 0 ▶ if ( $down ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($down) { } 0 0 0
176 0 $b->putAttribute( 1, $cShadow );
177 0 $ch = ' ';
178 0 $i = 2;
179 }
180 else {
181 0 $b->putAttribute( $s, $cShadow );
182 0 ▶ if ( $showMarkers ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($TUI::Dialogs::Button::showMarkers) { } 0 0 0
183 0 $ch = ' ';
184 }
185 else {
186 0 ▶ if ( $y == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($y == 0) { } 0 0 0
187 0 $b->putChar( $s, substr( $shadows, 0, 1 ) );
188 }
189 else {
190 0 $b->putChar( $s, substr( $shadows, 1, 1 ) );
191 }
192 0 $ch = substr( $shadows, 2, 1 );
193 }
194 0 $i = 1;
195 } #/ else [ if ( $down ) ]
196
197 0 ▶ if ( $y == $T && $self->{title} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($y == $T and $self->{"title"}) 0 0 0
Condition0%0/3
$y == $T and $self->{"title"}
!ll&&!rl&&r
000
MC/DC0%0/2
$y == $T and $self->{"title"}
$y == $T $self->{"title"}
Truth table0%0/3
A and B
A= $y == $TB= $self->{"title"}
ABresult
0X0
100
111
198 0 $self->$drawTitle( $b, $s, $i, $cButton, $down );
199 }
200
201 0 ▶ if ( $showMarkers && !$down ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($TUI::Dialogs::Button::showMarkers and not $down) 0 0 0
Condition0%0/3
$TUI::Dialogs::Button::showMarkers and not $down
!ll&&!rl&&r
000
MC/DC0%0/2
$TUI::Dialogs::Button::showMarkers and not $down
$TUI::Dialogs::Button::showMarkers not $down
Truth table0%0/3
A and not(B)
A= $TUI::Dialogs::Button::showMarkersB= not $down
ABresult
0X0
100
111
202 0 $b->putChar( 1, substr( $markers, 0, 1 ) );
203 0 $b->putChar( $s - 1, substr( $markers, 1, 1 ) );
204 }
205
206 0 $self->writeLine( 0, $y, $self->{size}{x}, 1, $b );
207 } #/ for ( my $y = 0 ; $y <=...)
208
209 0 $b->moveChar( 0, ' ', $cShadow, 2 );
210 0 $b->moveChar( 2, $ch, $cShadow, $s - 1 );
211
212 0 $self->writeLine( 0, $self->{size}{y} - 1, $self->{size}{x}, 1, $b );
213 0 return;
214 } #/ sub drawState
215
216 0 ▶sub getPalette { # $palette ()
Subroutine getPalette: not called CC=1 SCAR=6.9
Pod documented
217 0 state $sig = signature(
218 method => Object,
219 pos => [],
220 );
221 0 my ( $self ) = $sig->( @_ );
222 0 state $palette = TPalette->new(
223 data => cpButton,
224 size => length( cpButton ),
225 );
226 0 return $palette->clone();
227 }
228
229 0 ▶sub handleEvent { # void ($event)
Subroutine handleEvent: not called CC=27 SCAR=65.5
Pod documented
230 26 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
231 0 state $sig = signature(
232 method => Object,
233 pos => [Object],
234 );
235 0 my ( $self, $event ) = $sig->( @_ );
236
237 0 my $mouse;
238 my $clickRect;
239
240 0 $clickRect = $self->getExtent();
241 0 $clickRect->{a}{x}++;
242 0 $clickRect->{b}{x}--;
243 0 $clickRect->{b}{y}--;
244
245 0 ▶ if ( $event->{what} == evMouseDown ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 1) 0 0 0
246 0 $mouse = $self->makeLocal( $event->{mouse}{where} );
247 0 ▶ if ( !$clickRect->contains( $mouse ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($clickRect->contains($mouse)) 0 0 0
248 0 $self->clearEvent( $event );
249 }
250 }
251 0 ▶ if ( $self->{flags} & bfGrabFocus ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"flags"} & 8) 0 0 0
252 0 $self->SUPER::handleEvent( $event );
253 }
254
255 0 my $c = hotKey( $self->{title} );
256 0 SWITCH: for ( $event->{what} ) {
257 0 ▶ evMouseDown == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
1 == $_ and 0 0 0
258 0 ▶ if ( ( $self->{state} & sfDisabled ) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (($self->{"state"} & 256) == 0) 0 0 0
259 0 $clickRect->{b}{x}++;
260 0 my $down = false;
261 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$self->mouseEvent($event, 4) and do { do { $mouse = $self->makeLocal($event->{"mouse"}{"where"}); if (!$down != !$clickRect->contains($mouse)) { $down = !$down; $self->drawState($down); } } } 0 0 0
262 0 $mouse = $self->makeLocal( $event->{mouse}{where} );
263 0 ▶ if ( !$down != !$clickRect->contains( $mouse ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (!$down != !$clickRect->contains($mouse)) 0 0 0
264 0 $down = !$down;
265 0 $self->drawState( $down );
266 }
267 } while ( $self->mouseEvent( $event, evMouseMove ) );
268 0 ▶ if ( $down ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($down) 0 0 0
269 0 $self->press();
270 0 $self->drawState( false );
271 }
272 } #/ if ( ( $self->{state} ...))
273 0 $self->clearEvent( $event );
274 0 last;
275 };
276
277 0 ▶ evKeyDown == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
16 == $_ and do { if ($event->{"keyDown"}{"keyCode"} == &getAltCode($c) or $self->{"owner"}{"phase"} == 2 and $c and uc $event->{"keyDown"}{"charScan"}{"charCode"} eq $c or $self->{"state"} & 64 and $event->{"keyDown"}{"charScan"}{"charCode"} eq " ") { $self->press; $self->clearEvent($event); } ; last } 0 0 0
278 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"keyDown"}{"keyCode"} == &getAltCode($c) or $self->{"owner"}{"phase"} == 2 and $c and uc $event->{"keyDown"}{"charScan"}{"charCode"} eq $c or $self->{"state"} & 64 and $event->{"keyDown"}{"charScan"}{"charCode"} eq " ") 0 0 0
Condition0%0/15
$event->{"keyDown"}{"keyCode"} == &getAltCode($c) or $self->{"owner"}{"phase"} == 2 and $c and uc $event->{"keyDown"}{"charScan"}{"charCode"} eq $c or $self->{"state"} & 64 and $event->{"keyDown"}{"charScan"}{"charCode"} eq " "
l!l&&r!l&&!r
000
$event->{"keyDown"}{"keyCode"} == &getAltCode($c) or $self->{"owner"}{"phase"} == 2 and $c and uc $event->{"keyDown"}{"charScan"}{"charCode"} eq $c
l!l&&r!l&&!r
000
$self->{"owner"}{"phase"} == 2 and $c and uc $event->{"keyDown"}{"charScan"}{"charCode"} eq $c
!ll&&!rl&&r
000
$self->{"owner"}{"phase"} == 2 and $c
!ll&&!rl&&r
000
$self->{"state"} & 64 and $event->{"keyDown"}{"charScan"}{"charCode"} eq " "
!ll&&!rl&&r
000
MC/DC0%0/6
$event->{"keyDown"}{"keyCode"} == &getAltCode($c) or $self->{"owner"}{"phase"} == 2 and $c and uc $event->{"keyDown"}{"charScan"}{"charCode"} eq $c or $self->{"state"} & 64 and $event->{"keyDown"}{"charScan"}{"charCode"} eq " "
$event->{"keyDown"}{"keyCode"} == &getAltCode($c) $self->{"owner"}{"phase"} == 2 $c uc $event->{"keyDown"}{"charScan"}{"charCode"} eq $c $self->{"state"} & 64 $event->{"keyDown"}{"charScan"}{"charCode"} eq " "
Truth table0%0/11
A or B and C and D or E and F
A= $event->{"keyDown"}{"keyCode"} == &getAltCode($c)B= $self->{"owner"}{"phase"} == 2C= $cD= uc $event->{"keyDown"}{"charScan"}{"charCode"} eq $cE= $self->{"state"} & 64F= $event->{"keyDown"}{"charScan"}{"charCode"} eq " "
ABCDEFresult
1XXXXX1
0111XX1
00XX111
010X111
0110111
00XX0X0
00XX100
010X0X0
010X100
01100X0
0110100
279 $event->{keyDown}{keyCode} == getAltCode( $c )
280 || ( $self->{owner}{phase} == phPostProcess
281 && $c
282 && uc( $event->{keyDown}{charScan}{charCode} ) eq $c )
283 || ( ( $self->{state} & sfFocused )
284 && $event->{keyDown}{charScan}{charCode} eq ' ' )
285 )
286 {
287 0 $self->press();
288 0 $self->clearEvent( $event );
289 } #/ if ( $event->{keyDown}...)
290 0 last;
291 };
292
293 0 ▶ evBroadcast == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
512 == $_ and 0 0 0
294 0 local $_;
295 0 SWITCH: for ( $event->{message}{command} ) {
296 0 ▶ cmDefault == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
14 == $_ and do { if ($self->{"amDefault"} and not $self->{"state"} & 256) { $self->press; $self->clearEvent($event); } ; last } 0 0 0
297 0 ▶ if ( $self->{amDefault} && !( $self->{state} & sfDisabled ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"amDefault"} and not $self->{"state"} & 256) 0 0 0
Condition0%0/3
$self->{"amDefault"} and not $self->{"state"} & 256
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"amDefault"} and not $self->{"state"} & 256
$self->{"amDefault"} not $self->{"state"} & 256
Truth table0%0/3
A and not(B)
A= $self->{"amDefault"}B= not $self->{"state"} & 256
ABresult
0X0
100
111
298 0 $self->press();
299 0 $self->clearEvent( $event );
300 }
301 0 last;
302 };
303
304 cmGrabDefault == $_ ||
305 0 ▶ cmReleaseDefault == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
61 == $_ || 62 == $_ and do { if ($self->{"flags"} & 1) { $self->{"amDefault"} = $event->{"message"}{"command"} == 62; $self->drawView; } ; last } 0 0 0
Condition0%0/3
61 == $_ or 62 == $_
l!l&&r!l&&!r
000
MC/DC0%0/2
61 == $_ or 62 == $_
61 == $_ 62 == $_
Truth table0%0/3
A or B
A= 61 == $_B= 62 == $_
ABresult
1X1
011
000
306 0 ▶ if ( $self->{flags} & bfDefault ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"flags"} & 1) 0 0 0
307 0 $self->{amDefault} = $event->{message}{command} == cmReleaseDefault;
308 0 $self->drawView();
309 }
310 0 last;
311 };
312
313 0 ▶ cmCommandSetChanged == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
52 == $_ and 0 0 0
314 $self->setState(
315 sfDisabled,
316 0 ▶ !TView->commandEnabled( $self->{command} ) ? true : false
Branch: 1 branch
BranchTrueFalseTotal
!'TUI::Views::View'->commandEnabled($self->{'command'}) ? : 0 0 0
317 );
318 0 $self->drawView();
319 0 last;
320 };
321 } #/ SWITCH: for ( $event->{message}...)
322 0 last;
323 };
324
325 } #/ SWITCH: for ( $event->{what} )
326 0 return;
327 } #/ sub handleEvent
328
329 0 ▶sub makeDefault { # void ($enable)
Subroutine makeDefault: not called CC=3 SCAR=24.8
Pod documented
330 0 state $sig = signature(
331 method => Object,
332 pos => [Bool],
333 );
334 0 my ( $self, $enable ) = $sig->( @_ );
335
336 0 ▶ if ( ( $self->{flags} & bfDefault ) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (($self->{"flags"} & 1) == 0) 0 0 0
337 message(
338 $self->{owner},
339 0 ▶ evBroadcast,
Branch: 1 branch
BranchTrueFalseTotal
$enable ? : 0 0 0
340 $enable ? cmGrabDefault : cmReleaseDefault,
341 $self
342 );
343 0 $self->{amDefault} = $enable;
344 0 $self->drawView();
345 } #/ if ( ( $self->{flags} ...))
346 0 return;
347 } #/ sub makeDefault
348
349 0 ▶sub press { # void ()
Subroutine press: not called CC=2 SCAR=17.9
Pod documented
350 0 state $sig = signature(
351 method => Object,
352 pos => [],
353 );
354 0 my ( $self ) = $sig->( @_ );
355
356 0 message( $self->{owner}, evBroadcast, cmRecordHistory, undef );
357
358 0 ▶ if ( $self->{flags} & bfBroadcast ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'flags'} & 4) { } 0 0 0
359 0 message( $self->{owner}, evBroadcast, $self->{command}, $self );
360 }
361 else {
362 0 my $e = TEvent->new();
363 0 $e->{what} = evCommand;
364 0 $e->{message}{command} = $self->{command};
365 0 $e->{message}{infoPtr} = $self;
366 0 $self->putEvent( $e );
367 }
368 0 return;
369 } #/ sub press
370
371 0 ▶sub setState { # void ($aState, $enable)
Subroutine setState: not called CC=4 SCAR=30.0
Pod documented
372 0 state $sig = signature(
373 method => Object,
374 pos => [PositiveOrZeroInt, Bool],
375 );
376 0 my ( $self, $aState, $enable ) = $sig->( @_ );
377
378 0 $self->SUPER::setState( $aState, $enable );
379 0 ▶ if ( $aState & ( sfSelected | sfActive ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($aState & 48) 0 0 0
380 0 ▶ if ( !$enable ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($enable) 0 0 0
381 # BUG FIX - EFW - Thu 10/19/95
382 0 $self->{state} &= ~sfFocused;
383 0 $self->makeDefault( false );
384 }
385 0 $self->drawView();
386 }
387
388 0 ▶ if ( $aState & sfFocused ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($aState & 64) 0 0 0
389 0 $self->makeDefault( $enable );
390 }
391 0 return;
392 } #/ sub setState
393
394 0 ▶$drawTitle = sub { # void ($b, $s, $i, $cButton, $down)
Subroutine __ANON__: not called CC=14 SCAR=53.5
395 0 my ( $self, $b, $s, $i, $cButton, $down ) = @_;
396 0 ▶ assert ( @_ == 6 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 6 0 0 0
397 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
398 0 ▶ assert ( is_ArrayLike $b );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_ArrayLike($b) 0 0 0
399 0 ▶ assert ( is_Int $s );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Int($s) 0 0 0
400 0 ▶ assert ( is_Int $i );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Int($i) 0 0 0
401 0 ▶ assert ( is_PositiveOrZeroInt $cButton );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_PositiveOrZeroInt($cButton) 0 0 0
402 0 ▶ assert ( is_Bool $down );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Bool($down) 0 0 0
403
404 0 my ( $l, $scOff );
405 0 ▶ if ( $self->{flags} & bfLeftJust ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'flags'} & 2) { } 0 0 0
406 0 $l = 1;
407 }
408 else {
409 0 my $len = cstrlen( $self->{title} );
410 0 $l = int( ( $s - $len - 1 ) / 2 );
411 0 ▶ $l = 1 if $l < 1;
Branch: 1 branch
BranchTrueFalseTotal
if $l < 1 0 0 0
412 }
413
414 0 $b->moveCStr( $i + $l, $self->{title}, $cButton );
415
416 0 ▶ if ( $showMarkers && !$down ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($TUI::Dialogs::Button::showMarkers and not $down) 0 0 0
Condition0%0/3
$TUI::Dialogs::Button::showMarkers and not $down
!ll&&!rl&&r
000
MC/DC0%0/2
$TUI::Dialogs::Button::showMarkers and not $down
$TUI::Dialogs::Button::showMarkers not $down
Truth table0%0/3
A and not(B)
A= $TUI::Dialogs::Button::showMarkersB= not $down
ABresult
0X0
100
111
417 0 ▶ if ( $self->{state} & sfSelected ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'state'} & 32) { } 0 0 0
elsif ($self->{'amDefault'}) { } 0 0 0
418 0 $scOff = 0;
419 }
420 elsif ( $self->{amDefault} ) {
421 0 $scOff = 2;
422 }
423 else {
424 0 $scOff = 4;
425 }
426 0 $b->putChar( 0, $specialChars->[$scOff] );
427 0 $b->putChar( $s, $specialChars->[$scOff + 1] );
428 } #/ if ( $self->{showMarkers...})
429 0 return;
430 26 }; #/ sub drawTitle
431
432 0 ▶$pressButton = sub { # void ($event)
Subroutine __ANON__: not called CC=4 SCAR=30.0
433 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
434 0 ▶ assert ( is_Object $_[0] );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($_[0]) 0 0 0
435 0 ▶ assert ( is_Object $_[1] );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($_[1]) 0 0 0
436 0 ...;
437 26 };
438
439 0 ▶$getActiveRect = sub { # $rect ()
Subroutine __ANON__: not called CC=3 SCAR=24.8
440 0 ▶ assert ( @_ == 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 0 0
441 0 ▶ assert ( is_Object $_[0] );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($_[0]) 0 0 0
442 0 ...;
443 26 };
444
445 26 1
446
447 __END__
« lib/TUI/Validate/PXPictureValidator.pm ↑ Summary lib/TUI/Views/Frame.pm »