From 0b7fe504dc93246957aee38c0d93ea1fa1580fab Mon Sep 17 00:00:00 2001 From: Vojtech Bocek Date: Thu, 13 Mar 2014 17:36:52 +0100 Subject: Add support for actions triggered by key combination Change-Id: I9dfa7de40229f00412d63fc9c1eb3a809a6eb2e6 Signed-off-by: Vojtech Bocek --- gui/objects.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gui/objects.hpp') diff --git a/gui/objects.hpp b/gui/objects.hpp index 4942cd7e6..02417154a 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include extern "C" { @@ -101,7 +102,7 @@ public: // NotifyKey - Notify of a key press // Return 0 on success (and consume key), >0 to pass key to next handler, and <0 on error - virtual int NotifyKey(int key) { return 1; } + virtual int NotifyKey(int key, bool down) { return 1; } // GetRenderPos - Returns the current position of the object virtual int GetActionPos(int& x, int& y, int& w, int& h) { x = mActionX; y = mActionY; w = mActionW; h = mActionH; return 0; } @@ -269,7 +270,7 @@ public: public: virtual int NotifyTouch(TOUCH_STATE state, int x, int y); - virtual int NotifyKey(int key); + virtual int NotifyKey(int key, bool down); virtual int NotifyVarChange(const std::string& varName, const std::string& value); virtual int doActions(); @@ -282,7 +283,7 @@ protected: }; std::vector mActions; - int mKey; + std::map mKeys; protected: int getKeyByName(std::string key); @@ -927,6 +928,11 @@ public: virtual int KeyDown(int key_code); virtual int KeyUp(int key_code); virtual int KeyRepeat(void); + + void ConsumeKeyRelease(int key); + +private: + std::set mPressedKeys; }; class GUISliderValue: public GUIObject, public RenderObject, public ActionObject -- cgit v1.2.3