OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 UI_AURA_SHELL_WORKSPACE_WORKSPACE_H_ | 5 #ifndef UI_AURA_SHELL_WORKSPACE_WORKSPACE_H_ |
6 #define UI_AURA_SHELL_WORKSPACE_WORKSPACE_H_ | 6 #define UI_AURA_SHELL_WORKSPACE_WORKSPACE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 // |window| was successfully added to this workspace, or false if it | 48 // |window| was successfully added to this workspace, or false if it |
49 // failed. | 49 // failed. |
50 bool AddWindowAfter(aura::Window* window, aura::Window* after); | 50 bool AddWindowAfter(aura::Window* window, aura::Window* after); |
51 | 51 |
52 // Removes the |window| from this workspace. | 52 // Removes the |window| from this workspace. |
53 void RemoveWindow(aura::Window* window); | 53 void RemoveWindow(aura::Window* window); |
54 | 54 |
55 // Return true if this workspace has the |window|. | 55 // Return true if this workspace has the |window|. |
56 bool Contains(aura::Window* window) const; | 56 bool Contains(aura::Window* window) const; |
57 | 57 |
58 // Returns a window to swap based on the |position|. See implementation | |
sky
2011/10/27 00:53:03
I would nuke the second sentence and leave it at t
oshima
2011/10/27 16:16:27
Done.
| |
59 // for more details about exactly how a window is selected. | |
60 aura::Window* FindSwapWindowForLocation(const gfx::Point& position); | |
61 | |
62 // Swaps the location of window |drag| and window |target| within this | |
63 // workspace. It re-layouts windows except for the window |drag|. | |
64 void SwapWindow(aura::Window* drag, aura::Window* target); | |
sky
2011/10/27 00:53:03
nit: rename 'drag' to 'source' and name this SwapW
oshima
2011/10/27 16:16:27
Done.
| |
65 | |
66 // Replaces the window |window| in this workspace with |with|. It re-layouts | |
67 // only when |relayout| is true. | |
68 void ReplaceWindow(aura::Window* window, aura::Window* with, bool relayout); | |
69 | |
58 // Activates this workspace. | 70 // Activates this workspace. |
59 void Activate(); | 71 void Activate(); |
60 | 72 |
61 // Layout windows. Moving animation is applied to all windows except | 73 // Layout windows. The workspace doesn't set bounds on the |ignore| if it's |
62 // for the window specified by |no_animation|. | 74 // given. It still uses the |ignore| window's bounds to calculate |
63 void Layout(aura::Window* no_animation); | 75 // bounds for other windows. Moving animation is applied to all |
76 // windows except for the window specified by |no_animation| and |ignore|. | |
77 void Layout(aura::Window* ignore, aura::Window* no_animation); | |
64 | 78 |
65 private: | 79 private: |
66 FRIEND_TEST_ALL_PREFIXES(WorkspaceTest, WorkspaceBasic); | 80 FRIEND_TEST_ALL_PREFIXES(WorkspaceTest, WorkspaceBasic); |
67 | 81 |
68 // Returns the index in layout order of the |window| in this workspace. | 82 // Returns the index in layout order of the |window| in this workspace. |
69 int GetIndexOf(aura::Window* window) const; | 83 int GetIndexOf(aura::Window* window) const; |
70 | 84 |
71 // Returns true if the given |window| can be added to this workspace. | 85 // Returns true if the given |window| can be added to this workspace. |
72 bool CanAdd(aura::Window* window) const; | 86 bool CanAdd(aura::Window* window) const; |
73 | 87 |
74 // Moves |window| to the given point. It performs animation when | 88 // Moves |window| to the given point. It performs animation when |
75 // |animate| is true. | 89 // |animate| is true. |
76 void MoveWindowTo(aura::Window* window, | 90 void MoveWindowTo(aura::Window* window, |
77 const gfx::Point& origin, | 91 const gfx::Point& origin, |
78 bool animate); | 92 bool animate); |
79 | 93 |
94 // Returns the sum of all window's width. | |
95 int GetTotalWindowsWidth() const; | |
96 | |
80 WorkspaceManager* workspace_manager_; | 97 WorkspaceManager* workspace_manager_; |
81 | 98 |
82 gfx::Rect bounds_; | 99 gfx::Rect bounds_; |
83 | 100 |
84 // Windows in the workspace in layout order. | 101 // Windows in the workspace in layout order. |
85 std::vector<aura::Window*> windows_; | 102 std::vector<aura::Window*> windows_; |
86 | 103 |
87 DISALLOW_COPY_AND_ASSIGN(Workspace); | 104 DISALLOW_COPY_AND_ASSIGN(Workspace); |
88 }; | 105 }; |
89 | 106 |
90 typedef std::vector<Workspace*> Workspaces; | 107 typedef std::vector<Workspace*> Workspaces; |
91 | 108 |
92 } // namespace aura_shell | 109 } // namespace aura_shell |
93 | 110 |
94 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_H_ | 111 #endif // UI_AURA_SHELL_WORKSPACE_WORKSPACE_H_ |
OLD | NEW |