home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / iselhdr.hp_ / ISELHDR.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  7.7 KB  |  122 lines

  1. #ifndef _ISELHDR_
  2.   #define _ISELHDR_
  3. /*******************************************************************************
  4. * FILE NAME: iselhdr.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     ISelectHandler - Process a selection event for a control.                *
  9. *                                                                              *
  10. *                                                                              *
  11. * COPYRIGHT:                                                                   *
  12. *   Licensed Materials - Property of IBM                                       *
  13. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  14. *   All Rights Reserved                                                        *
  15. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. *$Log:   R:/IBMCLASS/IBASEAPP/VCS/ISELHDR.HPV  $                                                                         *
  19. // 
  20. //    Rev 1.24   25 Oct 1992 16:57:38   nunn
  21. // changed library name to ICLUI
  22. // 
  23. //    Rev 1.23   25 Oct 1992 14:43:26   tsuji
  24. // Update class description.
  25. //
  26. //    Rev 1.22   24 Oct 1992 17:14:26   tsuji
  27. // Format/document in the style of the standard header file.
  28. *******************************************************************************/
  29. #ifndef _IHANDLER_
  30.   #include <ihandler.hpp>
  31. #endif
  32.  
  33. // Forward declarations for other classes:
  34. class ISelectHandler;  /* selh */
  35. class IControlEvent;
  36. class IEvent;
  37.  
  38. class ISelectHandler : public IHandler {
  39. /*******************************************************************************
  40. * This class handles processing of item selection events (which includes       *
  41. * select/deselect, Enter key press, and double-click) for the following        *
  42. * controls: I3StateCheckBox, ICheckBox, IComboBox, IContainerControl,          *
  43. * IListBox, and IRadioButton.                                                  *
  44. *                                                                              *
  45. * The ISelectHandler class is designed to handle events resulting from a       *
  46. * selection/enter action on a control (for example, when the user clicks or    *
  47. * double-clicks a radio button).  If registered to the appropriate window (by  *
  48. * being passed on the addHandler() function of the control or the owner window *
  49. * of the control), the ISelectHandler object will be called to process the     *
  50. * selection/enter event.  It does this by creating an IControlEvent object and *
  51. * routing it to the appropriate virtual function (these virtual functions      *
  52. * allow you to supply your own specialized processing of the event).  The      *
  53. * return value from the virtual functions specifies if the IControlEvent       *
  54. * should be passed on to another handler object to be processed, as described  *
  55. * below:                                                                       *
  56. *                                                                              *
  57. *   Value  Meaning                                                             *
  58. *   ------ --------                                                            *
  59. *   true   The IControlEvent has been handled and requires no additional       *
  60. *          processing.                                                         *
  61. *   false  The IControlEvent should be passed to the next handler (if this is  *
  62. *          the last handler for the control it should be passed on the first   *
  63. *          handler of the owner for the control, and if the last handler for   *
  64. *          the owner window it should be passed on the default window          *
  65. *          procedure).                                                         *
  66. *                                                                              *
  67. * EXAMPLE:                                                                     *
  68. *   MyWindow::MyWindow()                                                       *
  69. *     : ...                                                                    *
  70. *   {                                                                          *
  71. *     MyRadioSelectHandler* selh = new MyRadioSelectHandler();                 *
  72. *     ...                                                                      *
  73. *     IRadioButton* rb1 = new IRadioButton(ID_RB1, this, this,                 *
  74. *                                          IRectangle(...));                   *
  75. *     IRadioButton* rb2 = new IRadioButton(ID_RB2, this, this,                 *
  76. *                                          IRectangle(...));                   *
  77. *     IRadioButton* rb3 = new IRadioButton(ID_RB3, this, this,                 *
  78. *                                          IRectangle(...));                   *
  79. *     rb1->addHandler(selh);                                                   *
  80. *     rb2->addHandler(selh);                                                   *
  81. *     rb3->addHandler(selh);                                                   *
  82. *     ...                                                                      *
  83. *     show();                                                                  *
  84. *   }                                                                          *
  85. *   Boolean  MyRadioSelectHandler::select(IControlEvent& evt)                  *
  86. *   {                                                                          *
  87. *     Boolean bProcessed = false;                                              *
  88. *     ulButtonId = evt.controlId();  // remember selected button               *
  89. *     return bProcessed;       // let another handle event also                *
  90. *   }                                                                          *
  91. *******************************************************************************/
  92. typedef IHandler Inherited;
  93. public:
  94. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  95. | There is 1 way to construct instances of this class:                         |
  96. |   1. default constructor                                                     |
  97. ------------------------------------------------------------------------------*/
  98.   ISelectHandler ( ) {;}
  99.  
  100. /*----------------------- EVENT DISPATCHING INTERFACE --------------------------
  101. | This function evaluates the event to determine if it is one appropriate for  |
  102. | this handler object to process.  If so it calls a virtual function used to   |
  103. | process the event.                                                           |
  104. |   dispatchHandlerEvent - invokes the select or enter function if appropriate |
  105. ------------------------------------------------------------------------------*/
  106. Boolean
  107.   dispatchHandlerEvent ( IEvent& evt );
  108.  
  109. protected:
  110. /*------------------------ EVENT PROCESSING FUNCTIONS --------------------------
  111. | These functions should be supplied by a derived class in order to provide    |
  112. | processing for a selection or enter event.                                   |
  113. |   enter    - function used to process an enter event                         |
  114. |   selected - function used to process a selection event                      |
  115. ------------------------------------------------------------------------------*/
  116. virtual Boolean
  117.   enter    ( IControlEvent& evt ) { return false; }
  118. virtual Boolean
  119.   selected ( IControlEvent& evt ) { return false; }
  120. };
  121. #endif /* ISELHDR */
  122.