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

  1. #ifndef _ISCRLHDR_
  2.   #define _ISCRLHDR_
  3. /*******************************************************************************
  4. * FILE NAME: iscrlhdr.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IScrollHandler - Process scrolling events for an IScrollBar object.      *
  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/ISCRLHDR.HPV  $                                                                         *
  19. // 
  20. //    Rev 1.23   25 Oct 1992 16:57:34   nunn
  21. // changed library name to ICLUI
  22. // 
  23. //    Rev 1.22   25 Oct 1992 14:25:14   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 IScrollHandler;  /* scrlh */
  32. class IScrollEvent;
  33. class IEvent;
  34.  
  35. class IScrollHandler : public IHandler {
  36. /*******************************************************************************
  37. * This class handles processing of scroll events for the following controls:   *
  38. * IScrollBar.                                                                  *
  39. *                                                                              *
  40. * The IScrollHandler class is designed to handle events resulting from a user  *
  41. * interacting with an IScrollBar object (for example, when the user clicks the *
  42. * down arrow of a scroll bar).  If registered to the owner of the scroll bar   *
  43. * (by being passed on the addHandler() function of the owner window), the      *
  44. * IScrollHandler object will be called to process the scroll event.  It does   *
  45. * this by creating an IScrollEvent object and routing it to the appropriate    *
  46. * virtual function (the virtual functions allow you to supply your own         *
  47. * specialized processing of the event).  The return value from the virtual     *
  48. * functions specifies if the IScrollEvent should be passed on to another       *
  49. * handler object to be processed, as described below:                          *
  50. *                                                                              *
  51. *   Value  Meaning                                                             *
  52. *   ------ --------                                                            *
  53. *   true   The IScrollEvent has been handled and requires no additional        *
  54. *          processing.                                                         *
  55. *   false  The IScrollEvent should be passed to the next handler (if this is   *
  56. *          the last handler for the owner window, it should be passed on to    *
  57. *          the default window procedure).                                      *
  58. *                                                                              *
  59. * EXAMPLE:                                                                     *
  60. *   MyWindow::MyWindow()   // inherits from IFrame, IScrollHandler             *
  61. *     : ...                                                                    *
  62. *   {                                                                          *
  63. *     addHandler((IHandler*)this);                                             *
  64. *     ...                                                                      *
  65. *     IScrollBar* sb = new IScrollBar(ID_SB, this, this, IRectangle(...));     *
  66. *     IStaticText* stxtPos = new IStaticText(0, this, this, IRectangle(...));  *
  67. *     ...                                                                      *
  68. *     show();                                                                  *
  69. *   }                                                                          *
  70. *   Boolean  MyWindow::pageUp(IScrollEvent& evt)                               *
  71. *   {                                                                          *
  72. *     unsigned long ulPos = sb.sliderPosition();                               *
  73. *     stxtPos.setText() = IString(ulPos);   // show current scroll position    *
  74. *     return false;            // let another handle event also                *
  75. *   }                                                                          *
  76. *******************************************************************************/
  77. typedef IHandler Inherited;
  78. public:
  79. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  80. | There is 1 way to construct instances of this class:                         |
  81. |   1. default constructor                                                     |
  82. ------------------------------------------------------------------------------*/
  83.   IScrollHandler ( ) {;}
  84.  
  85. /*----------------------- EVENT DISPATCHING INTERFACE --------------------------
  86. | This function evaluates the event to determine if it is one appropriate for  |
  87. | this handler object to process.  If so it calls the virtual function used to |
  88. | process the event.                                                           |
  89. |   dispatchHandlerEvent - invokes the appropriate function if scroll event    |
  90. ------------------------------------------------------------------------------*/
  91. Boolean
  92.   dispatchHandlerEvent ( IEvent& evt );
  93.  
  94. protected:
  95. /*------------------------ EVENT PROCESSING FUNCTIONS --------------------------
  96. | This function must be supplied by a derived class in order to provide        |
  97. | processing for an input change event.                                        |
  98. |   lineUp         - process scroll from pressing the up arrow key or clicking |
  99. |                    the up arrow of a vertical scroll bar                     |
  100. |   lineDown       - process scroll from pressing the down arrow key or        |
  101. |                    clicking the down arrow of a vertical scroll bar          |
  102. |   pageUp         - process scroll from pressing the page up key or clicking  |
  103. |                    the area above a vertical scroll bar slider               |
  104. |   pageDown       - process scroll from pressing the page down key or         |
  105. |                    clicking the area below a vertical scroll bar slider      |
  106. |   lineLeft       - process scroll from pressing the left arrow key or        |
  107. |                    clicking the left arrow of a horizontal scroll bar        |
  108. |   lineRight      - process scroll from pressing the right arrow key or       |
  109. |                    clicking the right arrow of a horizontal scroll bar       |
  110. |   pageLeft       - process scroll from pressing the page left key or         |
  111. |                    clicking the area left of a horizontal scroll bar slider  |
  112. |   pageRight      - process scroll from pressing the page right key or        |
  113. |                    clicking the area right of a horizontal scroll bar slider |
  114. |   sliderTrack    - process scroll from each time the position of the scroll  |
  115. |                    bar slider is changed                                     |
  116. |   sliderDragEnd  - process end of scrolling using the scroll bar slider      |
  117. |   arrowScrollEnd - process end of scrolling without the scroll bar slider    |
  118. ------------------------------------------------------------------------------*/
  119. virtual Boolean
  120.   lineUp         ( IScrollEvent& evt ) { return false; }
  121. virtual Boolean
  122.   lineDown       ( IScrollEvent& evt ) { return false; }
  123. virtual Boolean
  124.   pageUp         ( IScrollEvent& evt ) { return false; }
  125. virtual Boolean
  126.   pageDown       ( IScrollEvent& evt ) { return false; }
  127.  
  128. virtual Boolean
  129.   lineLeft       ( IScrollEvent& evt ) { return false; }
  130. virtual Boolean
  131.   lineRight      ( IScrollEvent& evt ) { return false; }
  132. virtual Boolean
  133.   pageLeft       ( IScrollEvent& evt ) { return false; }
  134. virtual Boolean
  135.   pageRight      ( IScrollEvent& evt ) { return false; }
  136.  
  137. virtual Boolean
  138.   sliderTrack    ( IScrollEvent& evt ) { return false; }
  139. virtual Boolean
  140.   sliderDragEnd  ( IScrollEvent& evt ) { return false; }
  141. virtual Boolean
  142.   arrowScrollEnd ( IScrollEvent& evt ) { return false; }
  143. };
  144. #endif /* ISCRLHDR */
  145.