button_drag_utils.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright (c) 2012 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. #ifndef UI_VIEWS_BUTTON_DRAG_UTILS_H_
  5. #define UI_VIEWS_BUTTON_DRAG_UTILS_H_
  6. #include <string>
  7. #include "ui/views/views_export.h"
  8. class GURL;
  9. namespace gfx {
  10. class ImageSkia;
  11. class Point;
  12. } // namespace gfx
  13. namespace ui {
  14. class OSExchangeData;
  15. }
  16. namespace button_drag_utils {
  17. // Sets url and title on data as well as setting a suitable image for dragging.
  18. // The image looks like that of the bookmark buttons. |press_pt| is optional
  19. // offset; otherwise, it centers the drag image.
  20. VIEWS_EXPORT void SetURLAndDragImage(const GURL& url,
  21. const std::u16string& title,
  22. const gfx::ImageSkia& icon,
  23. const gfx::Point* press_pt,
  24. ui::OSExchangeData* data);
  25. // As above, but only sets the image.
  26. VIEWS_EXPORT void SetDragImage(const GURL& url,
  27. const std::u16string& title,
  28. const gfx::ImageSkia& icon,
  29. const gfx::Point* press_pt,
  30. ui::OSExchangeData* data);
  31. } // namespace button_drag_utils
  32. #endif // UI_VIEWS_BUTTON_DRAG_UTILS_H_