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

  1. #ifndef _IPAINTH_
  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. *$Log:   S:/ibmclass/ibaseapp/vcs/ipainhdr.hpv  $                                                                         *
  19. // 
  20. //    Rev 1.21   26 Oct 1992 00:36:04   tsuji
  21. // Format/document in the style of the standard header file.
  22. *******************************************************************************/
  23. #ifndef _IHANDLER_
  24.   #include <ihandler.hpp>
  25. #endif
  26.  
  27. // Forward declarations for other classes:
  28. class IPaintHandler;  /* pnth */
  29. class IPaintEvent;
  30. class IEvent;
  31.  
  32. class IPaintHandler : public IHandler {
  33. /*******************************************************************************
  34. * This class handles processing of paint events for all windows and controls.  *
  35. *                                                                              *
  36. * The IPaintHandler class is designed to handle paint events, which require    *
  37. * a window or control to update its appearance on the screen.  If registered   *
  38. * to a window or control (by being passed on a call to its addHandler()        *
  39. * function), the IPaintHandler object will be called to process the paint      *
  40. * event.  It does this by creating an IPaintEvent object and routing it to the *
  41. * virtual paintWindow() function (this virtual function allows you to supply   *
  42. * your own specialized processing of the event).  The return value from the    *
  43. * virtual function specifies if the IControlEvent should be passed on to       *
  44. * another handler object to be processed, as described below:                  *
  45. *                                                                              *
  46. *   Value  Meaning                                                             *
  47. *   ------ --------                                                            *
  48. *   true   The IPaintEvent has been handled and requires no additional         *
  49. *          processing.                                                         *
  50. *   false  The IPaintEvent should be passed to the next handler (if this is    *
  51. *          the last handler for the window or control it should be passed on   *
  52. *          to the default window procedure).                                   *
  53. *                                                                              *
  54. * EXAMPLE:                                                                     *
  55. *   MyWindow::MyWindow()                                                       *
  56. *     : ...                                                                    *
  57. *   {                                                                          *
  58. *     MyPaintHandler* pnth = new MyPaintHandler();                             *
  59. *     ...                                                                      *
  60. *     addHandler(pnth);                                                        *
  61. *     ...                                                                      *
  62. *     show();                                                                  *
  63. *   }                                                                          *
  64. *   Boolean  MyPaintHandler::paintWindow(IPaintEvent& evt)                     *
  65. *   {                                                                          *
  66. *     // Processing to update the screen.                                      *
  67. *     ...                                                                      *
  68. *     return true;                                                             *
  69. *   }                                                                          *
  70. *******************************************************************************/
  71. typedef IHandler Inherited;
  72. public:
  73. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  74. | There is 1 way to construct instances of this class:                         |
  75. |   1. default constructor                                                     |
  76. ------------------------------------------------------------------------------*/
  77.   IPaintHandler ( ) {;}
  78.  
  79. /*----------------------- EVENT DISPATCHING INTERFACE --------------------------
  80. | This function evaluates the event to determine if it is one appropriate for  |
  81. | this handler object to process.  If so it calls the virtual function used to |
  82. | process the event.                                                           |
  83. |   dispatchHandlerEvent - invokes the paintWindow function if paint event     |
  84. ------------------------------------------------------------------------------*/
  85. Boolean
  86.   dispatchHandlerEvent ( IEvent& evt );
  87.  
  88. protected:
  89. /*------------------------ EVENT PROCESSING FUNCTIONS --------------------------
  90. | This function must be supplied by a derived class in order to provide        |
  91. | processing for a paint event.                                                |
  92. |   paintWindow - function used to process the paint event                     |
  93. ------------------------------------------------------------------------------*/
  94. virtual Boolean
  95.   paintWindow          ( IPaintEvent& evt ) = 0;
  96. };
  97. #endif /* IPAINHDR */
  98.