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