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

Side by Side Diff: aura/window.h

Issue 7739002: Revert 98850 - Proper MouseEvent targeting. Adds a Window method that locates a Window for a give... (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
« no previous file with comments | « aura/test_suite.cc ('k') | aura/window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 AURA_WINDOW_H_ 5 #ifndef AURA_WINDOW_H_
6 #define AURA_WINDOW_H_ 6 #define 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 "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 14
15 class SkCanvas; 15 class SkCanvas;
16 16
17 namespace ui { 17 namespace ui {
18 class Compositor; 18 class Compositor;
19 class Layer; 19 class Layer;
20 } 20 }
21 21
22 namespace aura { 22 namespace aura {
23 23
24 class Desktop; 24 class Desktop;
25 class MouseEvent; 25 class MouseEvent;
26 class WindowDelegate; 26 class WindowDelegate;
27 27
28 // Aura window implementation. Interesting events are sent to the 28 // Aura window implementation. Interesting events are sent to the
29 // WindowDelegate. 29 // WindowDelegate.
30 // TODO(beng): resolve ownership.
31 class Window { 30 class Window {
32 public: 31 public:
33 enum Visibility { 32 enum Visibility {
34 // Don't display the window onscreen and don't let it receive mouse 33 // Don't display the window onscreen and don't let it receive mouse
35 // events. This is the default. 34 // events. This is the default.
36 VISIBILITY_HIDDEN = 1, 35 VISIBILITY_HIDDEN = 1,
37 36
38 // Display the window and let it receive mouse events. 37 // Display the window and let it receive mouse events.
39 VISIBILITY_SHOWN = 2, 38 VISIBILITY_SHOWN = 2,
40 39
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 73
75 // Draw the window and its children. 74 // Draw the window and its children.
76 void DrawTree(); 75 void DrawTree();
77 76
78 // Tree operations. 77 // Tree operations.
79 // TODO(beng): Child windows are currently not owned by the hierarchy. We 78 // TODO(beng): Child windows are currently not owned by the hierarchy. We
80 // should change this. 79 // should change this.
81 void AddChild(Window* child); 80 void AddChild(Window* child);
82 void RemoveChild(Window* child); 81 void RemoveChild(Window* child);
83 82
84 static void ConvertPointToWindow(Window* source,
85 Window* target,
86 gfx::Point* point);
87
88 // Handles a mouse event. Returns true if handled. 83 // Handles a mouse event. Returns true if handled.
89 bool OnMouseEvent(const MouseEvent& event); 84 bool OnMouseEvent(const MouseEvent& event);
90 85
91 WindowDelegate* delegate() { return delegate_; }
92
93 // Returns true if the mouse pointer at the specified |point| can trigger an
94 // event for this Window.
95 // TODO(beng):
96 // A Window can supply a hit-test mask to cause some portions of itself to not
97 // trigger events, causing the events to fall through to the Window behind.
98 bool HitTest(const gfx::Point& point);
99
100 // Returns the Window that most closely encloses |point| for the purposes of
101 // event targeting.
102 Window* GetEventHandlerForPoint(const gfx::Point& point);
103
104 private: 86 private:
105 typedef std::vector<Window*> Windows; 87 typedef std::vector<Window*> Windows;
106 88
107 // If SchedulePaint has been invoked on the Window the delegate is notified. 89 // If SchedulePaint has been invoked on the Window the delegate is notified.
108 void UpdateLayerCanvas(); 90 void UpdateLayerCanvas();
109 91
110 // Draws the Window's contents. 92 // Draws the Window's contents.
111 void Draw(); 93 void Draw();
112 94
113 WindowDelegate* delegate_; 95 WindowDelegate* delegate_;
(...skipping 21 matching lines...) Expand all
135 Windows children_; 117 Windows children_;
136 118
137 int id_; 119 int id_;
138 120
139 DISALLOW_COPY_AND_ASSIGN(Window); 121 DISALLOW_COPY_AND_ASSIGN(Window);
140 }; 122 };
141 123
142 } // namespace aura 124 } // namespace aura
143 125
144 #endif // AURA_WINDOW_H_ 126 #endif // AURA_WINDOW_H_
OLDNEW
« no previous file with comments | « aura/test_suite.cc ('k') | aura/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698