home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IFOCSHDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
9KB
|
141 lines
#ifndef _IFOCSHDR_
#define _IFOCSHDR_
/*******************************************************************************
* FILE NAME: ifocshdr.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IFocusHandler - Process a focus 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 IFocusHandler : public IHandler {
typedef IHandler
Inherited;
/*******************************************************************************
* The IFocusHandler class handles the processing of focus change events for *
* the following controls: *
* *
* - IContainerControl *
* - IEntryField *
* - IListBox *
* - IMultiLineEdit *
* - IProgressIndicator *
* - ISlider *
* - ISpinButton *
* *
* The IFocusHandler class is designed to handle events that occur when a *
* control gains or loses the input focus, such as when the user tabs to or *
* from an entry field. The IFocusHandler object should be attached to the *
* control that will be getting or losing the input focus, or to the owner *
* window of the control. You can do this by passing the control or owner *
* window on the handleEventsFor function of the IFocusHandler object. *
* *
* When it receives a focus change event, the IFocusHandler object constructs *
* an IControlEvent object and routes it to the appropriate virtual function. *
* These virtual functions allow you to supply your own specialized processing *
* of the event. The return values from the virtual functions specify 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 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 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 window's *
* defaultProcedure function. (See IWindow::defaultProcedure.) *
* *
* Example: *
* MyWindow::MyWindow() // inherits from IFrame, IFocusHandler *
* : ... *
* { *
* ((IFocusHandler*)this)->handleEventsFor(this); *
* ... *
* IEntryField* ef = new IEntryField(ID_EF, this, this, IRectangle(...)); *
* IStaticText* stxtHelp = new IStaticText(ID_STXTHELP, this, this, *
* IRectangle(...)); *
* ... *
* show(); *
* } *
* Boolean MyWindow::gotFocus(IControlEvent& evt) *
* { // provide quick help for current owned control *
* if (evt.controlId() == ID_EF) *
* { // entry field gaining focus *
* stxtHelp->setText("Please give your full name."); *
* } *
* ... *
* else *
* { // some other control *
* stxtHelp->setText(" "); // no help for this one *
* } *
* ... *
* 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. |
| ----------------------------------------------------------------------------*/
IFocusHandler ( );
virtual
~IFocusHandler ( );
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 gotFocus or lostFocus function, as |
| appropriate. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent ( IEvent& event );
/*----------------------------- Event Processing -------------------------------
| These functions should be supplied by a derived class to process a focus |
| change event. |
| gotFocus - Implemented by derived classes to process a focus gain event. |
| lostFocus - Implemented by derived classes to process a focus loss event. |
------------------------------------------------------------------------------*/
virtual Boolean
gotFocus ( IControlEvent& event ),
lostFocus ( IControlEvent& event );
}; // IFocusHandler
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IFOCSHDR_ */