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