2001-11-06 15:35:24 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#ifndef nsToolkit_h_
|
|
|
|
#define nsToolkit_h_
|
|
|
|
|
2011-10-25 15:05:32 +00:00
|
|
|
#include "nscore.h"
|
2012-05-17 07:53:20 +00:00
|
|
|
#include "nsCocoaFeatures.h"
|
2006-12-18 19:50:14 +00:00
|
|
|
|
2007-07-17 20:29:39 +00:00
|
|
|
#import <Carbon/Carbon.h>
|
2008-02-13 15:57:12 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import <objc/Object.h>
|
2007-01-18 06:34:07 +00:00
|
|
|
#import <IOKit/IOKitLib.h>
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2011-10-25 15:05:32 +00:00
|
|
|
class nsToolkit
|
2001-11-06 15:35:24 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-12-08 08:29:46 +00:00
|
|
|
nsToolkit();
|
|
|
|
virtual ~nsToolkit();
|
|
|
|
|
2012-05-17 07:53:20 +00:00
|
|
|
static nsToolkit* GetToolkit();
|
2011-10-25 15:05:32 +00:00
|
|
|
|
|
|
|
static void Shutdown() {
|
|
|
|
delete gToolkit;
|
2012-07-30 14:20:58 +00:00
|
|
|
gToolkit = nullptr;
|
2011-10-25 15:05:32 +00:00
|
|
|
}
|
2006-12-08 08:29:46 +00:00
|
|
|
|
|
|
|
static void PostSleepWakeNotification(const char* aNotification);
|
|
|
|
|
2008-03-27 16:30:13 +00:00
|
|
|
static nsresult SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool classMethods = false);
|
2008-02-13 15:57:12 +00:00
|
|
|
|
2011-11-07 16:43:10 +00:00
|
|
|
void RegisterForAllProcessMouseEvents();
|
|
|
|
void UnregisterAllProcessMouseEventHandlers();
|
|
|
|
|
2006-12-08 08:29:46 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
nsresult RegisterForSleepWakeNotifcations();
|
|
|
|
void RemoveSleepWakeNotifcations();
|
|
|
|
|
|
|
|
protected:
|
2003-10-31 02:30:22 +00:00
|
|
|
|
2012-05-17 07:53:20 +00:00
|
|
|
static nsToolkit* gToolkit;
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2006-12-08 08:29:46 +00:00
|
|
|
CFRunLoopSourceRef mSleepWakeNotificationRLS;
|
|
|
|
io_object_t mPowerNotifier;
|
2007-07-17 20:29:39 +00:00
|
|
|
|
|
|
|
CFMachPortRef mEventTapPort;
|
|
|
|
CFRunLoopSourceRef mEventTapRLS;
|
2001-11-06 15:35:24 +00:00
|
|
|
};
|
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#endif // nsToolkit_h_
|