Chromium Code Reviews| 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 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 class Layer; | 25 class Layer; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace aura { | 28 namespace aura { |
| 29 | 29 |
| 30 class Desktop; | 30 class Desktop; |
| 31 class EventFilter; | 31 class EventFilter; |
| 32 class KeyEvent; | 32 class KeyEvent; |
| 33 class LayoutManager; | 33 class LayoutManager; |
| 34 class MouseEvent; | 34 class MouseEvent; |
| 35 class ToplevelWindowContainer; | |
| 35 class WindowDelegate; | 36 class WindowDelegate; |
| 36 | 37 |
| 37 namespace internal { | 38 namespace internal { |
| 38 class FocusManager; | 39 class FocusManager; |
| 39 class RootWindow; | 40 class RootWindow; |
| 40 } | 41 } |
| 41 | 42 |
| 42 // Aura window implementation. Interesting events are sent to the | 43 // Aura window implementation. Interesting events are sent to the |
| 43 // WindowDelegate. | 44 // WindowDelegate. |
| 44 // TODO(beng): resolve ownership. | 45 // TODO(beng): resolve ownership. |
| 45 class AURA_EXPORT Window : public ui::LayerDelegate { | 46 class AURA_EXPORT Window : public ui::LayerDelegate { |
| 46 public: | 47 public: |
| 47 typedef std::vector<Window*> Windows; | 48 typedef std::vector<Window*> Windows; |
| 48 | 49 |
| 49 explicit Window(WindowDelegate* delegate); | 50 explicit Window(WindowDelegate* delegate); |
| 50 ~Window(); | 51 ~Window(); |
| 51 | 52 |
| 52 void Init(); | 53 void Init(); |
| 53 | 54 |
| 55 int type() const { return type_; } | |
|
sky
2011/10/07 19:59:45
Add a description of what this is and who uses it.
| |
| 56 void SetType(int type); | |
| 57 | |
| 54 int id() const { return id_; } | 58 int id() const { return id_; } |
| 55 void set_id(int id) { id_ = id; } | 59 void set_id(int id) { id_ = id; } |
| 56 | 60 |
| 57 const std::string& name() const { return name_; } | 61 const std::string& name() const { return name_; } |
| 58 void set_name(const std::string& name) { name_ = name; } | 62 void set_name(const std::string& name) { name_ = name; } |
| 59 | 63 |
| 60 ui::Layer* layer() { return layer_.get(); } | 64 ui::Layer* layer() { return layer_.get(); } |
| 61 const ui::Layer* layer() const { return layer_.get(); } | 65 const ui::Layer* layer() const { return layer_.get(); } |
| 62 | 66 |
| 63 // Changes the visibility of the window. | 67 // Changes the visibility of the window. |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 90 void SchedulePaintInRect(const gfx::Rect& rect); | 94 void SchedulePaintInRect(const gfx::Rect& rect); |
| 91 | 95 |
| 92 // Sets the contents of the window. | 96 // Sets the contents of the window. |
| 93 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); | 97 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); |
| 94 | 98 |
| 95 // Sets the parent window of the window. If NULL, the window is parented to | 99 // Sets the parent window of the window. If NULL, the window is parented to |
| 96 // the desktop's window. | 100 // the desktop's window. |
| 97 void SetParent(Window* parent); | 101 void SetParent(Window* parent); |
| 98 Window* parent() { return parent_; } | 102 Window* parent() { return parent_; } |
| 99 | 103 |
| 100 // Returns true if this Window is the container for toplevel windows. | 104 // RTTI to a container for top-level windows. Returns NULL if this window is |
| 101 virtual bool IsToplevelWindowContainer() const; | 105 // not a top level window container. |
| 106 virtual ToplevelWindowContainer* AsToplevelWindowContainer(); | |
| 107 virtual const ToplevelWindowContainer* AsToplevelWindowContainer() const; | |
| 102 | 108 |
| 103 // Move the specified child of this Window to the front of the z-order. | 109 // Move the specified child of this Window to the front of the z-order. |
| 104 // TODO(beng): this is (obviously) feeble. | 110 // TODO(beng): this is (obviously) feeble. |
| 105 void MoveChildToFront(Window* child); | 111 void MoveChildToFront(Window* child); |
| 106 | 112 |
| 113 // Returns true if this window can be activated. | |
| 114 bool CanActivate() const; | |
| 115 | |
| 107 // Tree operations. | 116 // Tree operations. |
| 108 // TODO(beng): Child windows are currently not owned by the hierarchy. We | 117 // TODO(beng): Child windows are currently not owned by the hierarchy. We |
| 109 // should change this. | 118 // should change this. |
| 110 void AddChild(Window* child); | 119 void AddChild(Window* child); |
| 111 void RemoveChild(Window* child); | 120 void RemoveChild(Window* child); |
| 112 | 121 |
| 113 const Windows& children() const { return children_; } | 122 const Windows& children() const { return children_; } |
| 114 | 123 |
| 115 // Retrieves the first-level child with the specified id, or NULL if no first- | 124 // Retrieves the first-level child with the specified id, or NULL if no first- |
| 116 // level child is found matching |id|. | 125 // level child is found matching |id|. |
| 117 Window* GetChildById(int id); | 126 Window* GetChildById(int id); |
| 127 const Window* GetChildById(int id) const; | |
| 118 | 128 |
| 119 static void ConvertPointToWindow(Window* source, | 129 static void ConvertPointToWindow(Window* source, |
| 120 Window* target, | 130 Window* target, |
| 121 gfx::Point* point); | 131 gfx::Point* point); |
| 122 | 132 |
| 123 // Returns the cursor for the specified point, in window coordinates. | 133 // Returns the cursor for the specified point, in window coordinates. |
| 124 gfx::NativeCursor GetCursor(const gfx::Point& point) const; | 134 gfx::NativeCursor GetCursor(const gfx::Point& point) const; |
| 125 | 135 |
| 126 // Window takes ownership of the EventFilter. | 136 // Window takes ownership of the EventFilter. |
| 127 void SetEventFilter(EventFilter* event_filter); | 137 void SetEventFilter(EventFilter* event_filter); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 // it in the z-order. | 209 // it in the z-order. |
| 200 bool StopsEventPropagation() const; | 210 bool StopsEventPropagation() const; |
| 201 | 211 |
| 202 // Overridden from ui::LayerDelegate: | 212 // Overridden from ui::LayerDelegate: |
| 203 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 213 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
| 204 | 214 |
| 205 // Update the show state and restore bounds. Returns false | 215 // Update the show state and restore bounds. Returns false |
| 206 // if |new_show_state| is same as current show state. | 216 // if |new_show_state| is same as current show state. |
| 207 bool UpdateShowStateAndRestoreBounds(ui::WindowShowState new_show_state); | 217 bool UpdateShowStateAndRestoreBounds(ui::WindowShowState new_show_state); |
| 208 | 218 |
| 219 int type_; | |
| 220 | |
| 209 WindowDelegate* delegate_; | 221 WindowDelegate* delegate_; |
| 210 | 222 |
| 211 ui::WindowShowState show_state_; | 223 ui::WindowShowState show_state_; |
| 212 | 224 |
| 213 // The original bounds of a maximized/fullscreen window. | 225 // The original bounds of a maximized/fullscreen window. |
| 214 gfx::Rect restore_bounds_; | 226 gfx::Rect restore_bounds_; |
| 215 | 227 |
| 216 scoped_ptr<ui::Layer> layer_; | 228 scoped_ptr<ui::Layer> layer_; |
| 217 | 229 |
| 218 // The Window's parent. | 230 // The Window's parent. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 232 // When true, events are not sent to windows behind this one in the z-order, | 244 // When true, events are not sent to windows behind this one in the z-order, |
| 233 // provided this window has children. See set_stops_event_propagation(). | 245 // provided this window has children. See set_stops_event_propagation(). |
| 234 bool stops_event_propagation_; | 246 bool stops_event_propagation_; |
| 235 | 247 |
| 236 DISALLOW_COPY_AND_ASSIGN(Window); | 248 DISALLOW_COPY_AND_ASSIGN(Window); |
| 237 }; | 249 }; |
| 238 | 250 |
| 239 } // namespace aura | 251 } // namespace aura |
| 240 | 252 |
| 241 #endif // UI_AURA_WINDOW_H_ | 253 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |