OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WINDOW_H_ | 5 #ifndef UI_AURA_WINDOW_H_ |
6 #define UI_AURA_WINDOW_H_ | 6 #define UI_AURA_WINDOW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 28 matching lines...) Expand all Loading... |
39 class Texture; | 39 class Texture; |
40 } | 40 } |
41 | 41 |
42 namespace aura { | 42 namespace aura { |
43 | 43 |
44 class LayoutManager; | 44 class LayoutManager; |
45 class RootWindow; | 45 class RootWindow; |
46 class WindowDelegate; | 46 class WindowDelegate; |
47 class WindowObserver; | 47 class WindowObserver; |
48 | 48 |
| 49 // TODO(beng): remove once RootWindow is renamed. |
| 50 typedef RootWindow WindowEventDispatcher; |
| 51 |
49 // Defined in window_property.h (which we do not include) | 52 // Defined in window_property.h (which we do not include) |
50 template<typename T> | 53 template<typename T> |
51 struct WindowProperty; | 54 struct WindowProperty; |
52 | 55 |
53 namespace test { | 56 namespace test { |
54 class WindowTestApi; | 57 class WindowTestApi; |
55 } | 58 } |
56 | 59 |
57 // Aura window implementation. Interesting events are sent to the | 60 // Aura window implementation. Interesting events are sent to the |
58 // WindowDelegate. | 61 // WindowDelegate. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void SetTransparent(bool transparent); | 104 void SetTransparent(bool transparent); |
102 | 105 |
103 WindowDelegate* delegate() { return delegate_; } | 106 WindowDelegate* delegate() { return delegate_; } |
104 const WindowDelegate* delegate() const { return delegate_; } | 107 const WindowDelegate* delegate() const { return delegate_; } |
105 | 108 |
106 const gfx::Rect& bounds() const; | 109 const gfx::Rect& bounds() const; |
107 | 110 |
108 Window* parent() { return parent_; } | 111 Window* parent() { return parent_; } |
109 const Window* parent() const { return parent_; } | 112 const Window* parent() const { return parent_; } |
110 | 113 |
111 // Returns the RootWindow that contains this Window or NULL if the Window is | 114 // Returns the root Window that contains this Window. The root Window is |
112 // not contained by a RootWindow. | 115 // defined as the Window that has a dispatcher. These functions return NULL if |
113 virtual RootWindow* GetRootWindow(); | 116 // the Window is contained in a hierarchy that does not have a dispatcher at |
114 virtual const RootWindow* GetRootWindow() const; | 117 // its root. |
| 118 virtual Window* GetRootWindow(); |
| 119 virtual const Window* GetRootWindow() const; |
| 120 |
| 121 WindowEventDispatcher* GetDispatcher(); |
| 122 const WindowEventDispatcher* GetDispatcher() const; |
| 123 void set_dispatcher(WindowEventDispatcher* dispatcher) { |
| 124 dispatcher_ = dispatcher; |
| 125 } |
| 126 bool HasDispatcher() const { return !!dispatcher_; } |
115 | 127 |
116 // The Window does not own this object. | 128 // The Window does not own this object. |
117 void set_user_data(void* user_data) { user_data_ = user_data; } | 129 void set_user_data(void* user_data) { user_data_ = user_data; } |
118 void* user_data() const { return user_data_; } | 130 void* user_data() const { return user_data_; } |
119 | 131 |
120 // Changes the visibility of the window. | 132 // Changes the visibility of the window. |
121 void Show(); | 133 void Show(); |
122 void Hide(); | 134 void Hide(); |
123 // Returns true if this window and all its ancestors are visible. | 135 // Returns true if this window and all its ancestors are visible. |
124 bool IsVisible() const; | 136 bool IsVisible() const; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 // Overridden from ui::EventTarget: | 480 // Overridden from ui::EventTarget: |
469 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; | 481 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; |
470 virtual EventTarget* GetParentTarget() OVERRIDE; | 482 virtual EventTarget* GetParentTarget() OVERRIDE; |
471 | 483 |
472 // Updates the layer name with a name based on the window's name and id. | 484 // Updates the layer name with a name based on the window's name and id. |
473 void UpdateLayerName(const std::string& name); | 485 void UpdateLayerName(const std::string& name); |
474 | 486 |
475 // Returns true if the mouse is currently within our bounds. | 487 // Returns true if the mouse is currently within our bounds. |
476 bool ContainsMouse(); | 488 bool ContainsMouse(); |
477 | 489 |
| 490 WindowEventDispatcher* dispatcher_; |
| 491 |
478 client::WindowType type_; | 492 client::WindowType type_; |
479 | 493 |
480 // True if the Window is owned by its parent - i.e. it will be deleted by its | 494 // True if the Window is owned by its parent - i.e. it will be deleted by its |
481 // parent during its parents destruction. True is the default. | 495 // parent during its parents destruction. True is the default. |
482 bool owned_by_parent_; | 496 bool owned_by_parent_; |
483 | 497 |
484 WindowDelegate* delegate_; | 498 WindowDelegate* delegate_; |
485 | 499 |
486 // The Window's parent. | 500 // The Window's parent. |
487 Window* parent_; | 501 Window* parent_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 }; | 546 }; |
533 | 547 |
534 std::map<const void*, Value> prop_map_; | 548 std::map<const void*, Value> prop_map_; |
535 | 549 |
536 DISALLOW_COPY_AND_ASSIGN(Window); | 550 DISALLOW_COPY_AND_ASSIGN(Window); |
537 }; | 551 }; |
538 | 552 |
539 } // namespace aura | 553 } // namespace aura |
540 | 554 |
541 #endif // UI_AURA_WINDOW_H_ | 555 #endif // UI_AURA_WINDOW_H_ |
OLD | NEW |