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

  1. /******************************************************************************
  2. *                                                                             *
  3. * .FILE:         ahellow2.cpp                                                 *
  4. *                                                                             *
  5. * .DESCRIPTION:  Hello World Sample Program Version 2: Class Implementation   *
  6. *                                                                             *
  7. * .CLASSES:      AHellowWindow                                                *
  8. *                                                                             *
  9. * .COPYRIGHT:                                                                 *
  10. *    Licensed Material - Program-Property of IBM                              *
  11. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  12. *                                                                             *
  13. * .DISCLAIMER:                                                                *
  14. *   The following [enclosed] code is sample code created by IBM               *
  15. *   Corporation.  This sample code is not part of any standard IBM product    *
  16. *   and is provided to you solely for the purpose of assisting you in the     *
  17. *   development of your applications.  The code is provided 'AS IS',          *
  18. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  19. *   arising out of your use of the sample code, even if they have been        *
  20. *   advised of the possibility of such damages.                               *
  21. *                                                                             *
  22. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  23. *                                                                             *
  24. ******************************************************************************/
  25.  
  26. #include <ibase.hpp>
  27. #include <iapp.hpp>
  28. #include <icoordsy.hpp>
  29. #include "ahellow2.hpp"
  30. #include "ahellow2.h"
  31.  
  32. /**************************************************************************
  33. * main  - Application entry point for Hello World Version 2.              *
  34. *                                                                         *
  35. * Creates a new object mainWindow of class AHelloWindow                   *
  36. * Sets the size of mainWindow                                             *
  37. * Sets the window focus to mainWindow                                     *
  38. * Displays the mainWindow                                                 *
  39. * Starts the events processing for the application                        *
  40. **************************************************************************/
  41. int main()
  42. {
  43.   ICoordinateSystem::setApplicationOrientation(
  44.           ICoordinateSystem::originLowerLeft );
  45.   AHelloWindow mainWindow (WND_MAIN);
  46.   mainWindow.sizeTo(ISize(400,300));
  47.   mainWindow.setFocus();
  48.   mainWindow.show();
  49.   IApplication::current().run();
  50.   return 0;
  51. } /* end main () */
  52.  
  53.  
  54. /**************************************************************************
  55. * Class AHelloWindow :: AHelloWindow - Constructor for the main window    *
  56. *                                                                         *
  57. * Define itself as an IFrameWindow                                        *
  58. * Create static text in client window.                                    *
  59. * Create information area                                                 *
  60. **************************************************************************/
  61. AHelloWindow :: AHelloWindow(const unsigned long windowId)
  62.   : IFrameWindow(IFrameWindow::defaultStyle() |
  63.                  IFrameWindow::minimizedIcon,
  64.                  windowId)
  65.    ,hello(WND_HELLO, this, this)
  66.    ,infoArea(this)
  67. {
  68.  
  69. /*------------------------------------------------------------------------|
  70. |  Set the hello world static text window as the client window.           |
  71. |------------------------------------------------------------------------*/
  72.   setClient(&hello);
  73.  
  74.  
  75. /*------------------------------------------------------------------------|
  76. |  Set the values for the text controls from strings in the resource file.|
  77. |    The infoArea inactive text is displayed when no menu item is active. |
  78. |------------------------------------------------------------------------*/
  79.   hello.setText(STR_HELLO);
  80.   infoArea.setInactiveText(STR_INFO);
  81.  
  82.  
  83. /*------------------------------------------------------------------------|
  84. | Align the static text in the client window.                             |
  85. |------------------------------------------------------------------------*/
  86.   hello.setAlignment(IStaticText::centerCenter);
  87.  
  88. } /* end AHelloWindow :: AHelloWindow (...) */
  89.