diff --git a/src/input.cpp b/src/input.cpp index 5ff0c3d..9da6e7e 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -200,7 +200,16 @@ std::vector Input::getActions() } /* context-related functions */ -void Input::updateKeyBindings(){ +std::vector Input::getContextsList() +{ + std::vector res; + for(auto context : m_contexts) + res.push_back(context.getName()); + return res; +} + +void Input::updateKeyBindings() +{ m_keybindings.clear(); for (auto iter= m_contexts.begin(); iter != m_contexts.end(); ++iter) m_keybindings[iter->getName()]= KeyBindings(*iter,m_keysmap); diff --git a/src/input.h b/src/input.h index 187e7d6..45d453d 100644 --- a/src/input.h +++ b/src/input.h @@ -55,6 +55,7 @@ public: /* general action-mapping functions */ void setKeysMap(IKeysMap km); //set bindings + IKeysMap getKeysMap(){return m_keysmap;} void updateEvents(); //handle the input and put the associated event in the file std::vector getActions(); //get the first action in the file of event @@ -62,6 +63,7 @@ public: void addContext(Context context){m_contexts.push_back(context); updateKeyBindings();} std::string getCurrentContext(){return m_current_context;} void setCurrentContext(std::string context_name){m_current_context = context_name;} + std::vector getContextsList(); void updateKeyBindings(); /* window-related function */ diff --git a/src/keybindings.h b/src/keybindings.h index fa97f35..65e0f57 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -42,6 +42,7 @@ public: enum {PRESSED, RELEASED, HOLD}; IKeysMap(); std::vector getBindings(Action action) const; + std::vector& data(){return keys;} protected: std::vector keys; };