From e532af93180c53a80bd4a7e96ab42e7e67e13e97 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 8 Sep 2011 23:04:28 -0400 Subject: PEGASUS: Add and hookup the InputHandler class --- engines/pegasus/input.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'engines/pegasus/input.h') diff --git a/engines/pegasus/input.h b/engines/pegasus/input.h index 463e3d024b..432ff8098b 100755 --- a/engines/pegasus/input.h +++ b/engines/pegasus/input.h @@ -368,6 +368,52 @@ protected: Common::Point _inputLocation; }; +class InputHandler { +public: + static InputHandler *setInputHandler(InputHandler*); + static InputHandler *getCurrentHandler() { return _inputHandler; } + static InputDevice *getCurrentInputDevice() { return &_inputDevice; } + static void pollForInput(); + static void getInput(Input&, Hotspot*&); + static void readInputDevice(Input&); + static void invalHotspots() { _invalHotspots = true; } + static tInputBits getCurrentFilter() { return _lastFilter; } + + InputHandler(InputHandler*); + virtual ~InputHandler(); + + virtual void setNextHandler(InputHandler *nextHandler) { _nextHandler = nextHandler; } + virtual InputHandler *getNextHandler() { return _nextHandler; } + + virtual void handleInput(const Input&, const Hotspot*); + virtual void clickInHotspot(const Input&, const Hotspot*); + + virtual void activateHotspots(); + virtual void updateCursor(const Common::Point, const Hotspot*); + virtual bool isClickInput(const Input&, const Hotspot*); + virtual bool wantsCursor(); + + virtual bool releaseInputFocus() { return true; } + virtual void grabInputFocus() {} + + // This returns bits set for what kinds of input to accept. + virtual tInputBits getInputFilter(); + + // This returns bits defining what input constitutes a "click." + virtual tInputBits getClickFilter(); + + virtual void allowInput(const bool allow) { _allowInput = allow; } + +protected: + static InputHandler *_inputHandler; + static InputDevice _inputDevice; // TODO: Remove global constructor + static bool _invalHotspots; + static tInputBits _lastFilter; + + InputHandler *_nextHandler; + bool _allowInput; +}; + } // End of namespace Pegasus #endif -- cgit v1.2.3