| 1 | package TUI::Gadgets::FileWindow; | ||||||||||
| 2 | # ABSTRACT: TFileWindow is a file window for displaying file contents. | ||||||||||
| 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.000003'; | |||||||||
| 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 | TFileWindow | ||||||||||
| 15 | new_TFileWindow | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 5 | ▶ | use File::Spec (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 5 | ▶ | use Storable; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 5 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 5 | ▶ | use TUI::toolkit; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 5 | ▶ | use TUI::toolkit::Types qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | :is | ||||||||||
| 24 | :types | ||||||||||
| 25 | 5 | ); | |||||||||
| 26 | |||||||||||
| 27 | 5 | ▶ | use TUI::App::Program qw( $deskTop ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 5 | ▶ | use TUI::Gadgets::FileViewer; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 5 | ▶ | use TUI::Objects::Rect; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 5 | ▶ | use TUI::Views::Const qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | ofTileable | ||||||||||
| 32 | :sbXXXX | ||||||||||
| 33 | 5 | ); | |||||||||
| 34 | 5 | ▶ | use TUI::Views::Window; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 35 | |||||||||||
| 36 | sub TFileWindow() { __PACKAGE__ } | ||||||||||
| 37 | 0 | ▶ | sub new_TFileWindow { __PACKAGE__->from(@_) } | ||||||||
|
Subroutine
new_TFileWindow: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 38 | |||||||||||
| 39 | 5 | extends TWindow; | |||||||||
| 40 | |||||||||||
| 41 | # declaration local variables | ||||||||||
| 42 | 5 | my $winNumber = 0; | |||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub BUILDARGS { # \%args (%args) | ||||||||
|
Subroutine
BUILDARGS: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 45 | 0 | state $sig = signature( | |||||||||
| 46 | method => 1, | ||||||||||
| 47 | named => [ | ||||||||||
| 48 | fileName => Str, | ||||||||||
| 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 => $deskTop ? $deskTop->getExtent() : TRect->new(), | ||||||||||
| 56 | title => $args1->{fileName}, | ||||||||||
| 57 | 0 | ▶ | number => $winNumber++, | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | ); | ||||||||||
| 59 | 0 | return { %$args1, %$args2 }; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||
|
Subroutine
BUILD: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 63 | 0 | my ( $self, $args ) = @_; | |||||||||
| 64 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | 0 | ▶ | assert ( is_Object $self ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 0 | ▶ | assert ( is_HashRef $args ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 67 | 0 | $self->{options} |= ofTileable; | |||||||||
| 68 | 0 | my $r = $self->getExtent(); | |||||||||
| 69 | 0 | $r->grow( -1, -1 ); | |||||||||
| 70 | $self->insert( | ||||||||||
| 71 | TFileViewer->new( | ||||||||||
| 72 | bounds => $r, | ||||||||||
| 73 | hScrollBar => $self->standardScrollBar( sbHorizontal | sbHandleKeyboard ), | ||||||||||
| 74 | vScrollBar => $self->standardScrollBar( sbVertical | sbHandleKeyboard ), | ||||||||||
| 75 | fileName => $args->{fileName}, | ||||||||||
| 76 | ) | ||||||||||
| 77 | 0 | ); | |||||||||
| 78 | 0 | return; | |||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 0 | ▶ | sub from { # $fileWindow ($fileName) | ||||||||
|
Subroutine
from: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 82 | 0 | state $sig = signature( | |||||||||
| 83 | method => 1, | ||||||||||
| 84 | pos => [Str], | ||||||||||
| 85 | ); | ||||||||||
| 86 | 0 | my ( $class, $fileName ) = $sig->( @_ ); | |||||||||
| 87 | 0 | return $class->new( fileName => $fileName ); | |||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | 0 | ▶ | sub build { # $obj () | ||||||||
|
Subroutine
build: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 91 | 0 | my ( $class ) = @_; | |||||||||
| 92 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 93 | 0 | ▶ | assert ( is_Str $class ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 94 | 0 | ▶ | assert ( Storable::is_retrieving ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 95 | 0 | return $class->new( fileName => File::Spec->devnull ); | |||||||||
| 96 | } | ||||||||||
| 97 | |||||||||||
| 98 | 5 | 1 | |||||||||
| 99 | |||||||||||
| 100 | __END__ | ||||||||||