ScummVM API documentation
eventhandler.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ASYLUM_EVENTHANDLER_H
23 #define ASYLUM_EVENTHANDLER_H
24 
25 #include "common/func.h"
26 #include "common/events.h"
27 
28 namespace Asylum {
29 
30 enum AsylumEventType {
31  EVENT_ASYLUM_MIDI = 953,
32  EVENT_ASYLUM_CHANGECD = 5120,
33  EVENT_ASYLUM_INIT = 5122,
34  EVENT_ASYLUM_UPDATE = 5121,
35  EVENT_ASYLUM_DEINIT = 5123,
36  EVENT_ASYLUM_CURSOR = 5124,
37  EVENT_ASYLUM_SUBTITLE = 5125,
38  EVENT_ASYLUM_MUSIC = 5376,
39 
40  EVENT_ASYLUM_ACTIVATE = 0xFFF0
41 };
42 
43 struct AsylumEvent : public Common::Event {
44  AsylumEvent() : Event() {
45  param1 = 0;
46  param2 = 0;
47  }
48 
49  // Since we don't feed any custom message into the event manager,
50  // we can safely use our own custom event type.
51  AsylumEvent(AsylumEventType msgType, int32 p1 = 0, int32 p2 = 0) : Event() {
52  type = (Common::EventType)msgType;
53  param1 = p1;
54  param2 = p2;
55  }
56 
57  int32 param1;
58  int32 param2;
59 };
60 
61 class EventHandler {
62 public:
63  virtual ~EventHandler() {}
64 
65  virtual bool handleEvent(const AsylumEvent &ev) = 0;
66 };
67 
68 } // End of namespace Asylum
69 
70 #endif // ASYLUM_EVENTHANDLER_H
Definition: asylum.h:53
EventType
Definition: events.h:48
Definition: eventhandler.h:43
Definition: events.h:198
Definition: eventhandler.h:61
EventType type
Definition: events.h:201