home *** CD-ROM | disk | FTP | other *** search
-
- // abstract.h.key
-
- // Dreamscape - C++ class library for RISC OS
- // Copyright (c) 1996 Mark Seaborn <mseaborn@argonet.co.uk>
- //
- // This library is free software; you can redistribute it and/or
- // modify it under the terms of the GNU Library General Public
- // License as published by the Free Software Foundation; either
- // version 2 of the License, or (at your option) any later version.
- // See the Dreamscape documentation for more information.
-
- #ifndef dreamscape_key_H
- #define dreamscape_key_H
-
- #include "stringt.h"
-
- class Key {
- unsigned code;
-
- public:
- Key(): code(0) {}
- Key(unsigned c): code(c) {}
-
- operator unsigned() const { return code; }
- Key &operator=(unsigned c) { code = c; return *this; }
-
- bool is_char() const
- { return (code >= 32 && code < 127) || (code >= 128 && code < 256); }
- char to_char() const { return is_char() ? code : 0; }
-
- String name() const; // Not implemented
-
- enum {
- // Function keys
- F1 = 0x181, F2 = 0x182, F3 = 0x183, F4 = 0x184, F5 = 0x185,
- F6 = 0x186, F7 = 0x187, F8 = 0x188, F9 = 0x189, F10 = 0x1CA,
- F11 = 0x1CB, F12 = 0x1CC,
-
- // Direction keys
- up = 0x18F, down = 0x18E, left = 0x18C, right = 0x18D,
- pageup = 0x19F, pagedown = 0x19E,
-
- // Other keys
- backspace = 0x8, enter = 0xD, escape = 0x1B, tab = 0x18A,
- print = 0x180, insert = 0x1CD, home = 0x1E,
- kdelete = 0x7F, copy = 0x18B, end = 0x18B,
-
- // Modifiers
- shift = 0x10, control = 0x20
- };
- };
-
- #endif
-