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_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ |
6 #define ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ | 6 #define ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ui/base/animation/animation_delegate.h" | 11 #include "ui/base/animation/animation_delegate.h" |
12 #include "ui/gfx/display.h" | 12 #include "ui/gfx/display.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 | 14 |
15 namespace aura { | 15 namespace aura { |
| 16 class RootWindow; |
16 class Window; | 17 class Window; |
17 class RootWindow; | |
18 } | 18 } |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
| 21 class Layer; |
21 class SlideAnimation; | 22 class SlideAnimation; |
22 } | 23 } |
23 | 24 |
24 namespace views { | 25 namespace views { |
25 class Widget; | 26 class Widget; |
26 } | 27 } |
27 | 28 |
28 namespace ash { | 29 namespace ash { |
29 namespace internal { | 30 namespace internal { |
30 | 31 |
31 // PhantomWindowController is responsible for showing a phantom representation | 32 // PhantomWindowController is responsible for showing a phantom representation |
32 // of a window. It's used used during dragging a window to show a snap location. | 33 // of a window. It's used used during dragging a window to show a snap location. |
33 class ASH_EXPORT PhantomWindowController : public ui::AnimationDelegate { | 34 class ASH_EXPORT PhantomWindowController : public ui::AnimationDelegate { |
34 public: | 35 public: |
35 enum Style { | 36 enum Style { |
36 STYLE_SHADOW, // for window snapping. | 37 STYLE_SHADOW, // for window snapping. |
37 STYLE_WINDOW, // for window dragging. | 38 STYLE_NONE, // for window dragging. |
38 }; | 39 }; |
39 | 40 |
40 explicit PhantomWindowController(aura::Window* window); | 41 explicit PhantomWindowController(aura::Window* window); |
41 virtual ~PhantomWindowController(); | 42 virtual ~PhantomWindowController(); |
42 | 43 |
43 // Sets the display where the phantom is placed. | 44 // Sets the display where the phantom is placed. |
44 void SetDestinationDisplay(const gfx::Display& dst_display); | 45 void SetDestinationDisplay(const gfx::Display& dst_display); |
45 | 46 |
46 // Bounds last passed to Show(). | 47 // Bounds last passed to Show(). |
47 const gfx::Rect& bounds() const { return bounds_; } | 48 const gfx::Rect& bounds() const { return bounds_; } |
(...skipping 11 matching lines...) Expand all Loading... |
59 | 60 |
60 // Returns true if the phantom is showing. | 61 // Returns true if the phantom is showing. |
61 bool IsShowing() const; | 62 bool IsShowing() const; |
62 | 63 |
63 // If set, the phantom window is stacked below this window, otherwise it | 64 // If set, the phantom window is stacked below this window, otherwise it |
64 // is stacked above the window passed to the constructor. | 65 // is stacked above the window passed to the constructor. |
65 void set_phantom_below_window(aura::Window* phantom_below_window) { | 66 void set_phantom_below_window(aura::Window* phantom_below_window) { |
66 phantom_below_window_ = phantom_below_window; | 67 phantom_below_window_ = phantom_below_window; |
67 } | 68 } |
68 | 69 |
| 70 // Sets/gets the |layer| which is shown on top of the |phantom_widget_|. |
| 71 // PhantomWindowController does not own the |layer|. |
| 72 void set_layer(ui::Layer* layer); |
| 73 ui::Layer* layer() const { return layer_; } |
| 74 |
69 // Sets/gets the style of the phantom window. | 75 // Sets/gets the style of the phantom window. |
70 void set_style(Style style); | 76 void set_style(Style style); |
71 Style style() const { return style_; } | 77 Style style() const { return style_; } |
72 | 78 |
73 // Sets/gets the opacity of the phantom window. | 79 // Sets/gets the opacity of the phantom window. |
74 void SetOpacity(float opacity); | 80 void SetOpacity(float opacity); |
75 float GetOpacity() const; | 81 float GetOpacity() const; |
76 | 82 |
77 // ui::AnimationDelegate overrides: | 83 // ui::AnimationDelegate overrides: |
78 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 84 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
(...skipping 25 matching lines...) Expand all Loading... |
104 gfx::Rect bounds_; | 110 gfx::Rect bounds_; |
105 | 111 |
106 views::Widget* phantom_widget_; | 112 views::Widget* phantom_widget_; |
107 | 113 |
108 // Used to transition the bounds. | 114 // Used to transition the bounds. |
109 scoped_ptr<ui::SlideAnimation> animation_; | 115 scoped_ptr<ui::SlideAnimation> animation_; |
110 | 116 |
111 // The style of the phantom window. | 117 // The style of the phantom window. |
112 Style style_; | 118 Style style_; |
113 | 119 |
| 120 // The layer which should be shown on top of the |phantom_widget_|. NULL when |
| 121 // no layer needs to be shown. This object does not own the layer. |
| 122 ui::Layer* layer_; |
| 123 |
114 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController); | 124 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController); |
115 }; | 125 }; |
116 | 126 |
117 } // namespace internal | 127 } // namespace internal |
118 } // namespace ash | 128 } // namespace ash |
119 | 129 |
120 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ | 130 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ |
OLD | NEW |