diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-31 14:18:09 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-31 14:18:09 +0200 |
commit | f809b80a688b8cd0a5a8bcb578d4cce1562fff5e (patch) | |
tree | bfecbefcf9f56f9fd4e44d89bb8977eb872b0bd5 /src/ui/keys.h | |
parent | 7d0d4a6821644a73fc52b54eba6774ba5a64cb54 (diff) |
Preferences: Basic key bindings UI
One can now bind keys in Preferences. The configured keys aren't yet saved, though.
Diffstat (limited to 'src/ui/keys.h')
-rw-r--r-- | src/ui/keys.h | 20 |
1 files changed, 15 insertions, 5 deletions
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. */ | |||
23 | #pragma once | 23 | #pragma once |
24 | 24 | ||
25 | #include <the_Foundation/string.h> | 25 | #include <the_Foundation/string.h> |
26 | #include <the_Foundation/ptrarray.h> | ||
26 | #include <SDL_events.h> | 27 | #include <SDL_events.h> |
27 | 28 | ||
28 | #if defined (iPlatformApple) | 29 | #if defined (iPlatformApple) |
@@ -46,23 +47,32 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
46 | iDeclareType(Binding) | 47 | iDeclareType(Binding) |
47 | 48 | ||
48 | struct Impl_Binding { | 49 | struct Impl_Binding { |
50 | int id; | ||
49 | int key; | 51 | int key; |
50 | int mods; | 52 | int mods; |
51 | iString command; | 53 | iString command; |
52 | iString label; | 54 | iString label; |
53 | }; | 55 | }; |
54 | 56 | ||
57 | void setKey_Binding (int id, int key, int mods); | ||
58 | |||
59 | /*----------------------------------------------------------------------------------------------*/ | ||
60 | |||
55 | void init_Keys (void); | 61 | void init_Keys (void); |
56 | void deinit_Keys (void); | 62 | void deinit_Keys (void); |
57 | 63 | ||
58 | void load_Keys (const char *saveDir); | 64 | void load_Keys (const char *saveDir); |
59 | void save_Keys (const char *saveDir); | 65 | void save_Keys (const char *saveDir); |
60 | 66 | ||
61 | void bind_Keys (const char *command, int key, int mods); | 67 | void bind_Keys (int id, const char *command, int key, int mods); |
62 | void setLabel_Keys (const char *command, const char *label); | 68 | void setLabel_Keys (int id, const char *label); |
63 | const iBinding *findCommand_Keys (const char *command); | ||
64 | 69 | ||
65 | //const iString * label_Keys (const char *command); | 70 | iLocalDef void bindLabel_Keys(int id, const char *command, int key, int mods, const char *label) { |
66 | //const char * shortcutLabel_Keys (const char *command); | 71 | bind_Keys(id, command, key, mods); |
72 | setLabel_Keys(id, label); | ||
73 | } | ||
74 | |||
75 | const iBinding *findCommand_Keys (const char *command); | ||
67 | 76 | ||
68 | iBool processEvent_Keys (const SDL_Event *); | 77 | iBool processEvent_Keys (const SDL_Event *); |
78 | const iPtrArray *list_Keys (void); | ||