home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ISELHDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
10KB
|
149 lines
#ifndef _ISELHDR_
#define _ISELHDR_
/*******************************************************************************
* FILE NAME: iselhdr.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* ISelectHandler - Process a selection 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 ISelectHandler : public IHandler {
typedef IHandler
Inherited;
/*******************************************************************************
* The ISelectHandler class handles the processing of item selection events, *
* including: *
* *
* - Select *
* - Deselect *
* - Pressing the Enter key *
* - Double-clicking a mouse button *
* *
* for the following controls: *
* *
* - I3StateCheckBox *
* - ICheckBox *
* - IComboBox *
* - IContainerControl *
* - IListBox *
* - IRadioButton *
* *
* The ISelectHandler class is designed to handle events that result from a *
* user interacting with a selectable item, such as clicking a radio button. *
* An ISelectHandler should be attached to the control that generated the *
* selection event, or to the owner window of the control. This is done by *
* passing the control window or owner window on the handleEventsFor function *
* of the ISelectHandler object. *
* *
* When it receives a selection event, the ISelectHandler object creates an *
* IControlEvent object and routes it to the appropriate virtual function. *
* You can override the virtual functions of ISelectHandler 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 object requires no additional processing and *
* should not be passed to another handler. *
* false - The IControlEvent object should be passed on for additional *
* processing, as follows: *
* -- If there is a next handler for the control or window, the *
* event is passed on to the next handler. *
* -- If this is the last handler for the control, the object is *
* dispatched to the owner of the control (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() *
* : ... *
* { *
* MyRadioSelectHandler* selh = new MyRadioSelectHandler(); *
* ... *
* IRadioButton* rb1 = new IRadioButton(ID_RB1, this, this, *
* IRectangle(...)); *
* IRadioButton* rb2 = new IRadioButton(ID_RB2, this, this, *
* IRectangle(...)); *
* IRadioButton* rb3 = new IRadioButton(ID_RB3, this, this, *
* IRectangle(...)); *
* selh->handleEventsFor(rb1); *
* selh->handleEventsFor(rb2); *
* selh->handleEventsFor(rb3); *
* ... *
* show(); *
* } *
* Boolean MyRadioSelectHandler::select(IControlEvent& evt) *
* { *
* ulButtonId = evt.controlId(); // remember selected button *
* return false; // let another handle event also *
* } *
*******************************************************************************/
public:
/*------------------------------- Constructor ----------------------------------
| The only way to construct instances of this class is to use the default |
| constructor, which does not take any arguments. |
------------------------------------------------------------------------------*/
ISelectHandler ( );
virtual
~ISelectHandler ( );
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 a virtual function used |
| to process the event. |
| dispatchHandlerEvent - Calls the appropriate virtual function to process |
| the event. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent ( IEvent& event );
/*------------------------ Event Processing Functions --------------------------
| These functions should be supplied by a derived class in order to provide |
| processing for a selection or enter event. |
| enter - Implemented by derived classes to process an enter event. |
| selected - Implemented by derived classes to process a selection event. |
------------------------------------------------------------------------------*/
virtual Boolean
enter ( IControlEvent& event ),
selected ( IControlEvent& event );
private: /*------------------------ PRIVATE ----------------------------------*/
IWindowHandle
control( const IControlEvent& event ) const;
}; // ISelectHandler
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _ISELHDR_ */