home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IEDITHDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
9KB
|
139 lines
#ifndef _IEDITHDR_
#define _IEDITHDR_
/*******************************************************************************
* FILE NAME: iedithdr.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IEditHandler - Process an input change event for a control. *
* *
* 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 IEditHandler : public IHandler {
typedef IHandler
Inherited;
/*******************************************************************************
* The IEditHandler class handles the processing of input change events for *
* the following controls: *
* - IComboBox *
* - IEntryField *
* - IMultiLineEdit *
* - IProgressIndicator *
* - ISlider *
* - ISpinButton *
* *
* The IEditHandler class is designed to handle events that result from a user *
* changing a control's input value, such as changing the value of an entry *
* field or moving the arm of a slider. *
* *
* An IEditHandler object should be attached to the control whose input will be *
* changed, or to the owner window of the control. You can do this by passing *
* the control window or owner window on the handleEventsFor function of the *
* IEditHandler object. *
* *
* When it receives an input change event, the IEditHandler object creates an *
* IControlEvent object and routes it to the appropriate virtual function. You *
* can override the virtual functions of IEditHandler to supply your own *
* specialized processing of an event. The return value from the virtual *
* functions specifies whether the IControlEvent should be passed on for *
* additional processing, as follows: *
* *
* Value Meaning *
* --------------- *
* true - The IControlEvent requires no additional processing. *
* false - The IControlEvent should be passed to the next handler for *
* additional processing, as follows: *
* -- If there is another handler for the control or window, the *
* IControlEvent is passed on to the next handler. *
* -- If this is the last handler for the control, the *
* IControlEvent is dispatched to the owner window of the control. *
* (See IWindow::dispatch.) *
* -- If this is the last handler for the owner window, the *
* IControlEvent is passed on a call to the owner's *
* defaultProcedure function. (See IWindow::defaultProcedure.) *
* *
* Example: *
* MyWindow::MyWindow() *
* : ... *
* { *
* MyReqEntryEditHandler* edh = new MyReqEntryEditHandler(); *
* ... *
* IEntryField* ef = new IEntryField(ID_EF, this, this, IRectangle(...)); *
* edh->handleEventsFor(ef); *
* ... *
* show(); *
* } *
* Boolean MyReqEntryEditHandler::edit(IControlEvent& ctlevt) *
* { *
* IEntryField* ef = (IEntryField*)ctlevt.controlWindow(); *
* IString str = ef->text(); *
* if (str.strip().length() == 0) *
* { // required value missing *
* // disable Enter pushbutton *
* } *
* else *
* { // required value specified *
* // enable Enter pushbutton *
* } *
* ... *
* return false; // let another handle event also *
* } *
*******************************************************************************/
public:
/*-------------------------- Constructor/Destructor ----------------------------
| This class only provides a default constructor, which does not take any |
| arguments. |
------------------------------------------------------------------------------*/
IEditHandler ( );
virtual
~IEditHandler ( );
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 edit function if an input change event |
| is found. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent ( IEvent& event );
/*----------------------------- Event Processing -------------------------------
| This function must be supplied by a derived class to process an input change |
| event. |
| edit - Implemented by the derived classes to process input change events. |
------------------------------------------------------------------------------*/
virtual Boolean
edit ( IControlEvent& event ) = 0;
}; // IEditHandler
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IEDITHDR_ */