2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsToolkit_h_
|
|
|
|
#define nsToolkit_h_
|
|
|
|
|
2011-10-25 08:05:32 -07:00
|
|
|
#include "nscore.h"
|
2012-05-17 00:53:20 -07:00
|
|
|
#include "nsCocoaFeatures.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-07-17 13:29:39 -07:00
|
|
|
#import <Carbon/Carbon.h>
|
2008-02-13 07:57:12 -08:00
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import <objc/Object.h>
|
2007-03-22 10:30:00 -07:00
|
|
|
#import <IOKit/IOKitLib.h>
|
|
|
|
|
2011-10-25 08:05:32 -07:00
|
|
|
class nsToolkit
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsToolkit();
|
|
|
|
virtual ~nsToolkit();
|
|
|
|
|
2012-05-17 00:53:20 -07:00
|
|
|
static nsToolkit* GetToolkit();
|
2011-10-25 08:05:32 -07:00
|
|
|
|
|
|
|
static void Shutdown() {
|
|
|
|
delete gToolkit;
|
|
|
|
gToolkit = nsnull;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static void PostSleepWakeNotification(const char* aNotification);
|
|
|
|
|
2008-03-27 09:30:13 -07:00
|
|
|
static nsresult SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool classMethods = false);
|
2008-02-13 07:57:12 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
|
|
|
nsresult RegisterForSleepWakeNotifcations();
|
|
|
|
void RemoveSleepWakeNotifcations();
|
|
|
|
|
2007-05-17 19:06:59 -07:00
|
|
|
void RegisterForAllProcessMouseEvents();
|
2007-07-17 13:29:39 -07:00
|
|
|
void UnregisterAllProcessMouseEventHandlers();
|
2007-05-17 19:06:59 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
2012-05-17 00:53:20 -07:00
|
|
|
static nsToolkit* gToolkit;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
CFRunLoopSourceRef mSleepWakeNotificationRLS;
|
|
|
|
io_object_t mPowerNotifier;
|
2007-07-17 13:29:39 -07:00
|
|
|
|
|
|
|
CFMachPortRef mEventTapPort;
|
|
|
|
CFRunLoopSourceRef mEventTapRLS;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsToolkit_h_
|