home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IKEYEVT.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
11KB
|
191 lines
#ifndef _IKEYEVT_
#define _IKEYEVT_
/*******************************************************************************
* FILE NAME: ikeyevt.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IKeyboardEvent - represents a keyboard-related event *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IEVENT_
#include <ievent.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
// Forward declarations for other classes:
class IString;
class IKeyboardEvent : public IEvent {
typedef IEvent
Inherited;
/*******************************************************************************
* The IKeyboardEvent class represents a keyboard-related event. An *
* IKeyboardEvent object is created by a keyboard handler when a user presses *
* or releases a key. *
* *
* Keyboard events are first dispatched to the window with the input focus, *
* such as an entry field with the input cursor. If that window does not *
* process the keyboard event, the event is dispatched to the owner window of *
* the focus window. The event continues to be dispatched to the next owner *
* window until a handler stops the processing or a window processes the *
* keystroke itself. For example, an entry field processes character keys, *
* but it will not process a Tab key, so the Tab key is passed on to its owner *
* window. *
*******************************************************************************/
public:
/*------------------------ Constructor/Destructor ------------------------------
| The only way to construct instances of this class is from an instance of |
| the IEvent class. |
------------------------------------------------------------------------------*/
IKeyboardEvent ( IEvent& event );
virtual
~IKeyboardEvent ( );
/*--------------------------------- Testing ------------------------------------
| These functions should be called to determine the type of data stored in |
| the event: |
| isCharacter - Returns whether the event represents use of a data |
| key. |
| isScanCode - Returns whether a hardware scan code is available. |
| isVirtual - Returns whether the event represents use of a |
| virtual key. |
| isUpTransition - Returns whether a previously pressed key is being |
| released. |
| isRepeat - Returns whether a key has been previously pressed |
| and is being held down. |
| isUncombined - Returns whether this key is being pressed without |
| any other keys being pressed. |
| isShiftDown - Returns whether the Shift key is being held down. |
| isCtrlDown - Returns whether the Ctrl key is being held down. |
| isAltDown - Returns whether the Alt key is being held down. |
| isForComposite - Returns whether the character is a dead key, such as |
| an accent, which is to be combined with the next |
| character. |
| isComposite - Returns whether the character is formed by combining |
| this key with the previous dead key. |
| isInvalidComposite - Returns whether the character is not valid to be |
| combined with the previous dead key. |
------------------------------------------------------------------------------*/
Boolean
isCharacter ( ) const,
isScanCode ( ) const,
isVirtual ( ) const,
isUpTransition ( ) const,
isRepeat ( ) const,
isUncombined ( ) const,
isShiftDown ( ) const,
isCtrlDown ( ) const,
isAltDown ( ) const,
isForComposite ( ) const,
isComposite ( ) const,
isInvalidComposite ( ) const;
/*-------------------------------- Accessors -----------------------------------
| These functions provide means of querying values from instances of this |
| class: |
| character - Returns the character data of the key if it is a |
| single-byte character. Before calling this function, |
| you should first verify that the event contains |
| character data by calling the isCharacter function. The |
| mixedCharacter function should be used if double-byte |
| data is expected. |
| mixedCharacter - Returns the character data of the key, whether it is |
| single- or double-byte character. Before calling this |
| function, you should first verify that the event |
| contains character data by calling the isCharacter |
| function. |
| scanCode - Returns the hardware scan code of the key. Before |
| calling this function, you should first verify that the |
| event contains a scan code by calling the isScanCode |
| function. |
| VirtualKey - Enumeration that lists the possible virtual keys that |
| can be returned from the virtualKey function. |
| virtualKey - Returns the virtual key code of the key. Before calling |
| this function, you should first verify that the event |
| contains a virtual key code by calling the isVirtual |
| function. |
| repeatCount - Returns the number of repeated keys combined into this |
| event. |
------------------------------------------------------------------------------*/
char
character ( ) const;
IString
mixedCharacter ( ) const;
unsigned long
scanCode ( ) const;
enum VirtualKey
{
esc, tab, backTab, space, backSpace, enter, newLine,
shift, ctrl, altGraf, insert, deleteKey, home, end,
pageUp, pageDown, left, right, up, down,
capsLock, numLock, scrollLock, pause, sysRq, breakKey,
f2, f3, f4, f5, f6, f7, f8, f9, f11, f12,
f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24,
button1, button2, button3, endDrag,
firstDBCS, lastDBCS, firstUser, lastUser,
other
};
VirtualKey
virtualKey ( ) const;
unsigned long
repeatCount ( ) const;
protected:
/*------------------------------ Implementation --------------------------------
| These static flags are used to test corresponding flags in the key event. |
| ulCharacterFlag - Used to implement the isCharacter check. |
| ulScanCodeFlag - Used to implement the isScanCode check. |
| ulVirtualFlag - Used to implement the isVirtual check. |
| ulUpTransitionFlag - Used to implement the isUpTransition check. |
| ulRepeatFlag - Used to implement the isRepeat check. |
| ulUncombinedFlag - Used to implement the isUncombined check. |
| ulShiftFlag - Used to implement the isShiftDown check. |
| ulCtrlFlag - Used to implement the isCtrlDown check. |
| ulAltFlag - Used to implement the isAltDown check. |
| ulForCompositeFlag - Used to implement the isForComposite check. |
| ulCompositeFlag - Used to implement the isComposite check. |
| ulInvalidCompositeFlag - Used to implement the isInvalidComposite check. |
------------------------------------------------------------------------------*/
static const unsigned long
ulCharacterFlag,
ulScanCodeFlag,
ulVirtualFlag,
ulUpTransitionFlag,
ulRepeatFlag,
ulUncombinedFlag,
ulShiftFlag,
ulCtrlFlag,
ulAltFlag,
ulForCompositeFlag,
ulCompositeFlag,
ulInvalidCompositeFlag;
}; // IKeyboardEvent
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
/*----------------------------- Inline Functions -----------------------------*/
#ifndef I_NO_INLINES
#include <ikeyevt.inl>
#endif
#endif /* _IKEYEVT_ */