• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_VIEWS_WIDGET_DROP_TARGET_WIN_H_
6 #define UI_VIEWS_WIDGET_DROP_TARGET_WIN_H_
7 
8 #include "ui/base/dragdrop/drop_target_win.h"
9 #include "ui/views/widget/drop_helper.h"
10 
11 namespace views {
12 
13 class View;
14 namespace internal {
15 class RootView;
16 }
17 
18 // DropTargetWin takes care of managing drag and drop for NativeWidgetWin. It
19 // converts Windows OLE drop messages into Views drop messages.
20 //
21 // DropTargetWin uses DropHelper to manage the appropriate view to target
22 // drop messages at.
23 class DropTargetWin : public ui::DropTargetWin {
24  public:
25   explicit DropTargetWin(internal::RootView* root_view);
26   virtual ~DropTargetWin();
27 
28   // If a drag and drop is underway and view is the current drop target, the
29   // drop target is set to null.
30   // This is invoked when a View is removed from the RootView to make sure
31   // we don't target a view that was removed during dnd.
32   void ResetTargetViewIfEquals(View* view);
33 
34  protected:
35   virtual DWORD OnDragOver(IDataObject* data_object,
36                            DWORD key_state,
37                            POINT cursor_position,
38                            DWORD effect);
39 
40   virtual void OnDragLeave(IDataObject* data_object);
41 
42   virtual DWORD OnDrop(IDataObject* data_object,
43                        DWORD key_state,
44                        POINT cursor_position,
45                        DWORD effect);
46 
47  private:
48   views::DropHelper helper_;
49 
50   DISALLOW_COPY_AND_ASSIGN(DropTargetWin);
51 };
52 
53 }  // namespace views
54 
55 #endif  // UI_VIEWS_WIDGET_DROP_TARGET_WIN_H_
56