Go to the documentation of this file.00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 #include "vgui_key.h"
00006 #include <vcl_iostream.h>
00007
00008
00009
00010
00011
00012
00013 vgui_key vgui_key_CTRL(int character)
00014 {
00015 if (character >= 'A' && character <= 'Z')
00016 return vgui_key(character - '@');
00017 else
00018 return vgui_key(character - 'a' + 'A' - '@');
00019 }
00020
00021
00022 vcl_ostream& operator<<(vcl_ostream& s, vgui_key k)
00023 {
00024 int ik = int(k);
00025 s << ik << '/';
00026 if (ik < 0)
00027 return s << "[Bad key, code " << ik << "]";
00028 else if (ik < 27)
00029 return s << "^" << char(ik + '@');
00030 else if (ik < 256)
00031 return s << char(ik);
00032 else if (ik >= vgui_F1 && ik <= vgui_INSERT) {
00033 static char const* names[] = {
00034 "F1", "F2" , "F3" , "F4" ,
00035 "F5", "F6" , "F7" , "F8" ,
00036 "F9", "F10", "F11", "F12",
00037 "CURSOR_LEFT", "CURSOR_UP", "CURSOR_RIGHT",
00038 "CURSOR_DOWN",
00039 "PAGE_UP", "PAGE_DOWN",
00040 "HOME", "END",
00041 "DELETE", "INSERT"
00042 };
00043 return s << names[ik - int(vgui_F1)];
00044 } else
00045 return s << "[Bad key, code " << ik << "]";
00046 }