home *** CD-ROM | disk | FTP | other *** search
- #ifndef _ISUBMENU_
- #define _ISUBMENU_
- /**************************************************************/
- /* FILE NAME: isubmenu.hpp */
- /* */
- /* DESCRIPTION: */
- /* Declaration of the class: */
- /* ISubMenu - this is a wrapper for any menu. */
- /* It can be used to make temporary changes */
- /* to the menu that will be undone when */
- /* the menu is no longer visible. */
- /* */
- /* 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/ISUBMENU.HPV $ */
- //
- // Rev 1.5 26 Oct 1992 10:07:22 HARPERSP
- // Updates for documentation.
- //
- // Rev 1.2 08 Oct 1992 09:25:26 HARPERSP
- // First update using $Log$
- // Had to re-PUT because comment prefix was wrong.
- /* */
- /**************************************************************/
-
- #ifndef _IMENU_
- #include <imenu.hpp>
- #endif
-
- #include <iqueseq.h>
- #include <iqueue.h>
-
- // Forward declarations for other classes
- class ISubMenu;
-
- // IRestoreItem is
- // used for keeping a collection of changes made
- // to the menu.
- // It's declared in isubmenu.cpp.
- class IRestoreItem;
-
- class IWindowHandle;
- class IMenuItem;
-
- typedef IQueue<IRestoreItem*> RefreshQueueType;
-
- class ISubMenu : public IMenu
- {
-
- /**********************************************************************
- * The IMenuHandler creates a ISubMenu wrapper whenever a menu is *
- * about to be displayed. It then calls the menuShowing() callback *
- * passing a pointer to the ISubMenu object. *
- * Within the menuShowing() callback you can use ISubMenu member *
- * functions to alter the menu. *
- * These changes are automatically undone by the IMenuHandler once *
- * the menu is no longer visible. *
- * *
- * Example: *
- * *
- * void MyHandler :: menuShowing(const IMenuEvent& mnEvt, *
- * ISubMenu* psmnAboutToShow) *
- * { *
- * *
- * switch (psmnAboutToShow->id()) { *
- * *
- * case ID_MENU1: *
- * psmnAboutToShow->addSeparator(); *
- * if (defaultABMActive()) { *
- * psmnAboutToShow->addItem(mni_AltABM); *
- * psmnAboutToShow->disableItem(ID_TITLE_TEXT); *
- * } else { *
- * psmnAboutToShow->addItem(mni_DefABM); *
- * psmnAboutToShow->checkItem(ID_TITLE_TEXT); *
- * } *
- * *
- * ... *
- * *
- **********************************************************************/
-
- typedef IMenu inherited;
-
- public:
-
- /*------------------ CONSTRUCTORS/DESTRUCTORS -------------------------
- | There is 1 way to construct instances of this class: |
- | ISubMenu(IWindowHandle) |
- | |
- | You should not have to construct any instances of this class |
- | since the IMenuHandler::dipatchHandlerEvent() does this for you. |
- | |
- ---------------------------------------------------------------------*/
-
- ISubMenu(IWindowHandle subMenuHandle);
- ~ISubMenu();
-
- /*---------------------- OVERRIDES ------------------------------------
- | The following IMenu member functions are overridden. |
- | In each of its overriden versions of these functions |
- | ISubMenu actually calls each of the IMenu versions of the functions |
- | to cause the menu to change, then it stores information about |
- | how the menu was changed so that it can be undone. |
- | |
- | checkItem |
- | uncheckItem |
- | enableItem |
- | disableItem |
- | addItem |
- | addSeparator |
- | deleteItem |
- | |
- ---------------------------------------------------------------------*/
-
- virtual void checkItem(unsigned long itemId);
- virtual void uncheckItem(unsigned long itemId);
-
- virtual void enableItem(unsigned long itemId);
- virtual void disableItem(unsigned long itemId);
-
- virtual void addItem(const IMenuItem& mniNewItem);
-
- virtual void addSeparator(unsigned long newItemId = 0);
-
- virtual void deleteItem(unsigned long itemId);
-
- /*---------------------- ACCESSORS ------------------------------------
- | refresh - called by IMenuHandler::dispatchHandlerEvent() to |
- | undo all the changes made to the ISubMenu. |
- | You should not need to ever call refresh(). |
- ---------------------------------------------------------------------*/
-
- void refresh();
-
- /*----------------------- PRIVATE -----------------------------------*/
- private:
-
- // addItem and addSeparator are not applicable
- // to ISubMenu since the subMenuId is not needed.
- // These functions are declared here but not defined.
- virtual void addItem(const IMenuItem& newItem,
- unsigned long subMenuId) {;}
- virtual void addSeparator(unsigned long newItemId,
- unsigned long subMenuId) {;}
-
- ISubMenu(const IMenu&);
- ISubMenu &operator=(const IMenu&);
-
- RefreshQueueType* pRefreshQueue;
-
- RefreshQueueType* getQueue();
- void refreshItem(IRestoreItem*);
-
- };
-
- #endif