diff options
author | Neil <nyamatongwe@gmail.com> | 2022-08-13 19:58:27 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2022-08-13 19:58:27 +1000 |
commit | a3ad77a3499097ae3db33d95176458a0ef0dec2b (patch) | |
tree | 0683fc5d1bd5b933328b169fb23334d5f2350680 /include | |
parent | 5a19e2ac572bb0f3cd614836145a9d759263fd2d (diff) | |
download | scintilla-mirror-a3ad77a3499097ae3db33d95176458a0ef0dec2b.tar.gz |
Move ModifierFlags to ScintillaTypes.h as it is globally useful and not tied
to Editor.
Diffstat (limited to 'include')
-rw-r--r-- | include/ScintillaTypes.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/ScintillaTypes.h b/include/ScintillaTypes.h index 343dec749..5fc18b71b 100644 --- a/include/ScintillaTypes.h +++ b/include/ScintillaTypes.h @@ -818,6 +818,15 @@ constexpr KeyMod operator&(KeyMod a, KeyMod b) noexcept { return static_cast<KeyMod>(static_cast<int>(a) & static_cast<int>(b)); } +constexpr KeyMod ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false) noexcept { + return + (shift ? KeyMod::Shift : KeyMod::Norm) | + (ctrl ? KeyMod::Ctrl : KeyMod::Norm) | + (alt ? KeyMod::Alt : KeyMod::Norm) | + (meta ? KeyMod::Meta : KeyMod::Norm) | + (super ? KeyMod::Super : KeyMod::Norm); +} + // Test if an enum class value has some bit flag(s) of test set. template <typename T> constexpr bool FlagSet(T value, T test) { |