00001 #ifndef HEADER_KEYSTROKE_H
00002 #define HEADER_KEYSTROKE_H
00003
00004 #include "SDL.h"
00005 #include <string>
00006
00007
00008
00009
00010 class KeyStroke {
00011 private:
00012 static const int STROKE_IGNORE = ~(KMOD_CTRL|KMOD_ALT);
00013 SDLKey m_sym;
00014 int m_mod;
00015 Uint16 m_unicode;
00016 private:
00017 static int modStrip(int mod);
00018 public:
00019 KeyStroke(const SDL_keysym &keysym);
00020 KeyStroke(SDLKey sym, int mod);
00021
00022 SDLKey getKey() const { return m_sym; }
00023 Uint16 getUnicode() const { return m_unicode; }
00024 bool less(const KeyStroke &other) const;
00025 bool equals(const KeyStroke &other) const;
00026 std::string toString() const;
00027 };
00028
00029
00030
00031
00032 struct stroke_less
00033 {
00034 bool operator()(const KeyStroke &left, const KeyStroke &right) const
00035 {
00036 return left.less(right);
00037 }
00038 };
00039
00040 #endif