OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "views/view.h" | 9 #include "views/view.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
12 class ProgressBar; | 12 class ProgressBar; |
13 } // namespace views | 13 } // namespace views |
14 | 14 |
15 class SkBitmap; | 15 class SkBitmap; |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 // SettingLevelBubbleView displays information about the current value of a | 19 // SettingLevelBubbleView displays information about the current value of a |
20 // level-based setting like volume or brightness. | 20 // level-based setting like volume or brightness. |
21 class SettingLevelBubbleView : public views::View { | 21 class SettingLevelBubbleView : public views::View { |
22 public: | 22 public: |
23 SettingLevelBubbleView(); | 23 SettingLevelBubbleView(); |
24 | 24 |
25 // Initialize the view, setting the progress bar to the specified position. | 25 // Initialize the view, setting the progress bar to the specified position. |
26 // Ownership of |icon| remains with the caller (it's probably a shared | 26 // Ownership of |icon| remains with the caller (it's probably a shared |
27 // instance from ResourceBundle). | 27 // instance from ResourceBundle). |
28 void Init(SkBitmap* icon, int level_percent); | 28 void Init(SkBitmap* icon, int level_percent); |
29 | 29 |
| 30 // Change the icon that we're currently displaying. |
| 31 void SetIcon(SkBitmap* icon); |
| 32 |
30 // Set the progress bar to the specified position and redraw it. | 33 // Set the progress bar to the specified position and redraw it. |
31 void Update(int level_percent); | 34 void Update(int level_percent); |
32 | 35 |
33 // views::View implementation: | 36 // views::View implementation: |
34 virtual void Paint(gfx::Canvas* canvas); | 37 virtual void Paint(gfx::Canvas* canvas); |
35 virtual void Layout(); | 38 virtual void Layout(); |
36 virtual gfx::Size GetPreferredSize(); | 39 virtual gfx::Size GetPreferredSize(); |
37 | 40 |
38 private: | 41 private: |
39 views::ProgressBar* progress_bar_; | 42 views::ProgressBar* progress_bar_; |
40 SkBitmap* icon_; // not owned | 43 SkBitmap* icon_; // not owned |
41 | 44 |
42 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView); | 45 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView); |
43 }; | 46 }; |
44 | 47 |
45 } // namespace chromeos | 48 } // namespace chromeos |
46 | 49 |
47 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ | 50 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ |
OLD | NEW |