| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 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_IMAGE_H_ |
| 6 #define CHROME_BROWSER_COCOA_ANIMATABLE_IMAGE_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 #import <QuartzCore/QuartzCore.h> |
| 10 |
| 11 #include "base/scoped_nsobject.h" |
| 12 |
| 13 // This class helps animate an NSImage's frame and opacity. It works by creating |
| 14 // a blank NSWindow in the size specified and giving it a layer on which the |
| 15 // image can be animated. Clients are free to embed this object as a child |
| 16 // window for easier window management. This class will clean itself up when |
| 17 // the animation has finished. Clients that install this as a child window |
| 18 // should listen for the NSWindowWillCloseNotification to perform any additional |
| 19 // cleanup. |
| 20 @interface AnimatableImage : NSWindow { |
| 21 @private |
| 22 // The image to animate. |
| 23 scoped_nsobject<NSImage> image_; |
| 24 |
| 25 // The frame of the image before and after the animation. This is in this |
| 26 // window's coordinate system. |
| 27 CGRect startFrame_; |
| 28 CGRect endFrame_; |
| 29 |
| 30 // Opacity values for the animation. |
| 31 CGFloat startOpacity_; |
| 32 CGFloat endOpacity_; |
| 33 |
| 34 // The amount of time it takes to animate the image. |
| 35 CGFloat duration_; |
| 36 } |
| 37 |
| 38 @property (nonatomic) CGRect startFrame; |
| 39 @property (nonatomic) CGRect endFrame; |
| 40 @property (nonatomic) CGFloat startOpacity; |
| 41 @property (nonatomic) CGFloat endOpacity; |
| 42 @property (nonatomic) CGFloat duration; |
| 43 |
| 44 // Designated initializer. Do not use any other NSWindow initializers. Creates |
| 45 // but does not show the blank animation window of the given size. The |
| 46 // |animationFrame| should usually be big enough to contain the |startFrame| |
| 47 // and |endFrame| properties of the animation. |
| 48 - (id)initWithImage:(NSImage*)image |
| 49 animationFrame:(NSRect)animationFrame; |
| 50 |
| 51 // Begins the animation. |
| 52 - (void)startAnimation; |
| 53 |
| 54 @end |
| 55 |
| 56 #endif // CHROME_BROWSER_COCOA_ANIMATABLE_IMAGE_H_ |
| OLD | NEW |