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

  1. #ifndef _IPAGEHDR_
  2.   #define _IPAGEHDR_
  3. /*******************************************************************************
  4. * FILE NAME: ipagehdr.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IPageHandler - Process notebook page events for an INoteBook 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/IPAGEHDR.HPV  $                                                                         *
  19. // 
  20. //    Rev 1.23   25 Oct 1992 16:57:24   nunn
  21. // changed library name to ICLUI
  22. // 
  23. //    Rev 1.22   25 Oct 1992 14:24:54   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 IPageHandler;  /* pgh */
  32. class IControlEvent;
  33. class IPageEvent;
  34. class IEvent;
  35.  
  36. class IPageHandler : public IHandler {
  37. /*******************************************************************************
  38. * This class handles processing of page change events for the following        *
  39. * controls: INoteBook.                                                         *
  40. *                                                                              *
  41. * The IPageHandler class is designed to handle events resulting from a user    *
  42. * interacting with a notebook page.  If registered to the appropriate window   *
  43. * (by being passed on the addHandler() function of the control or the owner    *
  44. * window of the control), the IPageHandler object will be called to process    *
  45. * the page event.  It does this by creating either an IControlEvent or         *
  46. * IPageEvent object and routing it to the appropriate virtual function (the    *
  47. * virtual functions allow you to supply your own specialized processing of     *
  48. * the event).  The return value from the virtual functions specifies if the    *
  49. * IScrollEvent should be passed on to another handler object to be processed,  *
  50. * as described 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. *     MyPageHandler* pgh = new MyPageHandler();                                *
  67. *     ...                                                                      *
  68. *     INoteBook* nbk = new INoteBook(ID_NB, this, this, IRectangle(...));      *
  69. *     ef->addHandler(edh);                                                     *
  70. *     ...                                                                      *
  71. *     show();                                                                  *
  72. *   }                                                                          *
  73. *   Boolean  MyPageHandler::pageSelected(IPageEvent& 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.   IPageHandler ( ) {;}
  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 page 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. |   pageResized  - function used to process a page size change event           |
  103. |   pageSelected - function used to process a page selection event             |
  104. |   pageDeleted  - function used to process a page deletion event              |
  105. ------------------------------------------------------------------------------*/
  106. virtual Boolean
  107.   pageResized  ( IControlEvent& evt ) { return false; }
  108. virtual Boolean
  109.   pageSelected ( IPageEvent& evt ) { return false; }
  110. virtual Boolean
  111.   pageDeleted  ( IControlEvent& evt ) { return false; }
  112. };
  113. #endif /* IPAGEHDR */
  114.