OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ |
| 6 #define ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ |
| 7 |
| 8 #include "ash/system/tray/actionable_view.h" |
| 9 #include "ui/gfx/font.h" |
| 10 #include "ui/views/controls/button/button.h" |
| 11 #include "ui/views/controls/slider.h" |
| 12 |
| 13 namespace views { |
| 14 class View; |
| 15 class ImageView; |
| 16 } |
| 17 |
| 18 namespace ash { |
| 19 |
| 20 class SystemTrayItem; |
| 21 |
| 22 namespace system { |
| 23 class TrayAudioDelegate; |
| 24 } |
| 25 |
| 26 namespace internal { |
| 27 |
| 28 class HoverHighlightView; |
| 29 |
| 30 namespace tray { |
| 31 |
| 32 class BarSeparator; |
| 33 class VolumeButton; |
| 34 class VolumeSlider; |
| 35 |
| 36 class VolumeView : public ActionableView, |
| 37 public views::ButtonListener, |
| 38 public views::SliderListener { |
| 39 public: |
| 40 VolumeView(SystemTrayItem* owner, |
| 41 system::TrayAudioDelegate* audio_delegate, |
| 42 bool is_default_view); |
| 43 |
| 44 virtual ~VolumeView(); |
| 45 |
| 46 void Update(); |
| 47 |
| 48 // Sets volume level on slider_, |percent| is ranged from [0.00] to [1.00]. |
| 49 void SetVolumeLevel(float percent); |
| 50 |
| 51 private: |
| 52 // Updates bar_, device_type_ icon, and more_ buttons. |
| 53 void UpdateDeviceTypeAndMore(); |
| 54 void HandleVolumeUp(float percent); |
| 55 void HandleVolumeDown(float percent); |
| 56 |
| 57 // Overridden from views::View. |
| 58 virtual void Layout() OVERRIDE; |
| 59 |
| 60 // Overridden from views::ButtonListener. |
| 61 virtual void ButtonPressed(views::Button* sender, |
| 62 const ui::Event& event) OVERRIDE; |
| 63 |
| 64 // Overridden from views::SliderListener. |
| 65 void SliderValueChanged(views::Slider* sender, |
| 66 float value, |
| 67 float old_value, |
| 68 views::SliderChangeReason reason); |
| 69 |
| 70 // Overriden from ActionableView. |
| 71 virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
| 72 |
| 73 SystemTrayItem* owner_; |
| 74 system::TrayAudioDelegate* audio_delegate_; |
| 75 VolumeButton* icon_; |
| 76 VolumeSlider* slider_; |
| 77 BarSeparator* bar_; |
| 78 views::ImageView* device_type_; |
| 79 views::ImageView* more_; |
| 80 bool is_default_view_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(VolumeView); |
| 83 }; |
| 84 |
| 85 } // namespace tray |
| 86 } // namespace internal |
| 87 } // namespace ash |
| 88 |
| 89 #endif // ASH_SYSTEM_AUDIO_VOLUME_VIEW_H_ |
| 90 |
OLD | NEW |