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/. */ 5 6 #ifndef mozilla_widget_NativeKeyBindings_h_ 7 #define mozilla_widget_NativeKeyBindings_h_ 8 9 #include <gtk/gtk.h> 10 #include "mozilla/Attributes.h" 11 #include "mozilla/EventForwards.h" 12 #include "nsIWidget.h" 13 14 namespace mozilla { 15 namespace widget { 16 17 class NativeKeyBindings final { 18 typedef nsIWidget::NativeKeyBindingsType NativeKeyBindingsType; 19 20 public: 21 static NativeKeyBindings* GetInstance(NativeKeyBindingsType aType); 22 static void Shutdown(); 23 24 void Init(NativeKeyBindingsType aType); 25 26 void GetEditCommands(const WidgetKeyboardEvent& aEvent, 27 nsTArray<CommandInt>& aCommands); 28 29 private: 30 ~NativeKeyBindings(); 31 32 bool GetEditCommandsInternal(const WidgetKeyboardEvent& aEvent, 33 nsTArray<CommandInt>& aCommands, guint aKeyval); 34 35 GtkWidget* mNativeTarget; 36 37 static NativeKeyBindings* sInstanceForSingleLineEditor; 38 static NativeKeyBindings* sInstanceForMultiLineEditor; 39 }; 40 41 } // namespace widget 42 } // namespace mozilla 43 44 #endif // mozilla_widget_NativeKeyBindings_h_ 45