home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ISPINHDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
8KB
|
130 lines
#ifndef _ISPINHDR_
#define _ISPINHDR_
/*******************************************************************************
* FILE NAME: ispinhdr.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* ISpinHandler - Process a spin event for a spin button. *
* *
* 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. *
* *
*******************************************************************************/
#ifndef _IHANDLER_
#include <ihandler.hpp>
#endif
#ifndef _ICTLEVT_
#include <ictlevt.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
// Forward declarations for other classes:
class IEvent;
class ISpinHandler : public IHandler {
typedef IHandler
Inherited;
/*******************************************************************************
* The ISpinHandler class handles the processing of spin events for *
* ISpinButton objects. It is designed to handle events that result from a *
* user interacting with a spin button control, such as when the user clicks *
* on the down arrow in a spin button. *
* *
* An ISpinHandler should be attached to the spin button that generated the *
* spin event or to the owner window of the spin button. This is done by *
* passing the spin button or owner window on the handleEventsFor function of *
* the ISpinHandler object. *
* *
* When it receives a spin event, the ISpinHandler object processes the event *
* by creating an IControlEvent object and routing it to the appropriate *
* virtual function. You can override these virtual functions to supply your *
* own specialized processing of the event. The return value from the virtual *
* function specifies whether the IControlEvent should be passed on for *
* additional processing, as follows: *
* *
* Value Meaning *
* --------------- *
* true - The IControlEvent requires no additional processing and should *
* not be passed to another handler. *
* false - The IControlEvent should be passed on for additional processing, *
* as follows: *
* -- If there is a next handler for the spin button or owner *
* window, the event is passed on to the next handler. *
* -- If this is the last handler for the spin button, the event is *
* dispatched to the owner window of the spin button *
* (see IWindow::dispatch). *
* -- If this is the last handler for the owner window, the event is *
* passed on a call to the owner window's defaultProcedure *
* function (see IWindow::defaultProcedure). *
* *
* Example: *
* MyWindow::MyWindow() *
* : ... *
* { *
* MySpinHandler* spnh = new MySpinHandler(); *
* ... *
* ISpinButton* spb = new ISpinButton(ID_SB, this, this, IRectangle(...)); *
* spnh->handleEventsFor(spb); *
* ... *
* show(); *
* } *
* Boolean MySpinHandler::spinEnded(IControlEvent& evt) *
* { *
* // do some processing *
* ... *
* return false; // let another handle event also *
* } *
*******************************************************************************/
public:
/*-------------------------- Constructor/Destructor ----------------------------
| The only way to construct instances of this class is to use the default |
| constructor, which does not take any arguments. |
------------------------------------------------------------------------------*/
ISpinHandler ( );
virtual
~ISpinHandler ( );
protected:
/*---------------------------- Event Dispatching -------------------------------
| This function evaluates the event to determine if it is appropriate for
| this handler object to process. If it is, it calls the virtual function
| used to process the event. |
| dispatchHandlerEvent - Calls the appropriate virtual function to process |
| a spin event. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent ( IEvent& event );
/*----------------------------- Event Processing -------------------------------
| These functions must be supplied by a derived class to process a spin event. |
| arrowUp - Implemented by derived classes to process the pressing of the |
| up arrow key or clicking on the up arrow of the spin button. |
| arrowDown - Implemented by derived classes to process the pressing of the |
| down arrow key or clicking on the down arrow of the spin |
| button. |
| spinEnded - Implemented by derived classes to process the release of an |
| arrow key or the mouse button while spinning the spin button. |
------------------------------------------------------------------------------*/
virtual Boolean
arrowUp ( IControlEvent& event ),
arrowDown ( IControlEvent& event ),
spinEnded ( IControlEvent& event );
}; // ISpinHandler
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _ISPINHDR_ */