00001
00019 #ifndef KEYBOARD_H
00020 #define KEYBOARD_H
00021
00022 #include <map>
00023 #include <Vector.H>
00024 #include <UserInterface.H>
00025
00026 namespace xchen
00027 {
00028
00029 class UI :: KeyBoard
00030 {
00031 typedef map<KeyValue, pair<KeyEventCB, ConvertedKeyValue>, less<int> > KeyActionMap;
00032 public:
00033 static void null_cb(ConvertedKeyValue k, int x, int y) { }
00034 static void keyboard(unsigned char key, int x, int y);
00035 public:
00036 KeyBoard() : cur_generated_key(255) { }
00037
00038 void PrintRegisteredKey() const;
00039
00040 void operator()(KeyValue key, int x=-1, int y=-1);
00041 KeyValue Insert(KeyEventCB cb, KeyValue key, ConvertedKeyValue key_prime);
00042 KeyValue Insert(KeyEventCB cb, KeyValue key) { return Insert(cb, key, key); }
00043
00044 private:
00045 KeyActionMap key_action_map;
00046 KeyValue cur_generated_key;
00047 };
00048 }
00049
00050 #endif
00051