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

  1. /******************************************************************************/
  2. /* Canvas Classes Example 1 - Split Canvas                                    */
  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 1 - Split Canvas                                    */
  18. /*   key functions:                                                           */
  19. /*      - create a main window                                                */
  20. /*      - run the current application                                         */
  21. /*      - create horizontal and vertical split canvases                       */
  22. /*      - create static text controls                                         */
  23. /*      - load strings from resource bound to the exe                         */
  24. /******************************************************************************/
  25.                                         //Include IBM UI class headers:
  26. #ifndef _IBASE_                         //Make sure ibase.hpp is included
  27.   #include <ibase.hpp>                  //  since that is where IC_<environ>
  28. #endif                                  //  is defined.
  29. #include <iapp.hpp>                     //IApplication Class
  30.  
  31. #include "asplitcv.hpp"                 //Include ASplitCanvas Class headers
  32. #include "asplitcv.h"                   //Include our symbolic definitions
  33.  
  34. /******************************************************************************/
  35. /* main  - Application entry point                                            */
  36. /******************************************************************************/
  37. int main()
  38. {
  39.   ASplitCanvas mainWindow(WND_MAIN);    // create main window for application
  40.   IApplication::current().run();        // start message processing
  41.   return 0;
  42. } /* end main */
  43.  
  44. /******************************************************************************/
  45. /* ASplitCanvas :: ASplitCanvas - Constructor for our main window             */
  46. /******************************************************************************/
  47. ASplitCanvas :: ASplitCanvas( unsigned long windowId )
  48.   : IFrameWindow( windowId )
  49.   , horzCanvas( WND_CANVAS, this, this )
  50.   , vertCanvas( WND_CANVAS2, &horzCanvas, &horzCanvas )
  51.   , lText( WND_TXTL, &vertCanvas, &vertCanvas )
  52.   , rText( WND_TXTR, &vertCanvas, &vertCanvas )
  53.   , bText( WND_TXTB, &horzCanvas, &horzCanvas )
  54. {
  55.   setIcon( id() );                   // Set the icon
  56.                                      // give the canvas a horizontal split bar
  57.                                      // and make it the client area
  58.   horzCanvas.setOrientation( ISplitCanvas::horizontalSplit );
  59.   setClient( &horzCanvas );
  60.  
  61.                                      // give the canvas a vertical split bar
  62.   vertCanvas.setOrientation( ISplitCanvas::verticalSplit );
  63.  
  64.                                      // set top left static text
  65.   lText.setText(STR_TOPLEFT);
  66.   lText.setAlignment( IStaticText::centerCenter );
  67.  
  68.                                      // set top right static text
  69.   rText.setText(STR_TOPRIGHT);
  70.   rText.setAlignment( IStaticText::centerCenter );
  71.  
  72.                                      // set bottom static text
  73.   bText.setText(STR_BOTTOM);
  74.   bText.setAlignment( IStaticText::centerCenter );
  75.  
  76.   setFocus().show();                 // set focus and show window
  77.  
  78. } /* end ASplitCanvas :: ASplitCanvas(...) */
  79.