home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / dreamscape / source / Dreamscape / Headers / abstract / h / key < prev    next >
Encoding:
Text File  |  1996-09-06  |  1.4 KB  |  55 lines

  1.  
  2. // abstract.h.key
  3.  
  4. // Dreamscape - C++ class library for RISC OS
  5. // Copyright (c) 1996 Mark Seaborn <mseaborn@argonet.co.uk>
  6. //
  7. // This library is free software; you can redistribute it and/or
  8. // modify it under the terms of the GNU Library General Public
  9. // License as published by the Free Software Foundation; either
  10. // version 2 of the License, or (at your option) any later version.
  11. // See the Dreamscape documentation for more information.
  12.  
  13. #ifndef dreamscape_key_H
  14. #define dreamscape_key_H
  15.  
  16. #include "stringt.h"
  17.  
  18. class Key {
  19.   unsigned code;
  20.  
  21. public:
  22.   Key(): code(0) {}
  23.   Key(unsigned c): code(c) {}
  24.  
  25.   operator unsigned() const { return code; }
  26.   Key &operator=(unsigned c) { code = c; return *this; }
  27.  
  28.   bool is_char() const
  29.     { return (code >= 32 && code < 127) || (code >= 128 && code < 256); }
  30.   char to_char() const { return is_char() ? code : 0; }
  31.  
  32.   String name() const; // Not implemented
  33.  
  34.   enum {
  35.     // Function keys
  36.     F1 = 0x181, F2 = 0x182, F3 = 0x183, F4 = 0x184, F5 = 0x185,
  37.     F6 = 0x186, F7 = 0x187, F8 = 0x188, F9 = 0x189, F10 = 0x1CA,
  38.     F11 = 0x1CB, F12 = 0x1CC,
  39.  
  40.     // Direction keys
  41.     up = 0x18F, down = 0x18E, left = 0x18C, right = 0x18D,
  42.     pageup = 0x19F, pagedown = 0x19E,
  43.  
  44.     // Other keys
  45.     backspace = 0x8, enter = 0xD, escape = 0x1B, tab = 0x18A,
  46.     print = 0x180, insert = 0x1CD, home = 0x1E,
  47.     kdelete = 0x7F, copy = 0x18B, end = 0x18B,
  48.  
  49.     // Modifiers
  50.     shift = 0x10, control = 0x20
  51.   };
  52. };
  53.  
  54. #endif
  55.