widget/cocoa/nsToolkit.h

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:3cefb1197a5a
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 nsToolkit_h_
7 #define nsToolkit_h_
8
9 #include "nscore.h"
10 #include "nsCocoaFeatures.h"
11
12 #import <Carbon/Carbon.h>
13 #import <Cocoa/Cocoa.h>
14 #import <objc/Object.h>
15 #import <IOKit/IOKitLib.h>
16
17 class nsToolkit
18 {
19 public:
20 nsToolkit();
21 virtual ~nsToolkit();
22
23 static nsToolkit* GetToolkit();
24
25 static void Shutdown() {
26 delete gToolkit;
27 gToolkit = nullptr;
28 }
29
30 static void PostSleepWakeNotification(const char* aNotification);
31
32 static nsresult SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
33 bool classMethods = false);
34
35 void RegisterForAllProcessMouseEvents();
36 void UnregisterAllProcessMouseEventHandlers();
37
38 protected:
39
40 nsresult RegisterForSleepWakeNotifcations();
41 void RemoveSleepWakeNotifcations();
42
43 protected:
44
45 static nsToolkit* gToolkit;
46
47 CFRunLoopSourceRef mSleepWakeNotificationRLS;
48 io_object_t mPowerNotifier;
49
50 CFMachPortRef mEventTapPort;
51 CFRunLoopSourceRef mEventTapRLS;
52 };
53
54 #endif // nsToolkit_h_

mercurial