home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-11 | 716 b | 40 lines | [TEXT/CWIE] |
- //
- // CGetKeys.h
- //
- // A class the encapsulates the GetKeys() toolbox call.
- // Allows the testing of many keys with only one call to GetKeys().
- //
- // by James Jennings
- // July 11, 1996
- // Events.h
-
- #pragma once
-
- enum EKeyCode {
- code_Command = 0x37,
- code_Shift = 0x38,
- code_ShiftLock = 0x39,
- code_Option = 0x3A,
- code_Control = 0x3B,
-
- code_LeftArrow = 0x7B,
- code_RightArrow = 0x7C,
- code_UpArrow = 0x7E,
- code_DownArrow = 0x7D
- };
-
- class CGetKeys {
- public:
- CGetKeys() { ::GetKeys( mKeys ); }
- Boolean IsDown( Char16 inKeyCode );
- protected:
- KeyMap mKeys;
- };
-
- inline
- Boolean CGetKeys::IsDown( Char16 inKeyCode )
- {
- return (BitTst(((char*) &mKeys) + inKeyCode / 8, (long) 7 - (inKeyCode % 8) ) );
- }
-
-