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 #include "ui/views/controls/slider.h" | 5 #include "ui/views/controls/slider.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // There is no message-loop when running tests. So we cannot animate then. | 96 // There is no message-loop when running tests. So we cannot animate then. |
97 animating_value_ = old_value; | 97 animating_value_ = old_value; |
98 move_animation_.reset(new ui::SlideAnimation(this)); | 98 move_animation_.reset(new ui::SlideAnimation(this)); |
99 move_animation_->SetSlideDuration(kSlideValueChangeDurationMS); | 99 move_animation_->SetSlideDuration(kSlideValueChangeDurationMS); |
100 move_animation_->Show(); | 100 move_animation_->Show(); |
101 AnimationProgressed(move_animation_.get()); | 101 AnimationProgressed(move_animation_.get()); |
102 } else { | 102 } else { |
103 SchedulePaint(); | 103 SchedulePaint(); |
104 } | 104 } |
105 if (accessibility_events_enabled_ && GetWidget()) { | 105 if (accessibility_events_enabled_ && GetWidget()) { |
106 GetWidget()->NotifyAccessibilityEvent( | 106 NotifyAccessibilityEvent( |
107 this, ui::AccessibilityTypes::EVENT_VALUE_CHANGED, true); | 107 ui::AccessibilityTypes::EVENT_VALUE_CHANGED, true); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 void Slider::PrepareForMove(const gfx::Point& point) { | 111 void Slider::PrepareForMove(const gfx::Point& point) { |
112 // Try to remember the position of the mouse cursor on the button. | 112 // Try to remember the position of the mouse cursor on the button. |
113 gfx::Insets inset = GetInsets(); | 113 gfx::Insets inset = GetInsets(); |
114 gfx::Rect content = GetContentsBounds(); | 114 gfx::Rect content = GetContentsBounds(); |
115 float value = move_animation_.get() && move_animation_->is_animating() ? | 115 float value = move_animation_.get() && move_animation_->is_animating() ? |
116 animating_value_ : value_; | 116 animating_value_ : value_; |
117 | 117 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) { | 319 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) { |
320 if (!focus_border_color_) { | 320 if (!focus_border_color_) { |
321 View::OnPaintFocusBorder(canvas); | 321 View::OnPaintFocusBorder(canvas); |
322 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 322 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
323 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), | 323 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), |
324 focus_border_color_); | 324 focus_border_color_); |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 } // namespace views | 328 } // namespace views |
OLD | NEW |