| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 BASE_BASE_DRAG_SOURCE_H_ | 5 #ifndef APP_WIN_DRAG_SOURCE_H_ |
| 6 #define BASE_BASE_DRAG_SOURCE_H_ | 6 #define APP_WIN_DRAG_SOURCE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <objidl.h> | 9 #include <objidl.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 | 13 |
| 14 /////////////////////////////////////////////////////////////////////////////// | 14 namespace app { |
| 15 // | 15 namespace win { |
| 16 // BaseDragSource | 16 |
| 17 // | 17 // A base IDropSource implementation. Handles notifications sent by an active |
| 18 // A base IDropSource implementation. Handles notifications sent by an active | 18 // drag-drop operation as the user mouses over other drop targets on their |
| 19 // drag-drop operation as the user mouses over other drop targets on their | 19 // system. This object tells Windows whether or not the drag should continue, |
| 20 // system. This object tells Windows whether or not the drag should continue, | 20 // and supplies the appropriate cursors. |
| 21 // and supplies the appropriate cursors. | 21 class DragSource : public IDropSource, |
| 22 // | 22 public base::RefCountedThreadSafe<DragSource> { |
| 23 class BaseDragSource : public IDropSource, | |
| 24 public base::RefCountedThreadSafe<BaseDragSource> { | |
| 25 public: | 23 public: |
| 26 BaseDragSource(); | 24 DragSource(); |
| 27 virtual ~BaseDragSource() { } | 25 virtual ~DragSource() {} |
| 28 | 26 |
| 29 // Stop the drag operation at the next chance we get. This doesn't | 27 // Stop the drag operation at the next chance we get. This doesn't |
| 30 // synchronously stop the drag (since Windows is controlling that), | 28 // synchronously stop the drag (since Windows is controlling that), |
| 31 // but lets us tell Windows to cancel the drag the next chance we get. | 29 // but lets us tell Windows to cancel the drag the next chance we get. |
| 32 void CancelDrag() { | 30 void CancelDrag() { |
| 33 cancel_drag_ = true; | 31 cancel_drag_ = true; |
| 34 } | 32 } |
| 35 | 33 |
| 36 // IDropSource implementation: | 34 // IDropSource implementation: |
| 37 HRESULT __stdcall QueryContinueDrag(BOOL escape_pressed, DWORD key_state); | 35 HRESULT __stdcall QueryContinueDrag(BOOL escape_pressed, DWORD key_state); |
| 38 HRESULT __stdcall GiveFeedback(DWORD effect); | 36 HRESULT __stdcall GiveFeedback(DWORD effect); |
| 39 | 37 |
| 40 // IUnknown implementation: | 38 // IUnknown implementation: |
| 41 HRESULT __stdcall QueryInterface(const IID& iid, void** object); | 39 HRESULT __stdcall QueryInterface(const IID& iid, void** object); |
| 42 ULONG __stdcall AddRef(); | 40 ULONG __stdcall AddRef(); |
| 43 ULONG __stdcall Release(); | 41 ULONG __stdcall Release(); |
| 44 | 42 |
| 45 protected: | 43 protected: |
| 46 virtual void OnDragSourceCancel() { } | 44 virtual void OnDragSourceCancel() {} |
| 47 virtual void OnDragSourceDrop() { } | 45 virtual void OnDragSourceDrop() {} |
| 48 virtual void OnDragSourceMove() { } | 46 virtual void OnDragSourceMove() {} |
| 49 | 47 |
| 50 private: | 48 private: |
| 51 // Set to true if we want to cancel the drag operation. | 49 // Set to true if we want to cancel the drag operation. |
| 52 bool cancel_drag_; | 50 bool cancel_drag_; |
| 53 | 51 |
| 54 DISALLOW_COPY_AND_ASSIGN(BaseDragSource); | 52 DISALLOW_COPY_AND_ASSIGN(DragSource); |
| 55 }; | 53 }; |
| 56 | 54 |
| 57 #endif // BASE_BASE_DRAG_SOURCE_H_ | 55 } // namespace win |
| 56 } // namespace app |
| 57 |
| 58 #endif // APP_WIN_DRAG_SOURCE_H_ |
| OLD | NEW |