home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IMENU_
- #define _IMENU_
- /**************************************************************/
- /* FILE NAME: imenu.hpp */
- /* */
- /* DESCRIPTION: */
- /* Declaration of the class: */
- /* IMenu - This is the base class of menu class */
- /* hierarchy that provides operations to act on */
- /* menu items. */
- /* */
- /* COPYRIGHT: */
- /* Licensed Materials - Property of IBM */
- /* (c) Copyright IBM Corporation 1992, 1993 */
- /* US Government Users Restricted Rights - Use duplication */
- /* or disclosure restricted by GSA ADP Schedule Contract */
- /* with IBM Corp. */
- /* */
- // $Log: G:/IBMCLASS/IBASEAPP/VCS/IMENU.HPV $
- //
- // Rev 1.6 26 Oct 1992 10:07:40 HARPERSP
- // Updates for documentation.
- //
- // Rev 1.4 14 Oct 1992 10:45:12 kleong
- // Change handle() to return const IWindowHandle& KKL
- //
- // Rev 1.3 21 Sep 1992 12:39:34 HARPERSP
- //Removed the owner private data.
- //This has been moved down to the descendants that need to store it.
- //Problem was that ISubMenu could not supply this data and didn't
- //need it.
- //
- //Also added $Log$ directive.
- /* */
- /**************************************************************/
-
- #ifndef _IHANDLE_
- #include <ihandle.hpp>
- #endif
-
-
- // Forward declarations for other classes
- class IMenu; /* mn */
- class IWindow;
- class IMenuItem;
-
- class IMenu
- {
- /**********************************************************************
- * This is an abstract base class. You can not create IMenu instances. *
- * The Public member functions in IMenu can be used from derived *
- * classes to manuipulate Menus. *
- * *
- **********************************************************************/
-
- public:
-
- /*---------------------- ACCESSORS ------------------------------------
- | checkItem - place a check mark to the left of the item |
- | uncheckItem - remove check mark from an item |
- | isItemChecked - return true if item is checked |
- | |
- | enableItem - make item selectable |
- | disableItem - make item non-selectable |
- | isItemDisabled - return true is item non-selectable |
- | |
- | addItem - add an IMenuItem as the last item in a Menu |
- | addSeparator - add a separator as the last item in a Menu |
- | deleteItem - remove specified item from a Menu |
- | |
- | menuItem - return a IMenuItem* to the specified item |
- | handle - return the IWindowHandle of the Menu |
- | id - return the resource id of the Menu |
- | |
- ---------------------------------------------------------------------*/
-
- virtual void checkItem(unsigned long itemId);
- virtual void uncheckItem(unsigned long itemId);
- Boolean isItemChecked(unsigned long itemId) const;
-
- virtual void enableItem(unsigned long itemId);
- virtual void disableItem(unsigned long itemId);
- Boolean isItemDisabled(unsigned long itemId) const;
-
- // The addItem() and addSeparator() functions that do
- // not take the subMenuId parameter are used to addItems
- // to ActionBars, SystemMenus, or PopUps.
- // The functions that do take the subMenuId would be used
- // to delete items from a SubMenu. For example to delete
- // an item from a pull-down menu of an ActionBar.
-
- virtual void addItem(const IMenuItem& newItem);
- virtual void addItem(const IMenuItem& newItem,
- unsigned long subMenuId);
-
-
- virtual void addSeparator(unsigned long newItemId = 0);
- virtual void addSeparator(unsigned long newItemId,
- unsigned long subMenuId);
-
-
- virtual void deleteItem(unsigned long itemId);
-
-
- IMenuItem* menuItem(unsigned long itemId);
-
- const IWindowHandle& handle() const {return winClHandle;}
- const unsigned long id() const;
-
-
- protected:
-
- /*------------------ CONSTRUCTORS/DESTRUCTORS -------------------------
- | There is 1 way to construct instances of this class: |
- | IMenu(); |
- | |
- | This constructor is protected since it should only be called by |
- | derived classes. |
- | |
- ---------------------------------------------------------------------*/
-
- IMenu();
- virtual ~IMenu();
- void setHandle(IWindowHandle newHandle) {winClHandle = newHandle;}
-
-
- /*----------------------- PRIVATE -----------------------------------*/
- private:
-
- IWindowHandle winClHandle;
- IMenu(const IMenu&);
- IMenu &operator=(const IMenu&);
-
- IWindowHandle subMenuHandle(unsigned long subMenuId) const;
-
-
- };
- #endif /* _IMENU_ */