lib/TUI/Gadgets/FileWindow.pm

filter: Statementstmt 66.6% 42 / 63 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 12 / 16 Podpod 75.0% 3 / 4 totaltotal 62.6% 57 / 91 CC 5 SCAR 16.9
CC
5
Cov
59%
BUILD
20.0
BUILDARGS
6.0
new_TFileWindow
2.0
CRAP 5.4
« lib/TUI/Menus/MenuItem.pm ↑ Summary lib/TUI/Dialogs/ListBox.pm »
1 package TUI::Gadgets::FileWindow;
2 # ABSTRACT: TFileWindow is a file window for displaying file contents.
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.000002';
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 TFileWindow
15 new_TFileWindow
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::App::Program qw( $deskTop );
Subroutine BEGIN: called CC=1 SCAR=0.0
26 4 ▶use TUI::Gadgets::FileViewer;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 4 ▶use TUI::Objects::Rect;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 4 ▶use TUI::Views::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
29 ofTileable
30 :sbXXXX
31 4 );
32 4 ▶use TUI::Views::Window;
Subroutine BEGIN: called CC=1 SCAR=0.0
33
34 sub TFileWindow() { __PACKAGE__ }
35 0 ▶sub new_TFileWindow { __PACKAGE__->from(@_) }
Subroutine new_TFileWindow: not called CC=1 SCAR=6.9
Pod documented
36
37 4 extends TWindow;
38
39 # declaration local variables
40 4 my $winNumber = 0;
41
42 0 ▶sub BUILDARGS { # \%args (%args)
Subroutine BUILDARGS: not called CC=2 SCAR=17.9
Pod documented
43 0 state $sig = signature(
44 method => 1,
45 named => [
46 fileName => Str,
47 ],
48 caller_level => +1,
49 );
50 0 my ( $class, $args1 ) = $sig->( @_ );
51 0 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
52 my $args2 = $class->SUPER::BUILDARGS(
53 bounds => $deskTop ? $deskTop->getExtent() : TRect->new(),
54 title => $args1->{fileName},
55 0 ▶ number => $winNumber++,
Branch: 1 branch
BranchTrueFalseTotal
$TUI::Gadgets::FileWindow::deskTop ? : 0 0 0
56 );
57 0 return { %$args1, %$args2 };
58 }
59
60 0 ▶sub BUILD { # void (\%args)
Subroutine BUILD: not called CC=4 SCAR=30.0
Pod documented
61 0 my ( $self, $args ) = @_;
62 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
63 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
64 0 ▶ assert ( is_HashRef $args );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_HashRef($args) 0 0 0
65 0 $self->{options} |= ofTileable;
66 0 my $r = $self->getExtent();
67 0 $r->grow( -1, -1 );
68 $self->insert(
69 TFileViewer->new(
70 bounds => $r,
71 hScrollBar => $self->standardScrollBar( sbHorizontal | sbHandleKeyboard ),
72 vScrollBar => $self->standardScrollBar( sbVertical | sbHandleKeyboard ),
73 fileName => $args->{fileName},
74 )
75 0 );
76 0 return;
77 }
78
79 0 ▶sub from { # $fileWindow ($fileName)
Subroutine from: not called CC=1 SCAR=6.9
Pod undocumented
80 0 state $sig = signature(
81 method => 1,
82 pos => [Str],
83 );
84 0 my ( $class, $fileName ) = $sig->( @_ );
85 0 return $class->new( fileName => $fileName );
86 }
87
88 4 1
89
90 __END__
« lib/TUI/Menus/MenuItem.pm ↑ Summary lib/TUI/Dialogs/ListBox.pm »