line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
4
|
|
33
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
94
|
|
8
|
4
|
|
|
4
|
|
16
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
85
|
|
9
|
4
|
|
|
4
|
|
17
|
use base qw( Circle::Widget ); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1419
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.173320'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
2
|
|
|
2
|
0
|
72
|
my $class = shift; |
16
|
2
|
|
|
|
|
16
|
my %args = @_; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
25
|
my $self = $class->SUPER::new( @_ ); |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
7
|
$self->{on_enter} = $args{on_enter}; |
21
|
2
|
|
|
|
|
4
|
$self->{history} = $args{history}; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
7
|
$self->set_prop_text( "" ); |
24
|
2
|
|
|
|
|
28
|
$self->set_prop_autoclear( $args{autoclear} ); |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
25
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub method_enter |
30
|
|
|
|
|
|
|
{ |
31
|
2
|
|
|
2
|
0
|
12266
|
my $self = shift; |
32
|
2
|
|
|
|
|
6
|
my ( $ctx, $text ) = @_; |
33
|
2
|
|
|
|
|
18
|
$self->{on_enter}->( $text, $ctx ); |
34
|
|
|
|
|
|
|
|
35
|
2
|
50
|
|
|
|
20
|
if( defined( my $history = $self->{history} ) ) { |
36
|
2
|
|
|
|
|
19
|
my $histqueue = $self->get_prop_history; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
26
|
my $overcount = @$histqueue + 1 - $history; |
39
|
|
|
|
|
|
|
|
40
|
2
|
50
|
|
|
|
12
|
$self->shift_prop_history( $overcount ) if $overcount > 0; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
9
|
$self->push_prop_history( $text ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub set_on_typing |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
49
|
0
|
|
|
|
|
|
my ( $on_typing ) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->{on_typing} = $on_typing; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$self->set_prop_want_typing( defined $self->{on_typing} ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub method_typing |
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
59
|
0
|
|
|
|
|
|
my ( $ctx, $typing ) = @_; |
60
|
0
|
0
|
|
|
|
|
$self->{on_typing}->( $typing ) if $self->{on_typing}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
package Circle::Widget::Entry::CompleteGroup; |
64
|
|
|
|
|
|
|
|
65
|
4
|
|
|
4
|
|
36
|
use base qw( Tangence::Object ); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1338
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub new |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
|
|
my $class = shift; |
70
|
0
|
|
|
|
|
|
my %args = @_; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new( @_ ); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
0
|
|
|
|
$self->set_prop_only_at_sol( $args{only_at_sol} || 0 ); |
75
|
0
|
|
0
|
|
|
|
$self->set_prop_prefix_sol( $args{prefix_sol} || '' ); |
76
|
0
|
|
0
|
|
|
|
$self->set_prop_suffix_sol( $args{suffix_sol} || '' ); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return $self; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub set |
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
0
|
|
|
my $self = shift; |
84
|
0
|
|
|
|
|
|
my ( @strings ) = @_; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$self->set_prop_items( \@strings ); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub add |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
0
|
|
|
my $self = shift; |
92
|
0
|
|
|
|
|
|
my ( $str ) = @_; |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
grep { $_ eq $str } @{ $self->get_prop_items } or |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
$self->push_prop_items( $str ); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub remove |
99
|
|
|
|
|
|
|
{ |
100
|
0
|
|
|
0
|
|
|
my $self = shift; |
101
|
0
|
|
|
|
|
|
my ( $str ) = @_; |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
my $items = $self->get_prop_items; |
104
|
0
|
|
|
|
|
|
my @indices = grep { $items->[$_] eq $str } 0 .. $#$items; |
|
0
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
$self->splice_prop_items( $_, 1, () ) for reverse @indices; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
0x55AA; |