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

  1. #ifndef _IPAINEVT_
  2.   #define _IPAINEVT_
  3. /*******************************************************************************
  4. * FILE NAME: ipainevt.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IPaintEvent - Represents a window repaint event.                         *
  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/ipainevt.hpv  $                                                                         *
  19. // 
  20. //    Rev 1.22   26 Oct 1992 00:35:34   tsuji
  21. // Format/document in the style of the standard header file.
  22. *******************************************************************************/
  23. #ifndef _IEVENT_
  24.   #include <ievent.hpp>
  25. #endif
  26.  
  27. // Forward declarations for other classes:
  28. class IPaintEvent;  /* pntevt */
  29. class IPresSpaceHandle;
  30. #ifndef _ICOLOR_
  31.   #include <icolor.hpp>
  32. #endif
  33. #ifndef _IRECT_
  34.   #include <irect.hpp>
  35. #endif
  36.  
  37. class IPaintEvent : public IEvent {
  38. /*******************************************************************************
  39. * This class represents a paint event, which requires a window or control to   *
  40. * update its appearance on the screen.  This event object is created by an     *
  41. * IPaintHandler object and passed to its virtual paintWindow() function for    *
  42. * processing.  All window updates should be done using the presentation space  *
  43. * handle supplied by the IPaintEvent object.                                   *
  44. *******************************************************************************/
  45. typedef IEvent Inherited;
  46. public:
  47. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  48. | There are 2 ways to construct instances of this class:                       |
  49. |   1. construct from an IEvent                                                |
  50. |   2. construct from another IPaintEvent                                      |
  51. ------------------------------------------------------------------------------*/
  52.   IPaintEvent  ( IEvent& evt );
  53.   IPaintEvent  ( IPaintEvent& evt );
  54.   ~IPaintEvent ( );
  55.  
  56. /*--------------------------------- ACCESSORS ----------------------------------
  57. | These functions return information related to the paint event.               |
  58. |   defaultBgndColor - returns the background color of the desktop window      |
  59. |   defaultTextColor - returns the color of window static text used by the     |
  60. |                      system                                                  |
  61. |   presSpaceHandle  - returns the handle of the presentation space to use for |
  62. |                      any drawing                                             |
  63. |   rect             - returns the screen rectangle that needs updating        |
  64. |   exposedRect      - returns a rectangle that is interpreted as being        |
  65. |                      equivalent to the rectangle returned by rect() for      |
  66. |                      drawing functions provided by this class (for example,  |
  67. |                      you can pass it to the clearBackground() function)      |
  68. ------------------------------------------------------------------------------*/
  69. static const IGUIColor
  70.   defaultBgndColor ( ),
  71.   defaultTextColor ( );
  72. const IPresSpaceHandle&
  73.   presSpaceHandle  ( ) const;
  74. const IRectangle&
  75.   rect             ( ) const;
  76. static const IRectangle
  77.   exposedRect      ( );
  78.  
  79. /*---------------------------- PAINTING FUNCTIONS ------------------------------
  80. | These functions can be used to update a window's appearance on the screen.   |
  81. |   clearBackground - clears the specified rectangle, filling it with the      |
  82. |                     specified color                                          |
  83. |   drawText        - draws the specified text, beginning at the specified     |
  84. |                     point, using the specified color for the text            |
  85. ------------------------------------------------------------------------------*/
  86. void
  87.   clearBackground  ( const IRectangle& fillRect = exposedRect( ),
  88.                      const IColor& bgndColor = defaultBgndColor( ) ),
  89.   drawText         ( const char* text,
  90.                      const IPoint& atPos,
  91.                      const IColor& textColor = defaultTextColor( ) );
  92.  
  93. private:
  94. IPresSpaceHandle
  95.   hpsCl;
  96. IRectangle
  97.   rectCl;
  98. };
  99.  
  100. inline const IPresSpaceHandle& IPaintEvent::presSpaceHandle() const
  101. /**************************************************************/
  102. /* Return the presentation space handle of the exposing window*/
  103. /**************************************************************/
  104. { return hpsCl; }
  105.  
  106. inline const IRectangle& IPaintEvent::rect() const
  107. /**************************************************************/
  108. /* Return the rectangle of the exposing window.               */
  109. /**************************************************************/
  110. { return rectCl; }
  111. #endif /* IPAINEVT */
  112.