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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 SkPaint paint; | 217 SkPaint paint; |
218 paint.setStyle(SkPaint::kFill_Style); | 218 paint.setStyle(SkPaint::kFill_Style); |
219 paint.setAntiAlias(true); | 219 paint.setAntiAlias(true); |
220 paint.setColor(kButtonColor); | 220 paint.setColor(kButtonColor); |
221 canvas->sk_canvas()->drawCircle(button_cx, button_cy, kButtonRadius, paint); | 221 canvas->sk_canvas()->drawCircle(button_cx, button_cy, kButtonRadius, paint); |
222 } | 222 } |
223 View::OnPaint(canvas); | 223 View::OnPaint(canvas); |
224 } | 224 } |
225 | 225 |
226 bool Slider::OnMousePressed(const views::MouseEvent& event) { | 226 bool Slider::OnMousePressed(const ui::MouseEvent& event) { |
227 if (listener_) | 227 if (listener_) |
228 listener_->SliderDragStarted(this); | 228 listener_->SliderDragStarted(this); |
229 MoveButtonTo(event.location()); | 229 MoveButtonTo(event.location()); |
230 return true; | 230 return true; |
231 } | 231 } |
232 | 232 |
233 bool Slider::OnMouseDragged(const views::MouseEvent& event) { | 233 bool Slider::OnMouseDragged(const ui::MouseEvent& event) { |
234 MoveButtonTo(event.location()); | 234 MoveButtonTo(event.location()); |
235 return true; | 235 return true; |
236 } | 236 } |
237 | 237 |
238 void Slider::OnMouseReleased(const views::MouseEvent& event) { | 238 void Slider::OnMouseReleased(const ui::MouseEvent& event) { |
239 if (listener_) | 239 if (listener_) |
240 listener_->SliderDragEnded(this); | 240 listener_->SliderDragEnded(this); |
241 } | 241 } |
242 | 242 |
243 bool Slider::OnKeyPressed(const ui::KeyEvent& event) { | 243 bool Slider::OnKeyPressed(const ui::KeyEvent& event) { |
244 if (orientation_ == HORIZONTAL) { | 244 if (orientation_ == HORIZONTAL) { |
245 if (event.key_code() == ui::VKEY_LEFT) { | 245 if (event.key_code() == ui::VKEY_LEFT) { |
246 SetValueInternal(value_ - keyboard_increment_, VALUE_CHANGED_BY_USER); | 246 SetValueInternal(value_ - keyboard_increment_, VALUE_CHANGED_BY_USER); |
247 return true; | 247 return true; |
248 } else if (event.key_code() == ui::VKEY_RIGHT) { | 248 } else if (event.key_code() == ui::VKEY_RIGHT) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) { | 287 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) { |
288 if (!focus_border_color_) { | 288 if (!focus_border_color_) { |
289 View::OnPaintFocusBorder(canvas); | 289 View::OnPaintFocusBorder(canvas); |
290 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 290 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
291 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), | 291 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), |
292 focus_border_color_); | 292 focus_border_color_); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 } // namespace views | 296 } // namespace views |
OLD | NEW |