| e8555c89 Andy McCall |
1 |
#ifndef KEYBOARDSETTINGS_HH |
| 2 |
#define KEYBOARDSETTINGS_HH |
| 3 |
|
| 4 |
#include "BooleanSetting.hh" |
| 5 |
#include "EnumSetting.hh" |
| 6 |
#include "SDLKey.hh" |
| 7 |
|
| 8 |
#include <array> |
| 9 |
#include <cassert> |
| 10 |
#include <cstdint> |
| 11 |
|
| 12 |
namespace openmsx { |
| 13 |
|
| 14 |
class CommandController; |
| 15 |
|
| 16 |
class KeyboardSettings |
| 17 |
{ |
| 18 |
public: |
| 19 |
enum class KpEnterMode : uint8_t { MSX_KP_COMMA, MSX_ENTER }; |
| 20 |
enum class MappingMode : uint8_t { KEY, CHARACTER, POSITIONAL }; |
| 21 |
|
| 22 |
explicit KeyboardSettings(CommandController& commandController); |
| 23 |
|
| 24 |
[[nodiscard]] SDL_Keycode getDeadKeyHostKey(unsigned n) const { |
| 25 |
assert(n < 3); |
| 26 |
return deadKeyHostKey[n].getEnum(); |
| 27 |
} |
| 28 |
[[nodiscard]] SDL_Keycode getCodeKanaHostKey() const { |
| 29 |
return codeKanaHostKey.getEnum(); |
| 30 |
} |
| 31 |
[[nodiscard]] KpEnterMode getKpEnterMode() const { |
| 32 |
return kpEnterMode.getEnum(); |
| 33 |
} |
| 34 |
[[nodiscard]] MappingMode getMappingMode() const { |
| 35 |
return mappingMode.getEnum(); |
| 36 |
} |
| 37 |
[[nodiscard]] bool getAlwaysEnableKeypad() const { |
| 38 |
return alwaysEnableKeypad.getBoolean(); |
| 39 |
} |
| 40 |
[[nodiscard]] bool getTraceKeyPresses() const { |
| 41 |
return traceKeyPresses.getBoolean(); |
| 42 |
} |
| 43 |
[[nodiscard]] bool getAutoToggleCodeKanaLock() const { |
| 44 |
return autoToggleCodeKanaLock.getBoolean(); |
| 45 |
} |
| 46 |
#if defined(_WIN32) |
| 47 |
[[nodiscard]] bool getDisableIME() const { |
| 48 |
return disableIME.getBoolean(); |
| 49 |
} |
| 50 |
#endif |
| 51 |
|
| 52 |
private: |
| 53 |
std::array<EnumSetting<SDL_Keycode>, 3> deadKeyHostKey; |
| 54 |
EnumSetting<SDL_Keycode> codeKanaHostKey; |
| 55 |
EnumSetting<KpEnterMode> kpEnterMode; |
| 56 |
EnumSetting<MappingMode> mappingMode; |
| 57 |
BooleanSetting alwaysEnableKeypad; |
| 58 |
BooleanSetting traceKeyPresses; |
| 59 |
BooleanSetting autoToggleCodeKanaLock; |
| 60 |
#if defined(_WIN32) |
| 61 |
BooleanSetting disableIME; |
| 62 |
#endif |
| 63 |
}; |
| 64 |
|
| 65 |
} |
| 66 |
|
| 67 |
#endif |