| 1 | package TUI::Dialogs::ParamText; | ||||||||||
| 2 | # ABSTRACT: displays formatted dynamic text inside a dialog | ||||||||||
| 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 | |||||||||||
| 14 | 5 | our @EXPORT = qw( | |||||||||
| 15 | TParamText | ||||||||||
| 16 | new_TParamText | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 5 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 5 | ▶ | use Storable; | ||||||||
|
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( :types ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 5 | ▶ | use TUI::Dialogs::StaticText; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 5 | ▶ | use TUI::Objects::Rect; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 5 | ▶ | use TUI::toolkit; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | sub TParamText() { __PACKAGE__ } | ||||||||||
| 29 | sub name() { 'TParamText' } | ||||||||||
| 30 | 0 | ▶ | sub new_TParamText { __PACKAGE__->from( @_ ) } | ||||||||
|
Subroutine
new_TParamText: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 31 | |||||||||||
| 32 | 5 | extends TStaticText; | |||||||||
| 33 | |||||||||||
| 34 | # protected attributes | ||||||||||
| 35 | 5 | has str => ( is => 'ro', default => '' ); | |||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | sub BUILDARGS { # \%args (%args) | ||||||||
|
Subroutine
BUILDARGS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 38 | 0 | state $sig = signature( | |||||||||
| 39 | method => 1, | ||||||||||
| 40 | named => [ | ||||||||||
| 41 | bounds => Object, | ||||||||||
| 42 | ], | ||||||||||
| 43 | caller_level => +1, | ||||||||||
| 44 | ); | ||||||||||
| 45 | 0 | my ( $class, $args1 ) = $sig->( @_ ); | |||||||||
| 46 | 0 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | |||||||||
| 47 | my $args2 = $class->SUPER::BUILDARGS( | ||||||||||
| 48 | bounds => $args1->{bounds}, | ||||||||||
| 49 | 0 | text => '', | |||||||||
| 50 | ); | ||||||||||
| 51 | 0 | return { %$args1, %$args2 }; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub from { # $obj ($bounds) | ||||||||
|
Subroutine
from: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 55 | 0 | state $sig = signature( | |||||||||
| 56 | method => 1, | ||||||||||
| 57 | pos => [Object], | ||||||||||
| 58 | ); | ||||||||||
| 59 | 0 | my ( $class, $bounds ) = $sig->( @_ ); | |||||||||
| 60 | 0 | return $class->new( bounds => $bounds ); | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 0 | ▶ | sub getText { # void (\$s) | ||||||||
|
Subroutine
getText: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 64 | 0 | state $sig = signature( | |||||||||
| 65 | method => Object, | ||||||||||
| 66 | pos => [ScalarRef], | ||||||||||
| 67 | ); | ||||||||||
| 68 | 0 | my ( $self, $s ) = $sig->( @_ ); | |||||||||
| 69 | 0 | ▶ | $$s = defined $self->{str} ? $self->{str} : ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | 0 | return; | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 0 | ▶ | sub getTextLen { # $len () | ||||||||
|
Subroutine
getTextLen: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 74 | 0 | state $sig = signature( | |||||||||
| 75 | method => Object, | ||||||||||
| 76 | pos => [], | ||||||||||
| 77 | ); | ||||||||||
| 78 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||
| 79 | 0 | ▶ | return defined $self->{str} ? length $self->{str} : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | } | ||||||||||
| 81 | |||||||||||
| 82 | 0 | ▶ | sub setText { # void ($fmt, @args) | ||||||||
|
Subroutine
setText: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 83 | 0 | state $sig = signature( | |||||||||
| 84 | method => Object, | ||||||||||
| 85 | pos => [ | ||||||||||
| 86 | Str, | ||||||||||
| 87 | ArrayRef, { slurpy => 1 } | ||||||||||
| 88 | ], | ||||||||||
| 89 | ); | ||||||||||
| 90 | 0 | my ( $self, $fmt, $args ) = $sig->( @_ ); | |||||||||
| 91 | 0 | $self->{str} = sprintf( $fmt, @$args ); | |||||||||
| 92 | 0 | $self->drawView(); | |||||||||
| 93 | 0 | return; | |||||||||
| 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->{str} ); | |||||||||
| 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->{str} = $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( bounds => TRect->new() ); | |||||||||
| 124 | } | ||||||||||
| 125 | |||||||||||
| 126 | 5 | 1 | |||||||||
| 127 | |||||||||||
| 128 | __END__ | ||||||||||