OLD | NEW |
---|---|
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 #include "views/desktop/desktop_window_view.h" | 5 #include "views/desktop/desktop_window_view.h" |
6 | 6 |
7 #include "ui/gfx/canvas.h" | 7 #include "ui/gfx/canvas.h" |
8 #include "ui/gfx/transform.h" | 8 #include "ui/gfx/transform.h" |
9 #include "views/desktop/desktop_background.h" | 9 #include "views/desktop/desktop_background.h" |
10 #include "views/desktop/desktop_window_root_view.h" | 10 #include "views/desktop/desktop_window_root_view.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 virtual internal::RootView* CreateRootView() OVERRIDE { | 37 virtual internal::RootView* CreateRootView() OVERRIDE { |
38 return new DesktopWindowRootView(desktop_window_view_, this); | 38 return new DesktopWindowRootView(desktop_window_view_, this); |
39 } | 39 } |
40 | 40 |
41 virtual bool OnKeyEvent(const KeyEvent& event) OVERRIDE { | 41 virtual bool OnKeyEvent(const KeyEvent& event) OVERRIDE { |
42 NativeWidgetViews* native_widget = | 42 NativeWidgetViews* native_widget = |
43 desktop_window_view_->active_native_widget(); | 43 desktop_window_view_->active_native_widget(); |
44 return native_widget ? native_widget->OnKeyEvent(event) : false; | 44 return native_widget ? native_widget->OnKeyEvent(event) : false; |
45 } | 45 } |
46 | 46 |
47 virtual bool OnMouseEvent(const MouseEvent& event) { | |
sky
2011/08/17 15:50:35
OVERRIDE
| |
48 if (event.type() == ui::ET_MOUSEWHEEL) { | |
49 NativeWidgetViews* native_widget = | |
50 desktop_window_view_->active_native_widget(); | |
51 if (native_widget) | |
52 return native_widget->delegate()->OnMouseEvent(event); | |
53 } | |
54 return Widget::OnMouseEvent(event); | |
55 } | |
56 | |
47 DesktopWindowView* desktop_window_view_; | 57 DesktopWindowView* desktop_window_view_; |
48 | 58 |
49 DISALLOW_COPY_AND_ASSIGN(DesktopWindow); | 59 DISALLOW_COPY_AND_ASSIGN(DesktopWindow); |
50 }; | 60 }; |
51 | 61 |
52 class TestWindowContentView : public WidgetDelegateView { | 62 class TestWindowContentView : public WidgetDelegateView { |
53 public: | 63 public: |
54 TestWindowContentView(const std::wstring& title, SkColor color) | 64 TestWindowContentView(const std::wstring& title, SkColor color) |
55 : title_(title), | 65 : title_(title), |
56 color_(color) { | 66 color_(color) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 active_native_widget_->GetWidget()->Deactivate(); | 268 active_native_widget_->GetWidget()->Deactivate(); |
259 active_native_widget_ = | 269 active_native_widget_ = |
260 static_cast<NativeWidgetViews*>(widget->native_widget()); | 270 static_cast<NativeWidgetViews*>(widget->native_widget()); |
261 } else if (widget == active_native_widget_->GetWidget()) { | 271 } else if (widget == active_native_widget_->GetWidget()) { |
262 active_native_widget_ = NULL; | 272 active_native_widget_ = NULL; |
263 } | 273 } |
264 } | 274 } |
265 | 275 |
266 } // namespace desktop | 276 } // namespace desktop |
267 } // namespace views | 277 } // namespace views |
OLD | NEW |