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/gfx/animation/animation_delegate.h" | |
bruthig
2016/09/21 00:27:46
nit: You shouldn't need to include this since slid
yiyix
2016/09/21 15:20:52
Done.
| |
9 #include "ui/views/controls/slider.h" | 10 #include "ui/views/controls/slider.h" |
10 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
11 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
12 | 13 |
13 namespace views { | 14 namespace views { |
14 | 15 |
15 // TODO(yiyix): When material design is enabled by default, use | 16 // TODO(yiyix): When material design is enabled by default, use |
16 // MaterialDesignSlider as the default slider implementation. (crbug.com/614453) | 17 // MaterialDesignSlider as the default slider implementation. (crbug.com/614453) |
17 class VIEWS_EXPORT MdSlider : public Slider { | 18 class VIEWS_EXPORT MdSlider : public Slider { |
18 public: | 19 public: |
19 explicit MdSlider(SliderListener* listener); | 20 explicit MdSlider(SliderListener* listener); |
20 ~MdSlider() override; | 21 ~MdSlider() override; |
21 | 22 |
22 // ui::Slider: | 23 // ui::Slider: |
23 void UpdateState(bool control_on) override; | 24 void UpdateState(bool control_on) override; |
24 | 25 |
25 // views::View: | 26 // views::View: |
26 void OnPaint(gfx::Canvas* canvas) override; | 27 void OnPaint(gfx::Canvas* canvas) override; |
27 const char* GetClassName() const override; | 28 const char* GetClassName() const override; |
28 | 29 |
29 protected: | 30 protected: |
30 // ui::Slider: | 31 // ui::Slider: |
31 int GetThumbWidth() override; | 32 int GetThumbWidth() override; |
33 void SetFocus(bool focus) override; | |
32 | 34 |
33 private: | 35 private: |
36 // gfx::AnimationDelegate: | |
37 void AnimationProgressed(const gfx::Animation* animation) override; | |
38 | |
34 // Record whether the slider is in the active state or the disabled state. | 39 // Record whether the slider is in the active state or the disabled state. |
35 bool is_active_; | 40 bool is_active_; |
41 | |
42 // Animating value of the current stroke size of the thumb's highlight. | |
43 float animating_thumb_value_; | |
44 | |
45 // The desired value of stroke of the thumb's highlight. | |
46 float value_; | |
bruthig
2016/09/21 00:27:46
The variable name |highlight_radius_| would be mor
yiyix
2016/09/21 15:20:52
Done.
| |
47 | |
48 std::unique_ptr<gfx::SlideAnimation> highlight_animation_; | |
bruthig
2016/09/21 00:27:46
nit: You should forward declare SlideAnimation.
yiyix
2016/09/21 15:20:52
Done.
| |
36 }; | 49 }; |
37 | 50 |
38 } // namespace views | 51 } // namespace views |
39 | 52 |
40 #endif // UI_VIEWS_CONTROLS_MD_SLIDER_H_ | 53 #endif // UI_VIEWS_CONTROLS_MD_SLIDER_H_ |
OLD | NEW |