OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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_WINDOW_SELECTOR_H_ |
| 6 #define ASH_WM_WINDOW_SELECTOR_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "ui/aura/window_observer.h" |
| 12 #include "ui/base/events/event_handler.h" |
| 13 |
| 14 namespace aura { |
| 15 class RootWindow; |
| 16 } |
| 17 |
| 18 namespace ash { |
| 19 |
| 20 class WindowSelectorDelegate; |
| 21 |
| 22 // The WindowSelector shows a grid of all of your windows and allows selecting |
| 23 // a window by clicking or tapping on it. |
| 24 class WindowSelector : public ui::EventHandler, |
| 25 public aura::WindowObserver { |
| 26 public: |
| 27 typedef std::vector<aura::Window*> WindowList; |
| 28 |
| 29 WindowSelector(const WindowList& windows, |
| 30 WindowSelectorDelegate* delegate); |
| 31 virtual ~WindowSelector(); |
| 32 |
| 33 // ui::EventHandler: |
| 34 virtual void OnEvent(ui::Event* event) OVERRIDE; |
| 35 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
| 36 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 37 |
| 38 // aura::WindowObserver: |
| 39 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 40 |
| 41 private: |
| 42 void HandleSelectionEvent(ui::Event* event); |
| 43 void PositionWindows(); |
| 44 void PositionWindowsOnRoot(aura::RootWindow* root_window, |
| 45 const WindowList& windows); |
| 46 |
| 47 void SelectWindow(aura::Window*); |
| 48 |
| 49 // List of weak pointers of windows to select from. |
| 50 WindowList windows_; |
| 51 |
| 52 // Weak pointer to the selector delegate which will be called when a |
| 53 // selection is made. |
| 54 WindowSelectorDelegate* delegate_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(WindowSelector); |
| 57 }; |
| 58 |
| 59 } // namespace ash |
| 60 |
| 61 #endif // ASH_WM_WINDOW_SELECTOR_H_ |
OLD | NEW |