OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_AURA_WINDOW_DRAG_DROP_DELEGATE_H_ |
| 6 #define UI_AURA_WINDOW_DRAG_DROP_DELEGATE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "ui/aura/aura_export.h" |
| 10 |
| 11 namespace aura { |
| 12 |
| 13 class DropTargetEvent; |
| 14 |
| 15 // Delegate interface for drag and drop actions on aura::Window. |
| 16 class AURA_EXPORT WindowDragDropDelegate { |
| 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 & |
| 23 // drop session and CanDrop returns true. This is immediately |
| 24 // followed by an invocation of OnDragUpdated, and eventually one of |
| 25 // OnDragExited or OnPerformDrop. |
| 26 virtual void OnDragEntered(const DropTargetEvent& event) = 0; |
| 27 |
| 28 // 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 |
| 30 // based on the location of the event. Return 0 to indicate the drop should |
| 31 // not be accepted. |
| 32 virtual int OnDragUpdated(const DropTargetEvent& event) = 0; |
| 33 |
| 34 // 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. |
| 36 virtual void OnDragExited() = 0; |
| 37 |
| 38 // Invoked during a drag and drop session when OnDragUpdated returns a valid |
| 39 // operation and the user release the mouse. |
| 40 virtual int OnPerformDrop(const DropTargetEvent& event) = 0; |
| 41 |
| 42 protected: |
| 43 virtual ~WindowDragDropDelegate() {} |
| 44 }; |
| 45 |
| 46 } // namespace aura |
| 47 |
| 48 #endif // UI_AURA_WINDOW_DRAG_DROP_DELEGATE_H_ |
OLD | NEW |