ec_command.h

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_COMMAND_H
00023 #define FIFE_EVENTCHANNEL_COMMAND_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 "eventchannel/base/ec_event.h"
00037 #include "ec_commandids.h"
00038 
00039 namespace FIFE {
00040 
00044     class Command: public Event {
00045     public:
00048         Command(): 
00049             Event(),
00050             m_commandtype(CMD_UNKNOWN), 
00051             m_code(0) {}
00052 
00055         virtual ~Command() {}
00056 
00060         CommandType getCommandType() const { return m_commandtype; }
00061         void setCommandType(CommandType type) { m_commandtype = type; }
00062 
00066         int getCode() const { return m_code; }
00067         void setCode(int code) { m_code = code; }
00068 
00069         virtual void consume() { Event::consume(); }
00070         virtual bool isConsumed() const { return Event::isConsumed(); }
00071         virtual IEventSource* getSource() { return Event::getSource(); }
00072         virtual void setSource(IEventSource* source) { Event::setSource(source); }
00073         virtual gcn::Widget* getSourceWidget() { return Event::getSourceWidget(); }
00074         virtual void setSourceWidget(gcn::Widget* widget) { Event::setSourceWidget(widget); }
00075         virtual int getTimeStamp() const { return Event::getTimeStamp(); }
00076         virtual void setTimeStamp(int timestamp ) { Event::setTimeStamp(timestamp); }
00077 
00078         virtual const std::string& getName() const {
00079             const static std::string eventName("Command");
00080             return eventName;
00081         }
00082         virtual std::string getDebugString() const { return Event::getDebugString(); }
00083 
00084 
00085     private:
00086         CommandType m_commandtype;
00087         int m_code;
00088         void* m_data1;
00089         void* m_data2;
00090     };
00091 } //FIFE
00092 
00093 #endif
Generated by  doxygen 1.6.2-20100208