summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/throbber_view.h
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-19 20:46:37 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-19 20:46:37 +0000
commit1ae99501e0a15b85f0593a71c939063027c802d4 (patch)
treeae2c255da0ff4687c78b2a017dd1b660a8ed343c /chrome/browser/cocoa/throbber_view.h
parentf8fc92385be0fb12cfffd14db9c6f3b461bec447 (diff)
downloadchromium_src-1ae99501e0a15b85f0593a71c939063027c802d4.zip
chromium_src-1ae99501e0a15b85f0593a71c939063027c802d4.tar.gz
chromium_src-1ae99501e0a15b85f0593a71c939063027c802d4.tar.bz2
Implement a status throbber on the mac, currently using the Win artwork. Made the tab cell use a generic NSView for showing the icon instead of relying on the NSButtonCell to draw it, so a NSImageView is in place by default. Remove un-needed outlets, bindings, and views from the nib. BUG=11916. TEST=loading pages, opening and closing tabs.
Review URL: http://codereview.chromium.org/115527 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16410 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/throbber_view.h')
-rw-r--r--chrome/browser/cocoa/throbber_view.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/throbber_view.h b/chrome/browser/cocoa/throbber_view.h
new file mode 100644
index 0000000..5403371
--- /dev/null
+++ b/chrome/browser/cocoa/throbber_view.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_COCOA_THROBBER_VIEW_H_
+#define CHROME_BROWSER_COCOA_THROBBER_VIEW_H_
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/scoped_nsobject.h"
+
+@class TimerTarget;
+
+// A class that knows how to draw an animated state to indicate progress.
+// Currently draws via a sequence of frames in an image, but may ultimately be
+// written to render paths that are rotated around a center origin. Creating
+// the class starts the animation, destroying it stops it. There is no state
+// where the class is frozen on an image and not animating.
+
+@interface ThrobberView : NSView {
+ @private
+ scoped_nsobject<NSImage> image_;
+ scoped_nsobject<TimerTarget> target_; // Target of animation timer.
+ NSTimer* timer_; // Animation timer. Weak, owned by runloop.
+ unsigned int numFrames_; // Number of frames in this animation.
+ unsigned int animationFrame_; // Current frame of the animation,
+ // [0..numFrames_)
+}
+
+// Creates the view with |frame| and the image strip desginated by |image|. The
+// image needs to be made of squares such that the height divides evently into
+// the width. Takes ownership of |image|.
+- (id)initWithFrame:(NSRect)frame image:(NSImage*)image;
+
+@end
+
+#endif // CHROME_BROWSER_COCOA_THROBBER_VIEW_H_