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

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

Issue 7976020: Wires up mouse capture code for aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks 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 "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 Compositor; 21 class Compositor;
22 class Layer; 22 class Layer;
23 } 23 }
24 24
25 namespace aura { 25 namespace aura {
26 26
27 class Desktop; 27 class Desktop;
28 class EventFilter;
28 class KeyEvent; 29 class KeyEvent;
29 class LayoutManager; 30 class LayoutManager;
30 class MouseEvent; 31 class MouseEvent;
31 class WindowDelegate; 32 class WindowDelegate;
32 class EventFilter;
33 33
34 namespace internal { 34 namespace internal {
35 class FocusManager; 35 class FocusManager;
36 class RootWindow;
36 } 37 }
37 38
38 // Aura window implementation. Interesting events are sent to the 39 // Aura window implementation. Interesting events are sent to the
39 // WindowDelegate. 40 // WindowDelegate.
40 // TODO(beng): resolve ownership. 41 // TODO(beng): resolve ownership.
41 class AURA_EXPORT Window : public ui::LayerDelegate { 42 class AURA_EXPORT Window : public ui::LayerDelegate {
42 public: 43 public:
43 typedef std::vector<Window*> Windows; 44 typedef std::vector<Window*> Windows;
44 45
45 enum Visibility { 46 enum Visibility {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 Window* GetEventHandlerForPoint(const gfx::Point& point); 134 Window* GetEventHandlerForPoint(const gfx::Point& point);
134 135
135 // Returns the FocusManager for the Window, which may be attached to a parent 136 // Returns the FocusManager for the Window, which may be attached to a parent
136 // Window. Can return NULL if the Window has no FocusManager. 137 // Window. Can return NULL if the Window has no FocusManager.
137 virtual internal::FocusManager* GetFocusManager(); 138 virtual internal::FocusManager* GetFocusManager();
138 139
139 // The Window does not own this object. 140 // The Window does not own this object.
140 void set_user_data(void* user_data) { user_data_ = user_data; } 141 void set_user_data(void* user_data) { user_data_ = user_data; }
141 void* user_data() const { return user_data_; } 142 void* user_data() const { return user_data_; }
142 143
144 // 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 void SetCapture();
147
148 // Releases a mouse capture.
149 void ReleaseCapture();
150
151 // Returns true if this window has a mouse capture.
152 bool HasCapture();
153
154 protected:
155 explicit Window(WindowDelegate* delegate, bool is_root);
156
143 private: 157 private:
144 // If SchedulePaint has been invoked on the Window the delegate is notified. 158 // If SchedulePaint has been invoked on the Window the delegate is notified.
145 void UpdateLayerCanvas(); 159 void UpdateLayerCanvas();
146 160
147 // Schedules a paint for the Window's entire bounds. 161 // Schedules a paint for the Window's entire bounds.
148 void SchedulePaint(); 162 void SchedulePaint();
149 163
164 // Returns the RootWindow or NULL if we don't yet have a RootWindow.
165 internal::RootWindow* GetRoot();
166
150 // Overridden from ui::LayerDelegate: 167 // Overridden from ui::LayerDelegate:
151 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; 168 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE;
152 169
170 // Are we a RootWindow?
171 const bool is_root_;
172
153 WindowDelegate* delegate_; 173 WindowDelegate* delegate_;
154 174
155 Visibility visibility_; 175 Visibility visibility_;
156 176
157 scoped_ptr<ui::Layer> layer_; 177 scoped_ptr<ui::Layer> layer_;
158 178
159 // Bounds of the window in the desktop's coordinate system. 179 // Bounds of the window in the desktop's coordinate system.
160 gfx::Rect bounds_; 180 gfx::Rect bounds_;
161 181
162 // The Window's parent. 182 // The Window's parent.
(...skipping 10 matching lines...) Expand all
173 scoped_ptr<LayoutManager> layout_manager_; 193 scoped_ptr<LayoutManager> layout_manager_;
174 194
175 void* user_data_; 195 void* user_data_;
176 196
177 DISALLOW_COPY_AND_ASSIGN(Window); 197 DISALLOW_COPY_AND_ASSIGN(Window);
178 }; 198 };
179 199
180 } // namespace aura 200 } // namespace aura
181 201
182 #endif // UI_AURA_WINDOW_H_ 202 #endif // UI_AURA_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698