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