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 NativeKeyBindings_h
7 #define NativeKeyBindings_h
9 #include "mozilla/Attributes.h"
10 #include "mozilla/EventForwards.h"
11 #include "nsIWidget.h"
13 #include <glib.h> // for guint
15 using GtkWidget
= struct _GtkWidget
;
18 enum class NativeKeyBindingsType
: uint8_t;
26 class NativeKeyBindings final
{
28 static NativeKeyBindings
* GetInstance(NativeKeyBindingsType aType
);
29 static void Shutdown();
32 * GetEditCommandsForTests() returns commands performed in native widget
33 * in typical environment. I.e., this does NOT refer customized shortcut
34 * key mappings of the environment.
36 static void GetEditCommandsForTests(NativeKeyBindingsType aType
,
37 const WidgetKeyboardEvent
& aEvent
,
38 const Maybe
<WritingMode
>& aWritingMode
,
39 nsTArray
<CommandInt
>& aCommands
);
41 void Init(NativeKeyBindingsType aType
);
43 void GetEditCommands(const WidgetKeyboardEvent
& aEvent
,
44 const Maybe
<WritingMode
>& aWritingMode
,
45 nsTArray
<CommandInt
>& aCommands
);
50 bool GetEditCommandsInternal(const WidgetKeyboardEvent
& aEvent
,
51 nsTArray
<CommandInt
>& aCommands
, guint aKeyval
);
53 GtkWidget
* mNativeTarget
;
55 static NativeKeyBindings
* sInstanceForSingleLineEditor
;
56 static NativeKeyBindings
* sInstanceForMultiLineEditor
;
60 } // namespace mozilla
62 #endif // NativeKeyBindings_h