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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // TODO(oshima): Returning 0 for non existing property is problematic. | 286 // TODO(oshima): Returning 0 for non existing property is problematic. |
287 // Fix ViewProp to be able to tell if the property exists and | 287 // Fix ViewProp to be able to tell if the property exists and |
288 // change it to -1. | 288 // change it to -1. |
289 void* GetProperty(const char* name) const; | 289 void* GetProperty(const char* name) const; |
290 int GetIntProperty(const char* name) const; | 290 int GetIntProperty(const char* name) const; |
291 | 291 |
292 // Returns true if this window is currently stopping event | 292 // Returns true if this window is currently stopping event |
293 // propagation for any windows behind it in the z-order. | 293 // propagation for any windows behind it in the z-order. |
294 bool StopsEventPropagation() const; | 294 bool StopsEventPropagation() const; |
295 | 295 |
296 protected: | |
297 // Called when the |window| is being detached from the root window | |
298 // by being removed from its parent. It is called before |parent_| is | |
299 // set to NULL. | |
300 virtual void OnWindowDetachingFromRootWindow(aura::Window* window); | |
301 | |
302 // Called when the |window| is attached to the root window by being added | |
303 // to its parent. | |
304 virtual void OnWindowAttachedToRootWindow(aura::Window* window); | |
305 | |
306 private: | 296 private: |
307 friend class LayoutManager; | 297 friend class LayoutManager; |
308 | 298 |
309 // Changes the bounds of the window without condition. | 299 // Changes the bounds of the window without condition. |
310 void SetBoundsInternal(const gfx::Rect& new_bounds); | 300 void SetBoundsInternal(const gfx::Rect& new_bounds); |
311 | 301 |
312 // Updates the visible state of the layer, but does not make visible-state | 302 // Updates the visible state of the layer, but does not make visible-state |
313 // specific changes. Called from Show()/Hide(). | 303 // specific changes. Called from Show()/Hide(). |
314 void SetVisible(bool visible); | 304 void SetVisible(bool visible); |
315 | 305 |
316 // Schedules a paint for the Window's entire bounds. | 306 // Schedules a paint for the Window's entire bounds. |
317 void SchedulePaint(); | 307 void SchedulePaint(); |
318 | 308 |
319 // Gets a Window (either this one or a subwindow) containing |local_point|. | 309 // Gets a Window (either this one or a subwindow) containing |local_point|. |
320 // If |return_tightest| is true, returns the tightest-containing (i.e. | 310 // If |return_tightest| is true, returns the tightest-containing (i.e. |
321 // furthest down the hierarchy) Window containing the point; otherwise, | 311 // furthest down the hierarchy) Window containing the point; otherwise, |
322 // returns the loosest. If |for_event_handling| is true, then hit-test masks | 312 // returns the loosest. If |for_event_handling| is true, then hit-test masks |
323 // and StopsEventPropagation() are honored; otherwise, only bounds checks are | 313 // and StopsEventPropagation() are honored; otherwise, only bounds checks are |
324 // performed. | 314 // performed. |
325 Window* GetWindowForPoint(const gfx::Point& local_point, | 315 Window* GetWindowForPoint(const gfx::Point& local_point, |
326 bool return_tightest, | 316 bool return_tightest, |
327 bool for_event_handling); | 317 bool for_event_handling); |
328 | 318 |
329 // Called when this window's parent has changed. | 319 // Called when this window's parent has changed. |
330 void OnParentChanged(); | 320 void OnParentChanged(); |
331 | 321 |
332 // Called when this window's stacking order among its siblings is changed. | 322 // Called when this window's stacking order among its siblings is changed. |
333 void OnStackingChanged(); | 323 void OnStackingChanged(); |
334 | 324 |
| 325 // Notifies observers registered with this Window (and its subtree) when the |
| 326 // Window has been added or is about to be removed from a RootWindow. |
| 327 void NotifyAddedToRootWindow(); |
| 328 void NotifyRemovingFromRootWindow(); |
| 329 |
335 // Overridden from ui::LayerDelegate: | 330 // Overridden from ui::LayerDelegate: |
336 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 331 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
337 | 332 |
338 // Updates the layer name with a name based on the window's name and id. | 333 // Updates the layer name with a name based on the window's name and id. |
339 void UpdateLayerName(const std::string& name); | 334 void UpdateLayerName(const std::string& name); |
340 | 335 |
341 // Returns true if this window is behind a window that stops event | 336 // Returns true if this window is behind a window that stops event |
342 // propagation. | 337 // propagation. |
343 bool IsBehindStopEventsWindow() const; | 338 bool IsBehindStopEventsWindow() const; |
344 | 339 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // TODO(oshima): Consolidcate ViewProp and aura::window property | 393 // TODO(oshima): Consolidcate ViewProp and aura::window property |
399 // implementation. | 394 // implementation. |
400 std::map<const char*, void*> prop_map_; | 395 std::map<const char*, void*> prop_map_; |
401 | 396 |
402 DISALLOW_COPY_AND_ASSIGN(Window); | 397 DISALLOW_COPY_AND_ASSIGN(Window); |
403 }; | 398 }; |
404 | 399 |
405 } // namespace aura | 400 } // namespace aura |
406 | 401 |
407 #endif // UI_AURA_WINDOW_H_ | 402 #endif // UI_AURA_WINDOW_H_ |
OLD | NEW |