00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIFE_EVENTCHANNEL_KEYEVENT_H
00023 #define FIFE_EVENTCHANNEL_KEYEVENT_H
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "eventchannel/base/ec_inputevent.h"
00037 #include "eventchannel/source/ec_ieventsource.h"
00038
00039 #include "ec_key.h"
00040
00041 namespace FIFE {
00042
00045 class KeyEvent: public InputEvent {
00046 public:
00047 enum KeyEventType {
00048 UNKNOWN = -1,
00049 PRESSED = 0,
00050 RELEASED
00051 };
00052
00055 KeyEvent():
00056 InputEvent(),
00057 m_eventtype(UNKNOWN),
00058 m_isnumericpad(false),
00059 m_key(Key()) {}
00060
00063 virtual ~KeyEvent() {}
00064
00065 KeyEventType getType() const { return m_eventtype; }
00066 void setType(KeyEventType type) { m_eventtype = type; }
00067
00068 bool isNumericPad() const { return m_isnumericpad; }
00069 void setNumericPad(bool ispad) { m_isnumericpad = ispad; }
00070
00071 const Key& getKey() const { return m_key; }
00072 void setKey(const Key& key) { m_key = key; }
00073
00074 virtual bool isAltPressed() const { return InputEvent::isAltPressed(); }
00075 virtual void setAltPressed(bool pressed) { InputEvent::setAltPressed(pressed); }
00076 virtual bool isControlPressed() const { return InputEvent::isControlPressed(); }
00077 virtual void setControlPressed(bool pressed) { InputEvent::setControlPressed(pressed); }
00078 virtual bool isMetaPressed() const { return InputEvent::isMetaPressed(); }
00079 virtual void setMetaPressed(bool pressed) { InputEvent::setMetaPressed(pressed); }
00080 virtual bool isShiftPressed() const { return InputEvent::isShiftPressed(); }
00081 virtual void setShiftPressed(bool pressed) { InputEvent::setShiftPressed(pressed); }
00082
00083 virtual void consume() { InputEvent::consume(); }
00084 virtual bool isConsumed() const { return InputEvent::isConsumed(); }
00085 virtual void consumedByWidgets() { InputEvent::consumedByWidgets(); }
00086 virtual bool isConsumedByWidgets() const { return InputEvent::isConsumedByWidgets(); }
00087 virtual IEventSource* getSource() { return InputEvent::getSource(); }
00088 virtual void setSource(IEventSource* source) { InputEvent::setSource(source); }
00089 virtual gcn::Widget* getSourceWidget() { return InputEvent::getSourceWidget(); }
00090 virtual void setSourceWidget(gcn::Widget* widget) { InputEvent::setSourceWidget(widget); }
00091 virtual int getTimeStamp() const { return InputEvent::getTimeStamp(); }
00092 virtual void setTimeStamp(int timestamp ) { InputEvent::setTimeStamp(timestamp); }
00093
00094 virtual const std::string& getName() const {
00095 const static std::string eventName("KeyEvent");
00096 return eventName;
00097 }
00098 virtual std::string getDebugString() const { return InputEvent::getDebugString(); }
00099
00100 private:
00101 KeyEventType m_eventtype;
00102 bool m_isnumericpad;
00103 Key m_key;
00104 };
00105
00106 }
00107
00108 #endif