OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/time.h" | 7 #include "base/time/time.h" |
8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 canvas->DrawImageInt(*GetHandleImage()->ToImageSkia(), | 186 canvas->DrawImageInt(*GetHandleImage()->ToImageSkia(), |
187 kSelectionHandleHorizPadding, cursor_height()); | 187 kSelectionHandleHorizPadding, cursor_height()); |
188 } | 188 } |
189 | 189 |
190 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { | 190 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { |
191 event->SetHandled(); | 191 event->SetHandled(); |
192 switch (event->type()) { | 192 switch (event->type()) { |
193 case ui::ET_GESTURE_SCROLL_BEGIN: | 193 case ui::ET_GESTURE_SCROLL_BEGIN: |
194 widget_->SetCapture(this); | 194 widget_->SetCapture(this); |
195 controller_->SetDraggingHandle(this); | 195 controller_->SetDraggingHandle(this); |
196 drag_offset_ = event->y() - cursor_height() - | 196 drag_offset_ = event->y() - cursor_height() + |
varunjain
2013/08/30 16:52:08
While you are here, mind adding a comment on drag_
mohsen
2013/08/30 18:26:39
Done.
| |
197 kSelectionHandleVerticalDragOffset; | 197 kSelectionHandleVerticalDragOffset; |
198 break; | 198 break; |
199 case ui::ET_GESTURE_SCROLL_UPDATE: { | 199 case ui::ET_GESTURE_SCROLL_UPDATE: { |
200 gfx::Point drag_pos(event->location().x(), | 200 gfx::Point drag_pos(event->location().x(), |
201 event->location().y() - drag_offset_); | 201 event->location().y() - drag_offset_); |
202 controller_->SelectionHandleDragged(drag_pos); | 202 controller_->SelectionHandleDragged(drag_pos); |
203 break; | 203 break; |
204 } | 204 } |
205 case ui::ET_GESTURE_SCROLL_END: | 205 case ui::ET_GESTURE_SCROLL_END: |
206 case ui::ET_SCROLL_FLING_START: | 206 case ui::ET_SCROLL_FLING_START: |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 } | 530 } |
531 | 531 |
532 ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create( | 532 ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create( |
533 ui::TouchEditable* client_view) { | 533 ui::TouchEditable* client_view) { |
534 if (switches::IsTouchEditingEnabled()) | 534 if (switches::IsTouchEditingEnabled()) |
535 return new views::TouchSelectionControllerImpl(client_view); | 535 return new views::TouchSelectionControllerImpl(client_view); |
536 return NULL; | 536 return NULL; |
537 } | 537 } |
538 | 538 |
539 } // namespace views | 539 } // namespace views |
OLD | NEW |