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 nsToolkit_h_ michael@0: #define nsToolkit_h_ michael@0: michael@0: #include "nscore.h" michael@0: #include "nsCocoaFeatures.h" michael@0: michael@0: #import michael@0: #import michael@0: #import michael@0: #import michael@0: michael@0: class nsToolkit michael@0: { michael@0: public: michael@0: nsToolkit(); michael@0: virtual ~nsToolkit(); michael@0: michael@0: static nsToolkit* GetToolkit(); michael@0: michael@0: static void Shutdown() { michael@0: delete gToolkit; michael@0: gToolkit = nullptr; michael@0: } michael@0: michael@0: static void PostSleepWakeNotification(const char* aNotification); michael@0: michael@0: static nsresult SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod, michael@0: bool classMethods = false); michael@0: michael@0: void RegisterForAllProcessMouseEvents(); michael@0: void UnregisterAllProcessMouseEventHandlers(); michael@0: michael@0: protected: michael@0: michael@0: nsresult RegisterForSleepWakeNotifcations(); michael@0: void RemoveSleepWakeNotifcations(); michael@0: michael@0: protected: michael@0: michael@0: static nsToolkit* gToolkit; michael@0: michael@0: CFRunLoopSourceRef mSleepWakeNotificationRLS; michael@0: io_object_t mPowerNotifier; michael@0: michael@0: CFMachPortRef mEventTapPort; michael@0: CFRunLoopSourceRef mEventTapRLS; michael@0: }; michael@0: michael@0: #endif // nsToolkit_h_