Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: ui/aura_shell/drag_image_view.cc

Issue 8450018: First shot at implementing drag&drop for Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed windows build errors Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura_shell/drag_image_view.h ('k') | ui/aura_shell/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "ui/aura_shell/drag_image_view.h"
6
7 #include "views/widget/widget.h"
8
9 namespace aura_shell {
10 namespace internal {
11
12 namespace {
13 using views::Widget;
14
15 Widget* CreateDragWidget() {
16 Widget* drag_widget = new Widget;
17 Widget::InitParams params;
18 params.type = Widget::InitParams::TYPE_TOOLTIP;
19 params.keep_on_top = true;
20 params.accept_events = false;
21 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
22 params.transparent = true;
23 drag_widget->Init(params);
24 drag_widget->SetOpacity(0xFF);
25 return drag_widget;
26 }
27 }
28
29 DragImageView::DragImageView() : views::ImageView() {
30 widget_.reset(CreateDragWidget());
31 widget_->SetContentsView(this);
32 widget_->SetAlwaysOnTop(true);
33
34 // We are owned by the DragDropController.
35 set_parent_owned(false);
36 }
37
38 DragImageView::~DragImageView() {
39 widget_->Hide();
40 }
41
42 void DragImageView::SetScreenBounds(const gfx::Rect& bounds) {
43 widget_->SetBounds(bounds);
44 }
45
46 void DragImageView::SetScreenPosition(const gfx::Point& position) {
47 widget_->SetBounds(gfx::Rect(position, GetPreferredSize()));
48 }
49
50 void DragImageView::SetWidgetVisible(bool visible) {
51 if (visible != widget_->IsVisible()) {
52 if (visible)
53 widget_->Show();
54 else
55 widget_->Hide();
56 }
57 }
58
59 } // namespace internal
60 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/drag_image_view.h ('k') | ui/aura_shell/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698