1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/cocoa/NativeKeyBindings.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef mozilla_widget_NativeKeyBindings_h_ 1.10 +#define mozilla_widget_NativeKeyBindings_h_ 1.11 + 1.12 +#import <Cocoa/Cocoa.h> 1.13 +#include "mozilla/Attributes.h" 1.14 +#include "mozilla/EventForwards.h" 1.15 +#include "nsDataHashtable.h" 1.16 +#include "nsIWidget.h" 1.17 + 1.18 +namespace mozilla { 1.19 +namespace widget { 1.20 + 1.21 +typedef nsDataHashtable<nsPtrHashKey<struct objc_selector>, CommandInt> 1.22 + SelectorCommandHashtable; 1.23 + 1.24 +class NativeKeyBindings MOZ_FINAL 1.25 +{ 1.26 + typedef nsIWidget::NativeKeyBindingsType NativeKeyBindingsType; 1.27 + typedef nsIWidget::DoCommandCallback DoCommandCallback; 1.28 + 1.29 +public: 1.30 + static NativeKeyBindings* GetInstance(NativeKeyBindingsType aType); 1.31 + static void Shutdown(); 1.32 + 1.33 + void Init(NativeKeyBindingsType aType); 1.34 + 1.35 + bool Execute(const WidgetKeyboardEvent& aEvent, 1.36 + DoCommandCallback aCallback, 1.37 + void* aCallbackData); 1.38 + 1.39 +private: 1.40 + NativeKeyBindings(); 1.41 + 1.42 + SelectorCommandHashtable mSelectorToCommand; 1.43 + 1.44 + static NativeKeyBindings* sInstanceForSingleLineEditor; 1.45 + static NativeKeyBindings* sInstanceForMultiLineEditor; 1.46 +}; // NativeKeyBindings 1.47 + 1.48 +} // namespace widget 1.49 +} // namespace mozilla 1.50 + 1.51 +#endif // mozilla_widget_NativeKeyBindings_h_