michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_widget_NativeKeyBindings_h_ michael@0: #define mozilla_widget_NativeKeyBindings_h_ michael@0: michael@0: #import michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/EventForwards.h" michael@0: #include "nsDataHashtable.h" michael@0: #include "nsIWidget.h" michael@0: michael@0: namespace mozilla { michael@0: namespace widget { michael@0: michael@0: typedef nsDataHashtable, CommandInt> michael@0: SelectorCommandHashtable; michael@0: michael@0: class NativeKeyBindings MOZ_FINAL michael@0: { michael@0: typedef nsIWidget::NativeKeyBindingsType NativeKeyBindingsType; michael@0: typedef nsIWidget::DoCommandCallback DoCommandCallback; michael@0: michael@0: public: michael@0: static NativeKeyBindings* GetInstance(NativeKeyBindingsType aType); michael@0: static void Shutdown(); michael@0: michael@0: void Init(NativeKeyBindingsType aType); michael@0: michael@0: bool Execute(const WidgetKeyboardEvent& aEvent, michael@0: DoCommandCallback aCallback, michael@0: void* aCallbackData); michael@0: michael@0: private: michael@0: NativeKeyBindings(); michael@0: michael@0: SelectorCommandHashtable mSelectorToCommand; michael@0: michael@0: static NativeKeyBindings* sInstanceForSingleLineEditor; michael@0: static NativeKeyBindings* sInstanceForMultiLineEditor; michael@0: }; // NativeKeyBindings michael@0: michael@0: } // namespace widget michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_widget_NativeKeyBindings_h_