1 // Copyright (c) 2011 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.
5 #ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
9 #include "base/gtest_prod_util.h"
10 #include "ui/views/view.h"
20 // SettingLevelBubbleView displays information about the current value of a
21 // level-based setting like volume or brightness.
22 class SettingLevelBubbleView
: public views::View
{
24 // Layout() is called before Init(), make sure |progress_bar_| is ready.
25 SettingLevelBubbleView();
27 // Initialize the view, setting the progress bar to the specified level in the
28 // range [0.0, 100.0] and state. Ownership of |icon| remains with the caller
29 // (it's probably a shared instance from ResourceBundle).
30 void Init(SkBitmap
* icon
, double level
, bool enabled
);
32 // Change the icon that we're currently displaying.
33 void SetIcon(SkBitmap
* icon
);
35 // Set the progress bar to the specified level and redraw it.
36 void SetLevel(double level
);
38 // Draw the progress bar in an enabled or disabled state.
39 void SetEnabled(bool enabled
);
41 // views::View implementation:
42 virtual void OnPaint(gfx::Canvas
* canvas
) OVERRIDE
;
43 virtual void Layout() OVERRIDE
;
44 virtual gfx::Size
GetPreferredSize() OVERRIDE
;
47 FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest
, CreateAndUpdate
);
49 views::ProgressBar
* progress_bar_
;
50 SkBitmap
* icon_
; // not owned
52 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView
);
55 } // namespace chromeos
57 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_