home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IMNDIHDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
8KB
|
127 lines
#ifndef _IMNDIHDR_
#define _IMNDIHDR_
/*******************************************************************************
* FILE NAME: imndihdr.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IMenuDrawItemHandler - The draw item menu event handler class *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
// Forward declarations for other classes:
class IKeyboardHandler;
#ifndef _IHANDLER_
#include <ihandler.hpp>
#endif
#ifndef _IMNDIEVT_
#include <imndievt.hpp>
#endif
#ifndef _IBITFLAG_
#include <ibitflag.hpp>
#endif
#ifndef _IPOINT_
#include <ipoint.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IMenuDrawItemHandler : public IHandler {
typedef IHandler Inherited;
/*******************************************************************************
* The IMenuDrawItemHandler class is used to process the draw item menu events. *
* *
* The menu item must be created with the IMenuItem constructor that creates *
* a draw item. You can also call IMenuItem::setDrawItem after the item has *
* been created. *
*******************************************************************************/
public:
/*------------------------ Constructor -----------------------------------------
| The only way to construct instances of this class is by using the default |
| constructor. |
------------------------------------------------------------------------------*/
IMenuDrawItemHandler();
protected:
/*-------------------------------- DrawFlag ------------------------------------
| This flag is set in the overridden draw function to indicate the actions |
| that were taken. |
| |
| DrawFlag - Nested class that provides static members that define the set |
| of valid actions taken within a draw function. An instance of |
| a DrawFlag is passed as the second argument to an overridden |
| IMenuDrawItemHandler::draw function. The overridden function |
| sets the appropriate DrawFlag flags to indicate whether it |
| handled any of the special drawing needs of the menu item. |
| |
| The declaration of the IMenuDrawItemHandler::DrawFlag nested |
| class is generated by the INESTEDBITFLAGCLASSDEF0 macro. |
| |
| The valid menu owner-draw flags are: |
| |
| drewChecked - The menu item's check mark is drawn. |
| drewDisabled - The menu item's disabled state is drawn. |
| drewSelected - The highlighting of the menu item is drawn. |
------------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF0(DrawFlag, IMenuDrawItemHandler);
static const DrawFlag
drewChecked,
drewDisabled,
drewSelected;
/*------------------------- Override Functions ---------------------------------
| This class overrides the following inherited function: |
| dispatchHandlerEvent - Dispatches command functions for this handler. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent(IEvent& evt);
/*------------------------- Event Handling Functions ---------------------------
| These event handling functions are dispatched by this handler: |
| setSize - Override this function to set the width and height of each |
| draw item menu item. This event is dispatched only once for |
| each menu item, when the menu is initialized. Set the size |
| in the newSize argument. |
| draw - Override this function to draw the menu item. By default, |
| the system will draw a check mark, halftone the text for a |
| disabled menu item, and invert the bits to indicate menu |
| item selection. Unless the system default method is |
| unacceptable, you should not have to draw these attributes. |
| If you draw any of these attributes yourself, set the |
| appropriate DrawFlag before returning from the draw |
| function. This will prevent the system from drawing these |
| attributes. The IMenuDrawItemEvent class provides testing |
| functions to query whether the menu item is selected, |
| checked, or disabled. |
| highlight - Override this function if you want to draw the highlight |
| that indicates a menu item has been selected. You should do |
| this only if the system default of inverting the bits for a |
| selected item is unacceptable. |
| unhighlight - Override this function if you want to remove the highlight |
| that indicates a menu item has been de-selected. You should |
| do this only if the system default is unacceptable. |
|-----------------------------------------------------------------------------*/
virtual Boolean
setSize(ISize& newSize),
draw(IMenuDrawItemEvent& evt, DrawFlag& flag),
highlight(IMenuDrawItemEvent& evt),
unhighlight(IMenuDrawItemEvent& evt);
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IMNDIHDR_ */