Add support for actions triggered by key combination
Change-Id: I9dfa7de40229f00412d63fc9c1eb3a809a6eb2e6
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 4942cd7..0241715 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -25,6 +25,7 @@
#include <vector>
#include <string>
#include <map>
+#include <set>
#include <time.h>
extern "C" {
@@ -101,7 +102,7 @@
// 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:
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 @@
};
std::vector<Action> mActions;
- int mKey;
+ std::map<int, bool> mKeys;
protected:
int getKeyByName(std::string key);
@@ -927,6 +928,11 @@
virtual int KeyDown(int key_code);
virtual int KeyUp(int key_code);
virtual int KeyRepeat(void);
+
+ void ConsumeKeyRelease(int key);
+
+private:
+ std::set<int> mPressedKeys;
};
class GUISliderValue: public GUIObject, public RenderObject, public ActionObject