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

  1. #ifndef _IMENU_
  2.   #define _IMENU_
  3. /**************************************************************/
  4. /* FILE NAME: imenu.hpp                                       */
  5. /*                                                            */
  6. /* DESCRIPTION:                                               */
  7. /*    Declaration of the class:                               */
  8. /*      IMenu - This is the base class of menu class          */
  9. /*         hierarchy that provides operations to act on       */
  10. /*         menu items.                                        */
  11. /*                                                            */
  12. /* COPYRIGHT:                                                 */
  13. /*   Licensed Materials - Property of IBM                     */
  14. /*   (c) Copyright IBM Corporation 1992, 1993                 */
  15. /*   US Government Users Restricted Rights - Use duplication  */
  16. /*   or disclosure restricted by GSA ADP Schedule Contract    */
  17. /*   with IBM Corp.                                           */
  18. /*                                                            */
  19. // $Log:   G:/IBMCLASS/IBASEAPP/VCS/IMENU.HPV  $
  20. // 
  21. //    Rev 1.6   26 Oct 1992 10:07:40   HARPERSP
  22. // Updates for documentation.
  23. // 
  24. //    Rev 1.4   14 Oct 1992 10:45:12   kleong
  25. // Change handle() to return const IWindowHandle& KKL
  26. //
  27. //   Rev 1.3   21 Sep 1992 12:39:34   HARPERSP
  28. //Removed the owner private data.
  29. //This has been moved down to the descendants that need to store it.
  30. //Problem was that ISubMenu could not supply this data and didn't
  31. //need it.
  32. //
  33. //Also added $Log$ directive.
  34. /*                                                            */
  35. /**************************************************************/
  36.  
  37. #ifndef _IHANDLE_
  38. #include <ihandle.hpp>   
  39. #endif
  40.  
  41.  
  42. // Forward declarations for other classes
  43. class IMenu;  /*  mn  */
  44. class IWindow;
  45. class IMenuItem;
  46.  
  47. class IMenu
  48. {
  49. /**********************************************************************
  50. * This is an abstract base class. You can not create IMenu instances. *
  51. * The Public member functions in IMenu can be used from derived       *
  52. * classes to manuipulate Menus.                                       *
  53. *                                                                     *
  54. **********************************************************************/
  55.  
  56.   public:
  57.  
  58. /*---------------------- ACCESSORS ------------------------------------
  59. | checkItem - place a check mark to the left of the item              |
  60. | uncheckItem - remove check mark from an item                        |
  61. | isItemChecked - return true if item is checked                      |
  62. |                                                                     |
  63. | enableItem - make item selectable                                   |
  64. | disableItem - make item non-selectable                              |
  65. | isItemDisabled - return true is item non-selectable                 |
  66. |                                                                     |
  67. | addItem - add an IMenuItem as the last item in a Menu               |
  68. | addSeparator - add a separator as the last item in a Menu           |
  69. | deleteItem - remove specified item from a Menu                      |
  70. |                                                                     |
  71. | menuItem - return a IMenuItem* to the specified item                |
  72. | handle - return the IWindowHandle of the Menu                       |
  73. | id - return the resource id of the Menu                             |
  74. |                                                                     |
  75. ---------------------------------------------------------------------*/
  76.  
  77.      virtual void  checkItem(unsigned long itemId);
  78.      virtual void  uncheckItem(unsigned long itemId);
  79.      Boolean isItemChecked(unsigned long itemId) const;
  80.  
  81.      virtual void  enableItem(unsigned long itemId);
  82.      virtual void  disableItem(unsigned long itemId);
  83.      Boolean isItemDisabled(unsigned long itemId) const;
  84.  
  85.      // The addItem() and addSeparator() functions that do
  86.      // not take the subMenuId parameter are used to addItems
  87.      // to ActionBars, SystemMenus, or PopUps.
  88.      // The functions that do take the subMenuId would be used
  89.      // to delete items from a SubMenu. For example to delete
  90.      // an item from a pull-down menu of an ActionBar.
  91.  
  92.      virtual void  addItem(const IMenuItem& newItem);
  93.      virtual void  addItem(const IMenuItem& newItem,
  94.                            unsigned long subMenuId);
  95.  
  96.  
  97.      virtual void  addSeparator(unsigned long newItemId = 0);
  98.      virtual void  addSeparator(unsigned long newItemId,
  99.                                 unsigned long subMenuId);
  100.  
  101.  
  102.      virtual void  deleteItem(unsigned long itemId);
  103.  
  104.  
  105.      IMenuItem*  menuItem(unsigned long itemId);
  106.  
  107.      const IWindowHandle& handle() const {return winClHandle;}
  108.      const unsigned long id() const;
  109.  
  110.  
  111.   protected:
  112.  
  113. /*------------------ CONSTRUCTORS/DESTRUCTORS -------------------------
  114. |  There is 1 way to construct instances of this class:               |
  115. |     IMenu();                                                        |
  116. |                                                                     |
  117. |  This constructor is protected since it should only be called by    |
  118. |  derived classes.                                                   |
  119. |                                                                     |
  120. ---------------------------------------------------------------------*/
  121.  
  122.      IMenu();
  123.      virtual ~IMenu();
  124.      void setHandle(IWindowHandle newHandle) {winClHandle = newHandle;}
  125.  
  126.  
  127. /*----------------------- PRIVATE -----------------------------------*/
  128.   private:
  129.  
  130.      IWindowHandle winClHandle;
  131.      IMenu(const IMenu&);
  132.      IMenu &operator=(const IMenu&);
  133.  
  134.      IWindowHandle subMenuHandle(unsigned long subMenuId) const;
  135.  
  136.  
  137. };
  138. #endif  /* _IMENU_ */
  139.