line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UI::Various::Input; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Author, Copyright and License: see end of file |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
UI::Various::Input - general input widget of L |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use UI::Various; |
12
|
|
|
|
|
|
|
my $main = UI::Various::main(); |
13
|
|
|
|
|
|
|
my $input = 'enter name'; |
14
|
|
|
|
|
|
|
$main->window(... |
15
|
|
|
|
|
|
|
UI::Various::Input->new(textvar => $input), |
16
|
|
|
|
|
|
|
...); |
17
|
|
|
|
|
|
|
$main->mainloop(); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 ABSTRACT |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This module defines the general input widget of an application using |
22
|
|
|
|
|
|
|
L. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Besides the common attributes inherited from C the |
27
|
|
|
|
|
|
|
C widget knows only one additional attribute: |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Note that currently only single line input fields with visible text (no |
30
|
|
|
|
|
|
|
passwords!) are supported. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 Attributes |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=over |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
######################################################################### |
39
|
|
|
|
|
|
|
|
40
|
8
|
|
|
8
|
|
82
|
use v5.14; |
|
8
|
|
|
|
|
23
|
|
41
|
8
|
|
|
8
|
|
35
|
use strictures; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
36
|
|
42
|
8
|
|
|
8
|
|
1132
|
no indirect 'fatal'; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
30
|
|
43
|
8
|
|
|
8
|
|
531
|
no multidimensional; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
31
|
|
44
|
8
|
|
|
8
|
|
226
|
use warnings 'once'; |
|
8
|
|
|
|
|
30
|
|
|
8
|
|
|
|
|
349
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
47
|
|
|
|
|
|
|
|
48
|
8
|
|
|
8
|
|
39
|
use UI::Various::core; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
36
|
|
49
|
8
|
|
|
8
|
|
38
|
use UI::Various::widget; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
436
|
|
50
|
8
|
|
|
8
|
|
35
|
BEGIN { require 'UI/Various/' . UI::Various::core::using() . '/Input.pm'; } |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
require Exporter; |
53
|
|
|
|
|
|
|
our @ISA = qw(UI::Various::widget); |
54
|
|
|
|
|
|
|
our @EXPORT_OK = qw(); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
######################################################################### |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item textvar [rw, recommended] |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
a variable reference for the input field |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The content of the variable will be displayed and can be modified through |
63
|
|
|
|
|
|
|
the input field. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub textvar($;$) |
68
|
|
|
|
|
|
|
{ |
69
|
3
|
|
|
3
|
1
|
10
|
return access_varref('textvar', @_); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
######################################################################### |
73
|
|
|
|
|
|
|
# |
74
|
|
|
|
|
|
|
# internal constants and data: |
75
|
|
|
|
|
|
|
|
76
|
8
|
|
|
|
|
491
|
use constant ALLOWED_PARAMETERS => |
77
|
8
|
|
|
8
|
|
45
|
(UI::Various::widget::COMMON_PARAMETERS, qw(textvar)); |
|
8
|
|
|
|
|
11
|
|
78
|
8
|
|
|
8
|
|
40
|
use constant DEFAULT_ATTRIBUTES => (textvar => dummy_varref()); |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
22
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
######################################################################### |
81
|
|
|
|
|
|
|
######################################################################### |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 METHODS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Besides the accessors (attributes) described above and by |
88
|
|
|
|
|
|
|
L and the methods |
89
|
|
|
|
|
|
|
inherited from L only the |
90
|
|
|
|
|
|
|
constructor is provided by the C class itself: |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
######################################################################### |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 B - constructor |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
see L
|
99
|
|
|
|
|
|
|
constructor for UI elements> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub new($;\[@$]) |
106
|
|
|
|
|
|
|
{ |
107
|
3
|
|
|
3
|
1
|
686
|
debug(3, __PACKAGE__, '::new'); |
108
|
3
|
|
|
|
|
32
|
return construct({ DEFAULT_ATTRIBUTES }, |
109
|
|
|
|
|
|
|
'^(?:' . join('|', ALLOWED_PARAMETERS) . ')$', |
110
|
|
|
|
|
|
|
@_); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
######################################################################### |
116
|
|
|
|
|
|
|
######################################################################### |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SEE ALSO |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 LICENSE |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Copyright (C) Thomas Dorner. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it |
127
|
|
|
|
|
|
|
under the same terms as Perl itself. See LICENSE file for more details. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 AUTHOR |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Thomas Dorner Edorner (at) cpan (dot) orgE |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |