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

  1. /*******************************************************************************
  2. * .FILE:         asplitcv.cpp
  3. *                                                                              *
  4. * .DESCRIPTION:  Split Canvas Example:  Class Implementation                   *
  5. *                                                                              *
  6. * .CLASSES:      ASplitCanvas                                                  *
  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 <icoordsy.hpp>
  27. #include "asplitcv.hpp"
  28. #include "asplitcv.h"
  29.  
  30. /******************************************************************************
  31. * main  - Application entry point                                             *
  32. *******************************************************************************/
  33. int main()
  34. {
  35.   ICoordinateSystem::setApplicationOrientation(
  36.           ICoordinateSystem::originLowerLeft );
  37.   ASplitCanvas mainWindow(WND_MAIN);
  38.   IApplication::current().run();
  39.   return 0;
  40. } /* end main */
  41.  
  42. /******************************************************************************
  43. * ASplitCanvas :: ASplitCanvas - Constructor for our main window              *
  44. *                                                                             *
  45. * Constructs the window as an IFrameWindow.                                   *
  46. * Initializes the horizontal split canvas.                                    *
  47. * Initializes the vertical canvas.                                            *
  48. * Places the text string in each window                                       *
  49. ******************************************************************************/
  50.  
  51. ASplitCanvas :: ASplitCanvas( unsigned long windowId )
  52.   : IFrameWindow( windowId )
  53.   , horzCanvas( WND_CANVAS, this, this )
  54.   , vertCanvas( WND_CANVAS2, &horzCanvas, &horzCanvas )
  55.   , lText( WND_TXTL, &vertCanvas, &vertCanvas )
  56.   , rText( WND_TXTR, &vertCanvas, &vertCanvas )
  57.   , bText( WND_TXTB, &horzCanvas, &horzCanvas )
  58. {
  59. /*-----------------------------------------------------------------------------|
  60. |  Set the icon for the main window.                                           |
  61. ------------------------------------------------------------------------------*/
  62.   setIcon( id() );
  63.  
  64. /*-----------------------------------------------------------------------------|
  65. | Set the canvas to a horizontal split bar and make it the client area.        |
  66. ------------------------------------------------------------------------------*/
  67.   horzCanvas.setOrientation( ISplitCanvas::horizontalSplit );
  68.   setClient( &horzCanvas );
  69.  
  70. /*-----------------------------------------------------------------------------|
  71. | Set the cavas to a vertical split bar.                                       |
  72. ------------------------------------------------------------------------------*/
  73.   vertCanvas.setOrientation( ISplitCanvas::verticalSplit );
  74.  
  75. /*----------------------------------------------------------------------------|
  76. |  Sets and places the static text in the top left window.                    |
  77. -----------------------------------------------------------------------------*/
  78.   lText.setText(STR_TOPLEFT);
  79.   lText.setAlignment( IStaticText::centerCenter );
  80.  
  81. /*----------------------------------------------------------------------------|
  82. |  Sets and places the static text in the top right window.                   |
  83. -----------------------------------------------------------------------------*/
  84.   rText.setText(STR_TOPRIGHT);
  85.   rText.setAlignment( IStaticText::centerCenter );
  86.  
  87. /*----------------------------------------------------------------------------|
  88. |  Sets and places the static text in the bottom window.                      |
  89. -----------------------------------------------------------------------------*/
  90.   bText.setText(STR_BOTTOM);
  91.   bText.setAlignment( IStaticText::centerCenter );
  92.  
  93. /*-----------------------------------------------------------------------------|
  94. | Set focus to the main window and show the window on the screen.              |
  95. ------------------------------------------------------------------------------*/
  96.   setFocus().show();
  97.  
  98. } /* end ASplitCanvas :: ASplitCanvas(...) */
  99.