BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / animatable_image.h
blob102f337c596ab69f69cadbdeb61a82d4cdbccfac
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_
6 #define CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_
8 #import <Cocoa/Cocoa.h>
9 #import <QuartzCore/QuartzCore.h>
11 #include "base/mac/scoped_nsobject.h"
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 base::scoped_nsobject<NSImage> image_;
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_;
30 // Opacity values for the animation.
31 CGFloat startOpacity_;
32 CGFloat endOpacity_;
34 // The amount of time it takes to animate the image.
35 CGFloat duration_;
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;
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;
51 // Begins the animation.
52 - (void)startAnimation;
54 @end
56 #endif // CHROME_BROWSER_UI_COCOA_ANIMATABLE_IMAGE_H_