| 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_ROOT_WINDOW_H_ | 5 #ifndef UI_AURA_ROOT_WINDOW_H_ |
| 6 #define UI_AURA_ROOT_WINDOW_H_ | 6 #define UI_AURA_ROOT_WINDOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 | 10 |
| 11 namespace aura { | 11 namespace aura { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 class FocusManager; | 14 class FocusManager; |
| 15 | 15 |
| 16 // A Window subclass that handles event targeting for certain types of | 16 // A Window subclass that handles event targeting for certain types of |
| 17 // MouseEvent. | 17 // MouseEvent. |
| 18 class RootWindow : public Window { | 18 class RootWindow : public Window { |
| 19 public: | 19 public: |
| 20 RootWindow(); | 20 RootWindow(); |
| 21 virtual ~RootWindow(); | 21 virtual ~RootWindow(); |
| 22 | 22 |
| 23 // Handles a mouse event. Returns true if handled. | 23 // Handles a mouse event. Returns true if handled. |
| 24 bool HandleMouseEvent(const MouseEvent& event); | 24 bool HandleMouseEvent(const MouseEvent& event); |
| 25 | 25 |
| 26 // Handles a key event. Returns true if handled. | 26 // Handles a key event. Returns true if handled. |
| 27 bool HandleKeyEvent(const KeyEvent& event); | 27 bool HandleKeyEvent(const KeyEvent& event); |
| 28 | 28 |
| 29 // Sets capture to the specified window. |
| 30 void SetCapture(Window* window); |
| 31 |
| 32 // If |window| has mouse capture, the current capture window is set to NULL. |
| 33 void ReleaseCapture(Window* window); |
| 34 |
| 35 // Returns the window that has mouse capture. |
| 36 Window* capture_window() { return capture_window_; } |
| 37 |
| 38 // Invoked when a child window is destroyed. Cleans up any references to the |
| 39 // Window. |
| 40 void WindowDestroying(Window* window); |
| 41 |
| 42 // Current handler for mouse events. |
| 43 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } |
| 44 |
| 29 // Overridden from Window: | 45 // Overridden from Window: |
| 30 virtual FocusManager* GetFocusManager() OVERRIDE; | 46 virtual FocusManager* GetFocusManager() OVERRIDE; |
| 31 | 47 |
| 48 protected: |
| 49 // Overridden from Window: |
| 50 virtual internal::RootWindow* GetRoot() OVERRIDE; |
| 51 |
| 32 private: | 52 private: |
| 33 Window* mouse_pressed_handler_; | 53 Window* mouse_pressed_handler_; |
| 34 scoped_ptr<FocusManager> focus_manager_; | 54 scoped_ptr<FocusManager> focus_manager_; |
| 55 Window* capture_window_; |
| 35 | 56 |
| 36 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 57 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
| 37 }; | 58 }; |
| 38 | 59 |
| 39 } // namespace internal | 60 } // namespace internal |
| 40 } // namespace aura | 61 } // namespace aura |
| 41 | 62 |
| 42 #endif // UI_AURA_ROOT_WINDOW_H_ | 63 #endif // UI_AURA_ROOT_WINDOW_H_ |
| OLD | NEW |