| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ASH_WM_COMMON_WM_WINDOW_H_ |
| 6 #define ASH_WM_COMMON_WM_WINDOW_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "ash/ash_export.h" |
| 11 #include "ui/base/ui_base_types.h" |
| 12 #include "ui/wm/public/window_types.h" |
| 13 |
| 14 namespace gfx { |
| 15 class Display; |
| 16 class Point; |
| 17 class Rect; |
| 18 class Size; |
| 19 } |
| 20 |
| 21 namespace ui { |
| 22 class Layer; |
| 23 } |
| 24 |
| 25 namespace ash { |
| 26 namespace wm { |
| 27 |
| 28 class WMEvent; |
| 29 class WmRootWindowController; |
| 30 class WmWindowObserver; |
| 31 enum class WmWindowProperty; |
| 32 class WindowState; |
| 33 |
| 34 // This class exists as a porting layer to allow ash/wm to work with |
| 35 // aura::Window |
| 36 // or mus::Window. See aura::Window for details on the functions. |
| 37 class ASH_EXPORT WmWindow { |
| 38 public: |
| 39 WmWindow* GetRootWindow() { |
| 40 return const_cast<WmWindow*>( |
| 41 const_cast<const WmWindow*>(this)->GetRootWindow()); |
| 42 } |
| 43 virtual const WmWindow* GetRootWindow() const = 0; |
| 44 virtual WmRootWindowController* GetRootWindowController() = 0; |
| 45 |
| 46 virtual int GetShellWindowId() = 0; |
| 47 virtual WmWindow* GetChildByShellWindowId(int id) = 0; |
| 48 |
| 49 virtual ui::wm::WindowType GetType() const = 0; |
| 50 |
| 51 // TODO(sky): seems like this shouldn't be exposed. |
| 52 virtual ui::Layer* GetLayer() = 0; |
| 53 |
| 54 virtual gfx::Display GetDisplayNearestWindow() = 0; |
| 55 |
| 56 virtual bool HasNonClientArea() = 0; |
| 57 virtual int GetNonClientComponent(const gfx::Point& location) = 0; |
| 58 |
| 59 virtual gfx::Point ConvertPointToTarget(const WmWindow* target, |
| 60 const gfx::Point& point) const = 0; |
| 61 virtual gfx::Point ConvertPointToScreen(const gfx::Point& point) const = 0; |
| 62 virtual gfx::Point ConvertPointFromScreen(const gfx::Point& point) const = 0; |
| 63 virtual gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const = 0; |
| 64 virtual gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const = 0; |
| 65 |
| 66 virtual gfx::Size GetMinimumSize() = 0; |
| 67 virtual gfx::Size GetMaximumSize() = 0; |
| 68 |
| 69 // Returns the visibility requested by this window. IsVisible() takes into |
| 70 // account the visibility of the layer and ancestors, where as this tracks |
| 71 // whether Show() without a Hide() has been invoked. |
| 72 virtual bool GetTargetVisibility() const = 0; |
| 73 |
| 74 virtual bool IsVisible() const = 0; |
| 75 |
| 76 virtual bool GetBoolProperty(WmWindowProperty key) = 0; |
| 77 |
| 78 virtual WindowState* GetWindowState() = 0; |
| 79 |
| 80 virtual WmWindow* GetToplevelWindow() = 0; |
| 81 |
| 82 virtual WmWindow* GetParent() = 0; |
| 83 |
| 84 virtual WmWindow* GetTransientParent() = 0; |
| 85 |
| 86 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
| 87 // Sets the bounds in such a way that LayoutManagers are circumvented. |
| 88 virtual void SetBoundsDirect(const gfx::Rect& bounds) = 0; |
| 89 virtual void SetBoundsDirectAnimated(const gfx::Rect& bounds) = 0; |
| 90 virtual void SetBoundsDirectCrossFade(const gfx::Rect& bounds) = 0; |
| 91 virtual void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, |
| 92 const gfx::Display& dst_display) = 0; |
| 93 virtual gfx::Rect GetBoundsInScreen() const = 0; |
| 94 virtual const gfx::Rect& GetBounds() const = 0; |
| 95 virtual gfx::Rect GetTargetBounds() = 0; |
| 96 |
| 97 virtual void ClearRestoreBounds() = 0; |
| 98 virtual void SetRestoreBoundsInScreen(const gfx::Rect& bounds) = 0; |
| 99 virtual gfx::Rect GetRestoreBoundsInScreen() const = 0; |
| 100 |
| 101 virtual void OnWMEvent(const wm::WMEvent* event) = 0; |
| 102 |
| 103 virtual bool Contains(const WmWindow* other) const = 0; |
| 104 |
| 105 virtual void SetShowState(ui::WindowShowState show_state) = 0; |
| 106 virtual ui::WindowShowState GetShowState() const = 0; |
| 107 |
| 108 virtual void SetCapture() = 0; |
| 109 virtual bool HasCapture() = 0; |
| 110 virtual void ReleaseCapture() = 0; |
| 111 |
| 112 virtual bool HasRestoreBounds() const = 0; |
| 113 |
| 114 virtual void SetAlwaysOnTop(bool value) = 0; |
| 115 virtual bool IsAlwaysOnTop() const = 0; |
| 116 |
| 117 virtual void Hide() = 0; |
| 118 virtual void Show() = 0; |
| 119 |
| 120 virtual bool IsActive() const = 0; |
| 121 virtual void Activate() = 0; |
| 122 virtual void Deactivate() = 0; |
| 123 |
| 124 virtual void Maximize() = 0; |
| 125 virtual void Minimize() = 0; |
| 126 virtual void Unminimize() = 0; |
| 127 |
| 128 virtual bool CanMaximize() const = 0; |
| 129 virtual bool CanMinimize() const = 0; |
| 130 virtual bool CanResize() const = 0; |
| 131 virtual bool CanActivate() const = 0; |
| 132 |
| 133 virtual void StackChildAtTop(WmWindow* child) = 0; |
| 134 virtual void StackChildAbove(WmWindow* child, WmWindow* target) = 0; |
| 135 virtual void StackChildBelow(WmWindow* child, WmWindow* target) = 0; |
| 136 |
| 137 virtual std::vector<WmWindow*> GetChildren() = 0; |
| 138 |
| 139 virtual void AddObserver(WmWindowObserver* observer) = 0; |
| 140 virtual void RemoveObserver(WmWindowObserver* observer) = 0; |
| 141 |
| 142 protected: |
| 143 virtual ~WmWindow() {} |
| 144 }; |
| 145 |
| 146 } // namespace wm |
| 147 } // namespace ash |
| 148 |
| 149 #endif // ASH_WM_COMMON_WM_WINDOW_H_ |
| OLD | NEW |