Moved ArtificialEventSource to common/events.h.

svn-id: r42726
This commit is contained in:
Johannes Schickel 2009-07-25 01:00:47 +00:00
parent 141ded3063
commit eeaafdf4ee

View File

@ -158,6 +158,36 @@ public:
virtual bool allowMapping() const { return true; }
};
/**
* An artificial event source. This is class is used as an event source, which is
* made up by client specific events.
*
* Example usage cases for this are the Keymapper or the DefaultEventManager.
*/
class ArtificialEventSource : public EventSource {
protected:
Common::Queue<Common::Event> _artificialEventQueue;
public:
void addEvent(const Common::Event &ev) {
_artificialEventQueue.push(ev);
}
bool pollEvent(Common::Event &ev) {
if (!_artificialEventQueue.empty()) {
ev = _artificialEventQueue.pop();
return true;
} else {
return false;
}
}
/**
* By default an artificial event source prevents its events
* from being mapped.
*/
virtual bool allowMapping() const { return false; }
};
/**
* Object which catches and processes Events.
*