| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#! /usr/bin/env perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
;# |
|
4
|
|
|
|
|
|
|
;# COPYRIGHT |
|
5
|
|
|
|
|
|
|
;# Copyright (c) 1998-2007 Anthony R Fletcher. All rights reserved. This |
|
6
|
|
|
|
|
|
|
;# module is free software; you can redistribute it and/or modify it |
|
7
|
|
|
|
|
|
|
;# under the same terms as Perl itself. |
|
8
|
|
|
|
|
|
|
;# |
|
9
|
|
|
|
|
|
|
;# Please retain my name on any bits taken from this code. |
|
10
|
|
|
|
|
|
|
;# This code is supplied as-is - use at your own risk. |
|
11
|
|
|
|
|
|
|
;# |
|
12
|
|
|
|
|
|
|
;# AR Fletcher. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
;# This is a Tk month browser. |
|
15
|
|
|
|
|
|
|
;# Place into Tk/Year.pm somewhere in your perl-lib path. |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
64802
|
use 5; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
57
|
|
|
18
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
39
|
|
|
19
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1170
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package Tk::Year; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '1.1'; |
|
24
|
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
7
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
97
|
|
|
26
|
1
|
|
|
1
|
|
1347
|
use POSIX; |
|
|
1
|
|
|
|
|
8074
|
|
|
|
1
|
|
|
|
|
8
|
|
|
27
|
1
|
|
|
1
|
|
4684
|
use Time::Local; |
|
|
1
|
|
|
|
|
1801
|
|
|
|
1
|
|
|
|
|
60
|
|
|
28
|
1
|
|
|
1
|
|
1070
|
use Text::Abbrev; |
|
|
1
|
|
|
|
|
48
|
|
|
|
1
|
|
|
|
|
48
|
|
|
29
|
1
|
|
|
1
|
|
511
|
use Tk; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use Tk::Widget; |
|
31
|
|
|
|
|
|
|
use Tk::Month; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use base qw(Tk::Derived Tk::Frame); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Construct Tk::Widget 'Year'; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub debug {}; |
|
38
|
|
|
|
|
|
|
#sub debug { print STDERR @_; }; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
;# --------------------------------------------------------------------- |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
;## Constructor. Uses new inherited from base class |
|
43
|
|
|
|
|
|
|
sub Populate |
|
44
|
|
|
|
|
|
|
{ |
|
45
|
|
|
|
|
|
|
debug "args: @_\n"; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $self = shift; |
|
48
|
|
|
|
|
|
|
my $args = shift; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Create all the widgets, but don't pack them. |
|
51
|
|
|
|
|
|
|
$self->SUPER::Populate($args); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Construct the subwidgets. |
|
54
|
|
|
|
|
|
|
$self->{frame} = $self->make(); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Set up extra configuration |
|
57
|
|
|
|
|
|
|
$self->ConfigSpecs( |
|
58
|
|
|
|
|
|
|
'-cols' => ['METHOD',undef,undef, 3], |
|
59
|
|
|
|
|
|
|
'-year' => ['METHOD',undef,undef, (localtime())[5]+1900], |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
'-press' => ['METHOD',undef,undef, undef], |
|
62
|
|
|
|
|
|
|
'-command' => '-press', |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# configurable from Xdefaults file. |
|
65
|
|
|
|
|
|
|
'-font' => ['CHILDREN','font','Font', undef], |
|
66
|
|
|
|
|
|
|
'-first' => ['METHOD','first','First', 0], |
|
67
|
|
|
|
|
|
|
'-sep' => ['METHOD','sep','Sep', 3], |
|
68
|
|
|
|
|
|
|
'-buttonhighlightcolor' => ['METHOD','buttonhighlightcolor','ButtonHighlightColor', ''], |
|
69
|
|
|
|
|
|
|
'-buttonhighlightbackground' => ['METHOD','buttonhighlightbackground','ButtonHighlightBackground', ''], |
|
70
|
|
|
|
|
|
|
'-buttonfg' => ['METHOD','buttonfg','ButtonFg', ''], |
|
71
|
|
|
|
|
|
|
'-buttonbg' => ['METHOD','buttonbg','ButtonBg', ''], |
|
72
|
|
|
|
|
|
|
'-buttonbd' => ['METHOD','buttonbd','ButtonBd', ''], |
|
73
|
|
|
|
|
|
|
'-buttonrelief' => ['METHOD','buttonrelief','ButtonRelief', ''], |
|
74
|
|
|
|
|
|
|
); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Any further contracts happen to the title widget. |
|
77
|
|
|
|
|
|
|
$self->Delegates( |
|
78
|
|
|
|
|
|
|
Construct => $self->{title}, |
|
79
|
|
|
|
|
|
|
DEFAULT => $self->{title}, |
|
80
|
|
|
|
|
|
|
); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# return widget. |
|
83
|
|
|
|
|
|
|
$self; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
;# Create all the subwidgets needed |
|
87
|
|
|
|
|
|
|
sub make |
|
88
|
|
|
|
|
|
|
{ |
|
89
|
|
|
|
|
|
|
debug "args: @_\n"; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $self = shift; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $width = 2; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# First create all the buttons in a grid. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# navigation row. |
|
98
|
|
|
|
|
|
|
$self->{title} = $self->Menubutton( |
|
99
|
|
|
|
|
|
|
-width => 15, |
|
100
|
|
|
|
|
|
|
-text => 'Tk::Year', |
|
101
|
|
|
|
|
|
|
); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# Create the month widgets |
|
104
|
|
|
|
|
|
|
for my $month (@Tk::Month::year) |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
|
|
|
|
|
|
my $m = $self->Month( |
|
107
|
|
|
|
|
|
|
-title => '%B', |
|
108
|
|
|
|
|
|
|
-month => $month, |
|
109
|
|
|
|
|
|
|
-navigation => 0, |
|
110
|
|
|
|
|
|
|
-side => 0, |
|
111
|
|
|
|
|
|
|
); |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
push (@{$self->{'months'}}, $m); |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
$self; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# (Re-)Pack the months in to the correct number of columns. |
|
120
|
|
|
|
|
|
|
sub cols |
|
121
|
|
|
|
|
|
|
{ |
|
122
|
|
|
|
|
|
|
my $self = shift; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# requesting the value. |
|
125
|
|
|
|
|
|
|
return $self->{Configure}->{-cols} unless @_; |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# setting the value. |
|
128
|
|
|
|
|
|
|
my $cols = shift; |
|
129
|
|
|
|
|
|
|
$self->{Configure}->{-cols} = $cols; |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# Pack the title. |
|
132
|
|
|
|
|
|
|
$self->{title}->grid( |
|
133
|
|
|
|
|
|
|
-row => 0, |
|
134
|
|
|
|
|
|
|
-column => int(($cols-1)/2), |
|
135
|
|
|
|
|
|
|
-columnspan => 2 - $cols %2 , |
|
136
|
|
|
|
|
|
|
-sticky => 'nsew', |
|
137
|
|
|
|
|
|
|
); |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# Positions (0,0), (0,1), (0,6), (0,7) are the |
|
140
|
|
|
|
|
|
|
# navigation buttons. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
my $n = 0; |
|
143
|
|
|
|
|
|
|
for my $month (@{$self->{'months'}}) |
|
144
|
|
|
|
|
|
|
{ |
|
145
|
|
|
|
|
|
|
# decide the row and column. |
|
146
|
|
|
|
|
|
|
my $c = $n % $cols ; |
|
147
|
|
|
|
|
|
|
my $r = int($n / $cols) +1; |
|
148
|
|
|
|
|
|
|
$n ++; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
$month ->grid( |
|
151
|
|
|
|
|
|
|
'-row' => $r + 1, |
|
152
|
|
|
|
|
|
|
'-column' => $c, |
|
153
|
|
|
|
|
|
|
'-sticky' => 'nsew', |
|
154
|
|
|
|
|
|
|
'-padx' => 5, |
|
155
|
|
|
|
|
|
|
); |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# Set the inter-month spacing. |
|
160
|
|
|
|
|
|
|
sub sep |
|
161
|
|
|
|
|
|
|
{ |
|
162
|
|
|
|
|
|
|
my $self = shift; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
# requesting the value. |
|
165
|
|
|
|
|
|
|
return $self->{Configure}->{-sep} unless @_; |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
# setting the value. |
|
168
|
|
|
|
|
|
|
my $sep = shift; |
|
169
|
|
|
|
|
|
|
$self->{Configure}->{-sep} = $sep; |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
for my $month (@{$self->{'months'}}) |
|
172
|
|
|
|
|
|
|
{ |
|
173
|
|
|
|
|
|
|
$month ->grid('-padx' => $sep); |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
;# configure or return various properties. |
|
178
|
|
|
|
|
|
|
sub conf |
|
179
|
|
|
|
|
|
|
{ |
|
180
|
|
|
|
|
|
|
my $self = shift; |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# Decide what called us and hence which flag to set. |
|
183
|
|
|
|
|
|
|
my $var = (caller(1))[3]; |
|
184
|
|
|
|
|
|
|
$var =~ s/^.*:/-/; |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
debug "var = $var\n"; |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
return $self->{Configure}->{$var} unless @_; |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
my $val = shift; |
|
191
|
|
|
|
|
|
|
debug "val = $val\n"; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
# remember.... |
|
194
|
|
|
|
|
|
|
$self->{Configure}->{$var} = $val; |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
$self->confMonths($var => $val); |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
debug "done\n"; |
|
199
|
|
|
|
|
|
|
} |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
;# configure all the months at once. |
|
202
|
|
|
|
|
|
|
sub confMonths |
|
203
|
|
|
|
|
|
|
{ |
|
204
|
|
|
|
|
|
|
my $self = shift; |
|
205
|
|
|
|
|
|
|
my $var = shift; |
|
206
|
|
|
|
|
|
|
my $val = shift; |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# set the months |
|
209
|
|
|
|
|
|
|
for my $m (@{$self->{'months'}}) |
|
210
|
|
|
|
|
|
|
{ |
|
211
|
|
|
|
|
|
|
$m->configure( $var => $val, ); |
|
212
|
|
|
|
|
|
|
} |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
;# return or set the year. |
|
216
|
|
|
|
|
|
|
sub year |
|
217
|
|
|
|
|
|
|
{ |
|
218
|
|
|
|
|
|
|
my $self = shift; |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
# requesting the year. |
|
221
|
|
|
|
|
|
|
return $self->{Configure}->{-year} unless @_; |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
my $year = shift; |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
# deal with aliases. |
|
226
|
|
|
|
|
|
|
if ($year eq '' || $year eq 'now') |
|
227
|
|
|
|
|
|
|
{ |
|
228
|
|
|
|
|
|
|
# current year. |
|
229
|
|
|
|
|
|
|
$year = (localtime())[5] + 1900 ; |
|
230
|
|
|
|
|
|
|
} |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
# sanity? |
|
233
|
|
|
|
|
|
|
unless ($year =~ /^\d+$/) |
|
234
|
|
|
|
|
|
|
{ |
|
235
|
|
|
|
|
|
|
warn "Cannot set year to '$year'!\n"; |
|
236
|
|
|
|
|
|
|
return; |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
if ($year > 2038) |
|
240
|
|
|
|
|
|
|
{ |
|
241
|
|
|
|
|
|
|
warn "Tk::Year: Cannot deal with years beyound 2038\n"; |
|
242
|
|
|
|
|
|
|
return; |
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
# remember.... |
|
246
|
|
|
|
|
|
|
$self->{Configure}->{-year} = $year; |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
# set the title. |
|
249
|
|
|
|
|
|
|
$self->{title}->configure('-text' => $year, ); |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
# set the months |
|
252
|
|
|
|
|
|
|
$self->confMonths('-year' => $year); |
|
253
|
|
|
|
|
|
|
} |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
;# set the characters of the months. |
|
256
|
|
|
|
|
|
|
sub first { &conf; } |
|
257
|
|
|
|
|
|
|
sub press { &conf; } |
|
258
|
|
|
|
|
|
|
sub buttonfg { &conf; } |
|
259
|
|
|
|
|
|
|
sub buttonbg { &conf; } |
|
260
|
|
|
|
|
|
|
sub buttonbd { &conf; } |
|
261
|
|
|
|
|
|
|
sub buttonrelief { &conf; } |
|
262
|
|
|
|
|
|
|
sub buttonhighlightcolor { &conf; } |
|
263
|
|
|
|
|
|
|
sub buttonhighlightbackground { &conf; } |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
;# increment and decrement the displayed year. |
|
266
|
|
|
|
|
|
|
sub advance |
|
267
|
|
|
|
|
|
|
{ |
|
268
|
|
|
|
|
|
|
debug "args: @_\n"; |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
my ($self, $inc) = @_; |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
# sanitise the increment. |
|
273
|
|
|
|
|
|
|
$inc += 0; |
|
274
|
|
|
|
|
|
|
return if ($inc == 0); |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
my $year = $self->cget('-year') + $inc; |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
$self->configure(-year => $year); |
|
279
|
|
|
|
|
|
|
} |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
;################################################################# |
|
282
|
|
|
|
|
|
|
;# A default startup routine. |
|
283
|
|
|
|
|
|
|
sub test |
|
284
|
|
|
|
|
|
|
{ |
|
285
|
|
|
|
|
|
|
# only use this when testing. |
|
286
|
|
|
|
|
|
|
eval 'use Getopt::Long;'; |
|
287
|
|
|
|
|
|
|
Getopt::Long::Configure("pass_through"); |
|
288
|
|
|
|
|
|
|
GetOptions( |
|
289
|
|
|
|
|
|
|
'd' => sub { |
|
290
|
|
|
|
|
|
|
eval ' sub debug { |
|
291
|
|
|
|
|
|
|
my ($package, $filename, $line, |
|
292
|
|
|
|
|
|
|
$subroutine, $hasargs, $wantargs) = caller(1); |
|
293
|
|
|
|
|
|
|
$line = (caller(0))[2]; |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
print STDERR "$subroutine: "; |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
if (@_) {print STDERR @_; } |
|
298
|
|
|
|
|
|
|
else {print "Debug $filename line $line.\n";} |
|
299
|
|
|
|
|
|
|
}; |
|
300
|
|
|
|
|
|
|
'; |
|
301
|
|
|
|
|
|
|
}, |
|
302
|
|
|
|
|
|
|
); |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
# Test script for the Tk Tk::Month widget. |
|
305
|
|
|
|
|
|
|
use Tk; |
|
306
|
|
|
|
|
|
|
use Tk::Optionmenu; |
|
307
|
|
|
|
|
|
|
#use Tk::Month; |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
my $top=MainWindow->new(); |
|
310
|
|
|
|
|
|
|
my $n = $top->Frame( |
|
311
|
|
|
|
|
|
|
)->pack(); |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
######################################################### |
|
314
|
|
|
|
|
|
|
# can set the week days here but not recommended. |
|
315
|
|
|
|
|
|
|
# Tk::Month::setWeek( qw(Su M Tu W Th F Sa) ); |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
my $a = $top->Year( |
|
318
|
|
|
|
|
|
|
-command => sub { print "hello @_\n"; }, |
|
319
|
|
|
|
|
|
|
)->pack(); |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
$a->configure(@ARGV) if (@ARGV); |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
$a->command( |
|
324
|
|
|
|
|
|
|
-label => 'forward', |
|
325
|
|
|
|
|
|
|
-command => [ sub { $_[0]->advance($_[1]);}, $a, 1], |
|
326
|
|
|
|
|
|
|
); |
|
327
|
|
|
|
|
|
|
$a->command( |
|
328
|
|
|
|
|
|
|
-label => 'back', |
|
329
|
|
|
|
|
|
|
-command => [ sub { $_[0]->advance($_[1]);}, $a, -1], |
|
330
|
|
|
|
|
|
|
); |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
######################################################### |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
$a->separator(); |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
for my $i ( qw(raised flat sunken) ) |
|
337
|
|
|
|
|
|
|
{ |
|
338
|
|
|
|
|
|
|
$a->command( |
|
339
|
|
|
|
|
|
|
-label => ucfirst($i), |
|
340
|
|
|
|
|
|
|
-command => sub { $a->configure(-buttonrelief => $i); }, |
|
341
|
|
|
|
|
|
|
); |
|
342
|
|
|
|
|
|
|
} |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
$a->separator(); |
|
345
|
|
|
|
|
|
|
for my $i ( qw(2 3 4) ) |
|
346
|
|
|
|
|
|
|
{ |
|
347
|
|
|
|
|
|
|
$a->command( |
|
348
|
|
|
|
|
|
|
-label => "Columns $i", |
|
349
|
|
|
|
|
|
|
-command => [ sub { $_[0]->configure('-cols' => $_[1]);}, $a, $i], |
|
350
|
|
|
|
|
|
|
); |
|
351
|
|
|
|
|
|
|
} |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
$a->separator(); |
|
354
|
|
|
|
|
|
|
for my $i ( qw(0 1 2 3 4 5) ) |
|
355
|
|
|
|
|
|
|
{ |
|
356
|
|
|
|
|
|
|
$a->command( |
|
357
|
|
|
|
|
|
|
-label => "Separation $i", |
|
358
|
|
|
|
|
|
|
-command => [ sub { $_[0]->configure('-sep' => $_[1]);}, $a, $i], |
|
359
|
|
|
|
|
|
|
); |
|
360
|
|
|
|
|
|
|
} |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
$a->separator(); |
|
363
|
|
|
|
|
|
|
$a->command( |
|
364
|
|
|
|
|
|
|
-label => 'Exit', |
|
365
|
|
|
|
|
|
|
-command => sub { exit; }, |
|
366
|
|
|
|
|
|
|
); |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
# Navigation buttons. |
|
369
|
|
|
|
|
|
|
$n->Button( |
|
370
|
|
|
|
|
|
|
-text => '<<', |
|
371
|
|
|
|
|
|
|
-command => [ sub { $_[0]->advance($_[1]);}, $a, -10], |
|
372
|
|
|
|
|
|
|
)->pack( |
|
373
|
|
|
|
|
|
|
-side => 'left', |
|
374
|
|
|
|
|
|
|
); |
|
375
|
|
|
|
|
|
|
$n->Button( |
|
376
|
|
|
|
|
|
|
-text => '<', |
|
377
|
|
|
|
|
|
|
-command => [ sub { $_[0]->advance($_[1]);}, $a, -1], |
|
378
|
|
|
|
|
|
|
)->pack( |
|
379
|
|
|
|
|
|
|
-side => 'left', |
|
380
|
|
|
|
|
|
|
); |
|
381
|
|
|
|
|
|
|
$n->Button( |
|
382
|
|
|
|
|
|
|
-text => '=', |
|
383
|
|
|
|
|
|
|
-command => [ sub { $_[0]->configure(-year => ''); }, $a ], |
|
384
|
|
|
|
|
|
|
)->pack( |
|
385
|
|
|
|
|
|
|
-side => 'left', |
|
386
|
|
|
|
|
|
|
); |
|
387
|
|
|
|
|
|
|
$n->Button( |
|
388
|
|
|
|
|
|
|
-text => '>', |
|
389
|
|
|
|
|
|
|
-command => [ sub { $_[0]->advance($_[1]);}, $a, 1], |
|
390
|
|
|
|
|
|
|
)->pack( |
|
391
|
|
|
|
|
|
|
-side => 'left', |
|
392
|
|
|
|
|
|
|
); |
|
393
|
|
|
|
|
|
|
$n->Button( |
|
394
|
|
|
|
|
|
|
-text => '>>', |
|
395
|
|
|
|
|
|
|
-command => [ sub { $_[0]->advance($_[1]);}, $a, 10], |
|
396
|
|
|
|
|
|
|
)->pack( |
|
397
|
|
|
|
|
|
|
-side => 'left', |
|
398
|
|
|
|
|
|
|
); |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
MainLoop(); |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
1; |
|
403
|
|
|
|
|
|
|
} |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
# If we are running this file then run the test function.... |
|
406
|
|
|
|
|
|
|
&test if ($0 eq __FILE__); |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
1; |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
__END__ |