Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: ui/views/controls/slider.h

Issue 2335513002: Adding ripple effect for clicks on MD slider (Closed)
Patch Set: nits Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_SLIDER_H_ 5 #ifndef UI_VIEWS_CONTROLS_SLIDER_H_
6 #define UI_VIEWS_CONTROLS_SLIDER_H_ 6 #define UI_VIEWS_CONTROLS_SLIDER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/gfx/animation/animation_delegate.h" 9 #include "ui/gfx/animation/animation_delegate.h"
10 #include "ui/views/view.h" 10 #include "ui/views/view.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 accessibility_events_enabled_ = enabled; 66 accessibility_events_enabled_ = enabled;
67 } 67 }
68 68
69 void set_focus_border_color(SkColor color) { focus_border_color_ = color; } 69 void set_focus_border_color(SkColor color) { focus_border_color_ = color; }
70 70
71 // Update UI based on control on/off state. 71 // Update UI based on control on/off state.
72 virtual void UpdateState(bool control_on) = 0; 72 virtual void UpdateState(bool control_on) = 0;
73 73
74 protected: 74 protected:
75 explicit Slider(SliderListener* listener); 75 explicit Slider(SliderListener* listener);
76 virtual void SetHighlighted(bool is_highlighted);
bruthig 2016/09/23 22:24:39 nit: Can you group this together with the other vi
yiyix 2016/09/24 06:24:36 i will group is with getAnimatingValue().
76 77
77 // Returns the current position of the thumb on the slider. 78 // Returns the current position of the thumb on the slider.
78 float GetAnimatingValue() const; 79 float GetAnimatingValue() const;
79 80
80 virtual int GetThumbWidth() = 0; 81 virtual int GetThumbWidth() = 0;
81 82
83 // gfx::AnimationDelegate:
84 void AnimationProgressed(const gfx::Animation* animation) override;
85 void AnimationEnded(const gfx::Animation* animation) override;
86
82 // views::View: 87 // views::View:
83 void OnPaint(gfx::Canvas* canvas) override; 88 void OnPaint(gfx::Canvas* canvas) override;
84 89
85 private: 90 private:
86 friend class test::SliderTestApi; 91 friend class test::SliderTestApi;
87 92
88 void SetValueInternal(float value, SliderChangeReason reason); 93 void SetValueInternal(float value, SliderChangeReason reason);
89 94
90 // Should be called on the Mouse Down event. Used to calculate relative 95 // Should be called on the Mouse Down event. Used to calculate relative
91 // position of the mouse cursor (or the touch point) on the button to 96 // position of the mouse cursor (or the touch point) on the button to
(...skipping 18 matching lines...) Expand all
110 bool OnMouseDragged(const ui::MouseEvent& event) override; 115 bool OnMouseDragged(const ui::MouseEvent& event) override;
111 void OnMouseReleased(const ui::MouseEvent& event) override; 116 void OnMouseReleased(const ui::MouseEvent& event) override;
112 bool OnKeyPressed(const ui::KeyEvent& event) override; 117 bool OnKeyPressed(const ui::KeyEvent& event) override;
113 void GetAccessibleState(ui::AXViewState* state) override; 118 void GetAccessibleState(ui::AXViewState* state) override;
114 void OnFocus() override; 119 void OnFocus() override;
115 void OnBlur() override; 120 void OnBlur() override;
116 121
117 // ui::EventHandler: 122 // ui::EventHandler:
118 void OnGestureEvent(ui::GestureEvent* event) override; 123 void OnGestureEvent(ui::GestureEvent* event) override;
119 124
120 // gfx::AnimationDelegate:
121 void AnimationProgressed(const gfx::Animation* animation) override;
122
123 void set_listener(SliderListener* listener) { 125 void set_listener(SliderListener* listener) {
124 listener_ = listener; 126 listener_ = listener;
125 } 127 }
126 128
127 SliderListener* listener_; 129 SliderListener* listener_;
128 130
129 std::unique_ptr<gfx::SlideAnimation> move_animation_; 131 std::unique_ptr<gfx::SlideAnimation> move_animation_;
130 132
131 float value_; 133 float value_;
132 float keyboard_increment_; 134 float keyboard_increment_;
133 float animating_value_; 135 float initial_animating_value_;
134 bool value_is_valid_; 136 bool value_is_valid_;
135 base::string16 accessible_name_; 137 base::string16 accessible_name_;
136 bool accessibility_events_enabled_; 138 bool accessibility_events_enabled_;
137 SkColor focus_border_color_; 139 SkColor focus_border_color_;
138 140
139 // Relative position of the mouse cursor (or the touch point) on the slider's 141 // Relative position of the mouse cursor (or the touch point) on the slider's
140 // button. 142 // button.
141 int initial_button_offset_; 143 int initial_button_offset_;
142 144
143 DISALLOW_COPY_AND_ASSIGN(Slider); 145 DISALLOW_COPY_AND_ASSIGN(Slider);
144 }; 146 };
145 147
146 } // namespace views 148 } // namespace views
147 149
148 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ 150 #endif // UI_VIEWS_CONTROLS_SLIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698