Home | History | Annotate | Download | only in mac
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // This file contains forward declarations for items in later SDKs than the
      6 // default one with which Chromium is built (currently 10.6).
      7 // If you call any function from this header, be sure to check at runtime for
      8 // respondsToSelector: before calling these functions (else your code will crash
      9 // on older OS X versions that chrome still supports).
     10 
     11 #ifndef BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
     12 #define BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
     13 
     14 #import <AppKit/AppKit.h>
     15 
     16 #if !defined(MAC_OS_X_VERSION_10_7) || \
     17     MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
     18 enum {
     19   NSEventPhaseNone        = 0, // event not associated with a phase.
     20   NSEventPhaseBegan       = 0x1 << 0,
     21   NSEventPhaseStationary  = 0x1 << 1,
     22   NSEventPhaseChanged     = 0x1 << 2,
     23   NSEventPhaseEnded       = 0x1 << 3,
     24   NSEventPhaseCancelled   = 0x1 << 4,
     25   NSEventPhaseMayBegin    = 0x1 << 5
     26 };
     27 typedef NSUInteger NSEventPhase;
     28 
     29 enum {
     30   NSEventSwipeTrackingLockDirection = 0x1 << 0,
     31   NSEventSwipeTrackingClampGestureAmount = 0x1 << 1,
     32 };
     33 typedef NSUInteger NSEventSwipeTrackingOptions;
     34 
     35 enum {
     36   NSWindowAnimationBehaviorDefault = 0,
     37   NSWindowAnimationBehaviorNone = 2,
     38   NSWindowAnimationBehaviorDocumentWindow = 3,
     39   NSWindowAnimationBehaviorUtilityWindow = 4,
     40   NSWindowAnimationBehaviorAlertPanel = 5
     41 };
     42 typedef NSInteger NSWindowAnimationBehavior;
     43 
     44 @interface NSEvent (LionSDK)
     45 + (BOOL)isSwipeTrackingFromScrollEventsEnabled;
     46 
     47 - (NSEventPhase)momentumPhase;
     48 - (NSEventPhase)phase;
     49 - (CGFloat)scrollingDeltaX;
     50 - (CGFloat)scrollingDeltaY;
     51 - (void)trackSwipeEventWithOptions:(NSEventSwipeTrackingOptions)options
     52           dampenAmountThresholdMin:(CGFloat)minDampenThreshold
     53                                max:(CGFloat)maxDampenThreshold
     54                       usingHandler:(void (^)(CGFloat gestureAmount,
     55                                              NSEventPhase phase,
     56                                              BOOL isComplete,
     57                                              BOOL *stop))trackingHandler;
     58 
     59 - (BOOL)isDirectionInvertedFromDevice;
     60 
     61 @end
     62 
     63 @interface CALayer (LionAPI)
     64 - (CGFloat)contentsScale;
     65 - (void)setContentsScale:(CGFloat)contentsScale;
     66 @end
     67 
     68 @interface NSScreen (LionSDK)
     69 - (CGFloat)backingScaleFactor;
     70 - (NSRect)convertRectToBacking:(NSRect)aRect;
     71 @end
     72 
     73 @interface NSWindow (LionSDK)
     74 - (CGFloat)backingScaleFactor;
     75 - (NSWindowAnimationBehavior)animationBehavior;
     76 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
     77 @end
     78 #endif  // MAC_OS_X_VERSION_10_7
     79 
     80 #endif  // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
     81