home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Headers / misckit / MiscKeys.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-21  |  2.7 KB  |  84 lines

  1. //
  2. //    MiscKeys.h -- generic #defines for key codes under NEXTSTEP
  3. //        Written by Don Yacktman
  4. //        Copyright (c) 1994 by Don Yacktman.
  5. //                Version 1.0.  All rights reserved.
  6. //        This notice may not be removed from this source code.
  7. //
  8. //    This source is included in the MiscKit by permission from the author
  9. //    and its use is governed by the MiscKit license, found in the file
  10. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  11. //    for a list of all applicable permissions and restrictions.
  12. //    
  13.  
  14. // For the symbol charset -- this is woefully incomplete!
  15. // The missing ones are interesting printing characters,
  16. // but are not likely to be entered off the keyboard like
  17. // the arrow keys are.
  18.  
  19. #define MISC_UPARROW_KEY 0xAD
  20. #define MISC_DOWNARROW_KEY 0xAF
  21. #define MISC_LEFTARROW_KEY 0xAC
  22. #define MISC_RIGHTARROW_KEY 0xAE
  23.  
  24. // Warning:  These assume that theEvent is in fact a key
  25. // down/up event.  If it is not, expect the unexpected.
  26.  
  27. // Example:
  28. //
  29. // Do something is the event is a pressing of the up arrow key.
  30. // if (MISC_ISSYMBOL(theEvent, MISC_UPARROW)) { code; }
  31. //
  32. // If you're doing a lot of checks, these are NOT efficient.
  33. // You should look at the macro implementation and nest your
  34. // checks.  For example, check first for no flags.  Then have
  35. // one "if" for each charset.  Inside the body for each if, test
  36. // the individual keys.
  37.  
  38. #define MISC_ISKEY(theEvent, theSet, theCode)    (!(theEvent->flags & \
  39.         (NX_CONTROLMASK | NX_ALTERNATEMASK | NX_COMMANDMASK)) && \
  40.         (theEvent->data.key.charSet == theSet) && \
  41.         (theEvent->data.key.charCode == theCode))
  42.  
  43. #define MISC_ISSYMBOL(theEvent, theCode)    \
  44.         MISC_ISKEY(theEvent, NX_SYMBOLSET, theCode)
  45.  
  46. #define MISC_ISCHAR(theEvent, theCode)    \
  47.         MISC_ISKEY(theEvent, NX_ASCIISET, theCode)
  48.  
  49.  
  50. // -------------------------- Function Keys --------------------------
  51. // This is all for Intel hardware; it may or may not work on other HW...
  52. // Thanks to Greg Anderson for posting these codes to the USENET.
  53.  
  54. #ifndef NX_FUNCTIONSET
  55. #define NX_FUNCTIONSET 254
  56. #endif
  57.  
  58. #define MISC_F1_KEY 0x20
  59. #define MISC_HELP MISC_F1_KEY
  60. #define MISC_F2_KEY 0x21
  61. #define MISC_F3_KEY 0x22
  62. #define MISC_F4_KEY 0x23
  63. #define MISC_F5_KEY 0x24
  64. #define MISC_F6_KEY 0x25
  65. #define MISC_F7_KEY 0x26
  66. #define MISC_F8_KEY 0x27
  67. #define MISC_F9_KEY 0x28
  68. #define MISC_F10_KEY 0x29
  69. #define MISC_F11_KEY 0x2a
  70. #define MISC_F12_KEY 0x2b
  71.  
  72. #define MISC_INSERT_KEY 0x2c
  73. #define MISC_DELETE_KEY 0x2d
  74. #define MISC_HOME_KEY 0x2e
  75. #define MISC_END_KEY 0x2f
  76. #define MISC_PAGEUP_KEY 0x30
  77. #define MISC_PAGEDOWN_KEY 0x31
  78. #define MISC_PRINT_KEY 0x32
  79. #define MISC_SCROLLLOCK_KEY 0x33
  80. #define MISC_PAUSE_KEY 0x34
  81.  
  82. #define MISC_ISFUNCTION(theEvent, theCode)    \
  83.         MISC_ISKEY(theEvent, NX_FUNCTIONSET, theCode)
  84.