1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_widget_WinModifierKeyState_h_
7 #define mozilla_widget_WinModifierKeyState_h_
9 #include "mozilla/RefPtr.h"
10 #include "mozilla/EventForwards.h"
11 #include "nsStringFwd.h"
17 class MOZ_STACK_CLASS ModifierKeyState final
{
20 explicit ModifierKeyState(Modifiers aModifiers
);
24 void Unset(Modifiers aRemovingModifiers
);
25 void Set(Modifiers aAddingModifiers
);
27 void InitInputEvent(WidgetInputEvent
& aInputEvent
) const;
29 // Do not create IsAltGr() because it's unclear whether:
30 // - AltGr key is actually pressed.
31 // - Both Ctrl and Alt keys are pressed when a keyboard layout which
33 // - Both Ctrl and Alt keys are pressed when a keyboard layout which
34 // does not have AltGr key.
36 bool IsControl() const;
40 bool MaybeMatchShortcutKey() const;
42 bool IsCapsLocked() const;
43 bool IsNumLocked() const;
44 bool IsScrollLocked() const;
46 MOZ_ALWAYS_INLINE Modifiers
GetModifiers() const { return mModifiers
; }
51 void InitMouseEvent(WidgetInputEvent
& aMouseEvent
) const;
54 const nsCString
ToString(const ModifierKeyState
& aModifierKeyState
);
57 } // namespace mozilla
59 #endif // #ifndef mozilla_widget_WinModifierKeyState_h_