| 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_DRAG_UTILS_H_ | |
| 6 #define VIEWS_DRAG_UTILS_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/file_path.h" | |
| 12 #include "base/string16.h" | |
| 13 #include "views/views_export.h" | |
| 14 | |
| 15 class GURL; | |
| 16 class SkBitmap; | |
| 17 | |
| 18 namespace gfx { | |
| 19 class Canvas; | |
| 20 class Point; | |
| 21 class Size; | |
| 22 } | |
| 23 | |
| 24 namespace ui { | |
| 25 class OSExchangeData; | |
| 26 } | |
| 27 using ui::OSExchangeData; | |
| 28 | |
| 29 namespace drag_utils { | |
| 30 | |
| 31 // Sets url and title on data as well as setting a suitable image for dragging. | |
| 32 // The image looks like that of the bookmark buttons. | |
| 33 VIEWS_EXPORT void SetURLAndDragImage(const GURL& url, | |
| 34 const string16& title, | |
| 35 const SkBitmap& icon, | |
| 36 OSExchangeData* data); | |
| 37 | |
| 38 // Creates a dragging image to be displayed when the user drags a file from | |
| 39 // Chrome (via the download manager, for example). The drag image is set into | |
| 40 // the supplied data_object. 'file_name' can be a full path, but the directory | |
| 41 // portion will be truncated in the drag image. | |
| 42 VIEWS_EXPORT void CreateDragImageForFile(const FilePath& file_name, | |
| 43 const SkBitmap* icon, | |
| 44 OSExchangeData* data_object); | |
| 45 | |
| 46 // Sets the drag image on data_object from the supplied canvas. width/height | |
| 47 // are the size of the image to use, and the offsets give the location of | |
| 48 // the hotspot for the drag image. | |
| 49 VIEWS_EXPORT void SetDragImageOnDataObject(const gfx::Canvas& canvas, | |
| 50 const gfx::Size& size, | |
| 51 const gfx::Point& cursor_offset, | |
| 52 OSExchangeData* data_object); | |
| 53 | |
| 54 // Sets the drag image on data_object from the supplied bitmap. width/height | |
| 55 // are the size of the image to use, and the offsets give the location of | |
| 56 // the hotspot for the drag image. | |
| 57 VIEWS_EXPORT void SetDragImageOnDataObject(const SkBitmap& bitmap, | |
| 58 const gfx::Size& size, | |
| 59 const gfx::Point& cursor_offset, | |
| 60 OSExchangeData* data_object); | |
| 61 | |
| 62 } // namespace drag_utils | |
| 63 | |
| 64 #endif // #ifndef VIEWS_DRAG_UTILS_H_ | |
| OLD | NEW |