home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / islhdr.hp_ / ISLHDR.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  6.9 KB  |  111 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 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/ISLHDR.HPV  $                                                                         *
  19. // 
  20. //    Rev 1.24   25 Oct 1992 16:57:42   nunn
  21. // changed library name to ICLUI
  22. // 
  23. //    Rev 1.23   25 Oct 1992 14:43:28   tsuji
  24. // Update class description.
  25. //
  26. //    Rev 1.22   24 Oct 1992 17:14:32   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 IShowListHandler;  /* slh */
  35. class IControlEvent;
  36. class IEvent;
  37.  
  38. class IShowListHandler : public IHandler {
  39. /*******************************************************************************
  40. * This class handles processing of show list events for the following          *
  41. * controls: IComboBox.                                                         *
  42. *                                                                              *
  43. * The IShowListHandler class is designed to handle events resulting from a     *
  44. * list box being displayed by an IComboBox object (for example, when the user  *
  45. * clicks the drop-down button of the combo box).  If registered to the         *
  46. * appropriate window (by being passed on the addHandler() function of the      *
  47. * control or the owner window of the control), the IShowListHandler object     *
  48. * will be called to process the show list event.  It does this by creating an  *
  49. * IControlEvent object and routing it to the virtual listShown() fucntion      *
  50. * (this virtual function allows you to supply your own specialized process of  *
  51. * the event).  The return value from the virtual function specifies if the     *
  52. * IControlEvent should be passed on to another handler object to be processed, *
  53. * as described below:                                                          *
  54. *                                                                              *
  55. *   Value  Meaning                                                             *
  56. *   ------ --------                                                            *
  57. *   true   The IControlEvent has been handled and requires no additional       *
  58. *          processing.                                                         *
  59. *   false  The IControlEvent should be passed to the next handler (if this is  *
  60. *          the last handler for the control it should be passed on the first   *
  61. *          handler of the owner for the control, and if the last handler for   *
  62. *          the owner window it should be passed on the default window          *
  63. *          procedure).                                                         *
  64. *                                                                              *
  65. * EXAMPLE:                                                                     *
  66. *   MyWindow::MyWindow()                                                       *
  67. *     : ...                                                                    *
  68. *   {                                                                          *
  69. *     MyShowListHandler* slh = new MyShowListHandler();                        *
  70. *     ...                                                                      *
  71. *     IComboBox* cb = new IComboBox(ID_CB, this, this, IRectangle(...));       *
  72. *     cb->addHandler(slh);                                                     *
  73. *     ...                                                                      *
  74. *     show();                                                                  *
  75. *   }                                                                          *
  76. *   Boolean  MyShowListHandler::listShown(IControlEvent& evt)                  *
  77. *   {                                                                          *
  78. *     IComboBox* cb = (IComboBox*)ctlevt.controlWindow();                      *
  79. *     // add entries to the list box about to be displayed                     *
  80. *     ...                                                                      *
  81. *     return true;             // event processed                              *
  82. *   }                                                                          *
  83. *******************************************************************************/
  84. typedef IHandler Inherited;
  85. public:
  86. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  87. | There is 1 way to construct instances of this class:                         |
  88. |   1. default constructor                                                     |
  89. ------------------------------------------------------------------------------*/
  90.   IShowListHandler ( ) {;}
  91.  
  92. /*----------------------- EVENT DISPATCHING INTERFACE --------------------------
  93. | This function evaluates the event to determine if it is one appropriate for  |
  94. | this handler object to process.  If so it calls the virtual function used to |
  95. | process the event.                                                           |
  96. |   dispatchHandlerEvent - invokes the listShown function if show list event   |
  97. ------------------------------------------------------------------------------*/
  98. Boolean
  99.   dispatchHandlerEvent ( IEvent& evt );
  100.  
  101. protected:
  102. /*------------------------ EVENT PROCESSING FUNCTIONS --------------------------
  103. | This function must be supplied by a derived class in order to provide        |
  104. | processing for a show list event.                                            |
  105. |   listShown - function used to process the show list event                   |
  106. ------------------------------------------------------------------------------*/
  107. virtual Boolean
  108.   listShown ( IControlEvent& evt ) = 0;
  109. };
  110. #endif /* ISLHDR */
  111.