home *** CD-ROM | disk | FTP | other *** search
- #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. *
- * *
- *$Log: S:/ibmclass/ibaseapp/vcs/ifocshdr.hpv $ *
- //
- // Rev 1.25 26 Oct 1992 01:51:54 tsuji
- // Edit of comments.
- //
- // Rev 1.24 25 Oct 1992 16:57:04 nunn
- // changed library name to ICLUI
- //
- // Rev 1.23 25 Oct 1992 14:43:24 tsuji
- // Update class description.
- //
- // Rev 1.22 24 Oct 1992 17:14:10 tsuji
- // Format/document in the style of the standard header file.
- *******************************************************************************/
- #ifndef _IHANDLER_
- #include <ihandler.hpp>
- #endif
-
- // Forward declarations for other classes:
- class IFocusHandler; /* fch */
- class IControlEvent;
- class IEvent;
-
-
- class IFocusHandler : public IHandler {
- /*******************************************************************************
- * This class handles processing of focus change events for the following *
- * controls: IContainerControl, IEntryField, IListBox, IMLE, *
- * IProgressIndicator, ISlider, and ISpinButton. *
- * *
- * The IFocusHandler class is designed to handle events resulting from a *
- * control's gaining or losing the input focus (for example, when the user tabs *
- * to/from an entry field). If registered to the appropriate window (by being *
- * passed on the addHandler() function of the control or the owner window of *
- * the control), the IFocusHandler object will be called to process the focus *
- * change event. It does this by creating an IControlEvent object and routing *
- * it to the appropriate virtual function (these virtual functions allow you to *
- * supply your own specialized processing of the event). The return value from *
- * the virtual functions specifies if the IControlEvent should be passed on to *
- * another handler object to be processed, as described below: *
- * *
- * Value Meaning *
- * ------ -------- *
- * true The IControlEvent has been handled and requires no additional *
- * processing. *
- * false The IControlEvent should be passed to the next handler (if this is *
- * the last handler for the control it should be passed on to the *
- * first handler of the owner for the control, and if the last handler *
- * for the owner window it should be passed on to the default window *
- * procedure). *
- * *
- * EXAMPLE: *
- * MyWindow::MyWindow() // inherits from IFrame, IFocusHandler *
- * : ... *
- * { *
- * addHandler((IHandler*)this); *
- * ... *
- * IEntryField* ef = new IEntryField(ID_EF, this, this, IRectangle(...)); *
- * IStaticText* stxtHelp = new IStaticText(0, 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 *
- * } *
- *******************************************************************************/
- typedef IHandler Inherited;
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There is 1 way to construct instances of this class: |
- | 1. default constructor |
- ------------------------------------------------------------------------------*/
- IFocusHandler ( ) {;}
-
- /*----------------------- EVENT DISPATCHING INTERFACE --------------------------
- | This function evaluates the event to determine if it is one appropriate for |
- | this handler object to process. If so it calls a virtual function used to |
- | process the event. |
- | dispatchHandlerEvent - invokes gotFocus or lostFocus as appropriate |
- ------------------------------------------------------------------------------*/
- Boolean
- dispatchHandlerEvent ( IEvent& evt );
-
- protected:
- /*------------------------ EVENT PROCESSING FUNCTIONS --------------------------
- | These functions should be supplied by a derived class in order to provide |
- | processing for a selection or enter event. |
- | gotFocus - function used to process a focus gain event |
- | lostFocus - function used to process a focus loss event |
- ------------------------------------------------------------------------------*/
- virtual Boolean
- gotFocus ( IControlEvent& evt ) { return false; }
- virtual Boolean
- lostFocus ( IControlEvent& evt ) { return false; }
- };
- #endif /* IFOCSHDR */