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/touchui/touch_selection_controller_impl.h" | 5 #include "ui/views/touchui/touch_selection_controller_impl.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "third_party/skia/include/effects/SkGradientShader.h" | 10 #include "third_party/skia/include/effects/SkGradientShader.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 105 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
106 Circle circle = {kSelectionHandleRadius, gfx::Point(kSelectionHandleRadius, | 106 Circle circle = {kSelectionHandleRadius, gfx::Point(kSelectionHandleRadius, |
107 kSelectionHandleRadius + kSelectionHandleCursorHeight), | 107 kSelectionHandleRadius + kSelectionHandleCursorHeight), |
108 kSelectionHandleColor}; | 108 kSelectionHandleColor}; |
109 PaintCircle(circle, canvas); | 109 PaintCircle(circle, canvas); |
110 canvas->DrawLine(gfx::Point(kSelectionHandleRadius, 0), | 110 canvas->DrawLine(gfx::Point(kSelectionHandleRadius, 0), |
111 gfx::Point(kSelectionHandleRadius, kSelectionHandleCursorHeight), | 111 gfx::Point(kSelectionHandleRadius, kSelectionHandleCursorHeight), |
112 kSelectionHandleColor); | 112 kSelectionHandleColor); |
113 } | 113 } |
114 | 114 |
115 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE { | 115 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { |
116 controller_->dragging_handle_ = this; | 116 controller_->dragging_handle_ = this; |
117 return true; | 117 return true; |
118 } | 118 } |
119 | 119 |
120 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE { | 120 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE { |
121 controller_->SelectionHandleDragged(event.location()); | 121 controller_->SelectionHandleDragged(event.location()); |
122 return true; | 122 return true; |
123 } | 123 } |
124 | 124 |
125 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE { | 125 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE { |
126 controller_->dragging_handle_ = NULL; | 126 controller_->dragging_handle_ = NULL; |
127 } | 127 } |
128 | 128 |
129 virtual void OnMouseCaptureLost() OVERRIDE { | 129 virtual void OnMouseCaptureLost() OVERRIDE { |
130 controller_->dragging_handle_ = NULL; | 130 controller_->dragging_handle_ = NULL; |
131 } | 131 } |
132 | 132 |
133 virtual void SetVisible(bool visible) OVERRIDE { | 133 virtual void SetVisible(bool visible) OVERRIDE { |
134 // We simply show/hide the container widget. | 134 // We simply show/hide the container widget. |
135 if (visible != widget_->IsVisible()) { | 135 if (visible != widget_->IsVisible()) { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { | 487 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { |
488 return selection_handle_2_->visible(); | 488 return selection_handle_2_->visible(); |
489 } | 489 } |
490 | 490 |
491 TouchSelectionController* TouchSelectionController::create( | 491 TouchSelectionController* TouchSelectionController::create( |
492 TouchSelectionClientView* client_view) { | 492 TouchSelectionClientView* client_view) { |
493 return new TouchSelectionControllerImpl(client_view); | 493 return new TouchSelectionControllerImpl(client_view); |
494 } | 494 } |
495 | 495 |
496 } // namespace views | 496 } // namespace views |
OLD | NEW |