Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 UI_VIEWS_CONTROLS_MD_SLIDER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MD_SLIDER_H_ |
| 6 #define UI_VIEWS_CONTROLS_MD_SLIDER_H_ | 6 #define UI_VIEWS_CONTROLS_MD_SLIDER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/views/controls/slider.h" | 9 #include "ui/views/controls/slider.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 11 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
| 12 | 12 |
| 13 namespace gfx { | |
| 14 class SlideAnimation; | |
| 15 } | |
| 16 | |
| 13 namespace views { | 17 namespace views { |
| 14 | 18 |
| 15 // TODO(yiyix): When material design is enabled by default, use | 19 // TODO(yiyix): When material design is enabled by default, use |
| 16 // MaterialDesignSlider as the default slider implementation. (crbug.com/614453) | 20 // MdSlider as the default slider implementation. (crbug.com/614453) |
| 17 class VIEWS_EXPORT MdSlider : public Slider { | 21 class VIEWS_EXPORT MdSlider : public Slider { |
| 18 public: | 22 public: |
| 19 explicit MdSlider(SliderListener* listener); | 23 explicit MdSlider(SliderListener* listener); |
| 20 ~MdSlider() override; | 24 ~MdSlider() override; |
| 21 | 25 |
| 22 // ui::Slider: | 26 // ui::Slider: |
| 23 void UpdateState(bool control_on) override; | 27 void UpdateState(bool control_on) override; |
| 24 | 28 |
| 25 // views::View: | 29 // views::View: |
| 26 void OnPaint(gfx::Canvas* canvas) override; | 30 void OnPaint(gfx::Canvas* canvas) override; |
| 27 const char* GetClassName() const override; | 31 const char* GetClassName() const override; |
| 28 | 32 |
| 29 protected: | 33 protected: |
| 30 // ui::Slider: | 34 // ui::Slider: |
| 31 int GetThumbWidth() override; | 35 int GetThumbWidth() override; |
| 36 void SetHighlighted(bool is_highlighted) override; | |
| 32 | 37 |
| 33 private: | 38 private: |
| 39 // gfx::AnimationDelegate: | |
| 40 void AnimationProgressed(const gfx::Animation* animation) override; | |
| 41 void AnimationEnded(const gfx::Animation* animation) override; | |
| 42 | |
| 34 // Record whether the slider is in the active state or the disabled state. | 43 // Record whether the slider is in the active state or the disabled state. |
| 35 bool is_active_; | 44 bool is_active_; |
| 45 | |
| 46 // Animating value of the current radius of the thumb's highlight. | |
| 47 float thumb_highlight_radius_; | |
| 48 | |
| 49 std::unique_ptr<gfx::SlideAnimation> highlight_animation_; | |
|
sadrul
2016/09/30 02:53:36
DISALLOW_COPY_AND_ASSIGN
yiyix
2016/10/03 16:06:50
Thanks, i also added it to the NonMdSlider class.
| |
| 36 }; | 50 }; |
| 37 | 51 |
| 38 } // namespace views | 52 } // namespace views |
| 39 | 53 |
| 40 #endif // UI_VIEWS_CONTROLS_MD_SLIDER_H_ | 54 #endif // UI_VIEWS_CONTROLS_MD_SLIDER_H_ |
| OLD | NEW |