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

  1. #ifndef _IFRAMHDR_
  2. #define _IFRAMHDR_
  3. /*******************************************************************************
  4. * FILE NAME: iframhdr.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IFrameHandler - Frame window event handler.                              *
  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               *
  15. *   disclosure                                                                 *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. *******************************************************************************/
  19. #ifndef _IHANDLER_
  20.   #include <ihandler.hpp>
  21. #endif
  22.  
  23. /*----------------------------------------------------------------------------*/
  24. /* Align classes on four byte boundary.                                       */
  25. /*----------------------------------------------------------------------------*/
  26. #pragma pack(4)
  27.  
  28. class IFrameWindow;
  29. class IFrameEvent;
  30. class ICommandEvent;
  31. class IFrameFormatEvent;
  32.  
  33. class IFrameHandler : public IHandler {
  34. typedef IHandler
  35.   Inherited;
  36. /*******************************************************************************
  37. * The IFrameHandler class adds its objects to IFrameWindows to handle frame    *
  38. * window events related to maintenance of frame extensions.  An instance is    *
  39. * created and added to the frame at construction, usually, by the              *
  40. * IFrameWindow::start member function.  This function is called when the       *
  41. * frame is created using IFrameWindow::create, IFrameWindow::tryToLoadDialog,  *
  42. * or IFrameWindow::initialize.                                                 *
  43. *                                                                              *
  44. * If the frame is constructed using some alternate means (for example, by a    *
  45. * subclass of IFrameWindow) and IFrameWindow::start is not called, then an     *
  46. * instance of this handler class should be created and added through another   *
  47. * means.  In many such cases, an instance of some derived class is actually    *
  48. * added as a handler.                                                          *
  49. *******************************************************************************/
  50. public:
  51.   IFrameHandler ( );
  52.   ~IFrameHandler ( );
  53. /*------------------------------ Event Handling --------------------------------
  54. | This function is called to handle frame-specific window events.  Derived     |
  55. | classes should override this to change the handler functionality.            |
  56. |   numberOfExtensions - Returns the number of frame extensions that the       |
  57. |                        argument frame window possesses.  This number is      |
  58. |                        also the number of elements in the collection that    |
  59. |                        is returned by the frame's IFrameWindow::extensions.  |
  60. | These functions are passed by an IFrameEvent that provides an argument       |
  61. | value and in which an event result can be set.  Each has a Boolean return    |
  62. | type that indicates whether an additional handler should be dispatched.      |
  63. |   format      - Fills in an array of window position structures, one for     |
  64. |                 each frame control.  This function does this for the frame   |
  65. |                 extensions that have been added to the frame using           |
  66. |                 IFrameWindow::addExtension.  Derived class implementations   |
  67. |                 usually will call their inherited version, format their      |
  68. |                 controls, and finally return true (so that the standard      |
  69. |                 frame controls are not formatted again).                     |
  70. |   closed      - Called when the frame window is closed.  This function       |
  71. |                 queries whether the frame is modal and dismisses it, if so.  |
  72. |                 It then queries the state of the destroyOnClose flag         |
  73. |                 maintained by the IFrameWindow and destroys the              |
  74. |                 Presentation Manager window if this flag is on.  Else, an    |
  75. |                 SC_CLOSE systemCommand is posted to the client, if there is  |
  76. |                 a client.  True is always returned.                          |
  77. |   activated   - Called when the frame window is activated.  This function    |
  78. |                 does not take any action.  Derived classes, however, should  |
  79. |                 implement this function by performing their processing and   |
  80. |                 return false (so that other handlers can act on this event). |
  81. |   deactivated - Called when the frame is asked to give up the input focus.   |
  82. |                 This function does not take any action.  Derived classes,    |
  83. |                 however, should implement this function by performing their  |
  84. |                 processing and returning false.                              |
  85. |   saved       - Called when the application status is to be saved.  This     |
  86. |                 function does not take any action and returns false.         |
  87. |                 Derived classes, however, should save the application        |
  88. |                 status and return false (so that other handlers also have a  |
  89. |                 chance to handle this event).                                |
  90. |   draw        - Called when the frame window needs to be redrawn.  This      |
  91. |                 function draws the separator lines between frame extensions  |
  92. |                 and returns false.  Derived classes should invoke the        |
  93. |                 inherited implementation, perform any addition drawing they  |
  94. |                 require, and return false.                                   |
  95. |   command     - Called when the frame window receives a command event.       |
  96. |                 This function checks to see if the frame has a client.  If   |
  97. |                 so, it returns false (so the client can receive the event).  |
  98. |                 Otherwise, it returns true.                                  |
  99. |   calcRect    - Called when the frame window is asked to calculate the       |
  100. |                 size of the client rectangle given a frame rectangle or      |
  101. |                 calculate the size of the frame rectangle give a client      |
  102. |                 rectangle.                                                   |
  103. ------------------------------------------------------------------------------*/
  104. virtual unsigned
  105.   numberOfExtensions ( IFrameWindow *pFrame );
  106.  
  107. virtual Boolean
  108.   format      ( IFrameFormatEvent &formatEvent ),
  109.   closed      ( IFrameEvent       &frameEvent  ),
  110.   activated   ( IFrameEvent       &frameEvent  ),
  111.   deactivated ( IFrameEvent       &frameEvent  ),
  112.   saved       ( IFrameEvent       &frameEvent  ),
  113.   draw        ( IFrameEvent       &frameEvent  ),
  114.   command     ( ICommandEvent     &cmdEvent    ),
  115.   calcRect    ( IFrameEvent       &frameEvent  );
  116.  
  117. protected:
  118. /*-------------------------------- Overrides -----------------------------------
  119. | This inherited function is overridden:                                       |
  120. |   dispatchHandlerEvent - Intercepts all window events and dispatches         |
  121. |                          frame-specific events to the various handle event   |
  122. |                          functions.                                          |
  123. ------------------------------------------------------------------------------*/
  124. virtual Boolean
  125.   dispatchHandlerEvent ( IEvent &anEvent );
  126.  
  127. private: /*------------------------ PRIVATE ----------------------------------*/
  128. }; // class IFrameHandler
  129.  
  130. /*----------------------------------------------------------------------------*/
  131. /* Resume compiler default packing.                                           */
  132. /*----------------------------------------------------------------------------*/
  133. #pragma pack()
  134.  
  135. #endif // _IFRAMHDR_
  136.