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

  1. #ifndef _ICMDHDR_
  2.   #define _ICMDHDR_
  3. /*******************************************************************************
  4. * FILE NAME: icmdhdr.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     ICommandHandler - Process an application or system command event.        *
  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 _ICMDEVT_
  22.   #include <icmdevt.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. class ICommandHandler : public IHandler {
  34. typedef IHandler
  35.   Inherited;
  36. /*******************************************************************************
  37. * Instances of the ICommandHandler class process application and system        *
  38. * command events.  This handler should be attached to the client window, the   *
  39. * frame window (note, however, that a canvas that is the client area window    *
  40. * will not cause application commands to be dispatched to the frame window),   *
  41. * or to another appropriate window, such as the owner window of a push button. *
  42. * You can do this by passing the appropriate window on the handleEventsFor     *
  43. * function of the ICommandHandler object.                                      *
  44. *                                                                              *
  45. * When it receives a command event, the ICommandHandler object creates an      *
  46. * ICommandEvent object and routes it to the appropriate virtual function.  You *
  47. * should override the virtual functions of ICommandHandler to supply your own  *
  48. * specialized processing of an event.  The return value from the virtual       *
  49. * functions specifies whether the ICommandEvent should be passed on for        *
  50. * additional processing, as described below:                                   *
  51. *                                                                              *
  52. *   Value   Meaning                                                            *
  53. *   ---------------                                                            *
  54. *   true  - The ICommandEvent requires no additional processing.               *
  55. *   false - The ICommandEvent should be passed on for additional processing:   *
  56. *           -- if there is another handler for the window, the event is passed *
  57. *              on to the next handler                                          *
  58. *           -- if this is the last handler for the window, the event is passed *
  59. *              on a call to the window's defaultProcedure function             *
  60. *******************************************************************************/
  61. public:
  62. /*-------------------------- Constructor/Destructor ----------------------------
  63. | The only way to construct instances of this class is to use the default      |
  64. | constructor, which does not take any arguments.                              |
  65. ------------------------------------------------------------------------------*/
  66.   ICommandHandler      ( );
  67. virtual
  68.  ~ICommandHandler      ( );
  69.  
  70. protected:
  71. /*---------------------------- Event Dispatching -------------------------------
  72. | This function evaluates the event to determine if it is appropriate for      |
  73. | this handler object to process.  If it is, this function calls the virtual   |
  74. | function used to process the event.                                          |
  75. |   dispatchHandlerEvent - Calls the command or systemCommand function if a    |
  76. |                          command event is found.                             |
  77. ------------------------------------------------------------------------------*/
  78. virtual Boolean
  79.   dispatchHandlerEvent ( IEvent& event );
  80.  
  81. /*----------------------------- Event Processing -------------------------------
  82. | These functions must be supplied by a derived class to process an            |
  83. | application or system command event.                                         |
  84. |   command       - Implemented by derived classes to handle application       |
  85. |                   command events.                                            |
  86. |   systemCommand - Implemented by derived classes to handle the system        |
  87. |                   command events.                                            |
  88. ------------------------------------------------------------------------------*/
  89. virtual Boolean
  90.   command              ( ICommandEvent& event ),
  91.   systemCommand        ( ICommandEvent& event );
  92. }; // ICommandHandler
  93.  
  94. /*----------------------------------------------------------------------------*/
  95. /* Resume compiler default packing.                                           */
  96. /*----------------------------------------------------------------------------*/
  97. #pragma pack()
  98.  
  99. #endif /* _ICMDHDR_ */
  100.