| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 void set_enable_accessibility_events(bool enabled) { | 65 void set_enable_accessibility_events(bool enabled) { |
| 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 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 76 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 77 |
| 78 protected: |
| 75 explicit Slider(SliderListener* listener); | 79 explicit Slider(SliderListener* listener); |
| 76 | 80 |
| 77 // Returns the current position of the thumb on the slider. | 81 // Returns the current position of the thumb on the slider. |
| 78 float GetAnimatingValue() const; | 82 float GetAnimatingValue() const; |
| 79 | 83 |
| 80 virtual int GetThumbWidth() = 0; | 84 virtual int GetThumbWidth() = 0; |
| 81 | 85 |
| 82 // views::View: | 86 // views::View: |
| 83 void OnPaint(gfx::Canvas* canvas) override; | 87 void OnPaint(gfx::Canvas* canvas) override; |
| 84 | 88 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 99 | 103 |
| 100 // Notify the listener_, if not NULL, that dragging started. | 104 // Notify the listener_, if not NULL, that dragging started. |
| 101 void OnSliderDragStarted(); | 105 void OnSliderDragStarted(); |
| 102 | 106 |
| 103 // Notify the listener_, if not NULL, that dragging ended. | 107 // Notify the listener_, if not NULL, that dragging ended. |
| 104 void OnSliderDragEnded(); | 108 void OnSliderDragEnded(); |
| 105 | 109 |
| 106 // views::View: | 110 // views::View: |
| 107 const char* GetClassName() const override; | 111 const char* GetClassName() const override; |
| 108 gfx::Size GetPreferredSize() const override; | 112 gfx::Size GetPreferredSize() const override; |
| 109 bool OnMousePressed(const ui::MouseEvent& event) override; | |
| 110 bool OnMouseDragged(const ui::MouseEvent& event) override; | 113 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 111 void OnMouseReleased(const ui::MouseEvent& event) override; | |
| 112 bool OnKeyPressed(const ui::KeyEvent& event) override; | 114 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 113 void GetAccessibleState(ui::AXViewState* state) override; | 115 void GetAccessibleState(ui::AXViewState* state) override; |
| 114 void OnFocus() override; | 116 void OnFocus() override; |
| 115 void OnBlur() override; | 117 void OnBlur() override; |
| 116 | 118 |
| 117 // ui::EventHandler: | 119 // ui::EventHandler: |
| 118 void OnGestureEvent(ui::GestureEvent* event) override; | 120 void OnGestureEvent(ui::GestureEvent* event) override; |
| 119 | 121 |
| 120 // gfx::AnimationDelegate: | 122 // gfx::AnimationDelegate: |
| 121 void AnimationProgressed(const gfx::Animation* animation) override; | 123 void AnimationProgressed(const gfx::Animation* animation) override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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_ |
| OLD | NEW |