home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / Tk / DragDrop / Rect.pm < prev    next >
Encoding:
Perl POD Document  |  1997-08-10  |  1.4 KB  |  85 lines

  1. package Tk::DragDrop::Rect;
  2.  
  3. sub NewDrag
  4. {
  5.  my ($class,$widget) = @_;
  6. }
  7.  
  8. sub Enter
  9. {
  10.  my ($site,$token,$event) = @_;
  11.  $token->configure(-relief => 'sunken');
  12.  $token->{'Over'} = $site;
  13. }
  14.  
  15. sub Leave
  16. {
  17.  my ($site,$token,$event) = @_;
  18.  $token->configure(-relief => 'flat');
  19.  delete $token->{'Over'};
  20. }
  21.  
  22. sub Motion
  23. {
  24.  my ($site,$token,$event) = @_;
  25. }
  26.  
  27. sub Drop
  28. {
  29.  my ($site,$win,$seln,$event) = @_;
  30. }
  31.  
  32. sub Over
  33. {
  34.  my ($site,$X,$Y) = @_;
  35.  my $x = $site->X;
  36.  my $y = $site->Y;
  37.  my $val = ($X >= $x && $X < ($x + $site->width) && 
  38.          $Y >= $y && $Y < ($y + $site->height));
  39.  # print "Over ",$site->Show," $X,$Y => $val\n";
  40.  return $val;
  41. }
  42.  
  43. sub Match
  44. {
  45.  my ($site,$other) = @_;
  46.  return 0 unless (defined $other);
  47.  return 1 if ($site == $other);
  48.  return 0 unless (ref($site) eq ref($other)); 
  49.  for ("$site")
  50.   {
  51.    if (/ARRAY/)
  52.     {
  53.      my $i;   
  54.      return 0 unless (@$site == @$other); 
  55.      for ($i = 0; $i < @$site; $i++)
  56.       {       
  57.        return 0 unless ($site->[$i] == $other->[$i]);
  58.       }       
  59.      return 1;
  60.     }
  61.    elsif (/SCALAR/)
  62.     {
  63.      return $site == $other;
  64.     }
  65.    elsif (/HASH/)
  66.     {
  67.      my $key;
  68.      foreach $key (keys %$site)
  69.       {
  70.        return 0 unless ($other->{$key} == $site->{$key});
  71.       }
  72.      foreach $key (keys %$other)
  73.       {
  74.        return 0 unless ($other->{$key} == $site->{$key});
  75.       }
  76.      return 1;
  77.     }
  78.    return 0;
  79.   }
  80.  return 0;
  81. }
  82.  
  83.  
  84. 1;
  85.