From f809b80a688b8cd0a5a8bcb578d4cce1562fff5e Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 31 Oct 2020 14:18:09 +0200 Subject: Preferences: Basic key bindings UI One can now bind keys in Preferences. The configured keys aren't yet saved, though. --- src/ui/keys.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/ui/keys.h') diff --git a/src/ui/keys.h b/src/ui/keys.h index 0892bd81..a4c8f348 100644 --- a/src/ui/keys.h +++ b/src/ui/keys.h @@ -23,6 +23,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include +#include #include #if defined (iPlatformApple) @@ -46,23 +47,32 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ iDeclareType(Binding) struct Impl_Binding { + int id; int key; int mods; iString command; iString label; }; +void setKey_Binding (int id, int key, int mods); + +/*----------------------------------------------------------------------------------------------*/ + void init_Keys (void); void deinit_Keys (void); void load_Keys (const char *saveDir); void save_Keys (const char *saveDir); -void bind_Keys (const char *command, int key, int mods); -void setLabel_Keys (const char *command, const char *label); -const iBinding *findCommand_Keys (const char *command); +void bind_Keys (int id, const char *command, int key, int mods); +void setLabel_Keys (int id, const char *label); -//const iString * label_Keys (const char *command); -//const char * shortcutLabel_Keys (const char *command); +iLocalDef void bindLabel_Keys(int id, const char *command, int key, int mods, const char *label) { + bind_Keys(id, command, key, mods); + setLabel_Keys(id, label); +} + +const iBinding *findCommand_Keys (const char *command); iBool processEvent_Keys (const SDL_Event *); +const iPtrArray *list_Keys (void); -- cgit v1.2.3