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

  1. /******************************************************************************
  2. * .FILE:        ahellow3.hpp                                                  *
  3. *                                                                             *
  4. * .DESCRIPTION: Hello World Sample Program V. 3: Class Header                 *
  5. *                                                                             *
  6. * .CLASSES:     AHelloWindow                                                  *
  7. *               ACommandHandler                                               *
  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. #ifndef _AHELLOW3_
  26. #define _AHELLOW3_
  27.  
  28. #include <iframe.hpp>
  29. #include <istattxt.hpp>
  30. #include <iinfoa.hpp>
  31. #include <imenubar.hpp>
  32. #include <icmdhdr.hpp>
  33.  
  34. class AHelloWindow;
  35.  
  36. /**************************************************************************
  37. * Class ACommandHandler -- Handler for main frame window                  *                                                *
  38. **************************************************************************/
  39. class ACommandHandler : public ICommandHandler
  40. {
  41.   public:
  42.  
  43. /*------------------------------ Constructor -----------------------------|
  44. | Construct the object with:                                              |
  45. | 1) A pointer to the main frame window                                   |
  46. -------------------------------------------------------------------------*/
  47.     ACommandHandler(AHelloWindow *helloFrame);
  48.  
  49. /*------------------------------ Destructor ------------------------------|
  50. | Destruct the object with:                                               |
  51. | 1) No parameters                                                        |
  52. -------------------------------------------------------------------------*/
  53.     virtual
  54.      ~ACommandHandler() { };
  55.  
  56.   protected:
  57. /*------------------------ Override Command Function ---------------------|
  58. | The command function is called to handle application command events.    |
  59. -------------------------------------------------------------------------*/
  60.     virtual Boolean
  61.       command(ICommandEvent& cmdEvent);
  62.  
  63.   private:
  64.     AHelloWindow
  65.      *frame;
  66. };
  67.  
  68.  
  69. /**************************************************************************
  70. * Class:      AHelloWindow--Main Frame Window                             *
  71. **************************************************************************/
  72.  
  73. class AHelloWindow : public IFrameWindow
  74. {
  75.   public:
  76.  
  77. /*-------------------------------------------------------------------------
  78. | The following enumeration type is used to specify the alignment of      |
  79. | text in the hello static text window.                                   |
  80. |------------------------------------------------------------------------*/
  81.     enum Alignment
  82.     {
  83.       left, center, right
  84.     };
  85.  
  86. /*-------------------------- Constructor ----------------------------------
  87. | Constructs the object by either:                                        |
  88. | 1) WindowID                                                             |
  89. |------------------------------------------------------------------------*/
  90.     AHelloWindow(const unsigned long windowId);
  91.  
  92. /*--------------------------- Destructor ----------------------------------
  93. | Destruct the object in only one way:                                    |
  94. | 1) No Parameters                                                        |
  95. |------------------------------------------------------------------------*/
  96.     virtual
  97.        ~AHelloWindow();
  98.  
  99. /*------------------------------------------------------------------------|
  100. | This function is used to change the hello static text window.           |
  101. |   setTextAlignment - Align the static text horizontally.  The text is   |
  102. |           always centered vertically by design.                         |
  103. |------------------------------------------------------------------------*/
  104.     virtual AHelloWindow
  105.      &setTextAlignment( const Alignment alignment);
  106.  
  107.   private:
  108.     IMenuBar
  109.       menuBar;
  110.     IStaticText
  111.       statusLine,
  112.       hello;
  113.     IInfoArea
  114.       infoArea;
  115.     ACommandHandler
  116.       commandHandler;
  117.  
  118. /*------------------------------ Operators -------------------------------|
  119. | Operators defined for this class:                                       |
  120. |  =  -- Assignment operator                                              |
  121. -------------------------------------------------------------------------*/
  122.     AHelloWindow
  123.      &operator= (const AHelloWindow&);
  124. };
  125. #endif
  126.