Definition at line 14 of file KeyBinder.h.
Public Member Functions | |
~KeyBinder () | |
void | addStroke (const KeyStroke &stroke, BaseMsg *msg) |
Bind keystroke. | |
void | removeStroke (const KeyStroke &stroke) |
void | keyDown (const SDL_keysym &keysym) const |
Handle keydown event, find keystroke and send message. |
|
Definition at line 18 of file KeyBinder.cpp. 00019 { 00020 t_strokes::iterator end = m_strokes.end(); 00021 for (t_strokes::iterator i = m_strokes.begin(); i != end; ++i) { 00022 delete i->second; 00023 } 00024 }
|
|
Bind keystroke.
Definition at line 33 of file KeyBinder.cpp. 00034 { 00035 std::pair<t_strokes::iterator,bool> status = 00036 m_strokes.insert( 00037 std::pair<KeyStroke,BaseMsg*>(stroke, msg)); 00038 if (!status.second) { 00039 throw LogicException(ExInfo("keystroke is occupied") 00040 .addInfo("keystroke", stroke.toString())); 00041 } 00042 else { 00043 LOG_DEBUG(ExInfo("binding keystroke") 00044 .addInfo("keystroke", stroke.toString()) 00045 .addInfo("msg", msg->toString())); 00046 } 00047 }
|
|
Handle keydown event, find keystroke and send message.
Definition at line 68 of file KeyBinder.cpp. 00069 { 00070 KeyStroke stroke(keysym); 00071 t_strokes::const_iterator it = m_strokes.find(stroke); 00072 if (m_strokes.end() != it) { 00073 it->second->sendClone(); 00074 } 00075 }
|
|
Definition at line 50 of file KeyBinder.cpp. 00051 { 00052 t_strokes::iterator it = m_strokes.find(stroke); 00053 if (m_strokes.end() != it) { 00054 delete it->second; 00055 m_strokes.erase(it); 00056 } 00057 else { 00058 LOG_WARNING(ExInfo("keystroke does not exist") 00059 .addInfo("keystroke", stroke.toString())); 00060 } 00061 }
|