home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ICLUI.ZIP / SPLITCV / ASPLITCV.CPP < prev    next >
Text File  |  1993-03-09  |  4KB  |  74 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. #include <iapp.hpp>                     //IApplication Class
  27.  
  28. #include "asplitcv.hpp"                 //Include ASplitCanvas Class headers
  29. #include "asplitcv.h"                   //Include our symbolic definitions
  30.  
  31. /******************************************************************************/
  32. /* main  - Application entry point                                            */
  33. /******************************************************************************/
  34. void main()
  35. {
  36.   ASplitCanvas mainWindow(WND_MAIN);    // create main window for application
  37.   IApplication::current().run();        // start message processing
  38. } /* end main */
  39.  
  40. /******************************************************************************/
  41. /* ASplitCanvas :: ASplitCanvas - Constructor for our main window             */
  42. /******************************************************************************/
  43. ASplitCanvas :: ASplitCanvas( unsigned long windowId )
  44.   : IFrameWindow( windowId )
  45.   , horzCanvas( WND_CANVAS, this, this )
  46.   , vertCanvas( WND_CANVAS2, &horzCanvas, &horzCanvas )
  47.   , lText( WND_TXTL, &vertCanvas, &vertCanvas )
  48.   , rText( WND_TXTR, &vertCanvas, &vertCanvas )
  49.   , bText( WND_TXTB, &horzCanvas, &horzCanvas )
  50. {
  51.                                      // give the canvas a horizontal split bar
  52.                                      // and make it the client area
  53.   horzCanvas.setOrientation( ISplitCanvas::horizontalSplit );
  54.   setClient( &horzCanvas );
  55.  
  56.                                      // give the canvas a vertical split bar
  57.   vertCanvas.setOrientation( ISplitCanvas::verticalSplit );
  58.  
  59.                                      // set top left static text
  60.   lText.setText(STR_TOPLEFT);
  61.   lText.setAlignment( IStaticText::centerCenter );
  62.  
  63.                                      // set top right static text
  64.   rText.setText(STR_TOPRIGHT);
  65.   rText.setAlignment( IStaticText::centerCenter );
  66.  
  67.                                      // set bottom static text
  68.   bText.setText(STR_BOTTOM);
  69.   bText.setAlignment( IStaticText::centerCenter );
  70.  
  71.   setFocus().show();                 // set focus and show window
  72.  
  73. } /* end ASplitCanvas :: ASplitCanvas(...) */
  74.