Tk::Copy::Mac - simulate a Macintosh Classic copy dialog.


Tk-Copy-Mac documentation  | view source Contained in the Tk-Copy-Mac distribution.

Index


NAME

Top

Tk::Copy::Mac - simulate a Macintosh Classic copy dialog.

SYNOPSIS

Top

 use Tk::Copy::Mac;
 $cd = $parent->Copy(-option => value);

DESCRIPTION

Top

This widget simulates a Macintosh Classic copy dialog using Tk::ProgressBar::Mac and CollapsableFrame widgets.

OPTIONS

Top

The following option/value pairs are supported:

-bufsize

The copy buffer size in bytes (default is 2,097,152 bytes). The value of this option can only be set during widget creation.

METHODS

Top

copy(from, to)

Copies 'from' to 'to'.

ADVERTISED WIDGETS

Top

Component subwidgets can be accessed via the Subwidget method. Valid subwidget names are listed below.

Name: progressbar, Class: ProgressBar
  ProgressBar widget reference.

Name: collapsableframe, Class: CollapsableFrame
  CollapsableFrame widget reference.

EXAMPLE

Top

 #!/usr/local/bin/perl -w
 use Tk;
 use Tk::Copy::Mac;
 use strict;

 die "Usage: copy.pl from to" unless $#ARGV == 1;

 my $mw = MainWindow->new;

 my $mc = $mw->Copy(-bufsize => 4 * 1_048_576);

 my $b = $mw->Button(
     -text    => "Push me to copy all files in '$ARGV[0]' to '$ARGV[1]'.",
     -command => sub {$mc->copy($ARGV[0],  $ARGV[1])},
 )->pack;
 $mw->Button(-text => 'Quit', -command => \&exit)->pack;

 $mc->Subwidget('collapsableframe')->open;

 MainLoop;

BUGS

Top

There are two phases to a Copy operation. First, we do a pre-scan to compute a file count and total byte count using File::Find, followed by the actual copy using File::NCopy. The pre-scan phase is blocking - we haven't made any changes to that core module to keep Tk events flowing.

We don't verify that there is sufficient room in the destination for the copy to succeed.

AUTHOR and COPYRIGHT

Top

KEYWORDS

Top

Apple, CollapsableFrame, Copy, ProgressBar


Tk-Copy-Mac documentation  | view source Contained in the Tk-Copy-Mac distribution.