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