home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IACCEL.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
7KB
|
152 lines
#ifndef _IACCEL_
#define _IACCEL_
/**************************************************************/
/* FILE NAME: iaccel.hpp */
/* */
/* DESCRIPTION: */
/* Declaration of the class: */
/* IAccelertor - wrapper for menu accelerators */
/* */
/* COPYRIGHT: */
/* Licensed Materials - Property of IBM */
/* (c) Copyright IBM Corporation 1992, 1993 */
/* US Government Users Restricted Rights - Use duplication */
/* or disclosure restricted by GSA ADP Schedule Contract */
/* with IBM Corp. */
/* */
/* */
/**************************************************************/
#ifndef _IBASE_
#include <ibase.hpp>
#endif
#ifndef _IWINDOW_
#include <iwindow.hpp>
#endif
#ifndef _IHANDLE_
#include <ihandle.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
// Forward declarations for other classes
class IResourceId;
class IAccelerator : public IBase
{
/*******************************************************************************
* The IAccelerator class has members that serve as a means of accessing
* resources. Instances of the IAccelerator class allow you to access tables
* of shortcut keys and associated command IDs that are stored in resource
* files. These shortcut tables can be activated so that the keys trigger the
* associated command actions (typically the same as certain menu choices)
* when the shortcut keys are pressed.
*
* This class can be used to associate shortcut keys for a window or an entire
* application. The frame window associated with the table must have the
* keyboard focus for this to occur.
*******************************************************************************/
public:
/*------------------ Constructors/Destructor -----------------------------------
| You can construct instances of this class in the following ways: |
| |
| - From an IAccelTblHandle |
| - From an IResourceId |
| |
| Both constructors take an optional second parameter that is an IWindow. If |
| this IWindow is supplied, the accelerator will only be in effect when that |
| IWindow object has the focus. If the second parameter is omitted on the |
| constructor, the IAccelerator will apply to all Windows in the application, |
| but will have no effect on other applications that are currently running. |
| |
| |
| Note: When an IAccelerator is destroyed, the underlying Presentation |
| Manager accelerator table is also destroyed. Therefore the following |
| will not work: |
| |
| IAccelerator* pac1 = new IAccelerator(myAccelRes); |
| IAccelTblHandle haccel1 = pac1->accel(); |
| delete pac1; |
| pac1 = new IAccelerator(haccel1); //haccel1 no longer valid |
------------------------------------------------------------------------------*/
IAccelerator (const IAccelTblHandle& haccel = 0,
IWindow* owner = 0);
IAccelerator (const IResourceId& accelResId,
IWindow* owner = 0);
IAccelerator (unsigned long accelResId,
IWindow* owner = 0);
~IAccelerator ( );
/*---------------------- Accessors ---------------------------------------------
| set - Saves the current accelerator and then changes to the new |
| accelerator. A previously saved accelerator is not saved. |
| |
| remove - Removes the accelerator without restoring the one previously in |
| effect. |
| |
| unset - Removes the accelerator and restores the one that was previously |
| in effect. |
| |
| isSet - Returns true if the accelerator is in effect. |
| |
| handle - Returns the IAccelTblHandle of the accelerator in effect. |
| |
| owner - Returns the IWindow to which the accelerator applies. |
------------------------------------------------------------------------------*/
IAccelerator
&set (const IAccelTblHandle& haccel),
&set (const IResourceId& accelResId),
&set (unsigned long accelResId),
&remove ( ),
&unset ( );
Boolean
isSet ( ) const;
IAccelTblHandle
handle ( ) const;
IWindow*
owner ( ) const;
/*----------------------- Private -----------------------------------*/
private:
IAccelerator(const IAccelerator& acCopy);
create(IWindow* pwndOwner);
IWindowHandle ownerHandle() const;
IWindow* pwndClOwner;
IAccelTblHandle haccelCl;
IAccelTblHandle haccelClPrior;
IAccelTblHandle haccelClOriginal;
Boolean isSetCl;
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#ifndef I_NO_INLINES
#include <iaccel.inl>
#endif
#endif /* ifndef _IACCEL_ */