summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-24 12:07:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-25 07:03:08 +0000
commit63a6de2cab00e949751fcb35f4814844fc4ec71e (patch)
treec745e6d946e076f75ebaa31849ef2a77bd81b868 /include
parentdaf9156c76049873583f1f7c5de96524d7eba68a (diff)
convert MODKEY constants to o3tl::typed_flags
Change-Id: I53a6f6f6b12e0fb299e7d76e8e8f354ef3afbbb3 Reviewed-on: https://gerrit.libreoffice.org/31152 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/commandevent.hxx12
-rw-r--r--include/vcl/keycodes.hxx28
2 files changed, 22 insertions, 18 deletions
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index 5b9cc09a7eaa..51dab89536c3 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -187,15 +187,15 @@ public:
class VCL_DLLPUBLIC CommandModKeyData
{
private:
- sal_uInt16 mnCode;
+ ModKeyFlags mnCode;
public:
- CommandModKeyData( sal_uInt16 nCode );
+ CommandModKeyData( ModKeyFlags nCode );
- bool IsMod1() const { return (mnCode & MODKEY_MOD1) != 0; }
- bool IsMod2() const { return (mnCode & MODKEY_MOD2) != 0; }
- bool IsLeftShift() const { return (mnCode & MODKEY_LSHIFT) != 0; }
- bool IsRightShift() const { return (mnCode & MODKEY_RSHIFT) != 0; }
+ bool IsMod1() const { return bool(mnCode & ModKeyFlags::Mod1Msk); }
+ bool IsMod2() const { return bool(mnCode & ModKeyFlags::Mod2Msk); }
+ bool IsLeftShift() const { return bool(mnCode & ModKeyFlags::LeftShift); }
+ bool IsRightShift() const { return bool(mnCode & ModKeyFlags::RightShift); }
};
enum class ShowDialogId
diff --git a/include/vcl/keycodes.hxx b/include/vcl/keycodes.hxx
index 58cbf966b922..5356c203a187 100644
--- a/include/vcl/keycodes.hxx
+++ b/include/vcl/keycodes.hxx
@@ -153,18 +153,22 @@
#define KEY_SCROLLLOCK ((sal_uInt16)css::awt::Key::SCROLLLOCK)
// extended Modifier-Keys (only used for modkey events)
-#define MODKEY_LSHIFT 0x0001
-#define MODKEY_RSHIFT 0x0002
-#define MODKEY_LMOD1 0x0004
-#define MODKEY_RMOD1 0x0008
-#define MODKEY_LMOD2 0x0010
-#define MODKEY_RMOD2 0x0020
-#define MODKEY_LMOD3 0x0040
-#define MODKEY_RMOD3 0x0080
-#define MODKEY_SHIFT (MODKEY_LSHIFT|MODKEY_RSHIFT)
-#define MODKEY_MOD1 (MODKEY_LMOD1|MODKEY_RMOD1)
-#define MODKEY_MOD2 (MODKEY_LMOD2|MODKEY_RMOD2)
-#define MODKEY_MOD3 (MODKEY_LMOD3|MODKEY_RMOD3)
+enum class ModKeyFlags {
+ NONE = 0x0000,
+ LeftShift = 0x0001,
+ RightShift = 0x0002,
+ LeftMod1 = 0x0004,
+ RightMod1 = 0x0008,
+ LeftMod2 = 0x0010,
+ RightMod2 = 0x0020,
+ LeftMod3 = 0x0040,
+ RightMod3 = 0x0080,
+ Mod1Msk = LeftMod1 | RightMod1, // should be Mod1Mask, but that conflicts with a X.h macro grrrr
+ Mod2Msk = LeftMod2 | RightMod2,
+};
+namespace o3tl {
+ template<> struct typed_flags<ModKeyFlags> : is_typed_flags<ModKeyFlags, 0x00ff> {};
+}
enum class KeyIndicatorState {
NONE = 0x0000,