Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: ui/aura/window.h

Issue 7970001: Better Z-index support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ui/aura/aura_export.h" 14 #include "ui/aura/aura_export.h"
14 #include "ui/gfx/compositor/layer_delegate.h" 15 #include "ui/gfx/compositor/layer_delegate.h"
15 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
16 17
17 class SkCanvas; 18 class SkCanvas;
18 19
19 namespace ui { 20 namespace ui {
20 class Compositor; 21 class Compositor;
21 class Layer; 22 class Layer;
22 } 23 }
23 24
24 namespace aura { 25 namespace aura {
25 26
26 class Desktop; 27 class Desktop;
27 class KeyEvent; 28 class KeyEvent;
28 class LayoutManager; 29 class LayoutManager;
29 class MouseEvent; 30 class MouseEvent;
30 class WindowDelegate; 31 class WindowDelegate;
31 class WindowManager; 32 class EventFilter;
32 33
33 namespace internal { 34 namespace internal {
34 class FocusManager; 35 class FocusManager;
35 } 36 }
36 37
37 // Aura window implementation. Interesting events are sent to the 38 // Aura window implementation. Interesting events are sent to the
38 // WindowDelegate. 39 // WindowDelegate.
39 // TODO(beng): resolve ownership. 40 // TODO(beng): resolve ownership.
40 class AURA_EXPORT Window : public ui::LayerDelegate { 41 class AURA_EXPORT Window : public ui::LayerDelegate {
41 public: 42 public:
(...skipping 10 matching lines...) Expand all
52 }; 53 };
53 54
54 explicit Window(WindowDelegate* delegate); 55 explicit Window(WindowDelegate* delegate);
55 ~Window(); 56 ~Window();
56 57
57 void Init(); 58 void Init();
58 59
59 int id() const { return id_; } 60 int id() const { return id_; }
60 void set_id(int id) { id_ = id; } 61 void set_id(int id) { id_ = id; }
61 62
63 string16 name() const { return name_; }
tfarina 2011/09/20 02:19:24 const string16& name() const { ... } ?
64 void set_name(const string16& name) { name_ = name; }
65
62 ui::Layer* layer() { return layer_.get(); } 66 ui::Layer* layer() { return layer_.get(); }
63 const ui::Layer* layer() const { return layer_.get(); } 67 const ui::Layer* layer() const { return layer_.get(); }
64 68
65 // Changes the visibility of the window. 69 // Changes the visibility of the window.
66 void SetVisibility(Visibility visibility); 70 void SetVisibility(Visibility visibility);
67 Visibility visibility() const { return visibility_; } 71 Visibility visibility() const { return visibility_; }
68 72
69 // Assigns a LayoutManager to size and place child windows. 73 // Assigns a LayoutManager to size and place child windows.
70 // The Window takes ownership of the LayoutManager. 74 // The Window takes ownership of the LayoutManager.
71 void SetLayoutManager(LayoutManager* layout_manager); 75 void SetLayoutManager(LayoutManager* layout_manager);
72 76
73 // Changes the bounds of the window. 77 // Changes the bounds of the window.
74 void SetBounds(const gfx::Rect& bounds, int anim_ms); 78 void SetBounds(const gfx::Rect& bounds, int anim_ms);
75 const gfx::Rect& bounds() const { return bounds_; } 79 const gfx::Rect& bounds() const { return bounds_; }
76 80
77 // Marks the a portion of window as needing to be painted. 81 // Marks the a portion of window as needing to be painted.
78 void SchedulePaintInRect(const gfx::Rect& rect); 82 void SchedulePaintInRect(const gfx::Rect& rect);
79 83
80 // Sets the contents of the window. 84 // Sets the contents of the window.
81 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); 85 void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin);
82 86
83 // Sets the parent window of the window. If NULL, the window is parented to 87 // Sets the parent window of the window. If NULL, the window is parented to
84 // the desktop's window. 88 // the desktop's window.
85 void SetParent(Window* parent); 89 void SetParent(Window* parent);
86 Window* parent() { return parent_; } 90 Window* parent() { return parent_; }
87 91
88 // Returns true if this Window is the container for toplevel windows. 92 // Returns true if this Window is the container for toplevel windows.
89 virtual bool IsTopLevelWindowContainer() const; 93 virtual bool IsToplevelWindowContainer() const;
90 94
91 // Move the specified child of this Window to the front of the z-order. 95 // Move the specified child of this Window to the front of the z-order.
92 // TODO(beng): this is (obviously) feeble. 96 // TODO(beng): this is (obviously) feeble.
93 void MoveChildToFront(Window* child); 97 void MoveChildToFront(Window* child);
94 98
95 // Tree operations. 99 // Tree operations.
96 // TODO(beng): Child windows are currently not owned by the hierarchy. We 100 // TODO(beng): Child windows are currently not owned by the hierarchy. We
97 // should change this. 101 // should change this.
98 void AddChild(Window* child); 102 void AddChild(Window* child);
99 void RemoveChild(Window* child); 103 void RemoveChild(Window* child);
100 104
101 static void ConvertPointToWindow(Window* source, 105 static void ConvertPointToWindow(Window* source,
102 Window* target, 106 Window* target,
103 gfx::Point* point); 107 gfx::Point* point);
104 108
109 // Window takes ownership of the EventFilter.
110 void SetEventFilter(EventFilter* event_filter);
111
105 // Handles a mouse event. Returns true if handled. 112 // Handles a mouse event. Returns true if handled.
106 bool OnMouseEvent(MouseEvent* event); 113 bool OnMouseEvent(MouseEvent* event);
107 114
108 // Handles a key event. Returns true if handled. 115 // Handles a key event. Returns true if handled.
109 bool OnKeyEvent(KeyEvent* event); 116 bool OnKeyEvent(KeyEvent* event);
110 117
111 WindowDelegate* delegate() { return delegate_; } 118 WindowDelegate* delegate() { return delegate_; }
112 119
113 // Returns true if the mouse pointer at the specified |point| can trigger an 120 // Returns true if the mouse pointer at the specified |point| can trigger an
114 // event for this Window. 121 // event for this Window.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 gfx::Rect bounds_; 158 gfx::Rect bounds_;
152 159
153 // The Window's parent. 160 // The Window's parent.
154 // TODO(beng): Implement NULL-ness for toplevels. 161 // TODO(beng): Implement NULL-ness for toplevels.
155 Window* parent_; 162 Window* parent_;
156 163
157 // Child windows. Topmost is last. 164 // Child windows. Topmost is last.
158 Windows children_; 165 Windows children_;
159 166
160 int id_; 167 int id_;
168 string16 name_;
161 169
162 scoped_ptr<WindowManager> window_manager_; 170 scoped_ptr<EventFilter> event_filter_;
163 scoped_ptr<LayoutManager> layout_manager_; 171 scoped_ptr<LayoutManager> layout_manager_;
164 172
165 void* user_data_; 173 void* user_data_;
166 174
167 DISALLOW_COPY_AND_ASSIGN(Window); 175 DISALLOW_COPY_AND_ASSIGN(Window);
168 }; 176 };
169 177
170 } // namespace aura 178 } // namespace aura
171 179
172 #endif // UI_AURA_WINDOW_H_ 180 #endif // UI_AURA_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698