home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IMENUBAR.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  6KB  |  119 lines

  1. #ifndef _IMENUBAR_
  2.   #define _IMENUBAR_
  3. /******************************************************************************
  4. * FILE NAME: imenubar.hpp                                                     *
  5. *                                                                             *
  6. * DESCRIPTION:                                                                *
  7. *    Declaration of the class:                                                *
  8. *      IMenuBar - Create a menu-bar for a frame-window.                       *
  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. *******************************************************************************/
  18. #ifndef _IMENU_
  19.   #include <imenu.hpp>
  20. #endif
  21.  
  22. #ifndef _ICCONST_
  23.   #include <icconst.h>
  24. #endif
  25.  
  26. /*----------------------------------------------------------------------------*/
  27. /* Align classes on four byte boundary.                                       */
  28. /*----------------------------------------------------------------------------*/
  29. #pragma pack(4)
  30.  
  31. // Forward declarations for other classes
  32. class IResourceId;
  33. class IFrameWindow;
  34.  
  35. class IMenuBar : public IMenu {
  36. typedef IMenu
  37.   Inherited;
  38. /*******************************************************************************
  39. * The IMenuBar class is used to create a menu bar for a frame window.          *
  40. *******************************************************************************/
  41. public:
  42. /*-------------------------------- Style ---------------------------------------
  43. |  The following are valid styles for this class:                              |
  44. |   classDefaultStyle  - The original default style for this class, which is   |
  45. |                        IMenuBar::empty.                                      |
  46. |   empty              - The menu will be created with no items.  It can be    |
  47. |                        dynamically populated using IMenu and ISubmenu        |
  48. |                        functions.                                            |
  49. |   wrapper            - The menu bar will be a wrapper for an IFrameWindow    |
  50. |                        menu bar that was previously created using the        |
  51. |                        IFrameWindow::menuBar style.                          |
  52. |                                                                              |
  53. |  The following functions provide a means of getting and setting the default  |
  54. |  style for this class:                                                       |
  55. |                                                                              |
  56. |   defaultStyle    - Returns the current default style.  This is the same as  |
  57. |                     classDefaultStyle unless setDefaultStyle has been        |
  58. |                     called.                                                  |
  59. |   setDefaultStyle - Sets the default style for all subsequent menu items.    |
  60. ------------------------------------------------------------------------------*/
  61. INESTEDBITFLAGCLASSDEF2(Style, IMenuBar, IWindow, IMenu);
  62. static const Style
  63.   classDefaultStyle,
  64.   empty,
  65.   wrapper;
  66.  
  67. static Style
  68.   defaultStyle ( );
  69.  
  70. static void
  71.   setDefaultStyle ( const Style &aStyle );
  72.  
  73. /*------------------ Constructor/Destructor ------------------------------------
  74. |  Instances of this class can be constructed in the following ways:           |
  75. |   - By creating a menu bar with a menu resource ID and frame window owner.   |
  76. |   - By creating an empty menu bar or a wrapper for an IFrameWindow menu      |
  77. |     bar.  The empty and wrapper style flags determine which type of menu is  |
  78. |     created.                                                                 |
  79. ------------------------------------------------------------------------------*/
  80.   IMenuBar ( const IResourceId& menuResId,
  81.              IFrameWindow*      owner);
  82.  
  83.   IMenuBar ( IFrameWindow*      owner,
  84.              const Style&       style = defaultStyle() );
  85.  
  86. virtual
  87.  ~IMenuBar();
  88.  
  89. /*---------------------- Accessors --------------------------------------------
  90. | The following function switches the menu bar to another menu resource.       |
  91. |   setMenu - Sets or changes the menu bar to the menu resource ID.            |
  92. ------------------------------------------------------------------------------*/
  93. IMenuBar
  94.   &setMenu ( const IResourceId&  menuResId );
  95.  
  96.  
  97. private: /*---------------------- Private --------------------------*/
  98. static Style
  99.   currentDefaultStyle;
  100. /*------------------- Hidden Functions. -----------------------------------
  101. | The following inherited functions are hidden in this class.              |
  102. |-------------------------------------------------------------------------*/
  103.   IMenuBar(const IMenuBar&);
  104.   IMenuBar &operator=(const IMenuBar&);
  105. };
  106.  
  107. INESTEDBITFLAGCLASSFUNCS(Style, IMenuBar);
  108.  
  109. /*----------------------------------------------------------------------------*/
  110. /* Resume compiler default packing.                                           */
  111. /*----------------------------------------------------------------------------*/
  112. #pragma pack()
  113.  
  114. /*--------------------------------- Inlines ----------------------------------*/
  115. #ifndef I_NO_INLINES
  116.   #include <imenubar.inl>
  117. #endif
  118. #endif  /* _IMENUBAR_ */
  119.