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

  1. /******************************************************************************
  2. * .FILE:         ahellow5.hpp                                                 *
  3. *                                                                             *
  4. * .DESCRIPTION:  Hello World Sample Program Version 5: Class Header           *
  5. *                                                                             *
  6. * .CLASSES:      AHelloWindow                                                 *
  7. *                ACommandHandler                                              *
  8. *                ASelectHandler                                               *
  9. *                AHelpHandler                                                 *
  10. *                AEarthWindow                                                 *
  11. *                ATextDialogWindow                                            *
  12. *                                                                             *
  13. * .COPYRIGHT:                                                                 *
  14. *    Licensed Material - Program-Property of IBM                              *
  15. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  16. *                                                                             *
  17. * .DISCLAIMER:                                                                *
  18. *   The following [enclosed] code is sample code created by IBM               *
  19. *   Corporation.  This sample code is not part of any standard IBM product    *
  20. *   and is provided to you solely for the purpose of assisting you in the     *
  21. *   development of your applications.  The code is provided 'AS IS',          *
  22. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  23. *   arising out of your use of the sample code, even if they have been        *
  24. *   advised of the possibility of such damages.                               *
  25. *                                                                             *
  26. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  27. *                                                                             *
  28. ******************************************************************************/
  29. #ifndef _AHELLOW5_
  30. #define _AHELLOW5_
  31.  
  32. #include <iframe.hpp>
  33. #include <istattxt.hpp>
  34. #include <iinfoa.hpp>
  35. #include <imenubar.hpp>
  36. #include <icmdhdr.hpp>
  37. #include <isetcv.hpp>
  38. #include <ipushbut.hpp>
  39. #include <isplitcv.hpp>
  40. #include <ilistbox.hpp>
  41. #include <iselhdr.hpp>
  42. #include <ihelphdr.hpp>
  43. #include <ihelp.hpp>
  44.  
  45. #include "aearthw5.hpp"
  46.  
  47. //Forward declarations for other classes:
  48. class AHelloWindow;
  49.  
  50. /**************************************************************************
  51. * Class ACommandHandler -- Handler for main frame window                  *                                                *
  52. **************************************************************************/
  53. class ACommandHandler : public ICommandHandler
  54. {
  55.   public:
  56.  
  57. /*------------------------------ Constructor -----------------------------|
  58. | Construct the object with:                                              |
  59. | 1) A pointer to the main frame window                                   |
  60. -------------------------------------------------------------------------*/
  61.     ACommandHandler(AHelloWindow *helloFrame);
  62.  
  63. /*------------------------------ Destructor ------------------------------|
  64. | Destruct the object with:                                               |
  65. | 1) No parameters                                                        |
  66. -------------------------------------------------------------------------*/
  67.     virtual
  68.      ~ACommandHandler() { };
  69.  
  70.   protected:
  71. /*------------------------ Override Command Function ---------------------|
  72. | The command function is called to handle application command events.    |
  73. -------------------------------------------------------------------------*/
  74.     virtual Boolean
  75.       command(ICommandEvent& cmdEvent);
  76.  
  77.   private:
  78.     AHelloWindow
  79.      *frame;
  80. };
  81.  
  82. /**************************************************************************
  83. * Class ASelectHandler -- Handles list box selections for the main window *
  84. **************************************************************************/
  85. class ASelectHandler : public ISelectHandler
  86. {
  87.   public:
  88. /*------------------------------ Constructor -----------------------------|
  89. | Construct the object with:                                              |
  90. | 1) A pointer to the main frame window                                   |
  91. -------------------------------------------------------------------------*/
  92.     ASelectHandler(AHelloWindow *helloFrame);
  93.  
  94. /*------------------------------ Destructor ------------------------------|
  95. | Destruct the object with:                                               |
  96. | 1) No parameters                                                        |
  97. -------------------------------------------------------------------------*/
  98.     virtual
  99.      ~ASelectHandler() { }
  100.  
  101.   protected:
  102. /*------------------------ Override Selected Function --------------------|
  103. | The selected() function is called to handle list box selection events.  |
  104. |------------------------------------------------------------------------*/
  105.     virtual Boolean
  106.       selected(IControlEvent& ctlEvent);
  107.  
  108.   private:
  109.     AHelloWindow
  110.      *frame;
  111. };
  112.  
  113. /**************************************************************************
  114. * Clas AHelpHandler -- Provides help for keys                             *
  115. **************************************************************************/
  116. class AHelpHandler : public IHelpHandler
  117. {
  118.   public:
  119.  
  120. /*------------------------------ Destructor ------------------------------|
  121. | Destruct the object with:                                               |
  122. | 1) No parameters                                                        |
  123. -------------------------------------------------------------------------*/
  124.     virtual ~AHelpHandler() { }
  125.  
  126.   protected:
  127. /*----------------------- Override keysHelpId Function -------------------|
  128. | The keysHelpId() function is called to set the event result to the      |
  129. |   ID within the Hello World help libraries for Keys Help.               |
  130. |------------------------------------------------------------------------*/
  131.     virtual Boolean
  132.       keysHelpId(IEvent& evt);
  133. };
  134.  
  135. /**************************************************************************
  136. * Class AHelloWindow -- Main Frame Window                                 *
  137. **************************************************************************/
  138. class AHelloWindow : public IFrameWindow
  139. {
  140.   public:
  141. /*------------------------ Hello Text Alignment --------------------------|
  142. | The following enumeration type is used to specify the alignment of      |
  143. | text in the hello static text window.                                   |
  144. |------------------------------------------------------------------------*/
  145.     enum Alignment
  146.     {
  147.       left, center, right
  148.     };
  149.  
  150. /*------------------------------ Constructor -----------------------------|
  151. | Construct the object with:                                              |
  152. | 1) the window id                                                        |
  153. -------------------------------------------------------------------------*/
  154.     AHelloWindow(unsigned long windowId);
  155.  
  156. /*------------------------------ Destructor ------------------------------|
  157. | Destruct the object with:                                               |
  158. | 1) No parameters                                                        |
  159. -------------------------------------------------------------------------*/
  160.     virtual
  161.      ~AHelloWindow();
  162.  
  163. /*---------------------- Hello Static Text Functions ---------------------|
  164. | These functions are used to change the hello static text window.        |
  165. |   setTextAlignment - Align the static text horizontally.  The text is   |
  166. |           always centered vertically by design.                         |
  167. |   editText - Use a modal dialog window to edit the text in the static   |
  168. |           text window.                                                  |
  169. |   setTextFromListBox -  Set the text to the first selected item in the  |
  170. |           list box.                                                     |
  171. |------------------------------------------------------------------------*/
  172.     virtual AHelloWindow
  173.      &setTextAlignment(const Alignment alignment),
  174.      &editText(),
  175.      &setTextFromListBox();
  176.  
  177.   private:
  178.     IMenuBar
  179.       menuBar;
  180.     ISplitCanvas
  181.       clientWindow,
  182.       helloCanvas;
  183.     IStaticText
  184.       statusLine,
  185.       hello;
  186.     AEarthWindow
  187.       earthWindow;
  188.     IListBox
  189.       listBox;
  190.     ISetCanvas
  191.       buttons;
  192.     IPushButton
  193.       leftButton,
  194.       centerButton,
  195.       rightButton,
  196.       helpButton;
  197.     IInfoArea
  198.       infoArea;
  199.     ACommandHandler
  200.       commandHandler;
  201.     ASelectHandler
  202.       selectHandler;
  203.     IHelpWindow
  204.       helpWindow;
  205.     AHelpHandler
  206.       helpHandler;
  207.  
  208. /*------------------------------ Operators -------------------------------|
  209. | Operators defined for this class:                                       |
  210. |  =  -- Assignment operator                                              |
  211. -------------------------------------------------------------------------*/
  212.     AHelloWindow
  213.      &operator=(const AHelloWindow&);
  214. };
  215. #endif
  216.