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_BASE_DRAGDROP_DROP_TARGET_H_ | 5 #ifndef UI_BASE_DRAGDROP_DROP_TARGET_H_ |
6 #define UI_BASE_DRAGDROP_DROP_TARGET_H_ | 6 #define UI_BASE_DRAGDROP_DROP_TARGET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <objidl.h> | 9 #include <objidl.h> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "ui/ui_api.h" |
12 | 13 |
13 // Windows interface. | 14 // Windows interface. |
14 struct IDropTargetHelper; | 15 struct IDropTargetHelper; |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 | 18 |
18 // A DropTarget implementation that takes care of the nitty gritty | 19 // A DropTarget implementation that takes care of the nitty gritty |
19 // of dnd. While this class is concrete, subclasses will most likely | 20 // of dnd. While this class is concrete, subclasses will most likely |
20 // want to override various OnXXX methods. | 21 // want to override various OnXXX methods. |
21 // | 22 // |
22 // Because DropTarget is ref counted you shouldn't delete it directly, | 23 // Because DropTarget is ref counted you shouldn't delete it directly, |
23 // rather wrap it in a scoped_refptr. Be sure and invoke RevokeDragDrop(m_hWnd) | 24 // rather wrap it in a scoped_refptr. Be sure and invoke RevokeDragDrop(m_hWnd) |
24 // before the HWND is deleted too. | 25 // before the HWND is deleted too. |
25 // | 26 // |
26 // This class is meant to be used in a STA and is not multithread-safe. | 27 // This class is meant to be used in a STA and is not multithread-safe. |
27 class DropTarget : public IDropTarget { | 28 class UI_API DropTarget : public IDropTarget { |
28 public: | 29 public: |
29 // Create a new DropTarget associating it with the given HWND. | 30 // Create a new DropTarget associating it with the given HWND. |
30 explicit DropTarget(HWND hwnd); | 31 explicit DropTarget(HWND hwnd); |
31 virtual ~DropTarget(); | 32 virtual ~DropTarget(); |
32 | 33 |
33 // When suspended is set to |true|, the drop target does not receive drops | 34 // When suspended is set to |true|, the drop target does not receive drops |
34 // from drags initiated within the owning HWND. | 35 // from drags initiated within the owning HWND. |
35 bool suspended() const { return suspended_; } | 36 bool suspended() const { return suspended_; } |
36 void set_suspended(bool suspended) { suspended_ = suspended; } | 37 void set_suspended(bool suspended) { suspended_ = suspended; } |
37 | 38 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 bool suspended_; | 115 bool suspended_; |
115 | 116 |
116 LONG ref_count_; | 117 LONG ref_count_; |
117 | 118 |
118 DISALLOW_COPY_AND_ASSIGN(DropTarget); | 119 DISALLOW_COPY_AND_ASSIGN(DropTarget); |
119 }; | 120 }; |
120 | 121 |
121 } // namespace ui | 122 } // namespace ui |
122 | 123 |
123 #endif // UI_BASE_DRAGDROP_DROP_TARGET_H_ | 124 #endif // UI_BASE_DRAGDROP_DROP_TARGET_H_ |
OLD | NEW |