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

Side by Side Diff: ui/views/widget/root_view.h

Issue 12207092: views: Dispatch key, touch, scroll and gesture events using the EventDispatch interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-before-land Created 7 years, 10 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 | « ui/views/view.cc ('k') | ui/views/widget/root_view.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_VIEWS_WIDGET_ROOT_VIEW_H_ 5 #ifndef UI_VIEWS_WIDGET_ROOT_VIEW_H_
6 #define UI_VIEWS_WIDGET_ROOT_VIEW_H_ 6 #define UI_VIEWS_WIDGET_ROOT_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "ui/base/events/event_dispatcher.h"
11 #include "ui/views/focus/focus_manager.h" 12 #include "ui/views/focus/focus_manager.h"
12 #include "ui/views/focus/focus_search.h" 13 #include "ui/views/focus/focus_search.h"
13 #include "ui/views/view.h" 14 #include "ui/views/view.h"
14 15
15 namespace views { 16 namespace views {
16 17
17 class Widget; 18 class Widget;
18 19
19 // This is a views-internal API and should not be used externally. 20 // This is a views-internal API and should not be used externally.
20 // Widget exposes this object as a View*. 21 // Widget exposes this object as a View*.
21 namespace internal { 22 namespace internal {
22 23
23 //////////////////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////////////////
24 // RootView class 25 // RootView class
25 // 26 //
26 // The RootView is the root of a View hierarchy. A RootView is attached to a 27 // The RootView is the root of a View hierarchy. A RootView is attached to a
27 // Widget. The Widget is responsible for receiving events from the host 28 // Widget. The Widget is responsible for receiving events from the host
28 // environment, converting them to views-compatible events and then forwarding 29 // environment, converting them to views-compatible events and then forwarding
29 // them to the RootView for propagation into the View hierarchy. 30 // them to the RootView for propagation into the View hierarchy.
30 // 31 //
31 // A RootView can have only one child, called its "Contents View" which is 32 // A RootView can have only one child, called its "Contents View" which is
32 // sized to fill the bounds of the RootView (and hence the client area of the 33 // sized to fill the bounds of the RootView (and hence the client area of the
33 // Widget). Call SetContentsView() after the associated Widget has been 34 // Widget). Call SetContentsView() after the associated Widget has been
34 // initialized to attach the contents view to the RootView. 35 // initialized to attach the contents view to the RootView.
35 // TODO(beng): Enforce no other callers to AddChildView/tree functions by 36 // TODO(beng): Enforce no other callers to AddChildView/tree functions by
36 // overriding those methods as private here. 37 // overriding those methods as private here.
37 // TODO(beng): Clean up API further, make Widget a friend. 38 // TODO(beng): Clean up API further, make Widget a friend.
38 // TODO(sky): We don't really want to export this class. 39 // TODO(sky): We don't really want to export this class.
39 // 40 //
40 class VIEWS_EXPORT RootView : public View, public FocusTraversable { 41 class VIEWS_EXPORT RootView : public View,
42 public FocusTraversable,
43 public ui::EventDispatcherDelegate {
41 public: 44 public:
42 static const char kViewClassName[]; 45 static const char kViewClassName[];
43 46
44 // Creation and lifetime ----------------------------------------------------- 47 // Creation and lifetime -----------------------------------------------------
45 explicit RootView(Widget* widget); 48 explicit RootView(Widget* widget);
46 virtual ~RootView(); 49 virtual ~RootView();
47 50
48 // Tree operations ----------------------------------------------------------- 51 // Tree operations -----------------------------------------------------------
49 52
50 // Sets the "contents view" of the RootView. This is the single child view 53 // Sets the "contents view" of the RootView. This is the single child view
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // cursor during drag operations. The location of the mouse should be in the 129 // cursor during drag operations. The location of the mouse should be in the
127 // current coordinate system (i.e. any necessary transformation should be 130 // current coordinate system (i.e. any necessary transformation should be
128 // applied to the point prior to calling this). 131 // applied to the point prior to calling this).
129 void UpdateCursor(const ui::MouseEvent& event); 132 void UpdateCursor(const ui::MouseEvent& event);
130 133
131 // Updates the last_mouse_* fields from e. The location of the mouse should be 134 // Updates the last_mouse_* fields from e. The location of the mouse should be
132 // in the current coordinate system (i.e. any necessary transformation should 135 // in the current coordinate system (i.e. any necessary transformation should
133 // be applied to the point prior to calling this). 136 // be applied to the point prior to calling this).
134 void SetMouseLocationAndFlags(const ui::MouseEvent& event); 137 void SetMouseLocationAndFlags(const ui::MouseEvent& event);
135 138
139 void DispatchEventToTarget(View* target, ui::Event* event);
140
141 // Overridden from ui::EventDispatcherDelegate:
142 virtual bool CanDispatchToTarget(ui::EventTarget* target) OVERRIDE;
143
136 ////////////////////////////////////////////////////////////////////////////// 144 //////////////////////////////////////////////////////////////////////////////
137 145
138 // Tree operations ----------------------------------------------------------- 146 // Tree operations -----------------------------------------------------------
139 147
140 // The host Widget 148 // The host Widget
141 Widget* widget_; 149 Widget* widget_;
142 150
143 // Input --------------------------------------------------------------------- 151 // Input ---------------------------------------------------------------------
144 152
145 // The view currently handing down - drag - up 153 // The view currently handing down - drag - up
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Whether this root view belongs to the current active window. 188 // Whether this root view belongs to the current active window.
181 // bool activated_; 189 // bool activated_;
182 190
183 // The parent FocusTraversable, used for focus traversal. 191 // The parent FocusTraversable, used for focus traversal.
184 FocusTraversable* focus_traversable_parent_; 192 FocusTraversable* focus_traversable_parent_;
185 193
186 // The View that contains this RootView. This is used when we have RootView 194 // The View that contains this RootView. This is used when we have RootView
187 // wrapped inside native components, and is used for the focus traversal. 195 // wrapped inside native components, and is used for the focus traversal.
188 View* focus_traversable_parent_view_; 196 View* focus_traversable_parent_view_;
189 197
198 View* event_dispatch_target_;
199
190 // Drag and drop ------------------------------------------------------------- 200 // Drag and drop -------------------------------------------------------------
191 201
192 // Tracks drag state for a view. 202 // Tracks drag state for a view.
193 View::DragInfo drag_info_; 203 View::DragInfo drag_info_;
194 204
195 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView); 205 DISALLOW_IMPLICIT_CONSTRUCTORS(RootView);
196 }; 206 };
197 207
198 } // namespace internal 208 } // namespace internal
199 } // namespace views 209 } // namespace views
200 210
201 #endif // UI_VIEWS_WIDGET_ROOT_VIEW_H_ 211 #endif // UI_VIEWS_WIDGET_ROOT_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/view.cc ('k') | ui/views/widget/root_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698