| 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 "ui/gfx/animation/animation_delegate.h" | 8 #include "ui/gfx/animation/animation_delegate.h" |
| 9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
| 10 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 class VIEWS_EXPORT Slider : public View, public gfx::AnimationDelegate { | 48 class VIEWS_EXPORT Slider : public View, public gfx::AnimationDelegate { |
| 49 public: | 49 public: |
| 50 enum Orientation { | 50 enum Orientation { |
| 51 HORIZONTAL, | 51 HORIZONTAL, |
| 52 VERTICAL | 52 VERTICAL |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 Slider(SliderListener* listener, Orientation orientation); | 55 Slider(SliderListener* listener, Orientation orientation); |
| 56 virtual ~Slider(); | 56 ~Slider() override; |
| 57 | 57 |
| 58 float value() const { return value_; } | 58 float value() const { return value_; } |
| 59 void SetValue(float value); | 59 void SetValue(float value); |
| 60 | 60 |
| 61 // Set the delta used for changing the value via keyboard. | 61 // Set the delta used for changing the value via keyboard. |
| 62 void SetKeyboardIncrement(float increment); | 62 void SetKeyboardIncrement(float increment); |
| 63 | 63 |
| 64 void SetAccessibleName(const base::string16& name); | 64 void SetAccessibleName(const base::string16& name); |
| 65 | 65 |
| 66 void set_enable_accessibility_events(bool enabled) { | 66 void set_enable_accessibility_events(bool enabled) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 87 | 87 |
| 88 void OnPaintFocus(gfx::Canvas* canvas); | 88 void OnPaintFocus(gfx::Canvas* canvas); |
| 89 | 89 |
| 90 // Notify the listener_, if not NULL, that dragging started. | 90 // Notify the listener_, if not NULL, that dragging started. |
| 91 void OnSliderDragStarted(); | 91 void OnSliderDragStarted(); |
| 92 | 92 |
| 93 // Notify the listener_, if not NULL, that dragging ended. | 93 // Notify the listener_, if not NULL, that dragging ended. |
| 94 void OnSliderDragEnded(); | 94 void OnSliderDragEnded(); |
| 95 | 95 |
| 96 // views::View overrides: | 96 // views::View overrides: |
| 97 virtual gfx::Size GetPreferredSize() const override; | 97 gfx::Size GetPreferredSize() const override; |
| 98 virtual void OnPaint(gfx::Canvas* canvas) override; | 98 void OnPaint(gfx::Canvas* canvas) override; |
| 99 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 99 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 100 virtual bool OnMouseDragged(const ui::MouseEvent& event) override; | 100 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 101 virtual void OnMouseReleased(const ui::MouseEvent& event) override; | 101 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 102 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 102 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 103 virtual void GetAccessibleState(ui::AXViewState* state) override; | 103 void GetAccessibleState(ui::AXViewState* state) override; |
| 104 virtual void OnFocus() override; | 104 void OnFocus() override; |
| 105 virtual void OnBlur() override; | 105 void OnBlur() override; |
| 106 | 106 |
| 107 // ui::EventHandler overrides: | 107 // ui::EventHandler overrides: |
| 108 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 108 void OnGestureEvent(ui::GestureEvent* event) override; |
| 109 | 109 |
| 110 // gfx::AnimationDelegate overrides: | 110 // gfx::AnimationDelegate overrides: |
| 111 virtual void AnimationProgressed(const gfx::Animation* animation) override; | 111 void AnimationProgressed(const gfx::Animation* animation) override; |
| 112 | 112 |
| 113 void set_listener(SliderListener* listener) { | 113 void set_listener(SliderListener* listener) { |
| 114 listener_ = listener; | 114 listener_ = listener; |
| 115 } | 115 } |
| 116 | 116 |
| 117 SliderListener* listener_; | 117 SliderListener* listener_; |
| 118 Orientation orientation_; | 118 Orientation orientation_; |
| 119 | 119 |
| 120 scoped_ptr<gfx::SlideAnimation> move_animation_; | 120 scoped_ptr<gfx::SlideAnimation> move_animation_; |
| 121 | 121 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 136 const gfx::ImageSkia* thumb_; | 136 const gfx::ImageSkia* thumb_; |
| 137 const gfx::ImageSkia* images_[4]; | 137 const gfx::ImageSkia* images_[4]; |
| 138 int bar_height_; | 138 int bar_height_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(Slider); | 140 DISALLOW_COPY_AND_ASSIGN(Slider); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 } // namespace views | 143 } // namespace views |
| 144 | 144 |
| 145 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ | 145 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ |
| OLD | NEW |