| 1 | package TUI::App::Background; | ||||||||||
| 2 | # ABSTRACT: TBackground forms the background for the applications. | ||||||||||
| 3 | |||||||||||
| 4 | 60 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 60 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 60 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 60 | our $VERSION = '2.000003'; | |||||||||
| 9 | 60 | $VERSION =~ tr/_//d; | |||||||||
| 10 | 60 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||
| 11 | |||||||||||
| 12 | 60 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 60 | our @EXPORT = qw( | |||||||||
| 14 | TBackground | ||||||||||
| 15 | new_TBackground | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 60 | ▶ | use Storable; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 60 | ▶ | use TUI::toolkit; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 60 | ▶ | use TUI::toolkit::Types qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | :Object | ||||||||||
| 22 | Str | ||||||||||
| 23 | 60 | ); | |||||||||
| 24 | |||||||||||
| 25 | 60 | ▶ | use TUI::App::Const qw( cpBackground ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 60 | ▶ | use TUI::Objects::Rect; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 60 | ▶ | use TUI::Views::Const qw( :gfXXXX ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 60 | ▶ | use TUI::Views::DrawBuffer; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 60 | ▶ | use TUI::Views::Palette; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 60 | ▶ | use TUI::Views::View; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | |||||||||||
| 32 | sub TBackground() { __PACKAGE__ } | ||||||||||
| 33 | 0 | ▶ | sub new_TBackground { __PACKAGE__->from(@_) } | ||||||||
|
Subroutine
new_TBackground: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 34 | |||||||||||
| 35 | 60 | extends TView; | |||||||||
| 36 | |||||||||||
| 37 | # protected attributes | ||||||||||
| 38 | 0 | ▶ | has pattern => ( is => 'ro', default => sub { die 'required' } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub BUILDARGS { # \%args (%args) | ||||||||
|
Subroutine
BUILDARGS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 41 | 0 | state $sig = signature( | |||||||||
| 42 | method => 1, | ||||||||||
| 43 | named => [ | ||||||||||
| 44 | bounds => Object, | ||||||||||
| 45 | pattern => Str, { alias => 'aPattern' } | ||||||||||
| 46 | ], | ||||||||||
| 47 | caller_level => +1, | ||||||||||
| 48 | ); | ||||||||||
| 49 | 0 | my ( $class, $args ) = $sig->( @_ ); | |||||||||
| 50 | 0 | return { %$args }; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||
|
Subroutine
BUILD: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 54 | 0 | my ( $self, $args ) = @_; | |||||||||
| 55 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 0 | ▶ | assert ( is_Object $self ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 0 | $self->{growMode} = gfGrowHiX | gfGrowHiY; | |||||||||
| 58 | 0 | return; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub from { # $obj ($bounds, $aPattern) | ||||||||
|
Subroutine
from: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 62 | 0 | state $sig = signature( | |||||||||
| 63 | method => 1, | ||||||||||
| 64 | pos => [Object, Str], | ||||||||||
| 65 | ); | ||||||||||
| 66 | 0 | my ( $class, @args ) = $sig->( @_ ); | |||||||||
| 67 | 0 | return $class->new( bounds => $args[0], pattern => $args[1] ); | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 0 | ▶ | sub draw { # void () | ||||||||
|
Subroutine
draw: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 71 | 0 | state $sig = signature( | |||||||||
| 72 | method => Object, | ||||||||||
| 73 | pos => [], | ||||||||||
| 74 | ); | ||||||||||
| 75 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||
| 76 | 0 | my $b = TDrawBuffer->new(); | |||||||||
| 77 | |||||||||||
| 78 | 0 | $b->moveChar( 0, $self->{pattern}, $self->getColor(0x01), $self->{size}{x} ); | |||||||||
| 79 | 0 | $self->writeLine( 0, 0, $self->{size}{x}, $self->{size}{y}, $b ); | |||||||||
| 80 | 0 | return; | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | 0 | ▶ | sub getPalette { # $palette () | ||||||||
|
Subroutine
getPalette: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 84 | 0 | state $sig = signature( | |||||||||
| 85 | method => Object, | ||||||||||
| 86 | pos => [], | ||||||||||
| 87 | ); | ||||||||||
| 88 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||
| 89 | 0 | state $palette = TPalette->new( | |||||||||
| 90 | data => cpBackground, | ||||||||||
| 91 | size => length( cpBackground ) | ||||||||||
| 92 | ); | ||||||||||
| 93 | 0 | return $palette->clone(); | |||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 0 | ▶ | sub write :method { # void ($os) | ||||||||
|
Subroutine
write: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 97 | 0 | state $sig = signature( | |||||||||
| 98 | method => Object, | ||||||||||
| 99 | pos => [Object], | ||||||||||
| 100 | ); | ||||||||||
| 101 | 0 | my ( $self, $os ) = $sig->( @_ ); | |||||||||
| 102 | 0 | $self->SUPER::write( $os ); | |||||||||
| 103 | 0 | $os->put( $self->{pattern} ); | |||||||||
| 104 | 0 | return; | |||||||||
| 105 | } | ||||||||||
| 106 | |||||||||||
| 107 | 0 | ▶ | sub read :method { # $self ($is) | ||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 108 | 0 | state $sig = signature( | |||||||||
| 109 | method => Object, | ||||||||||
| 110 | pos => [Object], | ||||||||||
| 111 | ); | ||||||||||
| 112 | 0 | my ( $self, $is ) = $sig->( @_ ); | |||||||||
| 113 | 0 | $self->SUPER::read( $is ); | |||||||||
| 114 | 0 | $self->{pattern} = $is->get(); | |||||||||
| 115 | 0 | return $self; | |||||||||
| 116 | } | ||||||||||
| 117 | |||||||||||
| 118 | 0 | ▶ | sub build { # $obj () | ||||||||
|
Subroutine
build: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 119 | 0 | my ( $class ) = @_; | |||||||||
| 120 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 121 | 0 | ▶ | assert ( is_Str $class ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 122 | 0 | ▶ | assert ( Storable::is_retrieving ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | 0 | return $class->new( | |||||||||
| 124 | bounds => TRect->new(), | ||||||||||
| 125 | pattern => '', | ||||||||||
| 126 | ); | ||||||||||
| 127 | } | ||||||||||
| 128 | |||||||||||
| 129 | 60 | 1 | |||||||||
| 130 | |||||||||||
| 131 | __END__ | ||||||||||