home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / vport / avport.cpp next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  3.5 KB  |  63 lines

  1. /******************************************************************************
  2. * .FILE:         avport.cpp                                                   *
  3. *                                                                             *
  4. * .DESCRIPTION:  Canvas Classes Example 4 - ViewPort (Implementation)         *
  5. *                                                                             *
  6. * .CLASSES:      aviewport                                                    *
  7. *                                                                             *
  8. * .COPYRIGHT:                                                                 *
  9. *    Licensed Material - Program-Property of IBM                              *
  10. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  11. *                                                                             *
  12. * .DISCLAIMER:                                                                *
  13. *   The following [enclosed] code is sample code created by IBM               *
  14. *   Corporation.  This sample code is not part of any standard IBM product    *
  15. *   and is provided to you solely for the purpose of assisting you in the     *
  16. *   development of your applications.  The code is provided 'AS IS',          *
  17. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  18. *   arising out of your use of the sample code, even if they have been        *
  19. *   advised of the possibility of such damages.                               *
  20. *                                                                             *
  21. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  22. *                                                                             *
  23. ******************************************************************************/
  24. #include <ibase.hpp>
  25. #include <iapp.hpp>
  26. #include <ireslib.hpp>
  27. #include <icoordsy.hpp>
  28. #include "avport.h"
  29. #include "avport.hpp"
  30.  
  31. /*******************************************************************************
  32. * main - Application entry point                                               *
  33. *******************************************************************************/
  34. int main()
  35. {
  36.   ICoordinateSystem::setApplicationOrientation(
  37.           ICoordinateSystem::originLowerLeft );
  38.   AViewPort mainWindow(WND_MAIN);
  39.   IApplication::current().run();
  40.   return 0;
  41. } /* end main() */
  42.  
  43. /******************************************************************************
  44. * Class AViewPort :: AViewPort - constructor for our main window              *
  45. ******************************************************************************/
  46.  
  47. AViewPort :: AViewPort(unsigned long windowId)
  48.   : IFrameWindow( windowId )
  49.   , clientViewPort( WND_VIEWPORT, this, this )
  50.   , bitmap( WND_BITMAP, &clientViewPort, &clientViewPort , IResourceId(BMP_ID) )
  51. {
  52. /*-----------------------------------------------------------------------------|
  53. | Size the screen to be slighly smaller than the bitmap.                       |
  54. | Set the viewport as the client area.                                         |
  55. | Set focus to the main window and then show it.                               |
  56. ------------------------------------------------------------------------------*/
  57.   sizeTo( ISize( bitmap.minimumSize().width()*0.8,
  58.                  bitmap.minimumSize().height()*0.9 ) );
  59.   setIcon( id() );
  60.   setClient( &clientViewPort );
  61.   setFocus().show();
  62. } /* end AViewPort :: AViewPort(...) */
  63.