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

  1. /******************************************************************************
  2. * .FILE:         version.h                                                    *
  3. *                                                                             *
  4. * .DESCRIPTION:  Version Sample Application:   Implementation                 *
  5. *                                                                             *
  6. * .CLASSES:                                                                   *
  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 <ititle.hpp>
  27. #include <istring.hpp>
  28. #include <istattxt.hpp>
  29. #include <iframe.hpp>
  30. #include <ireslib.hpp>
  31. #include <icoordsy.hpp>
  32. #include "version.h"
  33.  
  34. int main()
  35. {
  36.   ICoordinateSystem::setApplicationOrientation(
  37.           ICoordinateSystem::originLowerLeft );
  38.  
  39.   IResourceLibrary
  40.     reslib;
  41.  
  42. /*----------------------------------------------------------------------------|
  43. | Create the main window with a window id of 0x1000                           |
  44. -----------------------------------------------------------------------------*/
  45.   IFrameWindow mainWindow (WND_MAIN);
  46.  
  47. /*----------------------------------------------------------------------------|
  48. | Create a title for the main window                                          |
  49. | Set the title text with a string from the resource file                     |
  50. -----------------------------------------------------------------------------*/
  51.   ITitle mainTitle(&mainWindow);
  52.   mainTitle.setTitleText(reslib.loadString(WND_MAIN));
  53.  
  54. /*----------------------------------------------------------------------------|
  55. | Place a static text string in the main window.                              |
  56. | Set the static text string with the version information.                    |                                                        |
  57. | Set the alignment of the text to the center of the window.                  |
  58. | Set the static text as the client of the main window                        |
  59. -----------------------------------------------------------------------------*/
  60.   IStaticText version(WND_TEXT, &mainWindow, &mainWindow);
  61.  
  62.   version.setText(reslib.loadString(STR_MAJOR)+
  63.                   IString(IC_MAJOR_VERSION)+
  64.                   reslib.loadString(STR_SPACES)+reslib.loadString(STR_MINOR)+
  65.                   IString(IC_MINOR_VERSION));
  66.   version.setAlignment(IStaticText::centerCenter);
  67.   mainWindow.setClient(&version);
  68.  
  69. /*----------------------------------------------------------------------------|
  70. | Set the size of the main window, change the focus to the main window, and   |
  71. |   show the main window.                                                     |
  72. | Run the application.                                                        |
  73. -----------------------------------------------------------------------------*/
  74.   mainWindow.sizeTo(ISize(800,100));
  75.   mainWindow.setFocus();
  76.   mainWindow.show();
  77.   IApplication::current().run();
  78.   return 0;
  79. } /* end main */
  80.