OLD | NEW |
(Empty) | |
| 1 |
| 2 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. |
| 5 |
| 6 #ifndef ASH_SYSTEM_FRACTIONAL_SCALE_VIEW_H_ |
| 7 #define ASH_SYSTEM_FRACTIONAL_SCALE_VIEW_H_ |
| 8 |
| 9 #include "base/macros.h" |
| 10 #include "ui/views/controls/button/button.h" |
| 11 #include "ui/views/controls/slider.h" |
| 12 #include "ui/views/view.h" |
| 13 |
| 14 namespace views { |
| 15 class CustomButton; |
| 16 class Label; |
| 17 } |
| 18 |
| 19 namespace ash { |
| 20 class SystemTrayItem; |
| 21 class TriView; |
| 22 |
| 23 namespace tray { |
| 24 class ScaleView : public views::View, |
| 25 public views::SliderListener, |
| 26 public views::ButtonListener { |
| 27 public: |
| 28 ScaleView(SystemTrayItem* owner, bool is_default_view); |
| 29 |
| 30 ~ScaleView() override; |
| 31 |
| 32 void Update(); |
| 33 |
| 34 // Sets volume level on slider_, |percent| is ranged from [0.00] to [1.00]. |
| 35 void SetScaleLevel(float value); |
| 36 |
| 37 private: |
| 38 // SliderListener: |
| 39 void SliderValueChanged(views::Slider* sender, |
| 40 float value, |
| 41 float old_value, |
| 42 views::SliderChangeReason reason) override; |
| 43 void SliderDragEnded(views::Slider* sender) override; |
| 44 |
| 45 // views::ButtonListener: |
| 46 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 47 |
| 48 SystemTrayItem* owner_; |
| 49 // The only immediate child view of |this|. All other view elements are added |
| 50 // to the |tri_view_| to handle layout. |
| 51 TriView* tri_view_; |
| 52 views::CustomButton* more_button_; |
| 53 views::Label* label_; |
| 54 views::Slider* slider_; |
| 55 bool is_default_view_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(ScaleView); |
| 58 }; |
| 59 |
| 60 } // namespace tray |
| 61 } // namespace ash |
| 62 |
| 63 #endif // ASH_SYSTEM_FRACTIONAL_SCALE_VIEW_H_ |
OLD | NEW |