# Converted from listbox.tcl -- # # This file defines the default bindings for Tk listbox widgets. # # @(#) listbox.tcl 1.7 94/12/17 16:05:18 # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package Tk::Listbox; use vars qw($VERSION); $VERSION = '3.031'; # $Id: //depot/Tk8/Listbox/Listbox.pm#31 $ use Tk qw(Ev $XS_VERSION); use Tk::Clipboard (); use AutoLoader; use base qw(Tk::Clipboard Tk::Widget); Construct Tk::Widget 'Listbox'; bootstrap Tk::Listbox; sub Tk_cmd { \&Tk::listbox } Tk::Methods('activate','bbox','curselection','delete','get','index', 'insert','nearest','scan','see','selection','size', 'xview','yview'); use Tk::Submethods ( 'selection' => [qw(anchor clear includes set)], 'scan' => [qw(mark dragto)], 'xview' => [qw(moveto scroll)], 'yview' => [qw(moveto scroll)], ); *Getselected = \&getSelected; sub clipEvents { return qw[Copy]; } sub BalloonInfo { my ($listbox,$balloon,$X,$Y,@opt) = @_; my $e = $listbox->XEvent; my $index = $listbox->index('@' . $e->x . ',' . $e->y); foreach my $opt (@opt) { my $info = $balloon->GetOption($opt,$listbox); if ($opt =~ /^-(statusmsg|balloonmsg)$/ && UNIVERSAL::isa($info,'ARRAY')) { $balloon->Subclient($index); if (defined $info->[$index]) { return $info->[$index]; } return ''; } return $info; } } sub ClassInit { my ($class,$mw) = @_; $class->SUPER::ClassInit($mw); # Standard Motif bindings: $mw->bind($class,'<1>',['BeginSelect',Ev('index',Ev('@'))]); $mw->bind($class,'',['Motion',Ev('index',Ev('@'))]); $mw->bind($class,'','ButtonRelease_1'); ; $mw->bind($class,'',['BeginExtend',Ev('index',Ev('@'))]); $mw->bind($class,'',['BeginToggle',Ev('index',Ev('@'))]); $mw->bind($class,'',['AutoScan',Ev('x'),Ev('y')]); $mw->bind($class,'','CancelRepeat'); $mw->bind($class,'',['UpDown',-1]); $mw->bind($class,'',['ExtendUpDown',-1]); $mw->bind($class,'',['UpDown',1]); $mw->bind($class,'',['ExtendUpDown',1]); $mw->XscrollBind($class); $mw->PriorNextBind($class); $mw->bind($class,'','Cntrl_Home'); ; $mw->bind($class,'',['DataExtend',0]); $mw->bind($class,'','Cntrl_End'); ; $mw->bind($class,'',['DataExtend','end']); # $class->clipboardOperations($mw,'Copy'); $mw->bind($class,'',['BeginSelect',Ev('index','active')]); $mw->bind($class,'