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

  1. #ifndef _IACCEL_
  2. #define _IACCEL_
  3. /**************************************************************/
  4. /* FILE NAME: iaccel.hpp                                      */
  5. /*                                                            */
  6. /* DESCRIPTION:                                               */
  7. /*    Declaration of the class:                               */
  8. /*      IAccelertor - wrapper for menu accelerators           */
  9. /*                                                            */
  10. /* COPYRIGHT:                                                 */
  11. /*   Licensed Materials - Property of IBM                     */
  12. /*   (c) Copyright IBM Corporation 1992, 1993                 */
  13. /*   US Government Users Restricted Rights - Use duplication  */
  14. /*   or disclosure restricted by GSA ADP Schedule Contract    */
  15. /*   with IBM Corp.                                           */
  16. /*                                                            */
  17. /*     $Log:   G:/IBMCLASS/IBASEAPP/VCS/IACCEL.HPV  $                                                  */
  18. // 
  19. //    Rev 1.3   26 Oct 1992 10:07:32   HARPERSP
  20. // Updates for documentation.
  21. // 
  22. //    Rev 1.2   16 Oct 1992 18:48:14   HARPERSP
  23. // Removed all the "system" member functions (ie. setSystemAccel(), etc.).
  24. // Now pass an IWindow* if the accelerator applies to a given window, or
  25. // just leave off the IWindow* on the cstor and it will apply to all 
  26. // windows.
  27. /*                                                            */
  28. /**************************************************************/
  29.  
  30. #ifndef _IBASETYP_
  31. #include <ibasetyp.hpp>
  32. #endif
  33.  
  34. #ifndef _IWINDOW_
  35. #include <iwindow.hpp>
  36. #endif
  37.  
  38. #ifndef _IHANDLE_
  39. #include <ihandle.hpp>
  40. #endif
  41.  
  42. // Forward declarations for other classes
  43. class    IAccelerator;  /* ac */
  44. class    IResourceId;
  45.  
  46. class IAccelerator
  47. {
  48.  
  49. /**********************************************************************
  50. * Wrapper for menu accelerators                                       *
  51. *                                                                     *
  52. *                                                                     *
  53. **********************************************************************/
  54.  
  55.   public:
  56.  
  57. /*------------------ CONSTRUCTORS/DESTRUCTORS -------------------------
  58. |  There are 2 ways to construct instances of this class:             |
  59. |                                                                     |
  60. |  1. From an IAccelTblHandle                                         |
  61. |                                                                     |
  62. |  2. From an IResourceId                                             |
  63. |                                                                     |
  64. |  All constructors take an optional second parameter that is a       |
  65. |  const IWindow*. If this IWindow* is supplied then the accelerator  |
  66. |  will only be in effect when that IWindow object has the focus.     |
  67. |  If the second parameter is omitted on the constructor, the the     |
  68. |  IAccelerator will apply to all Windows in the application but      |
  69. |  will have no effect on other applications that are currently       |
  70. |  running.                                                           |
  71. ---------------------------------------------------------------------*/
  72.  
  73.      IAccelerator(const IAccelTblHandle& haccel = 0, 
  74.                   const IWindow* const pwndOwner = 0);
  75.  
  76.      IAccelerator(const IResourceId& accelResId, 
  77.                   const IWindow* const pwndOwner = 0);
  78.  
  79.      IAccelerator(unsigned long accelResId, 
  80.                   const IWindow* const pwndOwner = 0);
  81.  
  82.      ~IAccelerator();
  83.  
  84.  
  85. /*---------------------- ACCESSORS ------------------------------------
  86. |                                                                     |
  87. | setAccel - changes the IAccelerator to specified setting            |
  88. |                                                                     |
  89. | removeAccel - removes the Accelerator and does not restore to       |
  90. |               the one previously in effect.                         |
  91. |                                                                     |
  92. | unsetAccel - removes the Accelerator but restores the one that      |
  93. |              was previously in effect                               |
  94. |                                                                     |
  95. | isAccelSet - returns true if the Accelerator is in effect           |
  96. |                                                                     |
  97. | accel - returns the IAccelTblHandle of the Accelerator in effect    |
  98. |                                                                     |
  99. | ownerHandle - returns the IWindowHandle to which the Accelerator    |
  100. |               applies                                               |
  101. ---------------------------------------------------------------------*/
  102.  
  103.      void        setAccel(const IAccelTblHandle& haccel);
  104.      void        setAccel(const IResourceId& accelResId);
  105.      void        setAccel(unsigned long accelResId);
  106.  
  107.      void        removeAccel();
  108.      void        unsetAccel();
  109.  
  110.      Boolean     isAccelSet();
  111.      IAccelTblHandle const     accel();
  112.      IWindowHandle ownerHandle();
  113.  
  114.  
  115. /*----------------------- PRIVATE -----------------------------------*/
  116.   private:
  117.  
  118.      IAccelerator(const IAccelerator& acCopy);
  119.      create(const IWindow* const pwndOwner);
  120.  
  121.      const IWindow*     pwndClOwner;
  122.      IAccelTblHandle             haccelCl;
  123.      IAccelTblHandle             haccelClPrior;
  124.      IAccelTblHandle             haccelClOriginal;
  125. };
  126. #endif  /* ifndef _IACCEL_ */
  127.