widget/cocoa/nsToolkit.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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