| 1 |
/*************************************************************************** |
| 2 |
* Copyright (C) 2005-2019 by the FIFE team * |
| 3 |
* http://www.fifengine.net * |
| 4 |
* This file is part of FIFE. * |
| 5 |
* * |
| 6 |
* FIFE is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Lesser General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2.1 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 14 |
* Lesser General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Lesser General Public * |
| 17 |
* License along with this library; if not, write to the * |
| 18 |
* Free Software Foundation, Inc., * |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
| 20 |
***************************************************************************/ |
| 21 |
|
| 22 |
#ifndef FIFE_EVENTCHANNEL_DROPEVENT_H |
| 23 |
#define FIFE_EVENTCHANNEL_DROPEVENT_H |
| 24 |
|
| 25 |
// Standard C++ library includes |
| 26 |
// |
| 27 |
|
| 28 |
// 3rd party library includes |
| 29 |
// |
| 30 |
|
| 31 |
// FIFE includes |
| 32 |
// These includes are split up in two parts, separated by one empty line |
| 33 |
// First block: files included from the FIFE root src directory |
| 34 |
// Second block: files included from the same folder |
| 35 |
// |
| 36 |
#include "eventchannel/base/inputevent.h" |
| 37 |
#include "eventchannel/source/ieventsource.h" |
| 38 |
|
| 39 |
namespace FIFE { |
| 40 |
|
| 41 |
/** Class for drop events |
| 42 |
*/ |
| 43 |
class DropEvent: public InputEvent { |
| 44 |
public: |
| 45 |
|
| 46 |
/** Constructor |
| 47 |
*/ |
| 48 |
DropEvent(): |
| 49 |
InputEvent(), |
| 50 |
m_path("") {} |
| 51 |
|
| 52 |
/** Destructor. |
| 53 |
*/ |
| 54 |
virtual ~DropEvent() {} |
| 55 |
|
| 56 |
/** Gets the path for the file that is droped. |
| 57 |
*/ |
| 58 |
const std::string& getPath() const { return m_path; } |
| 59 |
|
| 60 |
/** Sets the path for the file that is droped. |
| 61 |
*/ |
| 62 |
void setPath(const std::string& path) { m_path = path; } |
| 63 |
|
| 64 |
/** Marks events as consumed. |
| 65 |
*/ |
| 66 |
virtual void consume() { InputEvent::consume(); } |
| 67 |
|
| 68 |
/** Checks whether event is consumed. |
| 69 |
*/ |
| 70 |
virtual bool isConsumed() const { return InputEvent::isConsumed(); } |
| 71 |
|
| 72 |
/** Marks events as consumed by widget library. |
| 73 |
*/ |
| 74 |
virtual void consumedByWidgets() { InputEvent::consumedByWidgets(); } |
| 75 |
|
| 76 |
/** Checks whether event is consumed by widget library. |
| 77 |
*/ |
| 78 |
virtual bool isConsumedByWidgets() const { return InputEvent::isConsumedByWidgets(); } |
| 79 |
|
| 80 |
/** Gets the source of the event. |
| 81 |
*/ |
| 82 |
virtual IEventSource* getSource() const { return InputEvent::getSource(); } |
| 83 |
|
| 84 |
/** Sets the source of the event. |
| 85 |
*/ |
| 86 |
virtual void setSource(IEventSource* source) { InputEvent::setSource(source); } |
| 87 |
|
| 88 |
/** Gets the timestamp of the event. |
| 89 |
*/ |
| 90 |
virtual int32_t getTimeStamp() const { return InputEvent::getTimeStamp(); } |
| 91 |
|
| 92 |
/** Sets the timestamp of the event. |
| 93 |
*/ |
| 94 |
virtual void setTimeStamp(int32_t timestamp ) { InputEvent::setTimeStamp(timestamp); } |
| 95 |
|
| 96 |
/** Gets the name of the event. |
| 97 |
*/ |
| 98 |
virtual const std::string& getName() const { |
| 99 |
const static std::string eventName("DropEvent"); |
| 100 |
return eventName; |
| 101 |
} |
| 102 |
|
| 103 |
/** Gets the debugstring of the event. |
| 104 |
*/ |
| 105 |
virtual std::string getDebugString() const { return InputEvent::getDebugString(); } |
| 106 |
|
| 107 |
private: |
| 108 |
std::string m_path; |
| 109 |
}; |
| 110 |
|
| 111 |
} //FIFE |
| 112 |
|
| 113 |
#endif |