| OLD | NEW |
| (Empty) |
| 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 VIEWS_EVENTS_DRAG_CONTROLLER_H_ | |
| 6 #define VIEWS_EVENTS_DRAG_CONTROLLER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "views/views_export.h" | |
| 10 | |
| 11 namespace gfx { | |
| 12 class Point; | |
| 13 } | |
| 14 | |
| 15 namespace ui { | |
| 16 class OSExchangeData; | |
| 17 } | |
| 18 | |
| 19 namespace views { | |
| 20 class View; | |
| 21 | |
| 22 // DragController is responsible for writing drag data for a view, as well as | |
| 23 // supplying the supported drag operations. Use DragController if you don't | |
| 24 // want to subclass. | |
| 25 class VIEWS_EXPORT DragController { | |
| 26 public: | |
| 27 // Writes the data for the drag. | |
| 28 virtual void WriteDragDataForView(View* sender, | |
| 29 const gfx::Point& press_pt, | |
| 30 OSExchangeData* data) = 0; | |
| 31 | |
| 32 // Returns the supported drag operations (see DragDropTypes for possible | |
| 33 // values). A drag is only started if this returns a non-zero value. | |
| 34 virtual int GetDragOperationsForView(View* sender, | |
| 35 const gfx::Point& p) = 0; | |
| 36 | |
| 37 // Returns true if a drag operation can be started. | |
| 38 // |press_pt| represents the coordinates where the mouse was initially | |
| 39 // pressed down. |p| is the current mouse coordinates. | |
| 40 virtual bool CanStartDragForView(View* sender, | |
| 41 const gfx::Point& press_pt, | |
| 42 const gfx::Point& p) = 0; | |
| 43 | |
| 44 protected: | |
| 45 virtual ~DragController() {} | |
| 46 }; | |
| 47 | |
| 48 } // namespace views | |
| 49 | |
| 50 #endif // VIEWS_EVENTS_DRAG_CONTROLLER_H_ | |
| OLD | NEW |