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

  1. /******************************************************************************
  2. * .FILE:         ahellow4.hpp                                                 *
  3. *                                                                             *
  4. * .DESCRIPTION:  Hello World Sample Program Version 4: 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 _AHELLOW4_
  26. #define _AHELLOW4_
  27.  
  28. #include <iframe.hpp>
  29. #include <istattxt.hpp>
  30. #include <iinfoa.hpp>
  31. #include <imenubar.hpp>
  32. #include <icmdhdr.hpp>
  33. #include <isetcv.hpp>
  34. #include <ipushbut.hpp>
  35.  
  36. class AHelloWindow;
  37.  
  38. /**************************************************************************
  39. * Class ACommandHandler -- Handler for main frame window                  *                                                *
  40. **************************************************************************/
  41. class ACommandHandler : public ICommandHandler
  42. {
  43.   public:
  44.  
  45. /*------------------------------ Constructor -----------------------------|
  46. | Construct the object with:                                              |
  47. | 1) A pointer to the main frame window                                   |
  48. -------------------------------------------------------------------------*/
  49.     ACommandHandler(AHelloWindow *helloFrame);
  50.  
  51. /*------------------------------ Destructor ------------------------------|
  52. | Destruct the object with:                                               |
  53. | 1) No parameters                                                        |
  54. -------------------------------------------------------------------------*/
  55.     virtual
  56.      ~ACommandHandler() { };
  57.  
  58.   protected:
  59. /*------------------------ Override Command Function ---------------------|
  60. | The command function is called to handle application command events.    |
  61. -------------------------------------------------------------------------*/
  62.     virtual Boolean
  63.       command(ICommandEvent& cmdEvent);
  64.  
  65.   private:
  66.     AHelloWindow
  67.      *frame;
  68. };
  69.  
  70.  
  71. /**************************************************************************
  72. * Class AHelloWindow--Main Frame Window                                   *
  73. **************************************************************************/
  74. class AHelloWindow : public IFrameWindow
  75. {
  76.   public:
  77.  
  78. /*------------------------------------------------------------------------|
  79. | The following enumeration type is used to specify the alignment of      |
  80. | text in the hello static text window.                                   |
  81. |------------------------------------------------------------------------*/
  82.     enum Alignment
  83.     {
  84.       left, center, right
  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. |   editText - Use a modal dialog window to edit the text in the static   |
  104. |           text window.                                                  |
  105. |------------------------------------------------------------------------*/
  106.     virtual AHelloWindow
  107.      &setTextAlignment( const Alignment alignment),
  108.      &editText();
  109.  
  110.   private:
  111.     IMenuBar
  112.       menuBar;
  113.     IStaticText
  114.       statusLine,
  115.       hello;
  116.     ISetCanvas
  117.       buttons;
  118.     IPushButton
  119.       leftButton,
  120.       centerButton,
  121.       rightButton;
  122.     IInfoArea
  123.       infoArea;
  124.     ACommandHandler
  125.       commandHandler;
  126.  
  127. /*------------------------------ Operators -------------------------------|
  128. | Operators defined for this class:                                       |
  129. |  =  -- Assignment operator                                              |
  130. -------------------------------------------------------------------------*/
  131.     AHelloWindow
  132.       &operator=(const AHelloWindow&);    //Default assignment operator
  133. };
  134. #endif
  135.