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