home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / VPORT / AVPORT.CPP next >
Text File  |  1995-05-01  |  4KB  |  61 lines

  1. /******************************************************************************/
  2. /* Canvas Classes Example 4 - ViewPort                                        */
  3. /*                                                                            */
  4. /* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1993. */
  5. /*                                                                            */
  6. /* DISCLAIMER OF WARRANTIES:                                                  */
  7. /*   The following [enclosed] code is sample code created by IBM              */
  8. /*   Corporation.  This sample code is not part of any standard IBM product   */
  9. /*   and is provided to you solely for the purpose of assisting you in the    */
  10. /*   development of your applications.  The code is provided "AS IS",         */
  11. /*   without warranty of any kind.  IBM shall not be liable for any damages   */
  12. /*   arising out of your use of the sample code, even if they have been       */
  13. /*   advised of the possibility of such damages.                              */
  14. /******************************************************************************/
  15. /* NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          */
  16. /******************************************************************************/
  17. /* Canvas Classes Example 4 - ViewPort                                        */
  18. /*   key functions:                                                           */
  19. /*      - create a main window                                                */
  20. /*      - run the current application                                         */
  21. /*      - create a viewport and use as client area                            */
  22. /*      - create a bitmap control                                             */
  23. /*      - load the bitmap from resource bound to the exe                      */
  24. /*      - load strings from resource bound to the exe                         */
  25. /******************************************************************************/
  26.                                         //Include IBM UI class headers:
  27. #ifndef _IBASE_                         //Make sure ibase.hpp is included
  28.   #include <ibase.hpp>                  //  since that is where IC_<environ>
  29. #endif                                  //  is defined.
  30. #include <iapp.hpp>                     // IApplication class
  31. #include <ireslib.hpp>                  // IResourceId class
  32.  
  33. #include "avport.h"
  34. #include "avport.hpp"
  35.  
  36. /******************************************************************************/
  37. /* main  - Application entry point                                            */
  38. /******************************************************************************/
  39. int main()                              //Main Procedure with no parameters
  40. {
  41.   AViewPort mainWindow(WND_MAIN);       //Create our main window on the decktop
  42.   IApplication::current().run();        //Get current & run the application
  43.   return 0;
  44. } /* end main */
  45.  
  46. /******************************************************************************/
  47. /* AViewPort :: AViewPort - constructor for our main window                   */
  48. /******************************************************************************/
  49. AViewPort :: AViewPort(unsigned long windowId)
  50.   : IFrameWindow( windowId )
  51.   , clientViewPort( WND_VIEWPORT, this, this )
  52.   , bitmap( WND_BITMAP, &clientViewPort, &clientViewPort , IResourceId(BMP_ID) )
  53. {
  54.   sizeTo( ISize( bitmap.minimumSize().width()*0.8,       // Size the frame window
  55.                  bitmap.minimumSize().height()*0.9 ) );  // smaller than the bitmap
  56.   setIcon( id() );                     // set icon
  57.   setClient( &clientViewPort );        // make viewport the client
  58.   setFocus().show();                   // set focus and show window
  59.  
  60. } /* end AViewPort :: AViewPort(...) */
  61.