home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / HELLO5 / AHELLOW5.HPP < prev    next >
C/C++ Source or Header  |  1995-04-07  |  14KB  |  189 lines

  1. #ifndef _AHELLOW5_
  2. #define _AHELLOW5_
  3. /*****************************************************************************
  4. * HELLO WORLD SAMPLE PROGRAM - Version 5: Class Header (ahellow5.hpp)        *
  5. *                                                                            *
  6. * COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1995. *
  7. *                                                                            *
  8. * DISCLAIMER OF WARRANTIES:                                                  *
  9. *   The following [enclosed] code is sample code created by IBM              *
  10. *   Corporation.  This sample code is not part of any standard IBM product   *
  11. *   and is provided to you solely for the purpose of assisting you in the    *
  12. *   development of your applications.  The code is provided "AS IS",         *
  13. *   without warranty of any kind.  IBM shall not be liable for any damages   *
  14. *   arising out of your use of the sample code, even if they have been       *
  15. *   advised of the possibility of such damages.                              *
  16. *****************************************************************************/
  17. //NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
  18.  
  19. #ifndef _IFRAME_                                                            //V2
  20.   #include <iframe.hpp>         //Include IFrameWindow class header           V2
  21. #endif                                                                      //V2
  22. #ifndef _ISTATTXT_                                                          //V2
  23.   #include <istattxt.hpp>       //Include IStaticText class header            V2
  24. #endif                                                                      //V2
  25. #ifndef _IINFOA_                                                            //V2
  26.   #include <iinfoa.hpp>         //Include IInfoArea class header              V2
  27. #endif                                                                      //V2
  28. #ifndef _IMENUBAR_                                                          //V3
  29.   #include <imenubar.hpp>       //Include IMenuBar class header               V3
  30. #endif                                                                      //V3
  31. #ifndef _ICMDHDR_                                                           //V3
  32.   #include <icmdhdr.hpp>        //Include ICommandHandler class header        V3
  33. #endif                                                                      //V3
  34. #ifndef _ISETCV_                                                            //V4
  35.   #include <isetcv.hpp>         //Include ISetCanvas class header             V4
  36. #endif                                                                      //V4
  37. #ifndef _IPUSHBUT_                                                          //V4
  38.   #include <ipushbut.hpp>       //Include IPushButton class header            V4
  39. #endif                                                                      //V4
  40. #ifndef _ISPLITCV_                                                          //V5
  41.   #include <isplitcv.hpp>       //Include ISplitCanvas class header           V5
  42. #endif                                                                      //V5
  43. #ifndef _ILISTBOX_                                                          //V5
  44.   #include <ilistbox.hpp>       //Include IListBox class header               V5
  45. #endif                                                                      //V5
  46. #ifndef _ISELHDR_                                                           //V5
  47.   #include <iselhdr.hpp>        //Include ISelectHandler class header         V5
  48. #endif                                                                      //V5
  49. #ifndef _IHELPHDR_                                                          //V5
  50.   #include <ihelphdr.hpp>       //Include IHelpHandler class header           V5
  51. #endif                                                                      //V5
  52. #ifndef _IHELP_                                                             //V5
  53.   #include <ihelp.hpp>          //Include IHelpWindow class header            V5
  54. #endif                                                                      //V5
  55. #ifndef _AEARTHW5_                                                          //V5
  56.   #include "aearthw5.hpp"       //Include AEarthWindow class header           V5
  57. #endif                                                                      //V5
  58.  
  59. //Forward declarations for other classes:
  60. class AHelloWindow;                                                         //V3
  61.  
  62. /**************************************************************************   V3
  63. * Class:   ACommandHandler                                                *   V3
  64. *                                                                         *   V3
  65. * Purpose: New Command Handler class that handles commands                *   V3
  66. *          specifically for AHelloWindow class windows.                   *   V3
  67. *                                                                         *   V3
  68. **************************************************************************/ //V3
  69. class ACommandHandler : public ICommandHandler {                            //V3
  70. public:                                                                     //V3
  71.   ACommandHandler(AHelloWindow *helloFrame);                                //V3
  72. virtual ~ACommandHandler() { }                                              //V3
  73.  
  74. protected:                                                                  //V3
  75. /*------------------------ Override Command Function ---------------------|   V3
  76. | The command function is called to handle application command events.    |   V3
  77. |------------------------------------------------------------------------*/ //V3
  78. virtual Boolean                                                             //V3
  79.   command(ICommandEvent& cmdEvent);                                         //V3
  80.  
  81. private:                                                                    //V3
  82.   AHelloWindow *frame;                                                      //V3
  83. };                                                                          //V3
  84.  
  85. /**************************************************************************   V5
  86. * Class:   ASelectHandler                                                 *   V5
  87. *                                                                         *   V5
  88. * Purpose: New Select Handler class that handles list box selections      *   V5
  89. *          specifically for AHelloWindow class windows.                   *   V5
  90. *                                                                         *   V5
  91. **************************************************************************/ //V5
  92. class ASelectHandler : public ISelectHandler {                              //V5
  93.  
  94. public:                                                                     //V5
  95.   ASelectHandler(AHelloWindow *helloFrame);                                 //V5
  96. virtual ~ASelectHandler() { }                                               //V5
  97.  
  98. protected:                                                                  //V5
  99. /*------------------------ Override Selected Function --------------------|   V5
  100. | The selected() function is called to handle list box selection events.  |   V5
  101. |------------------------------------------------------------------------*/ //V5
  102. virtual Boolean                                                             //V5
  103.   selected(IControlEvent& ctlEvent);                                        //V5
  104.  
  105. private:                                                                    //V5
  106.   AHelloWindow *frame;                                                      //V5
  107. };
  108.  
  109. /**************************************************************************   V5
  110. * Class:   AHelpHandler                                                   *   V5
  111. *                                                                         *   V5
  112. * Purpose: New Help Handler class that only overrides one                 *   V5
  113. *          IHelpHandler function, keysHelpId().  If keysHelpId()          *   V5
  114. *          is not overridden, then the default action sets the event      *   V5
  115. *          result to zero, which indicates that no action is required,    *   V5
  116. *          that is, no help information for keys is displayed.            *   V5
  117. **************************************************************************/ //V5
  118. class AHelpHandler : public IHelpHandler {                                  //V5
  119. public:                                                                     //V5
  120. virtual ~AHelpHandler() { }                                                 //V5
  121. protected:                                                                  //V5
  122. /*----------------------- Override keysHelpId Function -------------------|   V5
  123. | The keysHelpId() function is called to set the event result to the      |   V5
  124. |   ID within the Hello World help libraries for Keys Help.               |   V5
  125. |------------------------------------------------------------------------*/ //V5
  126. virtual Boolean                                                             //V5
  127.      keysHelpId(IEvent& evt);                                               //V5
  128. };
  129.  
  130. /**************************************************************************   V2
  131. * Class:   AHelloWindow                                                   *   V2
  132. *                                                                         *   V2
  133. * Purpose: Main Window class for C++ Hello World sample application.      *   V2
  134. *          It is derived from IFrameWindow class.                         *   V2
  135. *                                                                         *   V2
  136. **************************************************************************/ //V2
  137. class AHelloWindow : public IFrameWindow                                    //V2
  138. {                                                                           //V2
  139. public:                                                                     //V2
  140.     AHelloWindow(unsigned long windowId);                                   //V2
  141. virtual ~AHelloWindow();                    //Destructor for this class       v3
  142.  
  143. /*------------------------ Hello Text Alignment --------------------------|   V3
  144. | The following enumeration type is used to specify the alignment of      |   V3
  145. | text in the hello static text window.                                   |   V3
  146. |------------------------------------------------------------------------*/ //V3
  147.     enum Alignment                                                          //V3
  148.       {                                                                     //V3
  149.       left, center, right                                                   //V3
  150.       };                                                                    //V3
  151. /*---------------------- Hello Static Text Functions ---------------------|   V3
  152. | These functions are used to change the hello static text window.        |   V3
  153. |   setAlignment - Align the static text horizontally.  The text is       |   V3
  154. |           always centered vertically by design.                         |   V3
  155. |   editText - Use a modal dialog window to edit the text in the static   |   V4
  156. |           text window.                                                  |   V4
  157. |   setTextFromListBox -  Set the text to the first selected item in the  |   V5
  158. |           list box.                                                     |   V5
  159. |------------------------------------------------------------------------*/ //V3
  160. virtual AHelloWindow                                                        //V3
  161.    &setAlignment(Alignment alignment),                                      //V3
  162.    &editText(),                                                             //V4
  163.    &setTextFromListBox();                                                   //V5
  164.  
  165.   private:                                                                  //V2
  166.     IMenuBar      menuBar;                                                  //V3
  167.     IStaticText   statusLine;                                               //V3
  168.     ISplitCanvas  clientWindow;                                             //V5
  169.     ISplitCanvas  helloCanvas;                                              //V5
  170.     IStaticText   hello;                                                    //V2
  171.     AEarthWindow  earthWindow;                                              //V5
  172.     IListBox      listBox;                                                  //V5
  173.     ISetCanvas    buttons;                                                  //V4
  174.     IPushButton   leftButton;                                               //V4
  175.     IPushButton   centerButton;                                             //V4
  176.     IPushButton   rightButton;                                              //V4
  177.     IPushButton   helpButton;                                               //V5
  178.     IInfoArea     infoArea;                                                 //V2
  179.     ACommandHandler commandHandler;                                         //V3
  180.     ASelectHandler selectHandler;                                           //V5
  181.     AHelpHandler  helpHandler;                                              //V5
  182.     IHelpWindow   helpWindow;                                               //V5
  183.  
  184.     AHelloWindow(const AHelloWindow&);  //Default copy constructor            V2
  185. AHelloWindow                                                                //V2
  186.     &operator=(const AHelloWindow&);    //Default assignment operator         V2
  187. };                                                                          //V2
  188. #endif                                                                      //V2
  189.