home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / auto / Tk / Menubutton / Motion.al < prev    next >
Encoding:
Text File  |  1997-08-10  |  1.1 KB  |  41 lines

  1. # NOTE: Derived from ..\blib\lib\Tk\Menubutton.pm.  Changes made here will be lost.
  2. package Tk::Menubutton;
  3.  
  4. # Motion --
  5. # This procedure handles mouse motion events inside menubuttons, and
  6. # also outside menubuttons when a menubutton has a grab (e.g. when a
  7. # menu selection operation is in progress).
  8. #
  9. # Arguments:
  10. # w - The name of the menubutton widget.
  11. # upDown - "down" means button 1 is pressed, "up" means
  12. # it isn't.
  13. # rootx, rooty - Coordinates of mouse, in (virtual?) root window.
  14. sub Motion
  15. {
  16.  my $w = shift;
  17.  my $upDown = shift;
  18.  my $rootx = shift;
  19.  my $rooty = shift;
  20.  return if (defined($Tk::inMenubutton) && $Tk::inMenubutton == $w);
  21.  my $new = $w->Containing($rootx,$rooty) if defined $w->Containing($rootx,$rooty);
  22.  return if ! defined $new;
  23.  if (defined($Tk::inMenubutton) && $new != $Tk::inMenubutton)
  24.   {
  25.    $Tk::inMenubutton->Leave();
  26.   }
  27.  if (defined($new) && $new->IsMenubutton && $new->cget('-indicatoron') == 0)
  28.   {
  29.    if ($upDown eq "down")
  30.     {
  31.      $new->Post($rootx,$rooty);
  32.     }
  33.    else
  34.     {
  35.      $new->Enter();
  36.     }
  37.   }
  38. }
  39.  
  40. 1;
  41.