| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
| 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
| 10 | 10 |
| 11 namespace aura { | 11 namespace aura { |
| 12 class RootWindow; | |
| 13 class Window; | 12 class Window; |
| 14 } | 13 } |
| 15 | 14 |
| 16 namespace ash { | 15 namespace ash { |
| 17 | 16 |
| 18 // This class represents an item in overview mode. An item can have one or more | 17 // This class represents an item in overview mode. An item can have one or more |
| 19 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but | 18 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but |
| 20 // any can be selected with a pointer (touch or mouse). | 19 // any can be selected with a pointer (touch or mouse). |
| 21 class WindowSelectorItem { | 20 class WindowSelectorItem { |
| 22 public: | 21 public: |
| 23 WindowSelectorItem(); | 22 WindowSelectorItem(); |
| 24 virtual ~WindowSelectorItem(); | 23 virtual ~WindowSelectorItem(); |
| 25 | 24 |
| 26 // Returns the root window on which this item is shown. | 25 // Returns the root window on which this item is shown. |
| 27 virtual aura::RootWindow* GetRootWindow() = 0; | 26 virtual aura::Window* GetRootWindow() = 0; |
| 28 | 27 |
| 29 // Returns the targeted window given the event |target| window. | 28 // Returns the targeted window given the event |target| window. |
| 30 // Returns NULL if no Window in this item was selected. | 29 // Returns NULL if no Window in this item was selected. |
| 31 virtual aura::Window* TargetedWindow(const aura::Window* target) = 0; | 30 virtual aura::Window* TargetedWindow(const aura::Window* target) = 0; |
| 32 | 31 |
| 33 // Restores |window| on exiting window overview rather than returning it | 32 // Restores |window| on exiting window overview rather than returning it |
| 34 // to its previous state. | 33 // to its previous state. |
| 35 virtual void RestoreWindowOnExit(aura::Window* window) = 0; | 34 virtual void RestoreWindowOnExit(aura::Window* window) = 0; |
| 36 | 35 |
| 37 // Returns the |window| to activate on selecting of this item. | 36 // Returns the |window| to activate on selecting of this item. |
| 38 virtual aura::Window* SelectionWindow() = 0; | 37 virtual aura::Window* SelectionWindow() = 0; |
| 39 | 38 |
| 40 // Removes |window| from this item. Check empty() after calling this to see | 39 // Removes |window| from this item. Check empty() after calling this to see |
| 41 // if the entire item is now empty. | 40 // if the entire item is now empty. |
| 42 virtual void RemoveWindow(const aura::Window* window) = 0; | 41 virtual void RemoveWindow(const aura::Window* window) = 0; |
| 43 | 42 |
| 44 // Returns true if this item has no more selectable windows (i.e. after | 43 // Returns true if this item has no more selectable windows (i.e. after |
| 45 // calling RemoveWindow for the last contained window). | 44 // calling RemoveWindow for the last contained window). |
| 46 virtual bool empty() const = 0; | 45 virtual bool empty() const = 0; |
| 47 | 46 |
| 48 // Dispatched before beginning window overview. This will do any necessary | 47 // Dispatched before beginning window overview. This will do any necessary |
| 49 // one time actions such as restoring minimized windows. | 48 // one time actions such as restoring minimized windows. |
| 50 virtual void PrepareForOverview() = 0; | 49 virtual void PrepareForOverview() = 0; |
| 51 | 50 |
| 52 // Sets the bounds of this window selector item to |target_bounds| in the | 51 // Sets the bounds of this window selector item to |target_bounds| in the |
| 53 // |root_window| root window. | 52 // |root_window| root window. |
| 54 void SetBounds(aura::RootWindow* root_window, | 53 void SetBounds(aura::Window* root_window, |
| 55 const gfx::Rect& target_bounds); | 54 const gfx::Rect& target_bounds); |
| 56 | 55 |
| 57 // Recomputes the positions for the windows in this selection item. This is | 56 // Recomputes the positions for the windows in this selection item. This is |
| 58 // dispatched when the bounds of a window change. | 57 // dispatched when the bounds of a window change. |
| 59 void RecomputeWindowTransforms(); | 58 void RecomputeWindowTransforms(); |
| 60 | 59 |
| 61 const gfx::Rect& bounds() { return bounds_; } | 60 const gfx::Rect& bounds() { return bounds_; } |
| 62 const gfx::Rect& target_bounds() { return target_bounds_; } | 61 const gfx::Rect& target_bounds() { return target_bounds_; } |
| 63 | 62 |
| 64 protected: | 63 protected: |
| 65 // Sets the bounds of this selector item to |target_bounds| in |root_window|. | 64 // Sets the bounds of this selector item to |target_bounds| in |root_window|. |
| 66 // If |animate| the windows are animated from their current location. | 65 // If |animate| the windows are animated from their current location. |
| 67 virtual void SetItemBounds(aura::RootWindow* root_window, | 66 virtual void SetItemBounds(aura::Window* root_window, |
| 68 const gfx::Rect& target_bounds, | 67 const gfx::Rect& target_bounds, |
| 69 bool animate) = 0; | 68 bool animate) = 0; |
| 70 | 69 |
| 71 // Sets the bounds used by the selector item's windows. | 70 // Sets the bounds used by the selector item's windows. |
| 72 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } | 71 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } |
| 73 | 72 |
| 74 private: | 73 private: |
| 75 // The root window this item is being displayed on. | 74 // The root window this item is being displayed on. |
| 76 aura::RootWindow* root_window_; | 75 aura::Window* root_window_; |
| 77 | 76 |
| 78 // The target bounds this selector item is fit within. | 77 // The target bounds this selector item is fit within. |
| 79 gfx::Rect target_bounds_; | 78 gfx::Rect target_bounds_; |
| 80 | 79 |
| 81 // The actual bounds of the window(s) for this item. The aspect ratio of | 80 // The actual bounds of the window(s) for this item. The aspect ratio of |
| 82 // window(s) are maintained so they may not fill the target_bounds_. | 81 // window(s) are maintained so they may not fill the target_bounds_. |
| 83 gfx::Rect bounds_; | 82 gfx::Rect bounds_; |
| 84 | 83 |
| 85 // True if running SetItemBounds. This prevents recursive calls resulting from | 84 // True if running SetItemBounds. This prevents recursive calls resulting from |
| 86 // the bounds update when calling views::corewm::RecreateWindowLayers to copy | 85 // the bounds update when calling views::corewm::RecreateWindowLayers to copy |
| 87 // a window layer for display on another monitor. | 86 // a window layer for display on another monitor. |
| 88 bool in_bounds_update_; | 87 bool in_bounds_update_; |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 89 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 } // namespace ash | 92 } // namespace ash |
| 94 | 93 |
| 95 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 94 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
| OLD | NEW |