home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / Pedestal / Source / Sources / Commands / PedCommandClose.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  581 b   |  30 lines

  1. /*    ====================
  2.  *    PedCommandClose.cpp
  3.  *    ====================
  4.  */
  5.  
  6. #include "PedestalDebugging.h"
  7.  
  8. #include <Windows.h>
  9.  
  10. #include "PedCommandClose.hh"
  11. #include "PedWindow.hh"
  12. #include "PedAgent.hh"
  13.  
  14. void
  15. PedCommandClose::Execute()
  16. {
  17.     // Same as 'close front window'
  18.     //PedWindow::Frontmost->Close();
  19.     WindowPtr w = ::FrontWindow();
  20.     if (w != NULL)
  21.         if (((WindowPeek)w)->windowKind == kPedestalWindowKind) {
  22.             PedAgent *agent = ((PedWindow *)((WindowPeek)w)->refCon)->Agent();
  23.             if (agent)
  24.                 (void)agent->CloseWindow();
  25.         } else
  26.             DebugBeep();
  27.     else
  28.         DebugBeep();
  29. }
  30.