| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 ASH_DRAG_DROP_DRAG_IMAGE_VIEW_H_ | 5 #ifndef ASH_DRAG_DROP_DRAG_IMAGE_VIEW_H_ |
| 6 #define ASH_DRAG_DROP_DRAG_IMAGE_VIEW_H_ | 6 #define ASH_DRAG_DROP_DRAG_IMAGE_VIEW_H_ |
| 7 | 7 |
| 8 #include "ui/base/dragdrop/drag_drop_types.h" | 8 #include "ui/base/dragdrop/drag_drop_types.h" |
| 9 #include "ui/views/controls/image_view.h" | 9 #include "ui/views/controls/image_view.h" |
| 10 | 10 |
| 11 namespace gfx { |
| 12 class Image; |
| 13 } |
| 14 |
| 11 namespace views { | 15 namespace views { |
| 12 class Widget; | 16 class Widget; |
| 13 } | 17 } |
| 14 | 18 |
| 15 namespace ash { | 19 namespace ash { |
| 16 | 20 |
| 17 // This class allows to show a (native) view always on top of everything. It | 21 // This class allows to show a (native) view always on top of everything. It |
| 18 // does this by creating a widget and setting the content as the given view. The | 22 // does this by creating a widget and setting the content as the given view. The |
| 19 // caller can then use this object to freely move / drag it around on the | 23 // caller can then use this object to freely move / drag it around on the |
| 20 // desktop in screen coordinates. | 24 // desktop in screen coordinates. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 51 | 55 |
| 52 // |operation| is a bit field indicating allowable drag operations from | 56 // |operation| is a bit field indicating allowable drag operations from |
| 53 // ui::DragDropTypes::DragOperation. | 57 // ui::DragDropTypes::DragOperation. |
| 54 void SetTouchDragOperation(int operation); | 58 void SetTouchDragOperation(int operation); |
| 55 void SetTouchDragOperationHintPosition(const gfx::Point& position); | 59 void SetTouchDragOperationHintPosition(const gfx::Point& position); |
| 56 | 60 |
| 57 // Sets the |opacity| of the image view between 0.0 and 1.0. | 61 // Sets the |opacity| of the image view between 0.0 and 1.0. |
| 58 void SetOpacity(float opacity); | 62 void SetOpacity(float opacity); |
| 59 | 63 |
| 60 private: | 64 private: |
| 65 gfx::Image* DragHint() const; |
| 66 |
| 61 // Overridden from views::ImageView. | 67 // Overridden from views::ImageView. |
| 62 void OnPaint(gfx::Canvas* canvas) override; | 68 void OnPaint(gfx::Canvas* canvas) override; |
| 63 | 69 |
| 70 // Overridden from views::view |
| 71 void Layout() override; |
| 72 |
| 64 scoped_ptr<views::Widget> widget_; | 73 scoped_ptr<views::Widget> widget_; |
| 65 gfx::Size widget_size_; | 74 gfx::Size widget_size_; |
| 66 | 75 |
| 67 ui::DragDropTypes::DragEventSource drag_event_source_; | 76 ui::DragDropTypes::DragEventSource drag_event_source_; |
| 68 int touch_drag_operation_; | 77 int touch_drag_operation_; |
| 69 gfx::Point touch_drag_operation_indicator_position_; | 78 gfx::Point touch_drag_operation_indicator_position_; |
| 70 | 79 |
| 71 DISALLOW_COPY_AND_ASSIGN(DragImageView); | 80 DISALLOW_COPY_AND_ASSIGN(DragImageView); |
| 72 }; | 81 }; |
| 73 | 82 |
| 74 } // namespace ash | 83 } // namespace ash |
| 75 | 84 |
| 76 #endif // ASH_DRAG_DROP_DRAG_IMAGE_VIEW_H_ | 85 #endif // ASH_DRAG_DROP_DRAG_IMAGE_VIEW_H_ |
| OLD | NEW |