Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: ui/views/controls/slider.cc

Issue 10825254: Remove views::KeyEvent, replacing uses of it with ui::KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/slider.h ('k') | ui/views/controls/table/table_view_views.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "grit/ui_resources.h" 11 #include "grit/ui_resources.h"
12 #include "third_party/skia/include/core/SkCanvas.h" 12 #include "third_party/skia/include/core/SkCanvas.h"
13 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
14 #include "third_party/skia/include/core/SkPaint.h" 14 #include "third_party/skia/include/core/SkPaint.h"
15 #include "ui/base/accessibility/accessible_view_state.h" 15 #include "ui/base/accessibility/accessible_view_state.h"
16 #include "ui/base/animation/slide_animation.h" 16 #include "ui/base/animation/slide_animation.h"
17 #include "ui/base/event.h"
17 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/point.h" 20 #include "ui/gfx/point.h"
20 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
21 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
22 23
23 namespace { 24 namespace {
24 const int kSlideValueChangeDurationMS = 150; 25 const int kSlideValueChangeDurationMS = 150;
25 26
26 const int kBarImagesActive[] = { 27 const int kBarImagesActive[] = {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 bool Slider::OnMouseDragged(const views::MouseEvent& event) { 233 bool Slider::OnMouseDragged(const views::MouseEvent& event) {
233 MoveButtonTo(event.location()); 234 MoveButtonTo(event.location());
234 return true; 235 return true;
235 } 236 }
236 237
237 void Slider::OnMouseReleased(const views::MouseEvent& event) { 238 void Slider::OnMouseReleased(const views::MouseEvent& event) {
238 if (listener_) 239 if (listener_)
239 listener_->SliderDragEnded(this); 240 listener_->SliderDragEnded(this);
240 } 241 }
241 242
242 bool Slider::OnKeyPressed(const views::KeyEvent& event) { 243 bool Slider::OnKeyPressed(const ui::KeyEvent& event) {
243 if (orientation_ == HORIZONTAL) { 244 if (orientation_ == HORIZONTAL) {
244 if (event.key_code() == ui::VKEY_LEFT) { 245 if (event.key_code() == ui::VKEY_LEFT) {
245 SetValueInternal(value_ - keyboard_increment_, VALUE_CHANGED_BY_USER); 246 SetValueInternal(value_ - keyboard_increment_, VALUE_CHANGED_BY_USER);
246 return true; 247 return true;
247 } else if (event.key_code() == ui::VKEY_RIGHT) { 248 } else if (event.key_code() == ui::VKEY_RIGHT) {
248 SetValueInternal(value_ + keyboard_increment_, VALUE_CHANGED_BY_USER); 249 SetValueInternal(value_ + keyboard_increment_, VALUE_CHANGED_BY_USER);
249 return true; 250 return true;
250 } 251 }
251 } else { 252 } else {
252 if (event.key_code() == ui::VKEY_DOWN) { 253 if (event.key_code() == ui::VKEY_DOWN) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) { 287 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) {
287 if (!focus_border_color_) { 288 if (!focus_border_color_) {
288 View::OnPaintFocusBorder(canvas); 289 View::OnPaintFocusBorder(canvas);
289 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { 290 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) {
290 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), 291 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3),
291 focus_border_color_); 292 focus_border_color_);
292 } 293 }
293 } 294 }
294 295
295 } // namespace views 296 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/slider.h ('k') | ui/views/controls/table/table_view_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698