| 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 level and |
| 26 // Ownership of |icon| remains with the caller (it's probably a shared | 26 // state. 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, bool enabled); |
| 29 | 29 |
| 30 // Change the icon that we're currently displaying. | 30 // Change the icon that we're currently displaying. |
| 31 void SetIcon(SkBitmap* icon); | 31 void SetIcon(SkBitmap* icon); |
| 32 | 32 |
| 33 // Set the progress bar to the specified position and redraw it. | 33 // Set the progress bar to the specified level and redraw it. |
| 34 void Update(int level_percent); | 34 void SetLevel(int level_percent); |
| 35 |
| 36 // Draw the progress bar in an enabled or disabled state. |
| 37 void SetEnabled(bool enabled); |
| 35 | 38 |
| 36 // views::View implementation: | 39 // views::View implementation: |
| 37 virtual void OnPaint(gfx::Canvas* canvas); | 40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 38 virtual void Layout(); | 41 virtual void Layout() OVERRIDE; |
| 39 virtual gfx::Size GetPreferredSize(); | 42 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 views::ProgressBar* progress_bar_; | 45 views::ProgressBar* progress_bar_; |
| 43 SkBitmap* icon_; // not owned | 46 SkBitmap* icon_; // not owned |
| 44 | 47 |
| 45 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView); | 48 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView); |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 } // namespace chromeos | 51 } // namespace chromeos |
| 49 | 52 |
| 50 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ | 53 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_ |
| OLD | NEW |