$VERSION = '3.018'; # $Id: //depot/Tk8/TList/TList.pm#18 $
use Tk qw(Ev $XS_VERSION);
Construct Tk
::Widget
'TList';
sub Tk_cmd
{ \
&Tk
::tlist
}
Tk
::Methods
qw(insert index anchor delete dragsite dropsite entrycget
entryconfigure info nearest see selection xview yview);
use Tk
::Submethods
( 'delete' => [qw(all entry offsprings siblings)],
'info' => [qw(anchor dragsite dropsite selection)],
'selection' => [qw(clear get includes set)],
'anchor' => [qw(clear set)],
'dragsite' => [qw(clear set)],
'dropsite' => [qw(clear set)],
$mw->bind($class,'<ButtonPress-1>',[ 'Button1' ] );
$mw->bind($class,'<Shift-ButtonPress-1>',[ 'ShiftButton1' ] );
$mw->bind($class,'<Control-ButtonRelease-1>','Control_ButtonRelease_1');
$mw->bind($class,'<ButtonRelease-1>','ButtonRelease_1');
$mw->bind($class,'<B1-Motion>',[ 'Button1Motion' ] );
$mw->bind($class,'<B1-Leave>',[ 'AutoScan' ] );
$mw->bind($class,'<Double-ButtonPress-1>',['Double1']);
$mw->bind($class,'<Control-B1-Motion>','Control_B1_Motion');
$mw->bind($class,'<Control-ButtonPress-1>',['CtrlButton1']);
$mw->bind($class,'<Control-Double-ButtonPress-1>',['CtrlButton1']);
$mw->bind($class,'<B1-Enter>','B1_Enter');
$mw->bind($class,'<Up>', ['DirKey', 'up']);
$mw->bind($class,'<Down>',['DirKey', 'down']);
$mw->bind($class,'<Left>', ['DirKey', 'left']);
$mw->bind($class,'<Right>',['DirKey', 'right']);
$mw->bind($class,'<Prior>','Prior');
$mw->bind($class,'<Next>','Next');
$mw->bind($class,'<Return>', ['KeyboardActivate']);
$mw->bind($class,'<space>', ['KeyboardBrowse']);
sub Control_ButtonRelease_1
if($w->cget('-selectmode') ne 'dragdrop');
if($w->cget('-selectmode') ne 'dragdrop');
shift->yview('scroll', -1, 'pages')
shift->yview('scroll', 1, 'pages')
delete $w->{'shiftanchor'};
if($w->cget('-takefocus'));
my $mode = $w->cget('-selectmode');
# $w->Send_WaitDrag($Ev->y);
my $ent = $w->GetNearest($Ev->x, $Ev->y);
return unless defined $ent;
$w->selection('set', $ent);
elsif($mode eq 'multiple')
$w->selection('set', $ent);
elsif($mode eq 'extended')
$w->selection('set', $ent);
$w->Callback(-browsecmd
=> $ent) if ($browse);
my $to = $w->GetNearest($Ev->x,$Ev->y);
delete $w->{'shiftanchor'};
return unless defined $to;
my $mode = $w->cget('-selectmode');
my $from = $w->info('anchor');
$w->selection('set', $from, $to);
$w->selection('set', $to);
my $ent = $w->nearest($x,$y);
my $state = $w->entrycget($ent, '-state');
return $ent if (!defined($state) || $state ne 'disabled');
delete $w->{'shiftanchor'};
my $mode = $w->cget('-selectmode');
my ($x, $y) = ($Ev->x, $Ev->y);
my $ent = $w->GetNearest($x,$y);
return unless defined $ent;
if($x < 0 || $y < 0 || $x > $w->width || $y > $w->height)
return if($mode eq 'single' || $mode eq 'browse')
if($mode eq 'single' || $mode eq 'browse')
$w->selection('set', $ent);
elsif($mode eq 'multiple')
$w->selection('set', $ent);
elsif($mode eq 'extended')
$w->selection('set', $ent);
$w->Callback(-browsecmd
=>$ent);
delete $w->{'shiftanchor'};
my $mode = $w->cget('-selectmode');
my $ent = $w->GetNearest($Ev->x,$Ev->y);
return unless defined $ent;
elsif($mode eq 'multiple' || $mode eq 'extended')
my $from = $w->info('anchor');
$w->selection('set', $from, $ent);
$w->selection('set', $ent);
$w->Callback(-browsecmd
=>$ent);
delete $w->{'shiftanchor'};
my $ent = $w->GetNearest($Ev->x,$Ev->y);
return unless defined $ent;
$w->anchor('set', $ent) unless defined($w->info('anchor'));
$w->selection('set', $ent);
$w->Callback(-command
=> $ent);
delete $w->{'shiftanchor'};
my $ent = $w->GetNearest($Ev->x,$Ev->y);
return unless defined $ent;
my $mode = $w->cget('-selectmode');
$w->anchor('set', $ent) unless defined( $w->info('anchor') );
if($w->selection('includes', $ent))
$w->selection('clear', $ent);
$w->selection('set', $ent);
$w->Callback(-browsecmd
=>$ent);
my $anchor = $w->info('anchor');
my $new = (defined $anchor) ?
$w->info($dir,$anchor) : 0;
my $anchor = $w->info('anchor');
return unless defined $anchor;
if($w->cget('-selectmode'))
$w->selection('set', $anchor);
$w->Callback(-command
=> $anchor);
my $anchor = $w->info('anchor');
return unless defined $anchor;
if($w->cget('-selectmode'))
$w->selection('set', $anchor);
$w->Callback(-browsecmd
=>$anchor);
return if($w->cget('-selectmode') eq 'dragdrop');
$w->yview('scroll', 1, 'units');
$w->yview('scroll', -1, 'units');
$w->xview('scroll', 2, 'units');
$w->xview('scroll', -2, 'units');
$w->RepeatId($w->after(50,[AutoScan
=> $w]));