Bug 1893067 - Add actions key to glean urlbar metrics. r=mak,urlbar-reviewers
[gecko.git] / widget / windows / WinModifierKeyState.h
blob0788c259396ce559f0acb8c22605bf378b27591c
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"
12 #include <windows.h>
14 namespace mozilla {
15 namespace widget {
17 class MOZ_STACK_CLASS ModifierKeyState final {
18 public:
19 ModifierKeyState();
20 explicit ModifierKeyState(Modifiers aModifiers);
22 void Update();
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
32 // has AltGr key.
33 // - Both Ctrl and Alt keys are pressed when a keyboard layout which
34 // does not have AltGr key.
35 bool IsShift() const;
36 bool IsControl() const;
37 bool IsAlt() const;
38 bool IsWin() 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; }
48 private:
49 Modifiers mModifiers;
51 void InitMouseEvent(WidgetInputEvent& aMouseEvent) const;
54 const nsCString ToString(const ModifierKeyState& aModifierKeyState);
56 } // namespace widget
57 } // namespace mozilla
59 #endif // #ifndef mozilla_widget_WinModifierKeyState_h_