blob: 9b9f98f4a041829fdedb96a5777ba429b7c02a7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_AURA_CLIENT_DRAG_DROP_DELEGATE_H_
#define UI_AURA_CLIENT_DRAG_DROP_DELEGATE_H_
#pragma once
#include "ui/aura/aura_export.h"
namespace aura {
class DropTargetEvent;
class Window;
namespace client {
// A property key to store the drag and drop delegate for a window. The type of
// the value is |aura::WindowDragDropDelegate*|.
AURA_EXPORT extern const char kDragDropDelegateKey[];
// Delegate interface for drag and drop actions on aura::Window.
class AURA_EXPORT DragDropDelegate {
public:
// OnDragEntered is invoked when the mouse enters this window during a drag &
// drop session. This is immediately followed by an invocation of
// OnDragUpdated, and eventually one of OnDragExited or OnPerformDrop.
virtual void OnDragEntered(const DropTargetEvent& event) = 0;
// Invoked during a drag and drop session while the mouse is over the window.
// This should return a bitmask of the DragDropTypes::DragOperation supported
// based on the location of the event. Return 0 to indicate the drop should
// not be accepted.
virtual int OnDragUpdated(const DropTargetEvent& event) = 0;
// Invoked during a drag and drop session when the mouse exits the window, or
// when the drag session was canceled and the mouse was over the window.
virtual void OnDragExited() = 0;
// Invoked during a drag and drop session when OnDragUpdated returns a valid
// operation and the user release the mouse.
virtual int OnPerformDrop(const DropTargetEvent& event) = 0;
protected:
virtual ~DragDropDelegate() {}
};
AURA_EXPORT void SetDragDropDelegate(Window* window,
DragDropDelegate* delegate);
AURA_EXPORT DragDropDelegate* GetDragDropDelegate(Window* window);
} // namespace client
} // namespace aura
#endif // UI_AURA_CLIENT_DRAG_DROP_DELEGATE_H_
|