home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscKeys.h -- generic #defines for key codes under NEXTSTEP
- // Written by Don Yacktman
- // Copyright (c) 1994 by Don Yacktman.
- // Version 1.0. All rights reserved.
- // This notice may not be removed from this source code.
- //
- // This source is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
-
- // For the symbol charset -- this is woefully incomplete!
- // The missing ones are interesting printing characters,
- // but are not likely to be entered off the keyboard like
- // the arrow keys are.
-
- #define MISC_UPARROW_KEY 0xAD
- #define MISC_DOWNARROW_KEY 0xAF
- #define MISC_LEFTARROW_KEY 0xAC
- #define MISC_RIGHTARROW_KEY 0xAE
-
- // Warning: These assume that theEvent is in fact a key
- // down/up event. If it is not, expect the unexpected.
-
- // Example:
- //
- // Do something is the event is a pressing of the up arrow key.
- // if (MISC_ISSYMBOL(theEvent, MISC_UPARROW)) { code; }
- //
- // If you're doing a lot of checks, these are NOT efficient.
- // You should look at the macro implementation and nest your
- // checks. For example, check first for no flags. Then have
- // one "if" for each charset. Inside the body for each if, test
- // the individual keys.
-
- #define MISC_ISKEY(theEvent, theSet, theCode) (!(theEvent->flags & \
- (NX_CONTROLMASK | NX_ALTERNATEMASK | NX_COMMANDMASK)) && \
- (theEvent->data.key.charSet == theSet) && \
- (theEvent->data.key.charCode == theCode))
-
- #define MISC_ISSYMBOL(theEvent, theCode) \
- MISC_ISKEY(theEvent, NX_SYMBOLSET, theCode)
-
- #define MISC_ISCHAR(theEvent, theCode) \
- MISC_ISKEY(theEvent, NX_ASCIISET, theCode)
-
-
- // -------------------------- Function Keys --------------------------
- // This is all for Intel hardware; it may or may not work on other HW...
- // Thanks to Greg Anderson for posting these codes to the USENET.
-
- #ifndef NX_FUNCTIONSET
- #define NX_FUNCTIONSET 254
- #endif
-
- #define MISC_F1_KEY 0x20
- #define MISC_HELP MISC_F1_KEY
- #define MISC_F2_KEY 0x21
- #define MISC_F3_KEY 0x22
- #define MISC_F4_KEY 0x23
- #define MISC_F5_KEY 0x24
- #define MISC_F6_KEY 0x25
- #define MISC_F7_KEY 0x26
- #define MISC_F8_KEY 0x27
- #define MISC_F9_KEY 0x28
- #define MISC_F10_KEY 0x29
- #define MISC_F11_KEY 0x2a
- #define MISC_F12_KEY 0x2b
-
- #define MISC_INSERT_KEY 0x2c
- #define MISC_DELETE_KEY 0x2d
- #define MISC_HOME_KEY 0x2e
- #define MISC_END_KEY 0x2f
- #define MISC_PAGEUP_KEY 0x30
- #define MISC_PAGEDOWN_KEY 0x31
- #define MISC_PRINT_KEY 0x32
- #define MISC_SCROLLLOCK_KEY 0x33
- #define MISC_PAUSE_KEY 0x34
-
- #define MISC_ISFUNCTION(theEvent, theCode) \
- MISC_ISKEY(theEvent, NX_FUNCTIONSET, theCode)
-