| 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 AURA_WINDOW_H_ | 5 #ifndef AURA_WINDOW_H_ |
| 6 #define AURA_WINDOW_H_ | 6 #define AURA_WINDOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 14 | 15 |
| 15 class SkCanvas; | 16 class SkCanvas; |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 class Compositor; | 19 class Compositor; |
| 19 class Layer; | 20 class Layer; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace aura { | 23 namespace aura { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 // events. This is the default. | 35 // events. This is the default. |
| 35 VISIBILITY_HIDDEN = 1, | 36 VISIBILITY_HIDDEN = 1, |
| 36 | 37 |
| 37 // Display the window and let it receive mouse events. | 38 // Display the window and let it receive mouse events. |
| 38 VISIBILITY_SHOWN = 2, | 39 VISIBILITY_SHOWN = 2, |
| 39 | 40 |
| 40 // Display the window but prevent it from receiving mouse events. | 41 // Display the window but prevent it from receiving mouse events. |
| 41 VISIBILITY_SHOWN_NO_INPUT = 3, | 42 VISIBILITY_SHOWN_NO_INPUT = 3, |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 explicit Window(WindowDelegate* delegate); | 45 explicit Window(Desktop* desktop); |
| 45 ~Window(); | 46 ~Window(); |
| 46 | 47 |
| 47 void Init(); | 48 void set_delegate(WindowDelegate* d) { delegate_ = d; } |
| 48 | 49 |
| 49 int id() const { return id_; } | 50 int id() const { return id_; } |
| 50 void set_id(int id) { id_ = id; } | 51 void set_id(int id) { id_ = id; } |
| 51 | 52 |
| 52 ui::Layer* layer() { return layer_.get(); } | |
| 53 const ui::Layer* layer() const { return layer_.get(); } | |
| 54 | |
| 55 // Changes the visibility of the window. | 53 // Changes the visibility of the window. |
| 56 void SetVisibility(Visibility visibility); | 54 void SetVisibility(Visibility visibility); |
| 57 Visibility visibility() const { return visibility_; } | 55 Visibility visibility() const { return visibility_; } |
| 58 | 56 |
| 59 // Changes the bounds of the window. | 57 // Changes the bounds of the window. |
| 60 void SetBounds(const gfx::Rect& bounds, int anim_ms); | 58 void SetBounds(const gfx::Rect& bounds, int anim_ms); |
| 61 const gfx::Rect& bounds() const { return bounds_; } | 59 const gfx::Rect& bounds() const { return bounds_; } |
| 62 | 60 |
| 63 // Marks the window as needing to be painted. | 61 // Marks the window as needing to be painted. |
| 64 void SchedulePaint(const gfx::Rect& bounds); | 62 void SchedulePaint(const gfx::Rect& bounds); |
| 65 | 63 |
| 66 // Sets the contents of the window. | 64 // Sets the contents of the window. |
| 67 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); | 65 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); |
| 68 | 66 |
| 69 // Sets the parent window of the window. If NULL, the window is parented to | |
| 70 // the desktop's window. | |
| 71 void SetParent(Window* parent); | |
| 72 Window* parent() { return parent_; } | |
| 73 | |
| 74 // Draw the window and its children. | 67 // Draw the window and its children. |
| 75 void DrawTree(); | 68 void DrawTree(); |
| 76 | 69 |
| 77 // Tree operations. | 70 // Tree operations. |
| 78 // TODO(beng): Child windows are currently not owned by the hierarchy. We | 71 // TODO(beng): Child windows are currently not owned by the hierarchy. We |
| 79 // should change this. | 72 // should change this. |
| 80 void AddChild(Window* child); | 73 void AddChild(Window* child); |
| 81 void RemoveChild(Window* child); | 74 void RemoveChild(Window* child); |
| 75 Window* parent() { return parent_; } |
| 82 | 76 |
| 83 // Handles a mouse event. Returns true if handled. | 77 // Handles a mouse event. Returns true if handled. |
| 84 bool OnMouseEvent(const MouseEvent& event); | 78 bool OnMouseEvent(const MouseEvent& event); |
| 85 | 79 |
| 86 private: | 80 private: |
| 87 typedef std::vector<Window*> Windows; | 81 typedef std::vector<Window*> Windows; |
| 88 | 82 |
| 89 // If SchedulePaint has been invoked on the Window the delegate is notified. | 83 // If SchedulePaint has been invoked on the Window the delegate is notified. |
| 90 void UpdateLayerCanvas(); | 84 void UpdateLayerCanvas(); |
| 91 | 85 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 117 Windows children_; | 111 Windows children_; |
| 118 | 112 |
| 119 int id_; | 113 int id_; |
| 120 | 114 |
| 121 DISALLOW_COPY_AND_ASSIGN(Window); | 115 DISALLOW_COPY_AND_ASSIGN(Window); |
| 122 }; | 116 }; |
| 123 | 117 |
| 124 } // namespace aura | 118 } // namespace aura |
| 125 | 119 |
| 126 #endif // AURA_WINDOW_H_ | 120 #endif // AURA_WINDOW_H_ |
| OLD | NEW |