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/base/animation/animation_delegate.h" | 8 #include "ui/base/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" |
11 | 11 |
12 typedef unsigned int SkColor; | 12 typedef unsigned int SkColor; |
13 | 13 |
| 14 namespace gfx { |
| 15 class ImageSkia; |
| 16 } |
| 17 |
14 namespace ui { | 18 namespace ui { |
15 class SlideAnimation; | 19 class SlideAnimation; |
16 } | 20 } |
17 | 21 |
18 namespace views { | 22 namespace views { |
19 | 23 |
20 class Slider; | 24 class Slider; |
21 | 25 |
22 enum SliderChangeReason { | 26 enum SliderChangeReason { |
23 VALUE_CHANGED_BY_USER, // value was changed by the user (by clicking, e.g.) | 27 VALUE_CHANGED_BY_USER, // value was changed by the user (by clicking, e.g.) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void SetKeyboardIncrement(float increment); | 62 void SetKeyboardIncrement(float increment); |
59 | 63 |
60 void SetAccessibleName(const string16& name); | 64 void SetAccessibleName(const string16& name); |
61 | 65 |
62 void set_enable_accessibility_events(bool enabled) { | 66 void set_enable_accessibility_events(bool enabled) { |
63 accessibility_events_enabled_ = enabled; | 67 accessibility_events_enabled_ = enabled; |
64 } | 68 } |
65 | 69 |
66 void set_focus_border_color(SkColor color) { focus_border_color_ = color; } | 70 void set_focus_border_color(SkColor color) { focus_border_color_ = color; } |
67 | 71 |
| 72 // Update UI based on control on/off state. |
| 73 void UpdateState(bool control_on); |
| 74 |
68 private: | 75 private: |
69 void SetValueInternal(float value, SliderChangeReason reason); | 76 void SetValueInternal(float value, SliderChangeReason reason); |
70 | 77 |
71 // Moves the button to the specified point and updates the value accordingly. | 78 // Moves the button to the specified point and updates the value accordingly. |
72 void MoveButtonTo(const gfx::Point& point); | 79 void MoveButtonTo(const gfx::Point& point); |
73 | 80 |
74 // views::View overrides: | 81 // views::View overrides: |
75 virtual gfx::Size GetPreferredSize() OVERRIDE; | 82 virtual gfx::Size GetPreferredSize() OVERRIDE; |
76 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 83 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
77 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 84 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
92 scoped_ptr<ui::SlideAnimation> move_animation_; | 99 scoped_ptr<ui::SlideAnimation> move_animation_; |
93 | 100 |
94 float value_; | 101 float value_; |
95 float keyboard_increment_; | 102 float keyboard_increment_; |
96 float animating_value_; | 103 float animating_value_; |
97 bool value_is_valid_; | 104 bool value_is_valid_; |
98 string16 accessible_name_; | 105 string16 accessible_name_; |
99 bool accessibility_events_enabled_; | 106 bool accessibility_events_enabled_; |
100 SkColor focus_border_color_; | 107 SkColor focus_border_color_; |
101 | 108 |
| 109 const int* bar_active_images_; |
| 110 const int* bar_disabled_images_; |
| 111 const gfx::ImageSkia* thumb_; |
| 112 const gfx::ImageSkia* images_[4]; |
| 113 int bar_height_; |
| 114 |
102 DISALLOW_COPY_AND_ASSIGN(Slider); | 115 DISALLOW_COPY_AND_ASSIGN(Slider); |
103 }; | 116 }; |
104 | 117 |
105 } // namespace views | 118 } // namespace views |
106 | 119 |
107 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ | 120 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ |
OLD | NEW |