Home | History | Annotate | Download | only in chromeos
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
      6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
      7 #pragma once
      8 
      9 #include "views/view.h"
     10 
     11 namespace views {
     12 class ProgressBar;
     13 }  // namespace views
     14 
     15 class SkBitmap;
     16 
     17 namespace chromeos {
     18 
     19 // SettingLevelBubbleView displays information about the current value of a
     20 // level-based setting like volume or brightness.
     21 class SettingLevelBubbleView : public views::View {
     22  public:
     23   SettingLevelBubbleView();
     24 
     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
     27   // instance from ResourceBundle).
     28   void Init(SkBitmap* icon, int level_percent);
     29 
     30   // Change the icon that we're currently displaying.
     31   void SetIcon(SkBitmap* icon);
     32 
     33   // Set the progress bar to the specified position and redraw it.
     34   void Update(int level_percent);
     35 
     36   // views::View implementation:
     37   virtual void OnPaint(gfx::Canvas* canvas);
     38   virtual void Layout();
     39   virtual gfx::Size GetPreferredSize();
     40 
     41  private:
     42   views::ProgressBar* progress_bar_;
     43   SkBitmap* icon_;  // not owned
     44 
     45   DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleView);
     46 };
     47 
     48 }  // namespace chromeos
     49 
     50 #endif  // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_VIEW_H_
     51