OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_ |
6 #define CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_ | 6 #define CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #import <QuartzCore/QuartzCore.h> | 9 #import <QuartzCore/QuartzCore.h> |
10 | 10 |
11 #include "base/memory/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
12 | 12 |
13 // This class helps animate an NSImage's frame and opacity. It works by creating | 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 | 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 | 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 | 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 | 17 // the animation has finished. Clients that install this as a child window |
18 // should listen for the NSWindowWillCloseNotification to perform any additional | 18 // should listen for the NSWindowWillCloseNotification to perform any additional |
19 // cleanup. | 19 // cleanup. |
20 @interface AnimatableImage : NSWindow { | 20 @interface AnimatableImage : NSWindow { |
21 @private | 21 @private |
22 // The image to animate. | 22 // The image to animate. |
23 scoped_nsobject<NSImage> image_; | 23 base::scoped_nsobject<NSImage> image_; |
24 | 24 |
25 // The frame of the image before and after the animation. This is in this | 25 // The frame of the image before and after the animation. This is in this |
26 // window's coordinate system. | 26 // window's coordinate system. |
27 CGRect startFrame_; | 27 CGRect startFrame_; |
28 CGRect endFrame_; | 28 CGRect endFrame_; |
29 | 29 |
30 // Opacity values for the animation. | 30 // Opacity values for the animation. |
31 CGFloat startOpacity_; | 31 CGFloat startOpacity_; |
32 CGFloat endOpacity_; | 32 CGFloat endOpacity_; |
33 | 33 |
(...skipping 13 matching lines...) Expand all Loading... |
47 // and |endFrame| properties of the animation. | 47 // and |endFrame| properties of the animation. |
48 - (id)initWithImage:(NSImage*)image | 48 - (id)initWithImage:(NSImage*)image |
49 animationFrame:(NSRect)animationFrame; | 49 animationFrame:(NSRect)animationFrame; |
50 | 50 |
51 // Begins the animation. | 51 // Begins the animation. |
52 - (void)startAnimation; | 52 - (void)startAnimation; |
53 | 53 |
54 @end | 54 @end |
55 | 55 |
56 #endif // CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_ | 56 #endif // CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_ |
OLD | NEW |