lib/TUI/Help/HelpWindow.pm

filter: Statementstmt 65.2% 47 / 72 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 73.6% 14 / 19 Podpod 80.0% 4 / 5 totaltotal 63.7% 65 / 102 CC 4 SCAR 15.3
CC
4
Cov
60%
BUILD
20.0
new_THelpWindow
2.0
BUILDARGS
2.0
CRAP 4.6
« lib/TUI/Drivers/Screen.pm ↑ Summary lib/TUI/Objects/Collection.pm »
1 package TUI::Help::HelpWindow;
2 # ABSTRACT: window that hosts a help topic viewer
3
4 4 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 4 our $VERSION = '2.000003';
9 4 $VERSION =~ tr/_//d;
10 4 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 4 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 our @EXPORT = qw(
14 THelpWindow
15 new_THelpWindow
16 );
17
18 4 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19 4 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 4 ▶use TUI::toolkit::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
21 :is
22 :types
23 4 );
24
25 4 ▶use TUI::Help::Const qw( cHelpWindow );
Subroutine BEGIN: called CC=1 SCAR=0.0
26 4 ▶use TUI::Help::HelpFile;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 4 ▶use TUI::Help::HelpViewer;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 4 ▶use TUI::Objects::Rect;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 4 ▶use TUI::Views::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
30 ofCentered
31 sbHandleKeyboard
32 sbHorizontal
33 sbVertical
34 wnNoNumber
35 4 );
36 4 ▶use TUI::Views::Palette;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 4 ▶use TUI::Views::Window;
Subroutine BEGIN: called CC=1 SCAR=0.0
38
39 sub THelpWindow() { __PACKAGE__ }
40 sub name() { 'THelpWindow' }
41 0 ▶sub new_THelpWindow { __PACKAGE__->from(@_) }
Subroutine new_THelpWindow: not called CC=1 SCAR=6.9
Pod documented
42
43 4 extends TWindow;
44
45 0 ▶sub BUILDARGS { # \%args (%args)
Subroutine BUILDARGS: not called CC=1 SCAR=6.9
Pod documented
46 0 state $sig = signature(
47 method => 1,
48 named => [
49 hFile => Object, { alias => 'aHelpFile' },
50 context => PositiveOrZeroInt,
51 ],
52 caller_level => +1,
53 );
54 0 my ( $class, $args1 ) = $sig->( @_ );
55 0 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
56 0 my $args2 = TWindow->BUILDARGS(
57 bounds => TRect->new( ax => 0, ay => 0, bx => 50, by => 18 ),
58 title => 'Help',
59 number => wnNoNumber,
60 );
61 0 return { %$args1, %$args2 };
62 }
63
64 0 ▶sub BUILD { # void (\%args)
Subroutine BUILD: not called CC=4 SCAR=30.0
Pod documented
65 0 my ( $self, $args ) = @_;
66 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
67 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
68 0 ▶ assert ( is_HashRef $args );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_HashRef($args) 0 0 0
69 0 $self->{options} |= ofCentered;
70 0 my $r = $self->getExtent();
71 0 $r->grow( -2, -1 );
72 $self->insert( THelpViewer->new(
73 bounds => $r,
74 hScrollBar => $self->standardScrollBar( sbHorizontal | sbHandleKeyboard ),
75 vScrollBar => $self->standardScrollBar( sbVertical | sbHandleKeyboard ),
76 hFile => $args->{hFile},
77 context => $args->{context},
78 0 ) );
79 0 return;
80 }
81
82 0 ▶sub from { # $obj ($aHelpFile, $context)
Subroutine from: not called CC=1 SCAR=6.9
Pod undocumented
83 0 state $sig = signature(
84 method => 1,
85 pos => [Object, PositiveOrZeroInt],
86 );
87 0 my ( $class, @args ) = $sig->( @_ );
88 0 return $class->new( hFile => $args[0], context => $args[1] );
89 }
90
91 0 ▶sub getPalette { # $palette ()
Subroutine getPalette: not called CC=1 SCAR=6.9
Pod documented
92 0 state $sig = signature(
93 method => Object,
94 pos => [],
95 );
96 0 my ( $self ) = $sig->( @_ );
97 0 state $palette = TPalette->new(
98 data => cHelpWindow,
99 size => length( cHelpWindow ),
100 );
101 0 return $palette->clone();
102 }
103
104 4 1
105
106 __END__
« lib/TUI/Drivers/Screen.pm ↑ Summary lib/TUI/Objects/Collection.pm »