2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2007-03-17 00:07:34 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-03-17 01:11:46 +00:00
|
|
|
#if !defined(BACKEND_EVENTS_DEFAULT_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER)
|
|
|
|
#define BACKEND_EVENTS_DEFAULT_H
|
2007-03-17 00:07:34 +00:00
|
|
|
|
|
|
|
#include "common/events.h"
|
2009-01-11 00:20:27 +00:00
|
|
|
#include "common/queue.h"
|
2008-12-25 20:40:00 +00:00
|
|
|
|
2008-07-24 10:00:56 +00:00
|
|
|
namespace Common {
|
2008-09-30 13:51:01 +00:00
|
|
|
#ifdef ENABLE_KEYMAPPER
|
2008-08-13 19:24:52 +00:00
|
|
|
class Keymapper;
|
2008-09-30 13:51:01 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_VKEYBD
|
2008-07-24 10:00:56 +00:00
|
|
|
class VirtualKeyboard;
|
2008-09-30 13:51:01 +00:00
|
|
|
#endif
|
2008-07-24 10:00:56 +00:00
|
|
|
}
|
2007-03-17 00:07:34 +00:00
|
|
|
|
2009-01-11 00:20:27 +00:00
|
|
|
|
2009-07-25 01:00:12 +00:00
|
|
|
class DefaultEventManager : public Common::EventManager, Common::EventObserver {
|
2008-09-30 13:51:01 +00:00
|
|
|
#ifdef ENABLE_VKEYBD
|
2008-07-07 15:42:26 +00:00
|
|
|
Common::VirtualKeyboard *_vk;
|
2008-09-30 13:51:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_KEYMAPPER
|
2008-08-06 14:21:05 +00:00
|
|
|
Common::Keymapper *_keymapper;
|
2008-08-13 19:24:52 +00:00
|
|
|
bool _remap;
|
2008-09-30 13:51:01 +00:00
|
|
|
#endif
|
2008-07-07 14:30:11 +00:00
|
|
|
|
2009-07-25 01:01:05 +00:00
|
|
|
Common::ArtificialEventSource _artificialEventSource;
|
2008-07-09 13:33:36 +00:00
|
|
|
|
2009-07-25 01:00:12 +00:00
|
|
|
Common::Queue<Common::Event> _eventQueue;
|
|
|
|
bool notifyEvent(const Common::Event &ev) {
|
|
|
|
_eventQueue.push(ev);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-03-17 00:07:34 +00:00
|
|
|
Common::Point _mousePos;
|
|
|
|
int _buttonState;
|
|
|
|
int _modifierState;
|
|
|
|
bool _shouldQuit;
|
2008-07-02 00:30:49 +00:00
|
|
|
bool _shouldRTL;
|
2009-01-02 01:21:38 +00:00
|
|
|
bool _confirmExitDialogActive;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-03-17 15:44:26 +00:00
|
|
|
// for continuous events (keyDown)
|
|
|
|
enum {
|
|
|
|
kKeyRepeatInitialDelay = 400,
|
|
|
|
kKeyRepeatSustainDelay = 100
|
|
|
|
};
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint16 ascii;
|
|
|
|
byte flags;
|
|
|
|
int keycode;
|
|
|
|
} _currentKeyDown;
|
|
|
|
uint32 _keyRepeatTime;
|
2007-03-17 00:07:34 +00:00
|
|
|
public:
|
2009-07-25 00:59:03 +00:00
|
|
|
DefaultEventManager(Common::EventSource *boss);
|
2007-09-19 13:55:05 +00:00
|
|
|
~DefaultEventManager();
|
2007-03-17 00:07:34 +00:00
|
|
|
|
2008-08-18 10:07:11 +00:00
|
|
|
virtual void init();
|
2007-03-17 19:02:05 +00:00
|
|
|
virtual bool pollEvent(Common::Event &event);
|
2008-07-21 18:53:55 +00:00
|
|
|
virtual void pushEvent(const Common::Event &event);
|
2007-03-17 00:07:34 +00:00
|
|
|
|
|
|
|
virtual Common::Point getMousePos() const { return _mousePos; }
|
|
|
|
virtual int getButtonState() const { return _buttonState; }
|
|
|
|
virtual int getModifierState() const { return _modifierState; }
|
|
|
|
virtual int shouldQuit() const { return _shouldQuit; }
|
2008-07-02 00:30:49 +00:00
|
|
|
virtual int shouldRTL() const { return _shouldRTL; }
|
|
|
|
virtual void resetRTL() { _shouldRTL = false; }
|
2009-07-12 05:35:56 +00:00
|
|
|
#ifdef FORCE_RTL
|
|
|
|
virtual void resetQuit() { _shouldQuit = false; }
|
|
|
|
#endif
|
2009-05-24 15:17:42 +00:00
|
|
|
|
2008-09-30 13:51:01 +00:00
|
|
|
#ifdef ENABLE_KEYMAPPER
|
2008-08-06 14:21:05 +00:00
|
|
|
virtual Common::Keymapper *getKeymapper() { return _keymapper; }
|
2008-09-30 13:51:01 +00:00
|
|
|
#endif
|
2007-03-17 00:07:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|