/usr/lib/perl5/Tk/Spinbox.pm is in perl-tk 1:804.031-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | package Tk::Spinbox;
use strict;
use vars qw($VERSION);
$VERSION = '4.007'; # sprintf '4.%03d',q$Revision: #6 $ =~ /#(\d+)/;
use base 'Tk::Entry';
sub Tk_cmd { \&Tk::spinbox }
# Also inherits Entry's methods
Tk::Methods( "identify", "invoke", "set" );
use Tk::Submethods ( 'selection' => ["element"] );
Construct Tk::Widget 'Spinbox';
sub ClassInit
{
my ($class,$mw) = @_;
$class->SUPER::ClassInit($mw);
$mw->bind($class, '<Up>', [invoke => 'buttonup']);
$mw->bind($class, '<4>', [invoke => 'buttonup']);
$mw->bind($class, '<Down>',[invoke => 'buttondown']);
$mw->bind($class, '<5>', [invoke => 'buttondown']);
return $class;
}
sub Invoke
{
my ($w,$elem) = @_;
unless ($w->{_outside})
{
$w->invoke($elem);
$w->{_repeated}++;
}
my $delay = $w->cget('-repeatinterval');
if ($delay > 0)
{
$w->RepeatId($w->after($delay,[Invoke => $w,$elem]));
}
}
sub Button1
{
my ($w,$x,$y) = @_;
my $elem = $w->identify($x,$y);
$w->{_element} = $elem || 'entry';
if ($w->{_element} eq 'entry')
{
$w->SUPER::Button1($x,$y);
}
elsif ($w->cget('-state') ne 'disabled')
{
$w->selectionElement($elem);
$w->{_repeated} = 0;
$w->{_outside} = 0;
$w->{_relief} = $w->cget("-${elem}relief");
$w->CancelRepeat;
my $delay = $w->cget('-repeatdelay');
$w->RepeatId($w->after($delay,[Invoke => $w,$elem])) if $delay > 0;
}
}
sub Motion
{
my ($w,$x,$y) = @_;
my $elem = $w->identify($x,$y);
$w->{_element} = $elem || 'entry' unless $w->{_element};
if ($w->{_element} eq 'entry')
{
$w->SUPER::Motion($x,$y);
}
else
{
if (!defined($elem) || $elem ne $w->{_element})
{
# Moved outside the button
unless ($w->{_outside})
{
$w->{_outside} = 1;
$w->selectionElement('none');
}
}
elsif ($w->{_outside})
{
# Moved back over the button
$w->selectionElement($elem);
$w->{_outside} = 0;
}
}
}
sub Button1Release
{
my ($w,$x,$y) = @_;
$w->SUPER::Button1Release($x,$y);
my $elem = $w->{_element};
if (defined($elem) && $elem ne 'entry')
{
my $repeated = $w->{_repeated};
if (defined($repeated) && !$repeated)
{
$w->invoke($elem);
}
my $relief = delete $w->{_relief};
$w->configure("-${elem}relief",$relief) if $relief
}
$w->selectionElement('none');
}
1;
__END__
|