# Copyright (c) 1999 Greg London. All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # code for bindings taken from Listbox.pm # comments specifying method functionality taken from # "Perl/Tk Pocket Reference" by Stephen Lidie. ####################################################################### # this module uses a text module as its base class to create a list box. # this will allow list box functionality to also have all the functionality # of the Text widget. # # note that most methods use an element number to indicate which # element in the list to work on. # the exception to this is the tag and mark methods which # are dual natured. These methods may accept either the # normal element number, or they will also take a element.char index, # which would be useful for applying tags to part of a line in the list. # ####################################################################### package Tk::TextList; use strict; use vars qw($VERSION); $VERSION = '4.005'; # $Id: //depot/Tkutf8/TextList/TextList.pm#5 $ #XXXdel: use Tk::Reindex qw(Tk::ROText); #XXXdel: ReindexedROText); use base qw(Tk::Derived Tk::ReindexedROText ); use Tk qw (Ev); #XXX del: use base qw(Tk::ReindexedROText); Construct Tk::Widget 'TextList'; ####################################################################### # the following line causes Populate to get called # @ISA = qw(Tk::Derived ... ); ####################################################################### sub Populate { my ($w,$args)=@_; my $option=delete $args->{'-selectmode'}; $w->SUPER::Populate($args); $w->ConfigSpecs( -selectmode => ['PASSIVE','selectMode','SelectMode','browse'], -takefocus => ['PASSIVE','takeFocus','TakeFocus',1], -spacing3 => ['SELF', undef, undef, 3], -insertwidth => ['SELF', undef, undef, 0], ); } ####################################################################### ####################################################################### sub ClassInit { my ($class,$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,'