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_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_ | 5 #ifndef UI_AURA_CLIENT_DRAG_DROP_DELEGATE_H_ |
6 #define UI_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_ | 6 #define UI_AURA_CLIENT_DRAG_DROP_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/aura/aura_export.h" | 9 #include "ui/aura/aura_export.h" |
10 | 10 |
11 namespace aura { | 11 namespace aura { |
12 | |
13 class DropTargetEvent; | 12 class DropTargetEvent; |
| 13 class Window; |
| 14 namespace client { |
14 | 15 |
15 // Delegate interface for drag and drop actions on aura::Window. | 16 // Delegate interface for drag and drop actions on aura::Window. |
16 class AURA_EXPORT WindowDragDropDelegate { | 17 class AURA_EXPORT DragDropDelegate { |
17 public: | 18 public: |
18 // OnDragEntered is invoked when the mouse enters this window during a drag & | 19 // OnDragEntered is invoked when the mouse enters this window during a drag & |
19 // drop session. This is immediately followed by an invocation of | 20 // drop session. This is immediately followed by an invocation of |
20 // OnDragUpdated, and eventually one of OnDragExited or OnPerformDrop. | 21 // OnDragUpdated, and eventually one of OnDragExited or OnPerformDrop. |
21 virtual void OnDragEntered(const DropTargetEvent& event) = 0; | 22 virtual void OnDragEntered(const DropTargetEvent& event) = 0; |
22 | 23 |
23 // Invoked during a drag and drop session while the mouse is over the window. | 24 // Invoked during a drag and drop session while the mouse is over the window. |
24 // This should return a bitmask of the DragDropTypes::DragOperation supported | 25 // This should return a bitmask of the DragDropTypes::DragOperation supported |
25 // based on the location of the event. Return 0 to indicate the drop should | 26 // based on the location of the event. Return 0 to indicate the drop should |
26 // not be accepted. | 27 // not be accepted. |
27 virtual int OnDragUpdated(const DropTargetEvent& event) = 0; | 28 virtual int OnDragUpdated(const DropTargetEvent& event) = 0; |
28 | 29 |
29 // Invoked during a drag and drop session when the mouse exits the window, or | 30 // Invoked during a drag and drop session when the mouse exits the window, or |
30 // when the drag session was canceled and the mouse was over the window. | 31 // when the drag session was canceled and the mouse was over the window. |
31 virtual void OnDragExited() = 0; | 32 virtual void OnDragExited() = 0; |
32 | 33 |
33 // Invoked during a drag and drop session when OnDragUpdated returns a valid | 34 // Invoked during a drag and drop session when OnDragUpdated returns a valid |
34 // operation and the user release the mouse. | 35 // operation and the user release the mouse. |
35 virtual int OnPerformDrop(const DropTargetEvent& event) = 0; | 36 virtual int OnPerformDrop(const DropTargetEvent& event) = 0; |
36 | 37 |
37 protected: | 38 protected: |
38 virtual ~WindowDragDropDelegate() {} | 39 virtual ~DragDropDelegate() {} |
39 }; | 40 }; |
40 | 41 |
| 42 AURA_EXPORT void SetDragDropDelegate(Window* window, |
| 43 DragDropDelegate* delegate); |
| 44 AURA_EXPORT DragDropDelegate* GetDragDropDelegate(Window* window); |
| 45 |
| 46 } // namespace client |
41 } // namespace aura | 47 } // namespace aura |
42 | 48 |
43 #endif // UI_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_ | 49 #endif // UI_AURA_CLIENT_DRAG_DROP_DELEGATE_H_ |
OLD | NEW |