FIFE
2008.0
|
00001 /*************************************************************************** 00002 * Copyright (C) 2005-2008 by the FIFE team * 00003 * http://www.fifengine.de * 00004 * This file is part of FIFE. * 00005 * * 00006 * FIFE is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Lesser General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2.1 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * Lesser General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Lesser General Public * 00017 * License along with this library; if not, write to the * 00018 * Free Software Foundation, Inc., * 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00020 ***************************************************************************/ 00021 00022 #ifndef FIFE_EVENTCHANNEL_INPUTEVENT_H 00023 #define FIFE_EVENTCHANNEL_INPUTEVENT_H 00024 00025 // Standard C++ library includes 00026 // 00027 00028 // 3rd party library includes 00029 // 00030 00031 // FIFE includes 00032 // These includes are split up in two parts, separated by one empty line 00033 // First block: files included from the FIFE root src directory 00034 // Second block: files included from the same folder 00035 // 00036 #include "ec_event.h" 00037 00038 namespace FIFE { 00039 00042 class InputEvent: public Event { 00043 public: 00046 InputEvent(): 00047 Event(), 00048 m_consumedbywidgets(false), 00049 m_isshiftpressed(false), 00050 m_iscontrolpressed(false), 00051 m_isaltpressed(false), 00052 m_ismetapressed(false) {} 00053 00056 ~InputEvent() {} 00057 00060 virtual bool isAltPressed() const { return m_isaltpressed; } 00061 virtual void setAltPressed(bool pressed) { m_isaltpressed = pressed; } 00062 00065 virtual bool isControlPressed() const { return m_iscontrolpressed; } 00066 virtual void setControlPressed(bool pressed) { m_iscontrolpressed = pressed; } 00067 00070 virtual bool isMetaPressed() const { return m_ismetapressed; } 00071 virtual void setMetaPressed(bool pressed) { m_ismetapressed = pressed; } 00072 00075 virtual bool isShiftPressed() const { return m_isshiftpressed; } 00076 virtual void setShiftPressed(bool pressed) { m_isshiftpressed = pressed; } 00077 00080 virtual void consumedByWidgets() { m_consumedbywidgets = true; } 00081 virtual bool isConsumedByWidgets() const { return m_consumedbywidgets; } 00082 00083 virtual void consume() { Event::consume(); } 00084 virtual bool isConsumed() const { return Event::isConsumed(); } 00085 virtual IEventSource* getSource() { return Event::getSource(); } 00086 virtual void setSource(IEventSource* source) { Event::setSource(source); } 00087 virtual int getTimeStamp() const { return Event::getTimeStamp(); } 00088 virtual void setTimeStamp(int timestamp ) { Event::setTimeStamp(timestamp); } 00089 00090 virtual const std::string& getName() const { 00091 const static std::string eventName("InputEvent"); 00092 return eventName; 00093 } 00094 virtual std::string getDebugString() const { return Event::getDebugString(); } 00095 00096 virtual std::string getAttrStr() const { 00097 std::stringstream ss; 00098 ss << Event::getAttrStr() << std::endl; 00099 ss << "shift = " << m_isshiftpressed << ", "; 00100 ss << "ctrl = " << m_iscontrolpressed << ", "; 00101 ss << "alt = " << m_isaltpressed << ", "; 00102 ss << "meta = " << m_ismetapressed; 00103 return ss.str(); 00104 } 00105 00106 00107 private: 00108 bool m_consumedbywidgets; 00109 bool m_isshiftpressed; 00110 bool m_iscontrolpressed; 00111 bool m_isaltpressed; 00112 bool m_ismetapressed; 00113 }; 00114 } //FIFE 00115 00116 #endif