home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IMENUHDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
7KB
|
122 lines
#ifndef _IMENUHDR_
#define _IMENUHDR_
/******************************************************************************
* FILE NAME: imenuhdr.hpp *
* *
* DESCRIPTION: *
* Declaration of the class: *
* IMenu - Handles menu events, except menu command. *
* *
* 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. *
* *
*******************************************************************************/
#ifndef _IHANDLER_
#include <ihandler.hpp>
#endif
#ifndef _IMENUEVT_
#include <imenuevt.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
// Forward declarations for other classes
class ISubmenu;
class IMenuHandler : public IHandler {
typedef IHandler
Inherited;
/*******************************************************************************
* The IMenuHandler class is used to process the following menu events: *
* - Display pop-up menu. *
* - Alter a submenu menu item before it is shown. *
* - Perform processing when a menu item is selected. *
* - Perform processing when a submenu terminates. *
* *
* The application must override the virtual functions to respond to the event. *
* *
* NOTE: Menu command events are handled by the ICommandHandler class. *
*******************************************************************************/
public:
/*------------------ Constructor/Destructor ------------------------------------
| The only way to construct instances of this class is with the default |
| constructor. |
------------------------------------------------------------------------------*/
IMenuHandler();
~IMenuHandler();
protected:
/*---------------------------- Event Dispatching -------------------------------
| This function evaluates the event to determine if it is appropriate for |
| this handler object to process. If it is, this function calls the virtual |
| function used to process the event. |
| dispatchHandlerEvent - Calls the appropriate virtual function or |
| functions to process a menu event. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent(IEvent& event);
/*-------------------- Event Handling Virtual Functions ------------------------
| The following functions are dispatched to instances of this handler class: |
| |
| makePopUpMenu - Called when a context or pop-up menu is requested for the |
| object to which the handler applies. |
| |
| You can override this function to create and show a pop-up |
| menu by using the IPopUpMenu class. Code your override |
| function to return true if your program constructs an |
| IPopUpMenu; otherwise, code it to return false. The |
| pop-up menu terminates when the menuEnded function is |
| called. If, at this point, you want the library to delete |
| your IPopUpMenu instance, call the |
| IWindow::setAutoDeleteObject function. This requires you |
| to create the IPopUpMenu with the operator new. |
| |
| menuShowing - Called before a submenu, such as a pull-down, cascading |
| menu or pop-up menu, is shown. |
| |
| An instance of the ISubmenu class is provided to allow you |
| to alter the menu items temporarily. If true is returned |
| on this function, any change to the ISubmenu will be |
| undone when menuEnded is called to terminate the menu. |
| |
| menuSelected - Called when a menu item is selected. |
| |
| menuEnded - Called when a submenu, such as a pull-down, cascading menu |
| or pop-up menu, terminates. |
| |
------------------------------------------------------------------------------*/
virtual Boolean
makePopUpMenu ( IMenuEvent& menuEvent ),
menuShowing ( IMenuEvent& menuEvent,
ISubmenu& submenuAboutToShow ),
menuSelected ( IMenuEvent& menuEvent ),
menuEnded ( IMenuEvent& menuEvent );
/*-------------------- Show/Hide Source Emphasis--------------------------------
| The following functions provide a means to override the default |
| implementation of pop-up menu visual clue drawing. |
| |
| addSourceEmphasis - Invokes the IWindow::showSourceEmphasis function. |
| removeSourceEmphasis - Invokes the IWindow::hideSourceEmphasis function. |
------------------------------------------------------------------------------*/
virtual void
addSourceEmphasis( const IMenuEvent& menuEvent ),
removeSourceEmphasis( const IMenuEvent& menuEvent );
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* IMENUHDR */