OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_COMMON_WM_WINDOW_H_ | 5 #ifndef ASH_WM_COMMON_WM_WINDOW_H_ |
6 #define ASH_WM_COMMON_WM_WINDOW_H_ | 6 #define ASH_WM_COMMON_WM_WINDOW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 class WmLayoutManager; | 39 class WmLayoutManager; |
40 class WmRootWindowController; | 40 class WmRootWindowController; |
41 class WmWindowObserver; | 41 class WmWindowObserver; |
42 enum class WmWindowProperty; | 42 enum class WmWindowProperty; |
43 class WindowState; | 43 class WindowState; |
44 | 44 |
45 // This class exists as a porting layer to allow ash/wm to work with | 45 // This class exists as a porting layer to allow ash/wm to work with |
46 // aura::Window or mus::Window. See aura::Window for details on the functions. | 46 // aura::Window or mus::Window. See aura::Window for details on the functions. |
47 class ASH_EXPORT WmWindow { | 47 class ASH_EXPORT WmWindow { |
48 public: | 48 public: |
| 49 // See comments in SetBoundsInScreen(). |
| 50 enum class BoundsInScreenBehavior { |
| 51 USE_LOCAL_COORDINATES, |
| 52 USE_SCREEN_COORDINATES, |
| 53 }; |
| 54 |
49 WmWindow* GetRootWindow() { | 55 WmWindow* GetRootWindow() { |
50 return const_cast<WmWindow*>( | 56 return const_cast<WmWindow*>( |
51 const_cast<const WmWindow*>(this)->GetRootWindow()); | 57 const_cast<const WmWindow*>(this)->GetRootWindow()); |
52 } | 58 } |
53 virtual const WmWindow* GetRootWindow() const = 0; | 59 virtual const WmWindow* GetRootWindow() const = 0; |
54 virtual WmRootWindowController* GetRootWindowController() = 0; | 60 virtual WmRootWindowController* GetRootWindowController() = 0; |
55 | 61 |
56 // TODO(sky): fix constness. | 62 // TODO(sky): fix constness. |
57 virtual WmGlobals* GetGlobals() const = 0; | 63 virtual WmGlobals* GetGlobals() const = 0; |
58 | 64 |
| 65 // Used for debugging. |
| 66 virtual void SetName(const char* name) = 0; |
| 67 |
59 virtual base::string16 GetTitle() const = 0; | 68 virtual base::string16 GetTitle() const = 0; |
60 | 69 |
61 // See wm_shell_window_ids.h for list of known ids. | 70 // See wm_shell_window_ids.h for list of known ids. |
62 virtual void SetShellWindowId(int id) = 0; | 71 virtual void SetShellWindowId(int id) = 0; |
63 virtual int GetShellWindowId() const = 0; | 72 virtual int GetShellWindowId() const = 0; |
64 virtual WmWindow* GetChildByShellWindowId(int id) = 0; | 73 virtual WmWindow* GetChildByShellWindowId(int id) = 0; |
65 | 74 |
66 virtual ui::wm::WindowType GetType() const = 0; | 75 virtual ui::wm::WindowType GetType() const = 0; |
67 | 76 |
68 // TODO(sky): seems like this shouldn't be exposed. | 77 // TODO(sky): seems like this shouldn't be exposed. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 virtual WmLayoutManager* GetLayoutManager() = 0; | 137 virtual WmLayoutManager* GetLayoutManager() = 0; |
129 | 138 |
130 // |type| is WindowVisibilityAnimationType. Has to be an int to match aura. | 139 // |type| is WindowVisibilityAnimationType. Has to be an int to match aura. |
131 virtual void SetVisibilityAnimationType(int type) = 0; | 140 virtual void SetVisibilityAnimationType(int type) = 0; |
132 virtual void SetVisibilityAnimationDuration(base::TimeDelta delta) = 0; | 141 virtual void SetVisibilityAnimationDuration(base::TimeDelta delta) = 0; |
133 virtual void SetVisibilityAnimationTransition( | 142 virtual void SetVisibilityAnimationTransition( |
134 ::wm::WindowVisibilityAnimationTransition transition) = 0; | 143 ::wm::WindowVisibilityAnimationTransition transition) = 0; |
135 virtual void Animate(::wm::WindowAnimationType type) = 0; | 144 virtual void Animate(::wm::WindowAnimationType type) = 0; |
136 virtual void StopAnimatingProperty( | 145 virtual void StopAnimatingProperty( |
137 ui::LayerAnimationElement::AnimatableProperty property) = 0; | 146 ui::LayerAnimationElement::AnimatableProperty property) = 0; |
| 147 virtual void SetChildWindowVisibilityChangesAnimated() = 0; |
| 148 |
| 149 // See description in ui::Layer. |
| 150 virtual void SetMasksToBounds(bool value) = 0; |
138 | 151 |
139 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 152 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
140 virtual void SetBoundsWithTransitionDelay(const gfx::Rect& bounds, | 153 virtual void SetBoundsWithTransitionDelay(const gfx::Rect& bounds, |
141 base::TimeDelta delta) = 0; | 154 base::TimeDelta delta) = 0; |
142 // Sets the bounds in such a way that LayoutManagers are circumvented. | 155 // Sets the bounds in such a way that LayoutManagers are circumvented. |
143 virtual void SetBoundsDirect(const gfx::Rect& bounds) = 0; | 156 virtual void SetBoundsDirect(const gfx::Rect& bounds) = 0; |
144 virtual void SetBoundsDirectAnimated(const gfx::Rect& bounds) = 0; | 157 virtual void SetBoundsDirectAnimated(const gfx::Rect& bounds) = 0; |
145 virtual void SetBoundsDirectCrossFade(const gfx::Rect& bounds) = 0; | 158 virtual void SetBoundsDirectCrossFade(const gfx::Rect& bounds) = 0; |
| 159 |
| 160 // Sets the bounds in two distinct ways. The exact behavior is dictated by |
| 161 // the value of BoundsInScreenBehavior set on the parent: |
| 162 // |
| 163 // USE_LOCAL_COORDINATES: the bounds are applied as is to the window. In other |
| 164 // words this behaves the same as if SetBounds(bounds_in_screen) was used. |
| 165 // This is the default. |
| 166 // USE_SCREEN_COORDINATES: the bounds are actual screen bounds and converted |
| 167 // from the display. In this case the window may move to a different |
| 168 // display if allowed (see SetDescendantsStayInSameRootWindow()). |
146 virtual void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, | 169 virtual void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, |
147 const display::Display& dst_display) = 0; | 170 const display::Display& dst_display) = 0; |
148 virtual gfx::Rect GetBoundsInScreen() const = 0; | 171 virtual gfx::Rect GetBoundsInScreen() const = 0; |
149 virtual const gfx::Rect& GetBounds() const = 0; | 172 virtual const gfx::Rect& GetBounds() const = 0; |
150 virtual gfx::Rect GetTargetBounds() = 0; | 173 virtual gfx::Rect GetTargetBounds() = 0; |
151 | 174 |
152 virtual void ClearRestoreBounds() = 0; | 175 virtual void ClearRestoreBounds() = 0; |
153 virtual void SetRestoreBoundsInScreen(const gfx::Rect& bounds) = 0; | 176 virtual void SetRestoreBoundsInScreen(const gfx::Rect& bounds) = 0; |
154 virtual gfx::Rect GetRestoreBoundsInScreen() const = 0; | 177 virtual gfx::Rect GetRestoreBoundsInScreen() const = 0; |
155 | 178 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 virtual void StackChildAbove(WmWindow* child, WmWindow* target) = 0; | 225 virtual void StackChildAbove(WmWindow* child, WmWindow* target) = 0; |
203 virtual void StackChildBelow(WmWindow* child, WmWindow* target) = 0; | 226 virtual void StackChildBelow(WmWindow* child, WmWindow* target) = 0; |
204 | 227 |
205 virtual std::vector<WmWindow*> GetChildren() = 0; | 228 virtual std::vector<WmWindow*> GetChildren() = 0; |
206 | 229 |
207 // Shows/hides the resize shadow. |component| is the component to show the | 230 // Shows/hides the resize shadow. |component| is the component to show the |
208 // shadow for (one of the constants in ui/base/hit_test.h). | 231 // shadow for (one of the constants in ui/base/hit_test.h). |
209 virtual void ShowResizeShadow(int component) = 0; | 232 virtual void ShowResizeShadow(int component) = 0; |
210 virtual void HideResizeShadow() = 0; | 233 virtual void HideResizeShadow() = 0; |
211 | 234 |
| 235 // See description in SetBoundsInScreen(). |
| 236 virtual void SetBoundsInScreenBehaviorForChildren(BoundsInScreenBehavior) = 0; |
| 237 |
| 238 // See description of SnapToPixelBoundaryIfNecessary(). |
| 239 virtual void SetSnapsChildrenToPhysicalPixelBoundary() = 0; |
| 240 |
212 // If an ancestor has been set to snap children to pixel boundaries, then | 241 // If an ancestor has been set to snap children to pixel boundaries, then |
213 // snaps the layer associated with this window to the layer associated with | 242 // snaps the layer associated with this window to the layer associated with |
214 // the ancestor. | 243 // the ancestor. |
215 virtual void SnapToPixelBoundaryIfNecessary() = 0; | 244 virtual void SnapToPixelBoundaryIfNecessary() = 0; |
216 | 245 |
| 246 // Makes the hit region for children slightly larger for easier resizing. |
| 247 virtual void SetChildrenUseExtendedHitRegion() = 0; |
| 248 |
| 249 // Sets whether descendants of this should not be moved to a different |
| 250 // container. This is used by SetBoundsInScreen(). |
| 251 virtual void SetDescendantsStayInSameRootWindow(bool value) = 0; |
| 252 |
217 virtual void AddObserver(WmWindowObserver* observer) = 0; | 253 virtual void AddObserver(WmWindowObserver* observer) = 0; |
218 virtual void RemoveObserver(WmWindowObserver* observer) = 0; | 254 virtual void RemoveObserver(WmWindowObserver* observer) = 0; |
219 | 255 |
220 protected: | 256 protected: |
221 virtual ~WmWindow() {} | 257 virtual ~WmWindow() {} |
222 }; | 258 }; |
223 | 259 |
224 } // namespace wm | 260 } // namespace wm |
225 } // namespace ash | 261 } // namespace ash |
226 | 262 |
227 #endif // ASH_WM_COMMON_WM_WINDOW_H_ | 263 #endif // ASH_WM_COMMON_WM_WINDOW_H_ |
OLD | NEW |