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