diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-24 21:47:56 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-24 21:47:56 +0000 |
commit | 36df22b48817bc7fe7159e498f65b5e8b00f1605 (patch) | |
tree | 15e7aa8f769102d90479c5c59330a5309f4dbc3c /views/widget/root_view.cc | |
parent | af5ee7f3fe7c555578bd9c0cf1290bcf6af553e7 (diff) | |
download | chromium_src-36df22b48817bc7fe7159e498f65b5e8b00f1605.zip chromium_src-36df22b48817bc7fe7159e498f65b5e8b00f1605.tar.gz chromium_src-36df22b48817bc7fe7159e498f65b5e8b00f1605.tar.bz2 |
Transformable views: Use the transformation for points and events.
Added and updated API for converting points between views' coordinate systems,
taking transformations into consideration. This in turn gives us, for free,
transformation for located events (mouse events, touch events).
BUG=none
TEST=ViewTest.TransformEvent
Review URL: http://codereview.chromium.org/6534015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/root_view.cc')
-rw-r--r-- | views/widget/root_view.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc index d7b9007..4919bf4 100644 --- a/views/widget/root_view.cc +++ b/views/widget/root_view.cc @@ -116,7 +116,8 @@ bool RootView::ProcessKeyEvent(const KeyEvent& event) { return consumed; } -bool RootView::ProcessMouseWheelEvent(const MouseWheelEvent& e) { +bool RootView::ProcessMouseWheelEvent(const MouseWheelEvent& event) { + MouseWheelEvent e(event, this); View* v; bool consumed = false; View* focused_view = GetFocusManager()->GetFocusedView(); @@ -181,7 +182,9 @@ Widget* RootView::GetWidget() { return const_cast<Widget*>(const_cast<const RootView*>(this)->GetWidget()); } -bool RootView::OnMousePressed(const MouseEvent& e) { +bool RootView::OnMousePressed(const MouseEvent& event) { + MouseEvent e(event, this); + // This function does not normally handle non-client messages except for // non-client double-clicks. Actually, all double-clicks are special as the // are formed from a single-click followed by a double-click event. When the @@ -265,7 +268,8 @@ bool RootView::OnMousePressed(const MouseEvent& e) { return hit_disabled_view; } -bool RootView::OnMouseDragged(const MouseEvent& e) { +bool RootView::OnMouseDragged(const MouseEvent& event) { + MouseEvent e(event, this); UpdateCursor(e); if (mouse_pressed_handler_) { @@ -279,7 +283,8 @@ bool RootView::OnMouseDragged(const MouseEvent& e) { return false; } -void RootView::OnMouseReleased(const MouseEvent& e, bool canceled) { +void RootView::OnMouseReleased(const MouseEvent& event, bool canceled) { + MouseEvent e(event, this); UpdateCursor(e); if (mouse_pressed_handler_) { @@ -296,7 +301,8 @@ void RootView::OnMouseReleased(const MouseEvent& e, bool canceled) { } } -void RootView::OnMouseMoved(const MouseEvent& e) { +void RootView::OnMouseMoved(const MouseEvent& event) { + MouseEvent e(event, this); View* v = GetViewForPoint(e.location()); // Find the first enabled view, or the existing move handler, whichever comes // first. The check for the existing handler is because if a view becomes @@ -344,7 +350,9 @@ void RootView::SetMouseHandler(View *new_mh) { } #if defined(TOUCH_UI) -View::TouchStatus RootView::OnTouchEvent(const TouchEvent& e) { +View::TouchStatus RootView::OnTouchEvent(const TouchEvent& event) { + TouchEvent e(event, this); + // If touch_pressed_handler_ is non null, we are currently processing // a touch down on the screen situation. In that case we send the // event to touch_pressed_handler_ |