OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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_OVERVIEW_WINDOW_GRID_H_ | |
6 #define ASH_WM_OVERVIEW_WINDOW_GRID_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "ash/wm/overview/window_selector.h" | |
11 #include "base/macros.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 | |
14 namespace aura { | |
15 class Window; | |
16 } | |
17 | |
18 namespace views { | |
19 class Widget; | |
20 } | |
21 | |
22 namespace ash { | |
23 class WindowSelectorItem; | |
24 | |
25 // Represents a grid of windows in the Overview Mode in a particular root | |
26 // window. | |
27 class WindowGrid { | |
28 public: | |
29 WindowGrid(aura::Window* root_window, | |
30 std::vector<WindowSelectorItem*> window_list); | |
31 ~WindowGrid(); | |
32 | |
33 // Moves the selection widget to the specified |direction|. Returns false if, | |
34 // after moving, the widget is out of bounds. | |
35 bool Move(WindowSelector::Direction direction); | |
36 | |
37 // Positions all the windows in the grid. If a window pointer is invalid, the | |
tdanderson
2014/05/28 16:01:19
Just reading this header file and not looking into
Nina
2014/05/29 17:12:24
I'll consider that for future changes. I removed t
| |
38 // behavior is undefined. | |
39 void PositionWindows(bool animate); | |
40 | |
41 // Removes |window| from the grid, if present. Returns true if this was the | |
42 // case, false if |window| was not found. | |
tdanderson
2014/05/28 16:01:19
This comment needs to be updated since RemoveWindo
Nina
2014/05/29 17:12:24
Done.
| |
43 WindowSelectorItem* RemoveWindow(aura::Window* window); | |
44 | |
45 // Returns the target selected window, or NULL if there is none selected. | |
46 WindowSelectorItem* SelectedWindow() const; | |
47 | |
48 // Returns true if the grid no more windows. | |
49 bool empty() { return window_list_.empty(); } | |
50 | |
51 private: | |
52 // Updates |selected_index_| according to the specified |direction|. Returns | |
53 // |true| if the new selection index is out of this window grid bounds. | |
54 bool MoveSelectedIndex(WindowSelector::Direction direction); | |
55 | |
56 const gfx::Rect GetSelectionBounds() const; | |
tdanderson
2014/05/28 16:01:19
Add documentation for this.
Nina
2014/05/29 17:12:24
Done.
| |
57 | |
58 // Root window the grid is in. | |
59 aura::Window* root_window_; | |
60 | |
61 // Vector containing all the windows in this grid. | |
62 std::vector<WindowSelectorItem*> window_list_; | |
63 | |
64 // Widget that indicates the user which is the selected window. | |
tdanderson
2014/05/28 16:01:19
to the user
Nina
2014/05/29 17:12:24
Done.
| |
65 scoped_ptr<views::Widget> selection_widget_; | |
66 | |
67 // Current selected window position. | |
68 size_t selected_index_; | |
69 | |
70 // Grid size. | |
71 size_t rows_; | |
tdanderson
2014/05/28 16:01:19
I would prefer num_rows_ and num_columns_ to make
Nina
2014/05/29 17:12:24
Done.
| |
72 size_t columns_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(WindowGrid); | |
75 }; | |
76 | |
77 } // namespace ash | |
78 | |
79 #endif // ASH_WM_OVERVIEW_WINDOW_GRID_H_ | |
OLD | NEW |