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_WINDOW_H_ | 5 #ifndef UI_AURA_WINDOW_H_ |
6 #define UI_AURA_WINDOW_H_ | 6 #define UI_AURA_WINDOW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // Changes the visibility of the window. | 86 // Changes the visibility of the window. |
87 void Show(); | 87 void Show(); |
88 void Hide(); | 88 void Hide(); |
89 // Returns true if this window and all its ancestors are visible. | 89 // Returns true if this window and all its ancestors are visible. |
90 bool IsVisible() const; | 90 bool IsVisible() const; |
91 | 91 |
92 // Returns the window's bounds in screen coordinates. | 92 // Returns the window's bounds in screen coordinates. |
93 gfx::Rect GetScreenBounds() const; | 93 gfx::Rect GetScreenBounds() const; |
94 | 94 |
| 95 // Activates this window. Only top level windows can be activated. Requests |
| 96 // to activate a non-top level window are ignored. |
| 97 void Activate(); |
| 98 |
| 99 // Deactivates this window. Only top level windows can be |
| 100 // deactivated. Requests to deactivate a non-top level window are ignored. |
| 101 void Deactivate(); |
| 102 |
95 // Returns true if this window is active. | 103 // Returns true if this window is active. |
96 bool IsActive() const; | 104 bool IsActive() const; |
97 | 105 |
98 virtual void SetTransform(const ui::Transform& transform); | 106 virtual void SetTransform(const ui::Transform& transform); |
99 | 107 |
100 // Assigns a LayoutManager to size and place child windows. | 108 // Assigns a LayoutManager to size and place child windows. |
101 // The Window takes ownership of the LayoutManager. | 109 // The Window takes ownership of the LayoutManager. |
102 void SetLayoutManager(LayoutManager* layout_manager); | 110 void SetLayoutManager(LayoutManager* layout_manager); |
103 LayoutManager* layout_manager() { return layout_manager_.get(); } | 111 LayoutManager* layout_manager() { return layout_manager_.get(); } |
104 | 112 |
(...skipping 15 matching lines...) Expand all Loading... |
120 // the root window. | 128 // the root window. |
121 void SetParent(Window* parent); | 129 void SetParent(Window* parent); |
122 | 130 |
123 // Stacks the specified child of this Window at the front of the z-order. | 131 // Stacks the specified child of this Window at the front of the z-order. |
124 void StackChildAtTop(Window* child); | 132 void StackChildAtTop(Window* child); |
125 | 133 |
126 // Stacks |child| above |other|. Does nothing if |child| is already above | 134 // Stacks |child| above |other|. Does nothing if |child| is already above |
127 // |other|. | 135 // |other|. |
128 void StackChildAbove(Window* child, Window* other); | 136 void StackChildAbove(Window* child, Window* other); |
129 | 137 |
| 138 // Returns true if this window can be activated. |
| 139 bool CanActivate() const; |
| 140 |
130 // Tree operations. | 141 // Tree operations. |
131 // TODO(beng): Child windows are currently not owned by the hierarchy. We | 142 // TODO(beng): Child windows are currently not owned by the hierarchy. We |
132 // should change this. | 143 // should change this. |
133 void AddChild(Window* child); | 144 void AddChild(Window* child); |
134 void RemoveChild(Window* child); | 145 void RemoveChild(Window* child); |
135 | 146 |
136 const Windows& children() const { return children_; } | 147 const Windows& children() const { return children_; } |
137 | 148 |
138 // Returns true if this Window contains |other| somewhere in its children. | 149 // Returns true if this Window contains |other| somewhere in its children. |
139 bool Contains(const Window* other) const; | 150 bool Contains(const Window* other) const; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 void SetCapture(); | 241 void SetCapture(); |
231 | 242 |
232 // Releases a mouse capture. | 243 // Releases a mouse capture. |
233 void ReleaseCapture(); | 244 void ReleaseCapture(); |
234 | 245 |
235 // Returns true if this window has a mouse capture. | 246 // Returns true if this window has a mouse capture. |
236 bool HasCapture(); | 247 bool HasCapture(); |
237 | 248 |
238 // Sets the window property |value| for given |name|. Setting NULL or 0 | 249 // Sets the window property |value| for given |name|. Setting NULL or 0 |
239 // removes the property. It uses |ui::ViewProp| to store the property. | 250 // removes the property. It uses |ui::ViewProp| to store the property. |
240 // Please see the description of |prop_map_| for more details. The caller is | 251 // Please see the description of |prop_map_| for more details. |
241 // responsible for the lifetime of any object set as a property on the Window. | |
242 void SetProperty(const char* name, void* value); | 252 void SetProperty(const char* name, void* value); |
243 void SetIntProperty(const char* name, int value); | 253 void SetIntProperty(const char* name, int value); |
244 | 254 |
245 // Returns the window property for given |name|. Returns NULL or 0 if | 255 // Returns the window property for given |name|. Returns NULL or 0 if |
246 // the property does not exist. | 256 // the property does not exist. |
247 // TODO(oshima): Returning 0 for non existing property is problematic. | 257 // TODO(oshima): Returning 0 for non existing property is problematic. |
248 // Fix ViewProp to be able to tell if the property exists and | 258 // Fix ViewProp to be able to tell if the property exists and |
249 // change it to -1. | 259 // change it to -1. |
250 void* GetProperty(const char* name) const; | 260 void* GetProperty(const char* name) const; |
251 int GetIntProperty(const char* name) const; | 261 int GetIntProperty(const char* name) const; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // TODO(oshima): Consolidcate ViewProp and aura::window property | 350 // TODO(oshima): Consolidcate ViewProp and aura::window property |
341 // implementation. | 351 // implementation. |
342 std::map<const char*, void*> prop_map_; | 352 std::map<const char*, void*> prop_map_; |
343 | 353 |
344 DISALLOW_COPY_AND_ASSIGN(Window); | 354 DISALLOW_COPY_AND_ASSIGN(Window); |
345 }; | 355 }; |
346 | 356 |
347 } // namespace aura | 357 } // namespace aura |
348 | 358 |
349 #endif // UI_AURA_WINDOW_H_ | 359 #endif // UI_AURA_WINDOW_H_ |
OLD | NEW |