From e2e723bf10e3ec694df5a44d99f405aff8417489 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Tue, 10 Nov 2009 15:30:27 +0000 Subject: [Author: dmaclach] Turns out I needed to expose a bit more API to make it work with all of the animations in Chrome nicely. R=thomasvl DELTA=42 (30 added, 8 deleted, 4 changed) --- AppKit/GTMNSAnimation+Duration.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'AppKit/GTMNSAnimation+Duration.h') diff --git a/AppKit/GTMNSAnimation+Duration.h b/AppKit/GTMNSAnimation+Duration.h index fa1d86f..ee4be84 100644 --- a/AppKit/GTMNSAnimation+Duration.h +++ b/AppKit/GTMNSAnimation+Duration.h @@ -16,27 +16,47 @@ // the License. // -// Categories for changing the duration of an animation based on the current -// event. Right now they track the state of the shift and control keys to slow -// down animations similar to how minimize window animations occur. #import #import "GTMDefines.h" +// Given a "normal" duration for an animation, return what it should be based +// on the current system state. For example, holding down the shift and/or +// control keys modifies the normal duration for an animation making it slower. +NSTimeInterval GTMModifyDurationBasedOnCurrentState(NSTimeInterval duration); + +// Categories for changing the duration of an animation based on the current +// event. Right now they track the state of the shift and control keys to slow +// down animations similar to how minimize window animations occur. @interface NSAnimation (GTMNSAnimationDurationAdditions) + +// Note that using this initializer will set the duration of the animation +// based on the current event when the animation is created. If the animation +// is to be reused, the duration for the event should be reset with +// gtm_setDuration each time the animation is started. +- (id)gtm_initWithDuration:(NSTimeInterval)duration + animationCurve:(NSAnimationCurve)animationCurve; + +// Sets the duration by taking the duration passed in and calling +// GTMModifyDurationBasedOnCurrentState to calculate the real duration. - (void)gtm_setDuration:(NSTimeInterval)duration; @end - #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 #import @interface NSAnimationContext (GTMNSAnimationDurationAdditions) + +// Sets the duration by taking the duration passed in and calling +// GTMModifyDurationBasedOnCurrentState to calculate the real duration. - (void)gtm_setDuration:(NSTimeInterval)duration; @end @interface CAAnimation (GTMCAAnimationDurationAdditions) + +// Sets the duration by taking the duration passed in and calling +// GTMModifyDurationBasedOnCurrentState to calculate the real duration. - (void)gtm_setDuration:(CFTimeInterval)duration; @end -- cgit v1.2.3