home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / OutOfContextMenus / Source / CWindowBehavior.cp < prev    next >
Encoding:
Text File  |  1999-06-25  |  2.4 KB  |  103 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CWindowBehavior.cp                 ©1999 Eric Traut
  3. // ===========================================================================
  4.  
  5.  
  6. #include "CWindowBehavior.h"
  7. #include "CShadowWindow.h"
  8.  
  9.  
  10. // ---------------------------------------------------------------------------
  11. //        • CWindowBehavior
  12. // ---------------------------------------------------------------------------
  13.  
  14. CWindowBehavior::CWindowBehavior(
  15.     CShadowWindow &        inShadowWindow)
  16.     :    mShadowWindow(inShadowWindow)
  17. {
  18.     inShadowWindow.AttachBehavior(*this);
  19. }
  20.  
  21.  
  22. // ---------------------------------------------------------------------------
  23. //        • ~CWindowBehavior
  24. // ---------------------------------------------------------------------------
  25.  
  26. CWindowBehavior::~CWindowBehavior(void)
  27. {
  28. }
  29.  
  30.  
  31. // ---------------------------------------------------------------------------
  32. //        • SyncWithShadowWindow
  33. // ---------------------------------------------------------------------------
  34.  
  35. Boolean
  36. CWindowBehavior::SyncWithShadowWindow(void)
  37. {
  38.     // Subclasses should override
  39.     
  40.     // Returns true if no synchronizatino was necessary
  41.     return true;
  42. }
  43.  
  44.  
  45. // ---------------------------------------------------------------------------
  46. //        • DoIdleTask
  47. // ---------------------------------------------------------------------------
  48.  
  49. void
  50. CWindowBehavior::DoIdleTask(
  51.     Boolean        inGNETime)
  52. {
  53.     #pragma unused (inGNETime)
  54.  
  55.     // Subclasses should override
  56. }
  57.  
  58.  
  59. // ---------------------------------------------------------------------------
  60. //        • HandleEvent
  61. // ---------------------------------------------------------------------------
  62.  
  63. void
  64. CWindowBehavior::HandleEvent(
  65.     EventRecord *        ioEvent, 
  66.     Boolean *            ioResult)
  67. {
  68.     #pragma unused (ioEvent, ioResult)
  69.     
  70.     // Subclasses should override
  71. }
  72.  
  73.  
  74. // ---------------------------------------------------------------------------
  75. //        • DetachBehavior
  76. // ---------------------------------------------------------------------------
  77.  
  78. void
  79. CWindowBehavior::DetachBehavior(void)
  80. {
  81.     CWindowRecord *        macWindow = mShadowWindow.GetMacWindow();
  82.     Rect                entirePort = {-0x4000, -0x4000, 0x4000, 0x4000};
  83.     
  84.     ::SetPort(reinterpret_cast<GrafPtr>(macWindow));
  85.     
  86.     ::InvalRect(&entirePort);
  87. }
  88.  
  89.  
  90. // ---------------------------------------------------------------------------
  91. //        • ShouldEnableRestoreMenu
  92. // ---------------------------------------------------------------------------
  93.  
  94. Boolean
  95. CWindowBehavior::ShouldEnableRestoreMenu(void)
  96. {
  97.     return true;
  98. }
  99.  
  100.  
  101.  
  102.  
  103.