1
#!/usr/local/bin/perl -w
6
use Tk::DragDrop qw(Sun);
12
use base qw(Tk::Label);
13
Construct Tk::Widget Dragable;
18
$mw->bind($class,'<FocusIn>','Bell');
27
foreach $option ($w->configure())
29
next if (@$option == 2 || !defined $$option[4]);
30
next if (defined $$option[3] && $$option[3] eq $$option[4]);
31
push(@config,$$option[0],$$option[4]);
39
my $obj = $parent->Label(@_,-takefocus => 1);
40
# $obj->bind('<B1-Motion>',['DragDrop',Ev(['LabelInfo'])]);
41
return bless $obj,$class;
46
$icon_dir = Tk->findINC("demos/images");
56
fork || exec("$ENV{EDITOR} $path");
64
my $icon = (-d $name) ? "dir" : ($name =~ /\.([^\.]+)$/) ? $1 : "page";
65
if (!defined $icons{$icon})
67
my $file = "$icon_dir/$icon.xpm";
70
$icons{$icon} = $w->Pixmap($icon,-file=>"$file");
74
my $file = "$icon_dir/$icon.icon";
75
my $mask = "$icon_dir/$icon.mask";
76
$file = "$icon_dir/page.icon" unless (-f $file);
77
$mask = "$icon_dir/page.mask" unless (-f $mask);
78
$icons{$icon} = $w->Bitmap($icon,-file=> $file,-maskfile=>$mask);
80
if ($icons{$icon}->width != 32)
82
$icons{$icon} = choose_icon($w,"page");
91
{my ($string,$offset,$max) = @_;
100
my @files = readdir(DIR);
106
foreach (sort @files)
109
my $path = "$dir/$_";
111
my $i = $f->Dragable(-image=> choose_icon($w,$path));
112
$i->DragDrop(-image => $i->cget('-image'),-handlers => [[-type =>'FILE_NAME',[\&handle_string,"$dir/$_"]]]);
113
my $l = $f->Label(-text=> $_);
114
$i->bind('<FocusIn>','break');
115
$i->pack(-side=>'top');
116
$l->pack(-side=>'bottom',-fill=> 'x');
123
$i->bind('<Double-1>',[\&Edit,$path]);
130
$dir = (@ARGV) ? shift : getcwd();
132
$top = MainWindow->new();
135
$t->pack(-side=>'right',-fill=>'both',-expand=>1);
136
$top->AddScrollbars($t);
137
$top->configure('-scrollbars' => 'w');