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, 34 const gfx::Point& p) = 0; 35 36 // Returns true if a drag operation can be started. 37 // |press_pt| represents the coordinates where the mouse was initially 38 // pressed down. |p| is the current mouse coordinates. 39 virtual bool CanStartDragForView(View* sender, 40 const gfx::Point& press_pt, 41 const gfx::Point& p) = 0; 42 43 protected: ~DragController()44 virtual ~DragController() {} 45 }; 46 47 } // namespace views 48 49 #endif // UI_VIEWS_DRAG_CONTROLLER_H_ 50