widget/cocoa/nsToolkit.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     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/. */
     6 #ifndef nsToolkit_h_
     7 #define nsToolkit_h_
     9 #include "nscore.h"
    10 #include "nsCocoaFeatures.h"
    12 #import <Carbon/Carbon.h>
    13 #import <Cocoa/Cocoa.h>
    14 #import <objc/Object.h>
    15 #import <IOKit/IOKitLib.h>
    17 class nsToolkit
    18 {
    19 public:
    20                      nsToolkit();
    21   virtual            ~nsToolkit();
    23   static nsToolkit*  GetToolkit();
    25   static void Shutdown() {
    26     delete gToolkit;
    27     gToolkit = nullptr;
    28   }
    30   static void        PostSleepWakeNotification(const char* aNotification);
    32   static nsresult    SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
    33                                     bool classMethods = false);
    35   void               RegisterForAllProcessMouseEvents();
    36   void               UnregisterAllProcessMouseEventHandlers();
    38 protected:
    40   nsresult           RegisterForSleepWakeNotifcations();
    41   void               RemoveSleepWakeNotifcations();
    43 protected:
    45   static nsToolkit*  gToolkit;
    47   CFRunLoopSourceRef mSleepWakeNotificationRLS;
    48   io_object_t        mPowerNotifier;
    50   CFMachPortRef      mEventTapPort;
    51   CFRunLoopSourceRef mEventTapRLS;
    52 };
    54 #endif // nsToolkit_h_

mercurial