Home | History | Annotate | Download | only in cocoa
      1 // Copyright 2014 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_UI_COCOA_SPRITE_VIEW_H_
      6 #define CHROME_BROWSER_UI_COCOA_SPRITE_VIEW_H_
      7 
      8 #import <Cocoa/Cocoa.h>
      9 
     10 #include "base/mac/scoped_nsobject.h"
     11 
     12 @class CAKeyframeAnimation;
     13 
     14 // A class that knows how to repeatedly animate sprites from an image containing
     15 // the sprites in the form of a horizontal strip.
     16 @interface SpriteView : NSView {
     17  @private
     18   base::scoped_nsobject<CAKeyframeAnimation> spriteAnimation_;
     19 }
     20 
     21 // |image| contains square sprites in a horizontal strip.
     22 // The sprites will be animated, with each sprite shown for 30ms.
     23 // It is OK to pass in a single sprite (a square image), in which case there
     24 // will be no animation.
     25 - (void)setImage:(NSImage*)image;
     26 
     27 // Same as above, with a toast animation to transition to the new image.
     28 // The old image will animate to the bottom, and then the new image will
     29 // animate back up to position.
     30 - (void)setImage:(NSImage*)image withToastAnimation:(BOOL)animate;
     31 
     32 @end
     33 
     34 #endif  // CHROME_BROWSER_UI_COCOA_TABS_THROBBER_VIEW_H_
     35