| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_VIEWS_DRAG_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_DRAG_CONTROLLER_H_ |
| 6 #define UI_VIEWS_DRAG_CONTROLLER_H_ | 6 #define UI_VIEWS_DRAG_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "ui/views/views_export.h" | 8 #include "ui/views/views_export.h" |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| 11 class Point; | 11 class Point; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 class OSExchangeData; | 15 class OSExchangeData; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 class View; | 19 class View; |
| 20 | 20 |
| 21 // DragController is responsible for writing drag data for a view, as well as | 21 // DragController is responsible for writing drag data for a view, as well as |
| 22 // supplying the supported drag operations. Use DragController if you don't | 22 // supplying the supported drag operations. Use DragController if you don't |
| 23 // want to subclass. | 23 // want to subclass. |
| 24 class VIEWS_EXPORT DragController { | 24 class VIEWS_EXPORT DragController { |
| 25 public: | 25 public: |
| 26 // Writes the data for the drag. | 26 // Writes the data for the drag. |
| 27 virtual void WriteDragDataForView(View* sender, | 27 virtual void WriteDragDataForView(View* sender, |
| 28 const gfx::Point& press_pt, | 28 const gfx::PointF& press_pt, |
| 29 ui::OSExchangeData* data) = 0; | 29 ui::OSExchangeData* data) = 0; |
| 30 | 30 |
| 31 // Returns the supported drag operations (see DragDropTypes for possible | 31 // Returns the supported drag operations (see DragDropTypes for possible |
| 32 // values). A drag is only started if this returns a non-zero value. | 32 // values). A drag is only started if this returns a non-zero value. |
| 33 virtual int GetDragOperationsForView(View* sender, | 33 virtual int GetDragOperationsForView(View* sender, const gfx::PointF& p) = 0; |
| 34 const gfx::Point& p) = 0; | |
| 35 | 34 |
| 36 // Returns true if a drag operation can be started. | 35 // Returns true if a drag operation can be started. |
| 37 // |press_pt| represents the coordinates where the mouse was initially | 36 // |press_pt| represents the coordinates where the mouse was initially |
| 38 // pressed down. |p| is the current mouse coordinates. | 37 // pressed down. |p| is the current mouse coordinates. |
| 39 virtual bool CanStartDragForView(View* sender, | 38 virtual bool CanStartDragForView(View* sender, |
| 40 const gfx::Point& press_pt, | 39 const gfx::PointF& press_pt, |
| 41 const gfx::Point& p) = 0; | 40 const gfx::PointF& p) = 0; |
| 42 | 41 |
| 43 protected: | 42 protected: |
| 44 virtual ~DragController() {} | 43 virtual ~DragController() {} |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 } // namespace views | 46 } // namespace views |
| 48 | 47 |
| 49 #endif // UI_VIEWS_DRAG_CONTROLLER_H_ | 48 #endif // UI_VIEWS_DRAG_CONTROLLER_H_ |
| OLD | NEW |