home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CDividerGrippyPane.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  2.7 KB  |  86 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // Implementation for class that adapts the CPatternedGrippyPane for use in the chrome of
  20. // the window as visual feedback/interaction point for sliding a drawer in and out. 
  21. //
  22. // NOTE: Makes an "implicit" assumption that the superView is an LDividedView. By this
  23. // I mean that it assumes that the super view will handle certain behaviors and will 
  24. // understand certain messages broadcast to it. There are no dependancies on data or
  25. // on the LDividedView class itself.
  26. //
  27.  
  28. #include "CDividerGrippyPane.h"
  29. #include "macutil.h"
  30.  
  31.  
  32. //
  33. // Constructor
  34. //
  35. CDividerGrippyPane :: CDividerGrippyPane ( LStream* inStream )
  36.     : CPatternedGrippyPane(inStream)
  37. {
  38.  
  39. }
  40.  
  41.  
  42. //
  43. // ClickSelf
  44. //
  45. // Overloaded to handle clicking and dragging. If the user drags the grippy pane,
  46. // step aside and let the parent's ClickSelf() routine handle it (which is most likely
  47. // an LDividedView). If the user just clicks on the pane, send a message saying that
  48. // there was a click (the LDividedView is listening).
  49. //
  50. void CDividerGrippyPane::ClickSelf(const SMouseDownEvent& inMouseDown)
  51. {
  52.     // Drags are passed to the superView.  Handle only single clicks.
  53.     Point where;
  54.     ::GetMouse(&where);
  55.     if (::WaitForMouseAction(
  56.         where,
  57.         inMouseDown.macEvent.when,
  58.         ::LMGetDoubleTime()) == MOUSE_DRAGGING)
  59.     {
  60.         LView* superView = GetSuperView();
  61.         if (superView)
  62.         {
  63.             this->LocalToPortPoint(((SMouseDownEvent&)inMouseDown).whereLocal);
  64.             superView->PortToLocalPoint(((SMouseDownEvent&)inMouseDown).whereLocal);
  65.             superView->ClickSelf(inMouseDown);
  66.         }
  67.         return;
  68.     } // if drag
  69.     else
  70.         BroadcastMessage ( 'Zap!', this );
  71.     
  72. } // ClickSelf
  73.  
  74.  
  75. //
  76. // AdjustCursorSelf
  77. //
  78. // Change the cursor to a hand while mouse is over this pane
  79. //
  80. void CDividerGrippyPane::AdjustCursorSelf(Point /* inPortPt */, const EventRecord & /*inMacEvent*/)
  81. {
  82.     const ResIDT kPointingFingerID = 128;
  83.     ::SetCursor(*::GetCursor(kPointingFingerID));
  84.     
  85. } // AdjustCursorSelf
  86.