OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_COCOA_ANIMATABLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_COCOA_ANIMATABLE_VIEW_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 #include "base/scoped_nsobject.h" |
| 11 #import "chrome/browser/cocoa/view_resizer.h" |
| 12 |
| 13 // A view that provides an animatable height property. Provides methods to |
| 14 // animate to a new height, set a new height immediately, or cancel any running |
| 15 // animations. |
| 16 // |
| 17 // AnimatableView sends an |animationDidEnd:| message to its delegate when the |
| 18 // animation ends normally and an |animationDidStop:| message when the animation |
| 19 // was canceled (even when canceled as a result of a new animation starting). |
| 20 |
| 21 @interface AnimatableView : NSView { |
| 22 @protected |
| 23 IBOutlet id delegate_; // weak, used to send animation ended messages. |
| 24 |
| 25 @private |
| 26 scoped_nsobject<NSAnimation> currentAnimation_; |
| 27 id<ViewResizer> resizeDelegate_; // weak, usually owns us |
| 28 } |
| 29 |
| 30 // Properties for bindings. |
| 31 @property(assign) id delegate; |
| 32 |
| 33 // Gets the current height of the view. If an animation is currently running, |
| 34 // this will give the current height at the time of the call, not the target |
| 35 // height at the end of the animation. |
| 36 - (CGFloat)height; |
| 37 |
| 38 // Sets the height of the view immediately. Cancels any running animations. |
| 39 - (void)setHeight:(CGFloat)newHeight; |
| 40 |
| 41 // Starts a new animation to the given |newHeight| for the given |duration|. |
| 42 // Cancels any running animations. |
| 43 - (void)animateToNewHeight:(CGFloat)newHeight |
| 44 duration:(NSTimeInterval)duration; |
| 45 |
| 46 // Cancels any running animations, leaving the view at its current |
| 47 // (mid-animation) height. |
| 48 - (void)stopAnimation; |
| 49 |
| 50 // Sets the delegate that gets notified when this view needs to chanage its |
| 51 // height. |
| 52 - (void)setResizeDelegate:(id<ViewResizer>)resizeDelegate; |
| 53 |
| 54 @end |
| 55 |
| 56 #endif // CHROME_BROWSER_COCOA_ANIMATABLE_VIEW_H_ |
OLD | NEW |