| 1 | # You may distribute under the terms of the GNU General Public License | ||||||||||||
| 2 | # | ||||||||||||
| 3 | # (C) Paul Evans, 2008-2013 -- leonerd@leonerd.org.uk | ||||||||||||
| 4 | |||||||||||||
| 5 | package Circle::Widget::Entry; | ||||||||||||
| 6 | |||||||||||||
| 7 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 4 | ▶ | use base qw( Circle::Widget ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | |||||||||||||
| 12 | sub new | ||||||||||||
| 13 | { | ||||||||||||
| 14 | 0 | ▶ | my $class = shift; | ||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 15 | 0 | my %args = @_; | |||||||||||
| 16 | |||||||||||||
| 17 | 0 | my $self = $class->SUPER::new( @_ ); | |||||||||||
| 18 | |||||||||||||
| 19 | 0 | $self->{on_enter} = $args{on_enter}; | |||||||||||
| 20 | 0 | $self->{history} = $args{history}; | |||||||||||
| 21 | |||||||||||||
| 22 | 0 | $self->set_prop_text( "" ); | |||||||||||
| 23 | 0 | $self->set_prop_autoclear( $args{autoclear} ); | |||||||||||
| 24 | |||||||||||||
| 25 | 0 | return $self; | |||||||||||
| 26 | } | ||||||||||||
| 27 | |||||||||||||
| 28 | sub method_enter | ||||||||||||
| 29 | { | ||||||||||||
| 30 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
method_enter: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 31 | 0 | my ( $ctx, $text ) = @_; | |||||||||||
| 32 | 0 | $self->{on_enter}->( $text, $ctx ); | |||||||||||
| 33 | |||||||||||||
| 34 | 0 | ▶ | if( defined( my $history = $self->{history} ) ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 0 | my $histqueue = $self->get_prop_history; | |||||||||||
| 36 | |||||||||||||
| 37 | 0 | my $overcount = @$histqueue + 1 - $history; | |||||||||||
| 38 | |||||||||||||
| 39 | 0 | ▶ | $self->shift_prop_history( $overcount ) if $overcount > 0; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | |||||||||||||
| 41 | 0 | $self->push_prop_history( $text ); | |||||||||||
| 42 | } | ||||||||||||
| 43 | } | ||||||||||||
| 44 | |||||||||||||
| 45 | package Circle::Widget::Entry::CompleteGroup; | ||||||||||||
| 46 | |||||||||||||
| 47 | 4 | ▶ | use base qw( Tangence::Object ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 48 | |||||||||||||
| 49 | sub new | ||||||||||||
| 50 | { | ||||||||||||
| 51 | 0 | ▶ | my $class = shift; | ||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
| |||||||||||||
| 52 | 0 | my %args = @_; | |||||||||||
| 53 | |||||||||||||
| 54 | 0 | my $self = $class->SUPER::new( @_ ); | |||||||||||
| 55 | |||||||||||||
| 56 | 0 | ▶ | $self->set_prop_only_at_sol( $args{only_at_sol} || 0 ); | ||||||||||
|
Condition0%0/2
$args{'only_at_sol'} || 0
MC/DC0%0/1
$args{'only_at_sol'} || 0
$args{'only_at_sol'}
Truth table0%0/2
A
A= $args{'only_at_sol'}
| |||||||||||||
| 57 | 0 | ▶ | $self->set_prop_prefix_sol( $args{prefix_sol} || '' ); | ||||||||||
|
Condition0%0/2
$args{'prefix_sol'} || ''
MC/DC0%0/1
$args{'prefix_sol'} || ''
$args{'prefix_sol'}
Truth table0%0/2
A
A= $args{'prefix_sol'}
| |||||||||||||
| 58 | 0 | ▶ | $self->set_prop_suffix_sol( $args{suffix_sol} || '' ); | ||||||||||
|
Condition0%0/2
$args{'suffix_sol'} || ''
MC/DC0%0/1
$args{'suffix_sol'} || ''
$args{'suffix_sol'}
Truth table0%0/2
A
A= $args{'suffix_sol'}
| |||||||||||||
| 59 | |||||||||||||
| 60 | 0 | return $self; | |||||||||||
| 61 | } | ||||||||||||
| 62 | |||||||||||||
| 63 | sub set | ||||||||||||
| 64 | { | ||||||||||||
| 65 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
set: not called CC=1 SCAR=6.9
| |||||||||||||
| 66 | 0 | my ( @strings ) = @_; | |||||||||||
| 67 | |||||||||||||
| 68 | 0 | $self->set_prop_items( \@strings ); | |||||||||||
| 69 | } | ||||||||||||
| 70 | |||||||||||||
| 71 | sub add | ||||||||||||
| 72 | { | ||||||||||||
| 73 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
add: not called CC=2 SCAR=17.9
| |||||||||||||
| 74 | 0 | my ( $str ) = @_; | |||||||||||
| 75 | |||||||||||||
| 76 | 0 | ▶ | grep { $_ eq $str } @{ $self->get_prop_items } or | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 77 | $self->push_prop_items( $str ); | ||||||||||||
| 78 | } | ||||||||||||
| 79 | |||||||||||||
| 80 | sub remove | ||||||||||||
| 81 | { | ||||||||||||
| 82 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
remove: not called CC=2 SCAR=17.9
| |||||||||||||
| 83 | 0 | my ( $str ) = @_; | |||||||||||
| 84 | |||||||||||||
| 85 | 0 | my $items = $self->get_prop_items; | |||||||||||
| 86 | 0 | my @indices = grep { $items->[$_] eq $str } 0 .. $#$items; | |||||||||||
| 87 | |||||||||||||
| 88 | 0 | $self->splice_prop_items( $_, 1, () ) for reverse @indices; | |||||||||||
| 89 | } | ||||||||||||
| 90 | |||||||||||||
| 91 | 4 | 0x55AA; | |||||||||||