| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Throbbers display an animation, usually used as a status indicator. | 5 // Throbbers display an animation, usually used as a status indicator. |
| 6 | 6 |
| 7 #ifndef VIEWS_CONTROLS_THROBBER_H_ | 7 #ifndef VIEWS_CONTROLS_THROBBER_H_ |
| 8 #define VIEWS_CONTROLS_THROBBER_H_ | 8 #define VIEWS_CONTROLS_THROBBER_H_ |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // running. | 24 // running. |
| 25 Throbber(int frame_time_ms, bool paint_while_stopped); | 25 Throbber(int frame_time_ms, bool paint_while_stopped); |
| 26 virtual ~Throbber(); | 26 virtual ~Throbber(); |
| 27 | 27 |
| 28 // Start and stop the throbber animation | 28 // Start and stop the throbber animation |
| 29 virtual void Start(); | 29 virtual void Start(); |
| 30 virtual void Stop(); | 30 virtual void Stop(); |
| 31 | 31 |
| 32 // overridden from View | 32 // overridden from View |
| 33 virtual gfx::Size GetPreferredSize(); | 33 virtual gfx::Size GetPreferredSize(); |
| 34 virtual void Paint(ChromeCanvas* canvas); | 34 virtual void Paint(gfx::Canvas* canvas); |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 // Specifies whether the throbber is currently animating or not | 37 // Specifies whether the throbber is currently animating or not |
| 38 bool running_; | 38 bool running_; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 void Run(); | 41 void Run(); |
| 42 | 42 |
| 43 bool paint_while_stopped_; | 43 bool paint_while_stopped_; |
| 44 int frame_count_; // How many frames we have. | 44 int frame_count_; // How many frames we have. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // | 83 // |
| 84 class CheckmarkThrobber : public Throbber { | 84 class CheckmarkThrobber : public Throbber { |
| 85 public: | 85 public: |
| 86 CheckmarkThrobber(); | 86 CheckmarkThrobber(); |
| 87 | 87 |
| 88 // If checked is true, the throbber stops spinning and displays a checkmark. | 88 // If checked is true, the throbber stops spinning and displays a checkmark. |
| 89 // If checked is false, the throbber stops spinning and displays nothing. | 89 // If checked is false, the throbber stops spinning and displays nothing. |
| 90 void SetChecked(bool checked); | 90 void SetChecked(bool checked); |
| 91 | 91 |
| 92 // Overridden from Throbber: | 92 // Overridden from Throbber: |
| 93 virtual void Paint(ChromeCanvas* canvas); | 93 virtual void Paint(gfx::Canvas* canvas); |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 static const int kFrameTimeMs = 30; | 96 static const int kFrameTimeMs = 30; |
| 97 | 97 |
| 98 static void InitClass(); | 98 static void InitClass(); |
| 99 | 99 |
| 100 // Whether or not we should display a checkmark. | 100 // Whether or not we should display a checkmark. |
| 101 bool checked_; | 101 bool checked_; |
| 102 | 102 |
| 103 // The checkmark image. | 103 // The checkmark image. |
| 104 static SkBitmap* checkmark_; | 104 static SkBitmap* checkmark_; |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(CheckmarkThrobber); | 106 DISALLOW_COPY_AND_ASSIGN(CheckmarkThrobber); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace views | 109 } // namespace views |
| 110 | 110 |
| 111 #endif // VIEWS_CONTROLS_THROBBER_H_ | 111 #endif // VIEWS_CONTROLS_THROBBER_H_ |
| OLD | NEW |