|
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 MOZ_FINAL |
|
18 { |
|
19 typedef nsIWidget::NativeKeyBindingsType NativeKeyBindingsType; |
|
20 typedef nsIWidget::DoCommandCallback DoCommandCallback; |
|
21 |
|
22 public: |
|
23 static NativeKeyBindings* GetInstance(NativeKeyBindingsType aType); |
|
24 static void Shutdown(); |
|
25 |
|
26 void Init(NativeKeyBindingsType aType); |
|
27 |
|
28 bool Execute(const WidgetKeyboardEvent& aEvent, |
|
29 DoCommandCallback aCallback, |
|
30 void* aCallbackData); |
|
31 |
|
32 private: |
|
33 ~NativeKeyBindings(); |
|
34 |
|
35 bool ExecuteInternal(const WidgetKeyboardEvent& aEvent, |
|
36 DoCommandCallback aCallback, |
|
37 void* aCallbackData, |
|
38 guint aKeyval); |
|
39 |
|
40 GtkWidget* mNativeTarget; |
|
41 |
|
42 static NativeKeyBindings* sInstanceForSingleLineEditor; |
|
43 static NativeKeyBindings* sInstanceForMultiLineEditor; |
|
44 }; |
|
45 |
|
46 } // namespace widget |
|
47 } // namespace mozilla |
|
48 |
|
49 #endif // mozilla_widget_NativeKeyBindings_h_ |