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

  1. #ifndef _ISIZEHDR_
  2.   #define _ISIZEHDR_
  3. /*******************************************************************************
  4. * FILE NAME: isizehdr.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IResizeHandler - Process a resizing event for a window/control.          *
  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 _ISIZEEVT_
  22.   #include <isizeevt.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.  
  33.  
  34. class IResizeHandler : public IHandler {
  35. typedef IHandler
  36.   Inherited;
  37. /*******************************************************************************
  38. * The IResizeHandler class handles the notification that a window or control   *
  39. * has been resized.                                                            *
  40. *                                                                              *
  41. * A resizing event notifies a window or control that it has grown or shrunk    *
  42. * on the screen.  If the IResizeHandler object is attached to a window or      *
  43. * control, it will be called to process the resizing event.  You can attach    *
  44. * an IResizeHandler object to a window or control by passing the window or     *
  45. * control to the handleEventsFor function of the IResizeHandler object.        *
  46. *                                                                              *
  47. * IResizeHandler processes the resizing event by creating an IResizeEvent      *
  48. * object and routing it to the virtual windowResize function.  This virtual    *
  49. * function allows you to supply your own specialized processing of the event.  *
  50. * The return value from the virtual function specifies whether the             *
  51. * IResizeEvent should be passed on for additional processing, as follows:      *
  52. *                                                                              *
  53. *   Value   Meaning                                                            *
  54. *   ---------------                                                            *
  55. *   true  - The IResizeEvent object has been handled and requires no           *
  56. *           additional processing.                                             *
  57. *   false - The IResizeEvent object should be passed to the next handler.  If  *
  58. *           the next handler is the last handler for the window or control,    *
  59. *           the event is passed on a call to the window or control's           *
  60. *           defaultProcedure function (see IWindow::defaultProcedure).         *
  61. *                                                                              *
  62. * Example:                                                                     *
  63. *   MyWindow::MyWindow()                                                       *
  64. *     : ...                                                                    *
  65. *   {                                                                          *
  66. *     MyResizeHandler* szh = new MyResizeHandler();                            *
  67. *     ...                                                                      *
  68. *     szh.handleEventsFor(this);                                               *
  69. *     ...                                                                      *
  70. *     show();                                                                  *
  71. *   }                                                                          *
  72. *   Boolean  MyResizeHandler::windowResize(IResizeEvent& evt)                  *
  73. *   {                                                                          *
  74. *     // Specialized processing here.                                          *
  75. *     ...                                                                      *
  76. *     return false;                                                            *
  77. *   }                                                                          *
  78. *******************************************************************************/
  79. public:
  80. /*-------------------------- Constructor/Destructor ----------------------------
  81. | The only way to construct instances of this class is by using the default    |
  82. | constructor, which takes no arguments.                                       |
  83. ------------------------------------------------------------------------------*/
  84.   IResizeHandler       ( );
  85. virtual
  86.  ~IResizeHandler       ( );
  87.  
  88. protected:
  89. /*---------------------------- Event Dispatching -------------------------------
  90. | This function evaluates the event to determine if it is appropriate for      |
  91. | this handler object to process.  If it is, this function calls the virtual   |
  92. | function used to process the event.                                          |
  93. |   dispatchHandlerEvent - Calls the windowResize function if a resize event   |
  94. |                          is found.                                           |
  95. ------------------------------------------------------------------------------*/
  96. virtual Boolean
  97.   dispatchHandlerEvent ( IEvent& event );
  98.  
  99. /*----------------------------- Event Processing -------------------------------
  100. | This function must be supplied by a derived class to process a resizing      |
  101. | event.                                                                       |
  102. |   windowResize - Implemented by a derived class to handle a resizing event.  |
  103. ------------------------------------------------------------------------------*/
  104. virtual Boolean
  105.   windowResize         ( IResizeEvent& event ) = 0;
  106. }; // IResizeHandler
  107.  
  108. /*----------------------------------------------------------------------------*/
  109. /* Resume compiler default packing.                                           */
  110. /*----------------------------------------------------------------------------*/
  111. #pragma pack()
  112.  
  113. #endif /* _ISIZEHDR_ */
  114.