| 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/string16.h" | 13 #include "base/string16.h" |
| 14 #include "ui/aura/aura_export.h" | 14 #include "ui/aura/aura_export.h" |
| 15 #include "ui/gfx/compositor/layer_delegate.h" | 15 #include "ui/gfx/compositor/layer_delegate.h" |
| 16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 17 | 17 |
| 18 class SkCanvas; | 18 class SkCanvas; |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 class Animation; |
| 21 class Compositor; | 22 class Compositor; |
| 22 class Layer; | 23 class Layer; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace aura { | 26 namespace aura { |
| 26 | 27 |
| 27 class Desktop; | 28 class Desktop; |
| 28 class EventFilter; | 29 class EventFilter; |
| 29 class KeyEvent; | 30 class KeyEvent; |
| 30 class LayoutManager; | 31 class LayoutManager; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 72 |
| 72 // Changes the visibility of the window. | 73 // Changes the visibility of the window. |
| 73 void SetVisibility(Visibility visibility); | 74 void SetVisibility(Visibility visibility); |
| 74 Visibility visibility() const { return visibility_; } | 75 Visibility visibility() const { return visibility_; } |
| 75 | 76 |
| 76 // Assigns a LayoutManager to size and place child windows. | 77 // Assigns a LayoutManager to size and place child windows. |
| 77 // The Window takes ownership of the LayoutManager. | 78 // The Window takes ownership of the LayoutManager. |
| 78 void SetLayoutManager(LayoutManager* layout_manager); | 79 void SetLayoutManager(LayoutManager* layout_manager); |
| 79 | 80 |
| 80 // Changes the bounds of the window. | 81 // Changes the bounds of the window. |
| 81 void SetBounds(const gfx::Rect& bounds, int anim_ms); | 82 void SetBounds(const gfx::Rect& new_bounds); |
| 82 const gfx::Rect& bounds() const { return bounds_; } | 83 const gfx::Rect& bounds() const; |
| 83 | 84 |
| 84 // Marks the a portion of window as needing to be painted. | 85 // Marks the a portion of window as needing to be painted. |
| 85 void SchedulePaintInRect(const gfx::Rect& rect); | 86 void SchedulePaintInRect(const gfx::Rect& rect); |
| 86 | 87 |
| 87 // Sets the contents of the window. | 88 // Sets the contents of the window. |
| 88 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); | 89 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); |
| 89 | 90 |
| 90 // Sets the parent window of the window. If NULL, the window is parented to | 91 // Sets the parent window of the window. If NULL, the window is parented to |
| 91 // the desktop's window. | 92 // the desktop's window. |
| 92 void SetParent(Window* parent); | 93 void SetParent(Window* parent); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Does a mouse capture on the window. This does nothing if the window isn't | 145 // Does a mouse capture on the window. This does nothing if the window isn't |
| 145 // showing (VISIBILITY_SHOWN) or isn't contained in a valid window hierarchy. | 146 // showing (VISIBILITY_SHOWN) or isn't contained in a valid window hierarchy. |
| 146 void SetCapture(); | 147 void SetCapture(); |
| 147 | 148 |
| 148 // Releases a mouse capture. | 149 // Releases a mouse capture. |
| 149 void ReleaseCapture(); | 150 void ReleaseCapture(); |
| 150 | 151 |
| 151 // Returns true if this window has a mouse capture. | 152 // Returns true if this window has a mouse capture. |
| 152 bool HasCapture(); | 153 bool HasCapture(); |
| 153 | 154 |
| 155 // Returns an animation configured with the default duration. All animations |
| 156 // should use this. Caller owns returned value. |
| 157 static ui::Animation* CreateDefaultAnimation(); |
| 158 |
| 154 protected: | 159 protected: |
| 155 // Returns the RootWindow or NULL if we don't yet have a RootWindow. | 160 // Returns the RootWindow or NULL if we don't yet have a RootWindow. |
| 156 virtual internal::RootWindow* GetRoot(); | 161 virtual internal::RootWindow* GetRoot(); |
| 157 | 162 |
| 158 private: | 163 private: |
| 159 // Schedules a paint for the Window's entire bounds. | 164 // Schedules a paint for the Window's entire bounds. |
| 160 void SchedulePaint(); | 165 void SchedulePaint(); |
| 161 | 166 |
| 162 // Overridden from ui::LayerDelegate: | 167 // Overridden from ui::LayerDelegate: |
| 163 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; | 168 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; |
| 164 | 169 |
| 165 WindowDelegate* delegate_; | 170 WindowDelegate* delegate_; |
| 166 | 171 |
| 167 Visibility visibility_; | 172 Visibility visibility_; |
| 168 | 173 |
| 169 scoped_ptr<ui::Layer> layer_; | 174 scoped_ptr<ui::Layer> layer_; |
| 170 | 175 |
| 171 // Bounds of the window in the desktop's coordinate system. | |
| 172 gfx::Rect bounds_; | |
| 173 | |
| 174 // The Window's parent. | 176 // The Window's parent. |
| 175 // TODO(beng): Implement NULL-ness for toplevels. | 177 // TODO(beng): Implement NULL-ness for toplevels. |
| 176 Window* parent_; | 178 Window* parent_; |
| 177 | 179 |
| 178 // Child windows. Topmost is last. | 180 // Child windows. Topmost is last. |
| 179 Windows children_; | 181 Windows children_; |
| 180 | 182 |
| 181 int id_; | 183 int id_; |
| 182 string16 name_; | 184 string16 name_; |
| 183 | 185 |
| 184 scoped_ptr<EventFilter> event_filter_; | 186 scoped_ptr<EventFilter> event_filter_; |
| 185 scoped_ptr<LayoutManager> layout_manager_; | 187 scoped_ptr<LayoutManager> layout_manager_; |
| 186 | 188 |
| 187 void* user_data_; | 189 void* user_data_; |
| 188 | 190 |
| 189 DISALLOW_COPY_AND_ASSIGN(Window); | 191 DISALLOW_COPY_AND_ASSIGN(Window); |
| 190 }; | 192 }; |
| 191 | 193 |
| 192 } // namespace aura | 194 } // namespace aura |
| 193 | 195 |
| 194 #endif // UI_AURA_WINDOW_H_ | 196 #endif // UI_AURA_WINDOW_H_ |
| OLD | NEW |