| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_VIEWS_CONTROLS_MD_SLIDER_H_ | |
| 6 #define UI_VIEWS_CONTROLS_MD_SLIDER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "ui/views/controls/slider.h" | |
| 10 #include "ui/views/view.h" | |
| 11 #include "ui/views/views_export.h" | |
| 12 | |
| 13 namespace gfx { | |
| 14 class SlideAnimation; | |
| 15 } | |
| 16 | |
| 17 namespace views { | |
| 18 | |
| 19 // TODO(yiyix): When material design is enabled by default, use | |
| 20 // MdSlider as the default slider implementation. (crbug.com/614453) | |
| 21 class VIEWS_EXPORT MdSlider : public Slider { | |
| 22 public: | |
| 23 explicit MdSlider(SliderListener* listener); | |
| 24 ~MdSlider() override; | |
| 25 | |
| 26 // ui::Slider: | |
| 27 void UpdateState(bool control_on) override; | |
| 28 | |
| 29 // views::View: | |
| 30 void OnPaint(gfx::Canvas* canvas) override; | |
| 31 const char* GetClassName() const override; | |
| 32 | |
| 33 protected: | |
| 34 // ui::Slider: | |
| 35 int GetThumbWidth() override; | |
| 36 void SetHighlighted(bool is_highlighted) override; | |
| 37 | |
| 38 private: | |
| 39 // gfx::AnimationDelegate: | |
| 40 void AnimationProgressed(const gfx::Animation* animation) override; | |
| 41 void AnimationEnded(const gfx::Animation* animation) override; | |
| 42 | |
| 43 // Record whether the slider is in the active state or the disabled state. | |
| 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_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(MdSlider); | |
| 52 }; | |
| 53 | |
| 54 } // namespace views | |
| 55 | |
| 56 #endif // UI_VIEWS_CONTROLS_MD_SLIDER_H_ | |
| OLD | NEW |