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/widget/native_widget_view.h" | 5 #include "views/widget/native_widget_view.h" |
6 | 6 |
7 #include "ui/gfx/canvas.h" | 7 #include "ui/gfx/canvas.h" |
8 | 8 |
9 namespace views { | 9 namespace views { |
10 namespace internal { | 10 namespace internal { |
11 | 11 |
12 //////////////////////////////////////////////////////////////////////////////// | 12 //////////////////////////////////////////////////////////////////////////////// |
13 // NativeWidgetView, public: | 13 // NativeWidgetView, public: |
14 | 14 |
15 // static | 15 // static |
16 const char NativeWidgetView::kViewClassName[] = "views/NativeWidgetView"; | 16 const char NativeWidgetView::kViewClassName[] = "views/NativeWidgetView"; |
17 | 17 |
18 NativeWidgetView::NativeWidgetView(NativeWidgetViews* native_widget) | 18 NativeWidgetView::NativeWidgetView(NativeWidgetViews* native_widget) |
19 : native_widget_(native_widget), | 19 : native_widget_(native_widget), |
20 sent_create_(false), | 20 sent_create_(false), |
21 delete_native_widget_(true) { | 21 delete_native_widget_(true), |
| 22 cursor_(NULL) { |
22 } | 23 } |
23 | 24 |
24 NativeWidgetView::~NativeWidgetView() { | 25 NativeWidgetView::~NativeWidgetView() { |
25 // Don't let NativeWidgetViews delete this again. This must be outside | 26 // Don't let NativeWidgetViews delete this again. This must be outside |
26 // the |delete_native_widget_| clause so it gets invoked for | 27 // the |delete_native_widget_| clause so it gets invoked for |
27 // WIDGET_OWNS_NATIVE_WIDGET. It is safe because |native_widget_| will | 28 // WIDGET_OWNS_NATIVE_WIDGET. It is safe because |native_widget_| will |
28 // still exist in both ways NativeWidgetView can be destroyed: by view | 29 // still exist in both ways NativeWidgetView can be destroyed: by view |
29 // hierarchy teardown and from the NativeWidgetViews destructor. | 30 // hierarchy teardown and from the NativeWidgetViews destructor. |
30 native_widget_->set_delete_native_view(false); | 31 native_widget_->set_delete_native_view(false); |
31 if (delete_native_widget_) | 32 if (delete_native_widget_) |
(...skipping 30 matching lines...) Expand all Loading... |
62 } | 63 } |
63 | 64 |
64 void NativeWidgetView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 65 void NativeWidgetView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
65 delegate()->OnNativeWidgetSizeChanged(size()); | 66 delegate()->OnNativeWidgetSizeChanged(size()); |
66 } | 67 } |
67 | 68 |
68 void NativeWidgetView::OnPaint(gfx::Canvas* canvas) { | 69 void NativeWidgetView::OnPaint(gfx::Canvas* canvas) { |
69 delegate()->OnNativeWidgetPaint(canvas); | 70 delegate()->OnNativeWidgetPaint(canvas); |
70 } | 71 } |
71 | 72 |
| 73 gfx::NativeCursor NativeWidgetView::GetCursor(const MouseEvent& event) { |
| 74 return cursor_; |
| 75 } |
| 76 |
72 bool NativeWidgetView::OnMousePressed(const MouseEvent& event) { | 77 bool NativeWidgetView::OnMousePressed(const MouseEvent& event) { |
73 MouseEvent e(event, this); | 78 MouseEvent e(event, this); |
74 return delegate()->OnMouseEvent(event); | 79 return delegate()->OnMouseEvent(event); |
75 } | 80 } |
76 | 81 |
77 bool NativeWidgetView::OnMouseDragged(const MouseEvent& event) { | 82 bool NativeWidgetView::OnMouseDragged(const MouseEvent& event) { |
78 MouseEvent e(event, this); | 83 MouseEvent e(event, this); |
79 return delegate()->OnMouseEvent(event); | 84 return delegate()->OnMouseEvent(event); |
80 } | 85 } |
81 | 86 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 root->PaintToLayer(root_dirty_rect); | 183 root->PaintToLayer(root_dirty_rect); |
179 } | 184 } |
180 | 185 |
181 void NativeWidgetView::PaintComposite() { | 186 void NativeWidgetView::PaintComposite() { |
182 View::PaintComposite(); | 187 View::PaintComposite(); |
183 GetAssociatedWidget()->GetRootView()->PaintComposite(); | 188 GetAssociatedWidget()->GetRootView()->PaintComposite(); |
184 } | 189 } |
185 | 190 |
186 } // namespace internal | 191 } // namespace internal |
187 } // namespace views | 192 } // namespace views |
OLD | NEW |