| 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 <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 "base/observer_list.h" |
| 13 #include "base/string16.h" | 14 #include "base/string16.h" |
| 14 #include "ui/base/ui_base_types.h" | 15 #include "ui/base/ui_base_types.h" |
| 15 #include "ui/aura/aura_export.h" | 16 #include "ui/aura/aura_export.h" |
| 16 #include "ui/gfx/compositor/layer_delegate.h" | 17 #include "ui/gfx/compositor/layer_delegate.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
| 18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 19 | 20 |
| 20 class SkCanvas; | 21 class SkCanvas; |
| 21 | 22 |
| 22 namespace ui { | 23 namespace ui { |
| 23 class Animation; | 24 class Animation; |
| 24 class Compositor; | 25 class Compositor; |
| 25 class Layer; | 26 class Layer; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace aura { | 29 namespace aura { |
| 29 | 30 |
| 30 class Desktop; | 31 class Desktop; |
| 31 class EventFilter; | 32 class EventFilter; |
| 32 class KeyEvent; | 33 class KeyEvent; |
| 33 class LayoutManager; | 34 class LayoutManager; |
| 34 class MouseEvent; | 35 class MouseEvent; |
| 35 class ToplevelWindowContainer; | 36 class ToplevelWindowContainer; |
| 36 class WindowDelegate; | 37 class WindowDelegate; |
| 38 class WindowObserver; |
| 37 | 39 |
| 38 namespace internal { | 40 namespace internal { |
| 39 class FocusManager; | 41 class FocusManager; |
| 40 class RootWindow; | 42 class RootWindow; |
| 41 } | 43 } |
| 42 | 44 |
| 43 // Aura window implementation. Interesting events are sent to the | 45 // Aura window implementation. Interesting events are sent to the |
| 44 // WindowDelegate. | 46 // WindowDelegate. |
| 45 // TODO(beng): resolve ownership. | 47 // TODO(beng): resolve ownership. |
| 46 class AURA_EXPORT Window : public ui::LayerDelegate { | 48 class AURA_EXPORT Window : public ui::LayerDelegate { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Marks the a portion of window as needing to be painted. | 114 // Marks the a portion of window as needing to be painted. |
| 113 void SchedulePaintInRect(const gfx::Rect& rect); | 115 void SchedulePaintInRect(const gfx::Rect& rect); |
| 114 | 116 |
| 115 // Sets the contents of the window. | 117 // Sets the contents of the window. |
| 116 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); | 118 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); |
| 117 | 119 |
| 118 // Sets the parent window of the window. If NULL, the window is parented to | 120 // Sets the parent window of the window. If NULL, the window is parented to |
| 119 // the desktop's window. | 121 // the desktop's window. |
| 120 void SetParent(Window* parent); | 122 void SetParent(Window* parent); |
| 121 Window* parent() { return parent_; } | 123 Window* parent() { return parent_; } |
| 124 const Window* parent() const { return parent_; } |
| 122 | 125 |
| 123 // Move the specified child of this Window to the front of the z-order. | 126 // Move the specified child of this Window to the front of the z-order. |
| 124 // TODO(beng): this is (obviously) feeble. | 127 // TODO(beng): this is (obviously) feeble. |
| 125 void MoveChildToFront(Window* child); | 128 void MoveChildToFront(Window* child); |
| 126 | 129 |
| 127 // Returns true if this window can be activated. | 130 // Returns true if this window can be activated. |
| 128 bool CanActivate() const; | 131 bool CanActivate() const; |
| 129 | 132 |
| 130 // Tree operations. | 133 // Tree operations. |
| 131 // TODO(beng): Child windows are currently not owned by the hierarchy. We | 134 // TODO(beng): Child windows are currently not owned by the hierarchy. We |
| (...skipping 19 matching lines...) Expand all Loading... |
| 151 void SetEventFilter(EventFilter* event_filter); | 154 void SetEventFilter(EventFilter* event_filter); |
| 152 | 155 |
| 153 // Handles a mouse event. Returns true if handled. | 156 // Handles a mouse event. Returns true if handled. |
| 154 bool OnMouseEvent(MouseEvent* event); | 157 bool OnMouseEvent(MouseEvent* event); |
| 155 | 158 |
| 156 // Handles a key event. Returns true if handled. | 159 // Handles a key event. Returns true if handled. |
| 157 bool OnKeyEvent(KeyEvent* event); | 160 bool OnKeyEvent(KeyEvent* event); |
| 158 | 161 |
| 159 WindowDelegate* delegate() { return delegate_; } | 162 WindowDelegate* delegate() { return delegate_; } |
| 160 | 163 |
| 164 // Add/remove observer. |
| 165 void AddObserver(WindowObserver* observer); |
| 166 void RemoveObserver(WindowObserver* observer); |
| 167 |
| 161 // When set to true, this Window will stop propagation of all events targeted | 168 // When set to true, this Window will stop propagation of all events targeted |
| 162 // at Windows below it in the z-order, but only if this Window has children. | 169 // at Windows below it in the z-order, but only if this Window has children. |
| 163 // This is used to implement lock-screen type functionality where we do not | 170 // This is used to implement lock-screen type functionality where we do not |
| 164 // want events to be sent to running logged-in windows when the lock screen is | 171 // want events to be sent to running logged-in windows when the lock screen is |
| 165 // displayed. | 172 // displayed. |
| 166 void set_stops_event_propagation(bool stops_event_propagation) { | 173 void set_stops_event_propagation(bool stops_event_propagation) { |
| 167 stops_event_propagation_ = stops_event_propagation; | 174 stops_event_propagation_ = stops_event_propagation; |
| 168 } | 175 } |
| 169 | 176 |
| 170 // Returns true if the mouse pointer at the specified |point| can trigger an | 177 // Returns true if the mouse pointer at the specified |point| can trigger an |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 263 |
| 257 scoped_ptr<EventFilter> event_filter_; | 264 scoped_ptr<EventFilter> event_filter_; |
| 258 scoped_ptr<LayoutManager> layout_manager_; | 265 scoped_ptr<LayoutManager> layout_manager_; |
| 259 | 266 |
| 260 void* user_data_; | 267 void* user_data_; |
| 261 | 268 |
| 262 // When true, events are not sent to windows behind this one in the z-order, | 269 // When true, events are not sent to windows behind this one in the z-order, |
| 263 // provided this window has children. See set_stops_event_propagation(). | 270 // provided this window has children. See set_stops_event_propagation(). |
| 264 bool stops_event_propagation_; | 271 bool stops_event_propagation_; |
| 265 | 272 |
| 273 ObserverList<WindowObserver> observers_; |
| 274 |
| 266 DISALLOW_COPY_AND_ASSIGN(Window); | 275 DISALLOW_COPY_AND_ASSIGN(Window); |
| 267 }; | 276 }; |
| 268 | 277 |
| 269 } // namespace aura | 278 } // namespace aura |
| 270 | 279 |
| 271 #endif // UI_AURA_WINDOW_H_ | 280 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |