| 1 | package TUI::Drivers::ScreenCell; | ||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: screen cell value type | ||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||
| 4 | 103 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | 103 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 103 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||
| 8 | 103 | our $VERSION = '2.000002'; | |||||||||||||||||||||||||||||||||
| 9 | 103 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||
| 10 | 103 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||
| 12 | 103 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 13 | 103 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||
| 14 | TScreenCell | ||||||||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||
| 17 | 103 | ▶ | use PerlX::Assert::PP; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 18 | 103 | ▶ | use Scalar::Util qw( | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 19 | blessed | ||||||||||||||||||||||||||||||||||
| 20 | looks_like_number | ||||||||||||||||||||||||||||||||||
| 21 | 103 | ); | |||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||
| 23 | 103 | ▶ | use TUI::Drivers::AttrPair; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 24 | 103 | ▶ | use TUI::Drivers::ColorAttr; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 25 | 103 | ▶ | use TUI::Drivers::ScreenCharacter; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||
| 27 | sub TScreenCell() { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||
| 29 | # macro for coercing a value into a TScreenCharacter object | ||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | my $coerceChar = sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | return ref $_[0] ? $_[0] : TScreenCharacter->new( text => $_[0] ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 32 | 103 | }; | |||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||
| 34 | # macro for coercing a value into a TColorAttr object | ||||||||||||||||||||||||||||||||||
| 35 | 2 | ▶ | my $coerceAttr = sub { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||
| 36 | 2 | ▶ | return ref $_[0] ? $_[0] : TColorAttr->new( bios => $_[0] ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 37 | 103 | }; | |||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||
| 39 | 9 | ▶ | sub new { # $cell (|%args) | ||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=14 SCAR=30.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 40 | 9 | my ( $class, @args ) = @_; | |||||||||||||||||||||||||||||||||
| 41 | 9 | ▶ | assert ( $class and !ref $class ); | ||||||||||||||||||||||||||||||||
|
Condition33%1/3
$class && !ref($class)
MC/DC0%0/2
$class && !ref($class)
$class
!ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
| |||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||
| 43 | 9 | my ( $lo, $hi ); | |||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||
| 45 | # TScreenCell->new() | ||||||||||||||||||||||||||||||||||
| 46 | 9 | ▶ | if ( !@args ) { | ||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||
| 47 | 5 | $lo = TScreenCharacter->new(); | |||||||||||||||||||||||||||||||||
| 48 | 5 | $hi = TColorAttr->new(); | |||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||
| 51 | # TScreenCell->new( bios => Int ) | ||||||||||||||||||||||||||||||||||
| 52 | ▶ | elsif ( @args == 2 && $args[0] eq 'bios' ) { | |||||||||||||||||||||||||||||||||
|
Condition66%2/3
@args == 2 and $args[0] eq "bios"
MC/DC50%1/2
@args == 2 and $args[0] eq "bios"
@args == 2
$args[0] eq "bios"
Truth table66%2/3
A and B
A= @args == 2B= $args[0] eq "bios"
| |||||||||||||||||||||||||||||||||||
| 53 | 3 | assert ( looks_like_number $args[1] ); | |||||||||||||||||||||||||||||||||
| 54 | 3 | my $bios = $args[1]; | |||||||||||||||||||||||||||||||||
| 55 | 3 | my ( $ch, $attr ) = unpack 'aC' => pack 'v' => $bios; | |||||||||||||||||||||||||||||||||
| 56 | 3 | $lo = TScreenCharacter->new( text => $ch ); | |||||||||||||||||||||||||||||||||
| 57 | 3 | $hi = TColorAttr->new( bios => $attr ); | |||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||
| 60 | # TScreenCell->new( ch => TScreenCharacter, attr => TColorAttr ) | ||||||||||||||||||||||||||||||||||
| 61 | elsif ( @args % 2 == 0 ) { | ||||||||||||||||||||||||||||||||||
| 62 | 1 | my %args = @args; | |||||||||||||||||||||||||||||||||
| 63 | 1 | ▶ | assert ( exists $args{ch} && exists $args{attr} ); | ||||||||||||||||||||||||||||||||
|
Condition33%1/3
exists $args{'ch'} && exists $args{'attr'}
MC/DC0%0/2
exists $args{'ch'} && exists $args{'attr'}
exists $args{'ch'}
exists $args{'attr'}
Truth table33%1/3
A && B
A= exists $args{'ch'}B= exists $args{'attr'}
| |||||||||||||||||||||||||||||||||||
| 64 | 1 | ▶ | assert ( blessed $args{ch} or !ref $args{ch} && length $args{ch} ); | ||||||||||||||||||||||||||||||||
|
Condition33%2/6
builtin::blessed($args{'ch'}) || !ref($args{'ch'}) && length $args{'ch'}
not ref $args{"ch"} and length $args{"ch"}
MC/DC0%0/3
builtin::blessed($args{'ch'}) || !ref($args{'ch'}) && length $args{'ch'}
builtin::blessed($args{'ch'})
not ref $args{"ch"}
length $args{"ch"}
Truth table25%1/4
A || not(B) and C
A= builtin::blessed($args{'ch'})B= not ref $args{"ch"}C= length $args{"ch"}
| |||||||||||||||||||||||||||||||||||
| 65 | 1 | ▶ | assert ( blessed $args{attr} or looks_like_number $args{attr} ); | ||||||||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($args{'attr'}) || &looks_like_number($args{'attr'})
MC/DC0%0/2
builtin::blessed($args{'attr'}) || &looks_like_number($args{'attr'})
builtin::blessed($args{'attr'})
&looks_like_number($args{'attr'})
Truth table33%1/3
A || B
A= builtin::blessed($args{'attr'})B= &looks_like_number($args{'attr'})
| |||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||
| 67 | 1 | ▶ | $lo = ref $args{ch} ? $args{ch}->clone() : $args{ch}->$coerceChar(); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 68 | 1 | ▶ | $hi = ref $args{attr} ? $args{attr}->clone() : $args{attr}->$coerceAttr(); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||
| 71 | else { | ||||||||||||||||||||||||||||||||||
| 72 | 0 | return; | |||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||
| 75 | 9 | ▶ | assert ( blessed $lo and $lo->isa( TScreenCharacter ) ); | ||||||||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($lo) && $lo->isa('TUI::Drivers::ScreenCharacter')
MC/DC0%0/2
builtin::blessed($lo) && $lo->isa('TUI::Drivers::ScreenCharacter')
builtin::blessed($lo)
$lo->isa('TUI::Drivers::ScreenCharacter')
Truth table33%1/3
A && B
A= builtin::blessed($lo)B= $lo->isa('TUI::Drivers::ScreenCharacter')
| |||||||||||||||||||||||||||||||||||
| 76 | 9 | ▶ | assert ( blessed $hi and $hi->isa( TColorAttr ) ); | ||||||||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($hi) && $hi->isa('TUI::Drivers::ColorAttr')
MC/DC0%0/2
builtin::blessed($hi) && $hi->isa('TUI::Drivers::ColorAttr')
builtin::blessed($hi)
$hi->isa('TUI::Drivers::ColorAttr')
Truth table33%1/3
A && B
A= builtin::blessed($hi)B= $hi->isa('TUI::Drivers::ColorAttr')
| |||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||
| 78 | 9 | return bless [ $lo, $hi ], $class; | |||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub assign { # void ($other) | ||||||||||||||||||||||||||||||||
|
Subroutine
assign: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 82 | 0 | my ( $self, $other ) = @_; | |||||||||||||||||||||||||||||||||
| 83 | 0 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||
| 84 | 0 | assert ( blessed $other ); | |||||||||||||||||||||||||||||||||
| 85 | 0 | $self->[0]->assign( $other->[0] ); | |||||||||||||||||||||||||||||||||
| 86 | 0 | $self->[1]->assign( $other->[1] ); | |||||||||||||||||||||||||||||||||
| 87 | 0 | return; | |||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub clone { # $cell () | ||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 91 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||
| 92 | 0 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||
| 93 | 0 | return bless [ | |||||||||||||||||||||||||||||||||
| 94 | $self->[0]->clone(), | ||||||||||||||||||||||||||||||||||
| 95 | $self->[1]->clone(), | ||||||||||||||||||||||||||||||||||
| 96 | ], ref $self; | ||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||
| 99 | 13 | ▶ | sub character { # $ch|undef (|$ch) | ||||||||||||||||||||||||||||||||
|
Subroutine
character: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 100 | 13 | my ( $cell, $ch ) = @_; | |||||||||||||||||||||||||||||||||
| 101 | 13 | assert ( blessed $cell ); | |||||||||||||||||||||||||||||||||
| 102 | 13 | ▶ | assert ( !defined $ch or blessed $ch or !ref $ch ); | ||||||||||||||||||||||||||||||||
|
Condition83%5/6
!defined($ch) || builtin::blessed($ch) || !ref($ch)
not defined $ch or builtin::blessed($ch)
MC/DC0%0/3
!defined($ch) || builtin::blessed($ch) || !ref($ch)
not defined $ch
builtin::blessed($ch)
!ref($ch)
Truth table75%3/4
not(A) or B || not(C)
A= not defined $chB= builtin::blessed($ch)C= !ref($ch)
| |||||||||||||||||||||||||||||||||||
| 103 | 13 | ▶ | goto SET if @_ > 1; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 104 | GET: { | ||||||||||||||||||||||||||||||||||
| 105 | 9 | return $cell->[0]; | |||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||
| 107 | SET: { | ||||||||||||||||||||||||||||||||||
| 108 | 4 | ${ $cell->[0] } = ${ $ch->$coerceChar() }; | |||||||||||||||||||||||||||||||||
| 109 | 4 | return; | |||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||
| 113 | 11 | ▶ | sub attribute { # $attr|undef (|$attr) | ||||||||||||||||||||||||||||||||
|
Subroutine
attribute: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 114 | 11 | my ( $cell, $attr ) = @_; | |||||||||||||||||||||||||||||||||
| 115 | 11 | assert ( blessed $cell ); | |||||||||||||||||||||||||||||||||
| 116 | 11 | ▶ | assert ( !defined $attr or blessed $attr or looks_like_number $attr ); | ||||||||||||||||||||||||||||||||
|
Condition83%5/6
!defined($attr) || builtin::blessed($attr) || &looks_like_number($attr)
not defined $attr or builtin::blessed($attr)
MC/DC0%0/3
!defined($attr) || builtin::blessed($attr) || &looks_like_number($attr)
not defined $attr
builtin::blessed($attr)
&looks_like_number($attr)
Truth table75%3/4
not(A) or B || C
A= not defined $attrB= builtin::blessed($attr)C= &looks_like_number($attr)
| |||||||||||||||||||||||||||||||||||
| 117 | 11 | ▶ | goto SET if @_ > 1; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 118 | GET: { | ||||||||||||||||||||||||||||||||||
| 119 | 9 | return $cell->[1]; | |||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||
| 121 | SET: { | ||||||||||||||||||||||||||||||||||
| 122 | 2 | assert ( defined $attr ); | |||||||||||||||||||||||||||||||||
| 123 | 2 | ${ $cell->[1] } = ref $attr eq TAttrPair | |||||||||||||||||||||||||||||||||
| 124 | 0 | ? ${ $attr->[0] } # retrieve the lo value from the pair | |||||||||||||||||||||||||||||||||
| 125 | 2 | ▶ | : ${ $attr->$coerceAttr() }; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 126 | 2 | return; | |||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||
| 130 | 2 | ▶ | sub equals { # $bool ($other) | ||||||||||||||||||||||||||||||||
|
Subroutine
equals: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 131 | 2 | my ( $self, $other ) = @_; | |||||||||||||||||||||||||||||||||
| 132 | 2 | assert ( blessed $self ); | |||||||||||||||||||||||||||||||||
| 133 | 2 | assert ( blessed $other ); | |||||||||||||||||||||||||||||||||
| 134 | return ref $self eq ref $other | ||||||||||||||||||||||||||||||||||
| 135 | 2 | ▶ | && ${ $self->[0] } eq ${ $other->[0] } | ||||||||||||||||||||||||||||||||
|
Condition66%4/6
ref $self eq ref $other && ${$self->[0];} eq ${$other->[0];} && $self->[1]->equals($other->[1])
ref $self eq ref $other and ${$self->[0];} eq ${$other->[0];}
MC/DC33%1/3
ref $self eq ref $other && ${$self->[0];} eq ${$other->[0];} && $self->[1]->equals($other->[1])
ref $self eq ref $other
${$self->[0];} eq ${$other->[0];}
$self->[1]->equals($other->[1])
Truth table50%2/4
A and B && C
A= ref $self eq ref $otherB= ${$self->[0];} eq ${$other->[0];}C= $self->[1]->equals($other->[1])
| |||||||||||||||||||||||||||||||||||
| 136 | && $self->[1]->equals( $other->[1] ); | ||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||
| 139 | use overload | ||||||||||||||||||||||||||||||||||
| 140 | 103 | ▶ | '==' => \&equals, | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 141 | 103 | fallback => 1; | |||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||
| 143 | 103 | 1; | |||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||
| 145 | =head1 NAME | ||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||
| 147 | TUI::Drivers::ScreenCell - screen cell value type | ||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||
| 149 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||
| 151 | use TUI::Drivers; | ||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||
| 153 | my $cell = TScreenCell->new( | ||||||||||||||||||||||||||||||||||
| 154 | bios => 0x411F, | ||||||||||||||||||||||||||||||||||
| 155 | ); | ||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||
| 157 | $cell = TScreenCell->new( | ||||||||||||||||||||||||||||||||||
| 158 | ch => 'A', | ||||||||||||||||||||||||||||||||||
| 159 | attr => 0x1F, | ||||||||||||||||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||
| 162 | $cell->character( 'A' ); | ||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||
| 164 | my $attr = $cell->attribute; | ||||||||||||||||||||||||||||||||||
| 165 | my $ch = $cell->character; | ||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||
| 167 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||
| 169 | C<TScreenCell> stores the character and color attributes associated with | ||||||||||||||||||||||||||||||||||
| 170 | a screen cell. | ||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||
| 172 | A screen cell consists of: | ||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||
| 174 | =over | ||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||
| 176 | =item * | ||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||
| 178 | a L<TScreenCharacter|TUI::Drivers::ScreenCharacter> value describing the cell | ||||||||||||||||||||||||||||||||||
| 179 | contents | ||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||
| 181 | =item * | ||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||
| 183 | a L<TColorAttr|TUI::Drivers::ColorAttr> value describing the cell attributes | ||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||
| 185 | =back | ||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||
| 187 | Double-width characters occupy two adjacent screen cells. The first cell | ||||||||||||||||||||||||||||||||||
| 188 | contains the character itself and the second cell contains a wide-character | ||||||||||||||||||||||||||||||||||
| 189 | trail placeholder. | ||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||
| 191 | If a double-width character is not followed by a wide-character trail, or | ||||||||||||||||||||||||||||||||||
| 192 | if a wide-character trail is not preceded by a double-width character, the | ||||||||||||||||||||||||||||||||||
| 193 | character is considered to be partially overwritten. | ||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||
| 195 | L<TScreenCharacter|TUI::Drivers::ScreenCharacter> is designed to be compatible | ||||||||||||||||||||||||||||||||||
| 196 | with Borland's I<Turbo Vision> cell structure, and it is therefore trivially | ||||||||||||||||||||||||||||||||||
| 197 | constructible and copyable via L</assign> and L</clone>. | ||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||
| 199 | A zero-initialized TScreenCharacter is valid and represents the text of an | ||||||||||||||||||||||||||||||||||
| 200 | empty screen cell. | ||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||
| 202 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||
| 204 | =head2 new | ||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||
| 206 | Creates a screen cell. | ||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||
| 208 | my $cell = TScreenCell->new(); | ||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||
| 210 | Construct a cell using default attributes and an empty character value. | ||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||
| 212 | my $cell = TScreenCell->new( bios => 0x411F ); | ||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||
| 214 | Construct a cell from a PC text-mode character/attribute word. | ||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||
| 216 | my $cell = TScreenCell->new( ch => $char, attr => $attr ); | ||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||
| 218 | Construct a cell consisting of a character and an attribute value. | ||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||
| 220 | =head1 METHODS | ||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||
| 222 | =head2 assign | ||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||
| 224 | $self->assign($other); | ||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||
| 226 | Copies the contents of another C<TScreenCell> into the current one. | ||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||
| 228 | =head2 attribute | ||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||
| 230 | my $attr = $self->attribute(); | ||||||||||||||||||||||||||||||||||
| 231 | $self->attribute($attr); | ||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||
| 233 | Sets the cell attributes or returns the L<TColorAttr|TUI::Drivers::ColorAttr> | ||||||||||||||||||||||||||||||||||
| 234 | associated with the cell. | ||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||
| 236 | =head2 character | ||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||
| 238 | my $ch = $self->character(); | ||||||||||||||||||||||||||||||||||
| 239 | $self->character($ch); | ||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||
| 241 | Sets the character stored in the cell or returns the | ||||||||||||||||||||||||||||||||||
| 242 | L<TScreenCharacter|TUI::Drivers::ScreenCharacter> stored in the cell. | ||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||
| 244 | =head2 clone | ||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||
| 246 | my $cell = $self->clone(); | ||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||
| 248 | Returns a new C<TScreenCell> object that is a copy of the current one. | ||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||
| 250 | =head2 equals | ||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||
| 252 | my $bool = $self->equals($other); | ||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||
| 254 | Returns true if both screen cells contain identical character and | ||||||||||||||||||||||||||||||||||
| 255 | attribute values. | ||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||
| 257 | =head1 OPERATORS | ||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||
| 259 | =head2 Numeric equality | ||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||
| 261 | $a == $b | ||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||
| 263 | Returns true when C<TScreenCell> values contain identical data. | ||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||
| 265 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||
| 267 | L<TScreenCharacter|TUI::Drivers::ScreenCharacter>, | ||||||||||||||||||||||||||||||||||
| 268 | L<TColorAttr|TUI::Drivers::ColorAttr> | ||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||
| 270 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||
| 272 | =over | ||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||
| 274 | =item * magiblot <magiblot@hotmail.com> (original screen cell design) | ||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||
| 276 | =item * J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance) | ||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||
| 278 | =back | ||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||
| 280 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||
| 282 | Copyright (c) 2019-2026 the L</AUTHORS> listed above. | ||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||
| 284 | This software is licensed under the MIT license (see the LICENSE file, which is | ||||||||||||||||||||||||||||||||||
| 285 | part of the distribution). | ||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||
| 287 | =cut | ||||||||||||||||||||||||||||||||||