| 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/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 | 14 |
| 15 class SkCanvas; | 15 class SkCanvas; |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 class Compositor; | 18 class Compositor; |
| 19 class Layer; | 19 class Layer; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace aura { | 22 namespace aura { |
| 23 | 23 |
| 24 class Desktop; | 24 class Desktop; |
| 25 class MouseEvent; | 25 class MouseEvent; |
| 26 class WindowDelegate; | 26 class WindowDelegate; |
| 27 | 27 |
| 28 // Aura window implementation. Interesting events are sent to the | 28 // Aura window implementation. Interesting events are sent to the |
| 29 // WindowDelegate. | 29 // WindowDelegate. |
| 30 // TODO(beng): resolve ownership. |
| 30 class Window { | 31 class Window { |
| 31 public: | 32 public: |
| 32 enum Visibility { | 33 enum Visibility { |
| 33 // Don't display the window onscreen and don't let it receive mouse | 34 // Don't display the window onscreen and don't let it receive mouse |
| 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 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 74 |
| 74 // Draw the window and its children. | 75 // Draw the window and its children. |
| 75 void DrawTree(); | 76 void DrawTree(); |
| 76 | 77 |
| 77 // Tree operations. | 78 // Tree operations. |
| 78 // TODO(beng): Child windows are currently not owned by the hierarchy. We | 79 // TODO(beng): Child windows are currently not owned by the hierarchy. We |
| 79 // should change this. | 80 // should change this. |
| 80 void AddChild(Window* child); | 81 void AddChild(Window* child); |
| 81 void RemoveChild(Window* child); | 82 void RemoveChild(Window* child); |
| 82 | 83 |
| 84 static void ConvertPointToWindow(Window* source, |
| 85 Window* target, |
| 86 gfx::Point* point); |
| 87 |
| 83 // Handles a mouse event. Returns true if handled. | 88 // Handles a mouse event. Returns true if handled. |
| 84 bool OnMouseEvent(const MouseEvent& event); | 89 bool OnMouseEvent(const MouseEvent& event); |
| 85 | 90 |
| 91 WindowDelegate* delegate() { return delegate_; } |
| 92 |
| 93 // Returns true if the mouse pointer at the specified |point| can trigger an |
| 94 // event for this Window. |
| 95 // TODO(beng): |
| 96 // A Window can supply a hit-test mask to cause some portions of itself to not |
| 97 // trigger events, causing the events to fall through to the Window behind. |
| 98 bool HitTest(const gfx::Point& point); |
| 99 |
| 100 // Returns the Window that most closely encloses |point| for the purposes of |
| 101 // event targeting. |
| 102 Window* GetEventHandlerForPoint(const gfx::Point& point); |
| 103 |
| 86 private: | 104 private: |
| 87 typedef std::vector<Window*> Windows; | 105 typedef std::vector<Window*> Windows; |
| 88 | 106 |
| 89 // If SchedulePaint has been invoked on the Window the delegate is notified. | 107 // If SchedulePaint has been invoked on the Window the delegate is notified. |
| 90 void UpdateLayerCanvas(); | 108 void UpdateLayerCanvas(); |
| 91 | 109 |
| 92 // Draws the Window's contents. | 110 // Draws the Window's contents. |
| 93 void Draw(); | 111 void Draw(); |
| 94 | 112 |
| 95 WindowDelegate* delegate_; | 113 WindowDelegate* delegate_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 117 Windows children_; | 135 Windows children_; |
| 118 | 136 |
| 119 int id_; | 137 int id_; |
| 120 | 138 |
| 121 DISALLOW_COPY_AND_ASSIGN(Window); | 139 DISALLOW_COPY_AND_ASSIGN(Window); |
| 122 }; | 140 }; |
| 123 | 141 |
| 124 } // namespace aura | 142 } // namespace aura |
| 125 | 143 |
| 126 #endif // AURA_WINDOW_H_ | 144 #endif // AURA_WINDOW_H_ |
| OLD | NEW |