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 29 matching lines...) Expand all Loading... |
40 // button is pressed or released). | 40 // button is pressed or released). |
41 virtual void SliderDragStarted(Slider* sender) {} | 41 virtual void SliderDragStarted(Slider* sender) {} |
42 virtual void SliderDragEnded(Slider* sender) {} | 42 virtual void SliderDragEnded(Slider* sender) {} |
43 | 43 |
44 protected: | 44 protected: |
45 virtual ~SliderListener() {} | 45 virtual ~SliderListener() {} |
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 // Internal class name. |
| 51 static const char kViewClassName[]; |
| 52 |
50 enum Orientation { | 53 enum Orientation { |
51 HORIZONTAL, | 54 HORIZONTAL, |
52 VERTICAL | 55 VERTICAL |
53 }; | 56 }; |
54 | 57 |
55 Slider(SliderListener* listener, Orientation orientation); | 58 Slider(SliderListener* listener, Orientation orientation); |
56 ~Slider() override; | 59 ~Slider() override; |
57 | 60 |
58 float value() const { return value_; } | 61 float value() const { return value_; } |
59 void SetValue(float value); | 62 void SetValue(float value); |
(...skipping 27 matching lines...) Expand all Loading... |
87 | 90 |
88 void OnPaintFocus(gfx::Canvas* canvas); | 91 void OnPaintFocus(gfx::Canvas* canvas); |
89 | 92 |
90 // Notify the listener_, if not NULL, that dragging started. | 93 // Notify the listener_, if not NULL, that dragging started. |
91 void OnSliderDragStarted(); | 94 void OnSliderDragStarted(); |
92 | 95 |
93 // Notify the listener_, if not NULL, that dragging ended. | 96 // Notify the listener_, if not NULL, that dragging ended. |
94 void OnSliderDragEnded(); | 97 void OnSliderDragEnded(); |
95 | 98 |
96 // views::View overrides: | 99 // views::View overrides: |
| 100 const char* GetClassName() const override; |
97 gfx::Size GetPreferredSize() const override; | 101 gfx::Size GetPreferredSize() const override; |
98 void OnPaint(gfx::Canvas* canvas) override; | 102 void OnPaint(gfx::Canvas* canvas) override; |
99 bool OnMousePressed(const ui::MouseEvent& event) override; | 103 bool OnMousePressed(const ui::MouseEvent& event) override; |
100 bool OnMouseDragged(const ui::MouseEvent& event) override; | 104 bool OnMouseDragged(const ui::MouseEvent& event) override; |
101 void OnMouseReleased(const ui::MouseEvent& event) override; | 105 void OnMouseReleased(const ui::MouseEvent& event) override; |
102 bool OnKeyPressed(const ui::KeyEvent& event) override; | 106 bool OnKeyPressed(const ui::KeyEvent& event) override; |
103 void GetAccessibleState(ui::AXViewState* state) override; | 107 void GetAccessibleState(ui::AXViewState* state) override; |
104 void OnFocus() override; | 108 void OnFocus() override; |
105 void OnBlur() override; | 109 void OnBlur() override; |
106 | 110 |
(...skipping 29 matching lines...) Expand all Loading... |
136 const gfx::ImageSkia* thumb_; | 140 const gfx::ImageSkia* thumb_; |
137 const gfx::ImageSkia* images_[4]; | 141 const gfx::ImageSkia* images_[4]; |
138 int bar_height_; | 142 int bar_height_; |
139 | 143 |
140 DISALLOW_COPY_AND_ASSIGN(Slider); | 144 DISALLOW_COPY_AND_ASSIGN(Slider); |
141 }; | 145 }; |
142 | 146 |
143 } // namespace views | 147 } // namespace views |
144 | 148 |
145 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ | 149 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ |
OLD | NEW |