home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IPAGEHDR.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  9KB  |  137 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 events for a page on an INotebook object.         *
  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 _IPAGEEVT_
  22.   #include <ipageevt.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. class INotebookDrawItemEvent;
  33.  
  34.  
  35. class IPageHandler : public IHandler {
  36. typedef IHandler
  37.   Inherited;
  38. /*******************************************************************************
  39. * The IPageHandler class handles the processing of page change events for the  *
  40. * INotebook class.                                                             *
  41. *                                                                              *
  42. * The IPageHandler class is designed to handle events resulting from a user    *
  43. * interacting with a notebook page.  An IPageHandler object can be used to     *
  44. * handle page events for a notebook by either being added to the notebook      *
  45. * itself or to the owner window of the notebook.  This is done by either       *
  46. * passing the notebook or owner window to the handleEventsFor function of the  *
  47. * IPageHandler object.                                                         *
  48. *                                                                              *
  49. * When it receives a page event, the IPageHandler object creates the           *
  50. * appropriate event object and routes it to the appropriate virtual function.  *
  51. * You can override the virtual functions of the IPageHandler to supply your    *
  52. * own specialized processing of an event.  The return values from the virtual  *
  53. * functions specify whether the page event should be passed on to another      *
  54. * handler object to be processed, as follows:                                  *
  55. *                                                                              *
  56. *   Value   Meaning                                                            *
  57. *   ---------------                                                            *
  58. *   true  - The page event requires no additional processing and should not    *
  59. *           be passed to another handler.                                      *
  60. *   false - The page event should be passed to the next handler, as follows:   *
  61. *           -- If there is another handler for the notebook or owner window,   *
  62. *              the event is passed on to the next handler.                     *
  63. *           -- If this is the last handler for the notebook, the event is      *
  64. *              dispatched to the owner window of the notebook.  (See           *
  65. *              IWindow::dispatch.)                                             *
  66. *           -- If this is the last handler for the owner window, the event is  *
  67. *              passed on a call to the owner window's defaultProcedure         *
  68. *              function.  (See IWindow::defaultProcedure.)                     *
  69. *                                                                              *
  70. * Example:                                                                     *
  71. *   MyWindow::MyWindow()                                                       *
  72. *     : ...                                                                    *
  73. *   {                                                                          *
  74. *     MyPageHandler* pgh = new MyPageHandler();                                *
  75. *     ...                                                                      *
  76. *     INotebook* pnbk = new INotebook(ID_NB, this, this, IRectangle(...));     *
  77. *     pgh->handleEventsFor(pnbk);                                              *
  78. *     ...                                                                      *
  79. *     show();                                                                  *
  80. *   }                                                                          *
  81. *   Boolean  MyPageHandler::select(IPageEvent& evt)                            *
  82. *   {                                                                          *
  83. *     Boolean bProcessed = false;                                              *
  84. *     // do some processing                                                    *
  85. *     ...                                                                      *
  86. *     return bProcessed;                                                       *
  87. *   }                                                                          *
  88. *******************************************************************************/
  89. public:
  90. /*------------------------------- Constructor ----------------------------------
  91. | The only way to construct instances of this class is to use the default      |
  92. | constructor, which does not take any arguments.                              |
  93. ------------------------------------------------------------------------------*/
  94.   IPageHandler :: IPageHandler ( );
  95.  
  96. virtual
  97.   IPageHandler :: ~IPageHandler ( );
  98.  
  99. protected:
  100. /*---------------------------- Event Dispatching -------------------------------
  101. | This function evaluates the event to determine if it is appropriate for      |
  102. | this handler object to process.  If it is, this function calls the virtual   |
  103. | function used to process the event.                                          |
  104. |   dispatchHandlerEvent - Calls the appropriate function if a page event is   |
  105. |                          found.                                              |
  106. ------------------------------------------------------------------------------*/
  107. virtual Boolean
  108.   dispatchHandlerEvent ( IEvent& evt );
  109.  
  110. /*----------------------------- Event Processing -------------------------------
  111. | The following functions must be supplied by a derived class to process       |
  112. | various notebook page-related events.                                        |
  113. |   resize  - Implemented by derived classes to process a page size change     |
  114. |             notification.                                                    |
  115. |   select  - Implemented by derived classes to process the notification that  |
  116. |             a new page is at the top of the notebook.                        |
  117. |   remove  - Implemented by derived classes to process a page deletion        |
  118. |             notification.                                                    |
  119. |   help    - Implemented by derived classes to process a notification that    |
  120. |             help has been requested for a notebook page.                     |
  121. |   drawTab - Implemented by derived classes to draw the page tab.             |
  122. ------------------------------------------------------------------------------*/
  123. virtual Boolean
  124.   resize  ( IPageEvent             &event ),
  125.   select  ( IPageSelectEvent       &event ),
  126.   remove  ( IPageRemoveEvent       &event ),
  127.   help    ( IPageHelpEvent         &event ),
  128.   drawTab ( INotebookDrawItemEvent &event );
  129. }; // IPageHandler
  130.  
  131. /*----------------------------------------------------------------------------*/
  132. /* Resume compiler default packing.                                           */
  133. /*----------------------------------------------------------------------------*/
  134. #pragma pack()
  135.  
  136. #endif /* _IPAGEHDR_ */
  137.