widget/cocoa/nsToolkit.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/cocoa/nsToolkit.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     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 nsToolkit_h_
    1.10 +#define nsToolkit_h_
    1.11 +
    1.12 +#include "nscore.h"
    1.13 +#include "nsCocoaFeatures.h"
    1.14 +
    1.15 +#import <Carbon/Carbon.h>
    1.16 +#import <Cocoa/Cocoa.h>
    1.17 +#import <objc/Object.h>
    1.18 +#import <IOKit/IOKitLib.h>
    1.19 +
    1.20 +class nsToolkit
    1.21 +{
    1.22 +public:
    1.23 +                     nsToolkit();
    1.24 +  virtual            ~nsToolkit();
    1.25 +
    1.26 +  static nsToolkit*  GetToolkit();
    1.27 +
    1.28 +  static void Shutdown() {
    1.29 +    delete gToolkit;
    1.30 +    gToolkit = nullptr;
    1.31 +  }
    1.32 +
    1.33 +  static void        PostSleepWakeNotification(const char* aNotification);
    1.34 +
    1.35 +  static nsresult    SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
    1.36 +                                    bool classMethods = false);
    1.37 +
    1.38 +  void               RegisterForAllProcessMouseEvents();
    1.39 +  void               UnregisterAllProcessMouseEventHandlers();
    1.40 +
    1.41 +protected:
    1.42 +
    1.43 +  nsresult           RegisterForSleepWakeNotifcations();
    1.44 +  void               RemoveSleepWakeNotifcations();
    1.45 +
    1.46 +protected:
    1.47 +
    1.48 +  static nsToolkit*  gToolkit;
    1.49 +
    1.50 +  CFRunLoopSourceRef mSleepWakeNotificationRLS;
    1.51 +  io_object_t        mPowerNotifier;
    1.52 +
    1.53 +  CFMachPortRef      mEventTapPort;
    1.54 +  CFRunLoopSourceRef mEventTapRLS;
    1.55 +};
    1.56 +
    1.57 +#endif // nsToolkit_h_

mercurial