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_WINDOW_DRAG_DROP_DELEGATE_H_ |
6 #define UI_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_ | 6 #define UI_AURA_CLIENT_WINDOW_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 | 12 |
13 class DropTargetEvent; | 13 class DropTargetEvent; |
14 | 14 |
15 // Delegate interface for drag and drop actions on aura::Window. | 15 // Delegate interface for drag and drop actions on aura::Window. |
16 class AURA_EXPORT WindowDragDropDelegate { | 16 class AURA_EXPORT WindowDragDropDelegate { |
17 public: | 17 public: |
18 // A window that supports drag and drop must override this and return true if | |
19 // data contains a type that may be dropped on this window. | |
20 virtual bool CanDrop(const DropTargetEvent& event) = 0; | |
21 | |
22 // OnDragEntered is invoked when the mouse enters this window during a drag & | 18 // OnDragEntered is invoked when the mouse enters this window during a drag & |
23 // drop session and CanDrop returns true. This is immediately | 19 // drop session. This is immediately followed by an invocation of |
24 // followed by an invocation of OnDragUpdated, and eventually one of | 20 // OnDragUpdated, and eventually one of OnDragExited or OnPerformDrop. |
25 // OnDragExited or OnPerformDrop. | |
26 virtual void OnDragEntered(const DropTargetEvent& event) = 0; | 21 virtual void OnDragEntered(const DropTargetEvent& event) = 0; |
27 | 22 |
28 // Invoked during a drag and drop session while the mouse is over the window. | 23 // Invoked during a drag and drop session while the mouse is over the window. |
29 // This should return a bitmask of the DragDropTypes::DragOperation supported | 24 // This should return a bitmask of the DragDropTypes::DragOperation supported |
30 // based on the location of the event. Return 0 to indicate the drop should | 25 // based on the location of the event. Return 0 to indicate the drop should |
31 // not be accepted. | 26 // not be accepted. |
32 virtual int OnDragUpdated(const DropTargetEvent& event) = 0; | 27 virtual int OnDragUpdated(const DropTargetEvent& event) = 0; |
33 | 28 |
34 // Invoked during a drag and drop session when the mouse exits the window, or | 29 // Invoked during a drag and drop session when the mouse exits the window, or |
35 // when the drag session was canceled and the mouse was over the window. | 30 // when the drag session was canceled and the mouse was over the window. |
36 virtual void OnDragExited() = 0; | 31 virtual void OnDragExited() = 0; |
37 | 32 |
38 // Invoked during a drag and drop session when OnDragUpdated returns a valid | 33 // Invoked during a drag and drop session when OnDragUpdated returns a valid |
39 // operation and the user release the mouse. | 34 // operation and the user release the mouse. |
40 virtual int OnPerformDrop(const DropTargetEvent& event) = 0; | 35 virtual int OnPerformDrop(const DropTargetEvent& event) = 0; |
41 | 36 |
42 protected: | 37 protected: |
43 virtual ~WindowDragDropDelegate() {} | 38 virtual ~WindowDragDropDelegate() {} |
44 }; | 39 }; |
45 | 40 |
46 } // namespace aura | 41 } // namespace aura |
47 | 42 |
48 #endif // UI_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_ | 43 #endif // UI_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_ |
OLD | NEW |