aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-07-25 01:00:47 +0000
committerJohannes Schickel2009-07-25 01:00:47 +0000
commiteeaafdf4ee012df99b5f4d0ea5b394ad81e1e23c (patch)
tree4aba8141e195de190a01a7422dd94f43891f745e
parent141ded3063adaee202e4a87ce987d35fba041faf (diff)
downloadscummvm-rg350-eeaafdf4ee012df99b5f4d0ea5b394ad81e1e23c.tar.gz
scummvm-rg350-eeaafdf4ee012df99b5f4d0ea5b394ad81e1e23c.tar.bz2
scummvm-rg350-eeaafdf4ee012df99b5f4d0ea5b394ad81e1e23c.zip
Moved ArtificialEventSource to common/events.h.
svn-id: r42726
-rw-r--r--common/events.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/common/events.h b/common/events.h
index 484ccec5f0..4f060a6da7 100644
--- a/common/events.h
+++ b/common/events.h
@@ -159,6 +159,36 @@ public:
};
/**
+ * 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.
*
* An example for this is the Engine object, it is catching events and processing them.