home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / imenuhdr.hp_ / IMENUHDR.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  6.3 KB  |  142 lines

  1. #ifndef _IMENUHDL_
  2.   #define _IMENUHDL_
  3. /**************************************************************/
  4. /* FILE NAME: imenuhdr.hpp                                    */
  5. /*                                                            */
  6. /* DESCRIPTION:                                               */
  7. /*    Declaration of the class:                               */
  8. /*      IMenuHandler - handles events related to menu display */
  9. /*                                                            */
  10. /* COPYRIGHT:                                                 */
  11. /*   Licensed Materials - Property of IBM                     */
  12. /*   (c) Copyright IBM Corporation 1992, 1993                 */
  13. /*   US Government Users Restricted Rights - Use duplication  */
  14. /*   or disclosure restricted by GSA ADP Schedule Contract    */
  15. /*   with IBM Corp.                                           */
  16. /*                                                            */
  17. /*      $Log:   G:/IBMCLASS/IBASEAPP/VCS/IMENUHDR.HPV  $                                                 */
  18. // 
  19. //    Rev 1.25   26 Oct 1992 10:07:52   HARPERSP
  20. // Updates for documentation.
  21. //
  22. //   Rev 1.23   19 Oct 1992 20:04:38   kleong
  23. //No change.
  24. //
  25. //   Rev 1.22   19 Oct 1992 18:53:14   greg
  26. //Added menuEnded virtual callback
  27. //
  28. //   Rev 1.21   19 Oct 1992 16:27:48   law
  29. //Remove excess security classification.
  30. //
  31. //   Rev 1.20   18 Oct 1992 18:48:46   greg
  32. //Fixes for wrong handler bug
  33. //
  34. //    Rev 1.4   13 Oct 1992 20:23:28   kleong
  35. // Remove vf ~(), #include <ibasetyp.hpp> and virtual inheritence
  36. //
  37. //    Rev 1.3   13 Oct 1992 02:42:36   tsuji
  38. // Change base class from "public IHandler" to "public virtual IHandler", remove
  39. // #include <ibasetyp.hpp>, change "inherited" to "Inherited"
  40. //
  41. //    Rev 1.2   07 Oct 1992 17:28:26   HARPERSP
  42. // Delete autoDelete IPopUpMenu objects.
  43. /*                                                            */
  44. /**************************************************************/
  45.  
  46. #ifndef _IHANDLER_
  47.   #include <ihandler.hpp>
  48. #endif
  49. #ifndef _IMENUEVT_
  50.   #include <imenuevt.hpp>
  51. #endif
  52.  
  53. // Forward declarations for other classes
  54. class IMenuHandler;
  55. class ISubMenu;
  56. class IPopUpMenu;
  57. class IEvent;
  58. class IString;
  59. class IPoint;
  60.  
  61. class IMenuHandler : public IHandler
  62. {
  63. /**********************************************************************
  64. * You can derive a class from IMenuHandler and then use               *
  65. * IHandler::addHandler() to have it handle Menu related events        *
  66. * for a given object.                                                 *
  67. *                                                                     *
  68. * Example:                                                            *
  69. *   To handle Menu events for your applications IFrameWindow:         *
  70. *                                                                     *
  71. *   class FrameMenuHandler : public IMenuHandler {                    *
  72. *      ...                                                            *
  73. *   };                                                                *
  74. *                                                                     *
  75. *   IFrameWindow myFrame(id, parent, owner, size);                    *
  76. *   FrameMenuHandler myHandler();                                     *
  77. *                                                                     *
  78. *   myFrame.addHandler(myHandler);                                    *
  79. *                                                                     *
  80. * You would then override the virtual functions in IMenuHandler       *
  81. * so that you could respond to Menu events.                           *
  82. *                                                                     *
  83. **********************************************************************/
  84.  
  85.   typedef IHandler Inherited;
  86.   public:
  87.  
  88. /*------------------ CONSTRUCTORS/DESTRUCTORS -------------------------
  89. |  There is 1 way to construct instances of this class:               |
  90. |    1. IMenuHandler()                                                |
  91. |                                                                     |
  92. |  Since this is a default constructor there is no need to explicitly |
  93. |  call it from your derived class.                                   |
  94. ---------------------------------------------------------------------*/
  95.  
  96.     IMenuHandler();            
  97.  
  98.     virtual Boolean dispatchHandlerEvent(IEvent& evt);
  99.  
  100.     virtual IString dump();
  101.  
  102.   protected:
  103.  
  104. /*---------------------  IMPLEMENTATION -------------------------------
  105. | The following functions can be overridden in your derived class:    |
  106. |                                                                     |
  107. |  makePopUpMenu - called whenever a user requests context sensitive  |
  108. |                  help for the object that the handler applies to.   |
  109. |                                                                     |
  110. |  menuShowing - called whenever a menu is about to be displayed.     |
  111. |                The menu can be dynamically changed using the        |
  112. |                ISubMenu wrapper object that is passed to you.       |
  113. |                                                                     |
  114. |  menuSelected - called whenever a Menu Item is hilited. Could be    |
  115. |                 used to give brief help on the Menu Item in an      |
  116. |                 Information Area.                                   |
  117. |                                                                     |
  118. |  menuEnded    - called when a Menu is about to be removed from      |
  119. |                 the display.                                        |
  120. |                                                                     |
  121. ---------------------------------------------------------------------*/
  122.  
  123.  
  124.     virtual IPopUpMenu* makePopUpMenu(const IMenuEvent& mnEvt)
  125.               {return (IPopUpMenu*)0;}
  126.  
  127.     virtual void menuShowing(const IMenuEvent& mnEvt,
  128.                              ISubMenu* psmnAboutToShow) {;}
  129.  
  130.     virtual void menuSelected(const IMenuEvent& mnEvt) {;}
  131.  
  132.     virtual void menuEnded(const IMenuEvent& mnEvt) {;}
  133.  
  134.  
  135. /*----------------------- PRIVATE -----------------------------------*/
  136.   private:
  137.     ISubMenu*  psmnCl;
  138.     Boolean bClPopUp;
  139.     IPopUpMenu*  ppumnCl;
  140. };
  141. #endif /* IMENUHDL */
  142.