home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / frame1 / minmax / chdhider.cpp next >
Encoding:
C/C++ Source or Header  |  1996-10-29  |  1.4 KB  |  61 lines

  1. //*********************************************************
  2. // Frame Window Basics - Minimize/Maximize Handler Example
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // Copyright (c) 1997 John Wiley & Sons, Inc. 
  6. // All Rights Reserved.
  7. //*********************************************************
  8. #include <ibase.hpp>
  9.  
  10. #ifdef IC_PM
  11.   #define INCL_WINWINDOWMGR    // For WinShowWindow.
  12.   #include <os2.h>
  13. #else
  14.   #include <windows.h>
  15. #endif
  16.  
  17. #include <ihandle.hpp>
  18. #include <iwindow.hpp>
  19. #include "chdhider.hpp"
  20.  
  21. IBase::Boolean ChildHider::minimized ( IEvent& event )
  22. {
  23.   this->showChildren( event.window(), false );
  24.   return false;
  25. }
  26.  
  27. IBase::Boolean ChildHider::maximized ( IEvent& event )
  28. {
  29.   this->showChildren( event.window(), true );
  30.   return false;
  31. }
  32.  
  33. IBase::Boolean ChildHider::restored ( IEvent& event )
  34. {
  35.   this->showChildren( event.window(), true );
  36.   return false;
  37. }
  38.  
  39. void ChildHider::showChildren ( IWindow* parent,
  40.                                 Boolean  show )
  41. {
  42.   IWindow::ChildCursor
  43.     cursor( *parent );
  44.   for ( cursor.setToFirst();
  45.         cursor.isValid();
  46.         cursor.setToNext() )
  47.   {
  48.     IWindowHandle
  49.       child = parent->childAt( cursor );
  50.  
  51.     // Show or hide the child window.
  52.     // Note: We use a system API here to support
  53.     //       non-IWindow windows.
  54. #ifdef IC_PM
  55.     WinShowWindow( child, show );
  56. #else
  57.     ShowWindow( child, show ? SW_SHOW : SW_HIDE );
  58. #endif
  59.   }
  60. }
  61.