home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IPAINHDR.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  7KB  |  115 lines

  1. #ifndef _IPAINHDR_
  2.   #define _IPAINHDR_
  3. /*******************************************************************************
  4. * FILE NAME: ipainhdr.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IPaintHandler - Process a paint event for a window/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. *******************************************************************************/
  19. #ifndef _IHANDLER_
  20.   #include <ihandler.hpp>
  21. #endif
  22. #ifndef _IPAINEVT_
  23.   #include <ipainevt.hpp>
  24. #endif
  25.  
  26. /*----------------------------------------------------------------------------*/
  27. /* Align classes on four byte boundary.                                       */
  28. /*----------------------------------------------------------------------------*/
  29. #pragma pack(4)
  30.  
  31. // Forward declarations for other classes:
  32. class IEvent;
  33.  
  34.  
  35. class IPaintHandler : public IHandler {
  36. typedef IHandler
  37.   Inherited;
  38. /*******************************************************************************
  39. * Instances of the IPaintHandler class process paint events for all windows    *
  40. * and controls.                                                                *
  41. *                                                                              *
  42. * This class is designed to handle paint events that require a window or       *
  43. * control to update their appearance on the screen.  If the IPaintHandler      *
  44. * object is registered to a window or control, it will be called to process    *
  45. * the paint event.  You can do this by passing the window on the               *
  46. * handleEventsFor function of the IPaintHandler object.                        *
  47. *                                                                              *
  48. * It processes the paint event by creating an IPaintEvent object and routing   *
  49. * it to the appropriate virtual function.  The virtual function allows you     *
  50. * to supply your own specialized processing of the event.  The return values   *
  51. * from the virtual function specify whether the paint event should be passed   *
  52. * on to another handler object to be processed, as follows:                    *
  53. *                                                                              *
  54. *   Value   Meaning                                                            *
  55. *   ---------------                                                            *
  56. *   true  - The IPaintEvent has been handled and requires no additional        *
  57. *           processing.                                                        *
  58. *   false - The IPaintEvent should be passed to the next handler, as follows:  *
  59. *           -- If there is another handler for the window, the event is        *
  60. *              passed on to the next handler.                                  *
  61. *           -- If this is the last handler for the window, the event is        *
  62. *              passed on a call to the window's defaultProcedure function.     *
  63. *                                                                              *
  64. * Example:                                                                     *
  65. *   MyWindow::MyWindow()                                                       *
  66. *     : ...                                                                    *
  67. *   {                                                                          *
  68. *     MyPaintHandler* pnth = new MyPaintHandler();                             *
  69. *     ...                                                                      *
  70. *     pnth->handleEventsFor(this);                                             *
  71. *     ...                                                                      *
  72. *     show();                                                                  *
  73. *   }                                                                          *
  74. *   Boolean  MyPaintHandler::paintWindow(IPaintEvent& event)                   *
  75. *   {                                                                          *
  76. *     // Processing to update the screen.                                      *
  77. *     ...                                                                      *
  78. *     return true;                                                             *
  79. *   }                                                                          *
  80. *******************************************************************************/
  81. public:
  82. /*-------------------------- Constructor/Destructor ----------------------------
  83. | The only way to construct instances of this class is to use the default      |
  84. | constructor, which does not take any arguments.                              |
  85. ------------------------------------------------------------------------------*/
  86.   IPaintHandler        ( );
  87. virtual
  88.  ~IPaintHandler        ( );
  89.  
  90. protected:
  91. /*---------------------------- Event Dispatching -------------------------------
  92. | This function evaluates the event to determine if it is appropriate for      |
  93. | this handler object to process.  If it is, this function calls the virtual   |
  94. | function used to process the event.                                          |
  95. |   dispatchHandlerEvent - Calls the appropriate virtual function to process   |
  96. |                          a paint event.                                      |
  97. ------------------------------------------------------------------------------*/
  98. virtual Boolean
  99.   dispatchHandlerEvent ( IEvent& event );
  100.  
  101. /*----------------------------- Event Processing -------------------------------
  102. | This function must be supplied by a derived class to process a paint event.  |
  103. |   paintWindow - Implemented by derived classes to process paint events.      |
  104. ------------------------------------------------------------------------------*/
  105. virtual Boolean
  106.   paintWindow          ( IPaintEvent& event ) = 0;
  107. }; // IPaintHandler
  108.  
  109. /*----------------------------------------------------------------------------*/
  110. /* Resume compiler default packing.                                           */
  111. /*----------------------------------------------------------------------------*/
  112. #pragma pack()
  113.  
  114. #endif /* _IPAINHDR_ */
  115.