Backed out changeset 3fe07c50c854 (bug 946316) for bustage. a=backout
[gecko.git] / widget / cocoa / NativeKeyBindings.h
bloba794bdf264ff8b2b26b07e3397c2fa007ec51b3f
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 "nsINativeKeyBindings.h"
11 #import <Cocoa/Cocoa.h>
12 #include "mozilla/Attributes.h"
13 #include "mozilla/EventForwards.h"
14 #include "nsDataHashtable.h"
16 // 8477f934-febf-4c79-b7fe-bb7f9ebb9b4f
17 #define NS_NATIVEKEYBINDINGS_INPUT_CID \
18 { 0x8477f934, 0xfebf, 0x4c79, \
19 { 0xb7, 0xfe, 0xbb, 0x7f, 0x9e, 0xbb, 0x9b, 0x4f } }
21 // 13a6e56f-f00b-4e19-8cf6-1a51ee7cc4bf
22 #define NS_NATIVEKEYBINDINGS_TEXTAREA_CID \
23 { 0x13a6e56f, 0xf00b, 0x4e19, \
24 { 0x8c, 0xf6, 0x1a, 0x51, 0xee, 0x7c, 0xc4, 0xbf } }
26 // 36bfbd29-4e02-40f4-8fff-094f1a9ec97c
27 #define NS_NATIVEKEYBINDINGS_EDITOR_CID \
28 { 0x36bfbd29, 0x4e02, 0x40f4, \
29 { 0x8f, 0xff, 0x09, 0x4f, 0x1a, 0x9e, 0xc9, 0x7c } }
31 namespace mozilla {
32 namespace widget {
34 enum NativeKeyBindingsType
36 eNativeKeyBindingsType_Input,
37 eNativeKeyBindingsType_TextArea,
38 eNativeKeyBindingsType_Editor
41 typedef nsDataHashtable<nsPtrHashKey<struct objc_selector>, const char *>
42 SelectorCommandHashtable;
44 class NativeKeyBindings MOZ_FINAL : public nsINativeKeyBindings
46 public:
47 NativeKeyBindings();
49 NS_DECL_ISUPPORTS
51 NS_IMETHOD Init(NativeKeyBindingsType aType);
53 // nsINativeKeyBindings
54 NS_IMETHOD_(bool) KeyDown(const WidgetKeyboardEvent& aEvent,
55 DoCommandCallback aCallback,
56 void* aCallbackData);
58 NS_IMETHOD_(bool) KeyPress(const WidgetKeyboardEvent& aEvent,
59 DoCommandCallback aCallback,
60 void* aCallbackData);
62 NS_IMETHOD_(bool) KeyUp(const WidgetKeyboardEvent& aEvent,
63 DoCommandCallback aCallback,
64 void* aCallbackData);
66 private:
67 SelectorCommandHashtable mSelectorToCommand;
68 }; // NativeKeyBindings
70 } // namespace widget
71 } // namespace mozilla
73 #endif /* NativeKeyBindings_h_ */