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

  1. #ifndef _ISPINHDR_
  2.   #define _ISPINHDR_
  3. /*******************************************************************************
  4. * FILE NAME: ispinhdr.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     ISpinHandler - Process a spin 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/ISPINHDR.HPV  $                                                                         *
  19. // 
  20. //    Rev 1.23   25 Oct 1992 16:57:46   nunn
  21. // changed library name to ICLUI
  22. // 
  23. //    Rev 1.22   25 Oct 1992 14:25:16   tsuji
  24. // Format/document in the style of the standard header file.
  25. *******************************************************************************/
  26. #ifndef _IHANDLER_
  27.   #include <ihandler.hpp>
  28. #endif
  29.  
  30. // Forward declarations for other classes:
  31. class ISpinHandler;  /* spnh */
  32. class IControlEvent;
  33. class IEvent;
  34.  
  35. class ISpinHandler : public IHandler {
  36. /*******************************************************************************
  37. * This class handles processing of spin events for the following controls:     *
  38. * ISpinButton.                                                                 *
  39. *                                                                              *
  40. * The ISpinHandler class is designed to handle events resulting from a user    *
  41. * interacting with a spin button control (for example, when the user presses   *
  42. * the down arrow key in a spin button).  If registered to the appropriate      *
  43. * window (by being passed on the addHandler() function of the control or the   *
  44. * owner window of the control), the ISpinHandler object will be called to      *
  45. * process the spin event.  It does this by creating an IControlEvent object    *
  46. * and routing it to the appropriate virtual function (the virtual functions    *
  47. * allow you to supply your own specialized processing of the event).  The      *
  48. * return value from the virtual functions specifies if the IControlEvent       *
  49. * should be passed on to another handler object to be processed, as described  *
  50. * below:                                                                       *
  51. *                                                                              *
  52. *   Value  Meaning                                                             *
  53. *   ------ --------                                                            *
  54. *   true   The IControlEvent has been handled and requires no additional       *
  55. *          processing.                                                         *
  56. *   false  The IControlEvent should be passed to the next handler (if this is  *
  57. *          the last handler for the control it should be passed on the first   *
  58. *          handler of the owner for the control, and if the last handler for   *
  59. *          the owner window it should be passed on the default window          *
  60. *          procedure).                                                         *
  61. *                                                                              *
  62. * EXAMPLE:                                                                     *
  63. *   MyWindow::MyWindow()                                                       *
  64. *     : ...                                                                    *
  65. *   {                                                                          *
  66. *     MySpinHandler* spnh = new MySpinHandler();                               *
  67. *     ...                                                                      *
  68. *     ISpinButton* spb = new ISpinButton(ID_SB, this, this, IRectangle(...));  *
  69. *     spb->addHandler(spnh);                                                   *
  70. *     ...                                                                      *
  71. *     show();                                                                  *
  72. *   }                                                                          *
  73. *   Boolean  MySpinHandler::spinEnded(IControlEvent& evt)                      *
  74. *   {                                                                          *
  75. *     Boolean bProcessed = false;                                              *
  76. *     // do some processing                                                    *
  77. *     ...                                                                      *
  78. *     return bProcessed;                                                       *
  79. *   }                                                                          *
  80. *******************************************************************************/
  81. typedef IHandler Inherited;
  82. public:
  83. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  84. | There is 1 way to construct instances of this class:                         |
  85. |   1. default constructor                                                     |
  86. ------------------------------------------------------------------------------*/
  87.   ISpinHandler ( ) {;}
  88.  
  89. /*----------------------- EVENT DISPATCHING INTERFACE --------------------------
  90. | This function evaluates the event to determine if it is one appropriate for  |
  91. | this handler object to process.  If so it calls the virtual function used to |
  92. | process the event.                                                           |
  93. |   dispatchHandlerEvent - invokes the appropriate function if spin event      |
  94. ------------------------------------------------------------------------------*/
  95. Boolean
  96.   dispatchHandlerEvent ( IEvent& evt );
  97.  
  98. protected:
  99. /*------------------------ EVENT PROCESSING FUNCTIONS --------------------------
  100. | This function must be supplied by a derived class in order to provide        |
  101. | processing for an input change event.                                        |
  102. |   arrowUp   - function used to process pressing of the up arrow key or       |
  103. |               clicking the up arrow of the spin button                       |
  104. |   arrowDown - function used to process pressing of the down arrow key or     |
  105. |               clicking the down arrow of the spin button                     |
  106. |   spinEnded - function used to process the release of an arrow key or the    |
  107. |               mouse button while spinning the spin button                    |
  108. ------------------------------------------------------------------------------*/
  109. virtual Boolean
  110.   arrowUp   ( IControlEvent& evt ) { return false; }
  111. virtual Boolean
  112.   arrowDown ( IControlEvent& evt ) { return false; }
  113. virtual Boolean
  114.   spinEnded ( IControlEvent& evt ) { return false; }
  115. };
  116. #endif /* ISPINHDR */
  117.