home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / ISLHDR.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  8KB  |  123 lines

  1. #ifndef _ISLHDR_
  2.   #define _ISLHDR_
  3. /*******************************************************************************
  4. * FILE NAME: islhdr.hpp                                                        *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IShowListHandler - Process a show list event for a combo box.            *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18. #ifndef _IHANDLER_
  19.   #include <ihandler.hpp>
  20. #endif
  21. #ifndef _ICTLEVT_
  22.   #include <ictlevt.hpp>
  23. #endif
  24.  
  25. /*----------------------------------------------------------------------------*/
  26. /* Align classes on four byte boundary.                                       */
  27. /*----------------------------------------------------------------------------*/
  28. #pragma pack(4)
  29.  
  30. // Forward declarations for other classes:
  31. class IEvent;
  32.  
  33.  
  34. class IShowListHandler : public IHandler {
  35. typedef IHandler
  36.   Inherited;
  37. /*******************************************************************************
  38. * The IShowListHandler class handles the processing of show list events for    *
  39. * the IComboBox control.  For example, a show list event occurs when the user  *
  40. * clicks on the drop-down button of the combination box.                       *
  41. *                                                                              *
  42. * An IShowListHandler object should be attached to the combination box that    *
  43. * generated the show list event or to the owner window of the combination box. *
  44. * This is done by passing the combination box or the owner window on the       *
  45. * handleEventsFor function of the IShowListHandler object.                     *
  46. *                                                                              *
  47. * When it receives a show list event, the IShowListHandler object processes    *
  48. * the event by creating an IControlEvent object and routing it to the          *
  49. * listShown virtual function.  You can override this virtual function to       *
  50. * supply your own specialized processing of the event.  The return value from  *
  51. * the listShown function specifies whether the IControlEvent should be passed  *
  52. * on for additional processing, as follows:                                    *
  53. *                                                                              *
  54. *   Value   Meaning                                                            *
  55. *   ---------------                                                            *
  56. *   true  - The IControlEvent object requires no additional processing and     *
  57. *           should not be passed to another handler.                           *
  58. *   false - The IControlEvent object should be passed on for additional        *
  59. *           processing, as follows:                                            *
  60. *           -- If there is a next handler for the control or window, the       *
  61. *              event is passed on to the next handler.                         *
  62. *           -- If this is the last handler for the control, the event is       *
  63. *              dispatched to the owner window of the control                   *
  64. *              (see IWindow::dispatch).                                        *
  65. *           -- If this is the last handler for the owner window, the event is  *
  66. *              passed on a call to the owner window's defaultProcedure         *
  67. *              function (see IWindow::defaultProcedure).                       *
  68. *                                                                              *
  69. * Example:                                                                     *
  70. *   MyWindow::MyWindow()                                                       *
  71. *     : ...                                                                    *
  72. *   {                                                                          *
  73. *     MyShowListHandler* slh = new MyShowListHandler();                        *
  74. *     ...                                                                      *
  75. *     IComboBox* cb = new IComboBox(ID_CB, this, this, IRectangle(...));       *
  76. *     slh->handleEventsFor(cb);                                                *
  77. *     ...                                                                      *
  78. *     show();                                                                  *
  79. *   }                                                                          *
  80. *   Boolean  MyShowListHandler::listShown(IControlEvent& evt)                  *
  81. *   {                                                                          *
  82. *     IComboBox* cb = (IComboBox*)ctlevt.controlWindow();                      *
  83. *     // add entries to the list box about to be displayed                     *
  84. *     ...                                                                      *
  85. *     return true;             // event processed                              *
  86. *   }                                                                          *
  87. *******************************************************************************/
  88. public:
  89. /*-------------------------- Constructor/Destructor ----------------------------
  90. | The only way to construct instances of this class is to use the default      |
  91. | constructor, which takes no arguments.                                       |
  92. ------------------------------------------------------------------------------*/
  93.   IShowListHandler     ( );
  94. virtual
  95.  ~IShowListHandler     ( );
  96.  
  97. protected:
  98. /*---------------------------- Event Dispatching -------------------------------
  99. | This function evaluates the event to determine if it is appropriate for      |
  100. | this handler object to process.  If it is, this function calls the virtual   |
  101. | function used to process the event.                                          |
  102. |   dispatchHandlerEvent - Calls the listShown function if a show list event   |
  103. |                          is found.                                           |
  104. ------------------------------------------------------------------------------*/
  105. virtual Boolean
  106.   dispatchHandlerEvent ( IEvent& event );
  107.  
  108. /*----------------------------- Event Processing -------------------------------
  109. | This function must be supplied by a derived class to process a show list     |
  110. | event.                                                                       |
  111. |   listShown - Implemented by derived classes to process show list events.    |
  112. ------------------------------------------------------------------------------*/
  113. virtual Boolean
  114.   listShown            ( IControlEvent& event ) = 0;
  115. }; // IShowListHandler
  116.  
  117. /*----------------------------------------------------------------------------*/
  118. /* Resume compiler default packing.                                           */
  119. /*----------------------------------------------------------------------------*/
  120. #pragma pack()
  121.  
  122. #endif /* _ISLHDR_ */
  123.