PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/google-toolbox-for-mac/AppKit/GTMNSAnimation+Duration.h

http://macfuse.googlecode.com/
C++ Header | 83 lines | 23 code | 14 blank | 46 comment | 0 complexity | b47127fc312146e55fab1b8337721780 MD5 | raw file
 1//
 2//  GTMNSAnimation+Duration.h
 3//
 4//  Copyright 2009 Google Inc.
 5//
 6//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
 7//  use this file except in compliance with the License.  You may obtain a copy
 8//  of the License at
 9//
10//  http://www.apache.org/licenses/LICENSE-2.0
11//
12//  Unless required by applicable law or agreed to in writing, software
13//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15//  License for the specific language governing permissions and limitations under
16//  the License.
17//
18
19
20#import <AppKit/AppKit.h>
21#import "GTMDefines.h"
22
23// Given a "normal" duration for an animation, return what it should be based
24// on the current system state. For example, holding down the shift and/or
25// control keys modifies the normal duration for an animation making it slower.
26// Currently only modifies the duration if the current event is masked by
27// eventMask and only the control and/or shift modifiers are down.
28// The shift modifier is ignored if it is applied to a Tab key down.
29// Tab and shift-tab are often used for navigating around UI elements,
30// and in the majority of cases slowing down the animations while navigating
31// around UI elements is not desired.
32NSTimeInterval GTMModifyDurationBasedOnCurrentState(NSTimeInterval duration,
33                                                    NSUInteger eventMask);
34
35// The standard eventmask that you want for the methods in this file. Some apps
36// (eg Chrome) may not want to have animations fire on key strokes, so will use
37// just NSLeftMouseUpMask instead.
38extern const NSUInteger kGTMLeftMouseUpAndKeyDownMask;
39
40// Categories for changing the duration of an animation based on the current
41// event. Right now they track the state of the shift and control keys to slow
42// down animations similar to how minimize window animations occur.
43@interface NSAnimation (GTMNSAnimationDurationAdditions)
44
45// Note that using this initializer will set the duration of the animation
46// based on the current event when the animation is created. If the animation
47// is to be reused, the duration for the event should be reset with
48// gtm_setDuration each time the animation is started.
49// See notes for GTMModifyDurationBasedOnCurrentState for more info.
50- (id)gtm_initWithDuration:(NSTimeInterval)duration
51                 eventMask:(NSUInteger)eventMask
52            animationCurve:(NSAnimationCurve)animationCurve;
53
54// Sets the duration by taking the duration passed in and calling
55// GTMModifyDurationBasedOnCurrentState to calculate the real duration.
56// See notes for GTMModifyDurationBasedOnCurrentState for more info.
57- (void)gtm_setDuration:(NSTimeInterval)duration
58              eventMask:(NSUInteger)eventMask;
59@end
60
61#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
62
63#import <QuartzCore/QuartzCore.h>
64
65@interface NSAnimationContext (GTMNSAnimationDurationAdditions)
66
67// Sets the duration by taking the duration passed in and calling
68// GTMModifyDurationBasedOnCurrentState to calculate the real duration.
69// See notes for GTMModifyDurationBasedOnCurrentState for more info.
70- (void)gtm_setDuration:(NSTimeInterval)duration
71              eventMask:(NSUInteger)eventMask;
72@end
73
74@interface CAAnimation (GTMCAAnimationDurationAdditions)
75
76// Sets the duration by taking the duration passed in and calling
77// GTMModifyDurationBasedOnCurrentState to calculate the real duration.
78// See notes for GTMModifyDurationBasedOnCurrentState for more info.
79- (void)gtm_setDuration:(CFTimeInterval)duration
80              eventMask:(NSUInteger)events;
81@end
82
83#endif  // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5