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/controls/textfield/native_textfield_win.h" | 5 #include "views/controls/textfield/native_textfield_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
14 #include "grit/ui_strings.h" | 14 #include "grit/ui_strings.h" |
15 #include "skia/ext/skia_utils_win.h" | 15 #include "skia/ext/skia_utils_win.h" |
16 #include "ui/base/accessibility/accessible_view_state.h" | 16 #include "ui/base/accessibility/accessible_view_state.h" |
17 #include "ui/base/clipboard/clipboard.h" | 17 #include "ui/base/clipboard/clipboard.h" |
18 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 18 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
19 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 19 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
20 #include "ui/base/keycodes/keyboard_codes.h" | 20 #include "ui/base/keycodes/keyboard_codes.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/l10n/l10n_util_win.h" | 22 #include "ui/base/l10n/l10n_util_win.h" |
23 #include "ui/base/range/range.h" | 23 #include "ui/base/range/range.h" |
| 24 #include "ui/base/win/mouse_wheel_util.h" |
24 #include "ui/gfx/native_theme_win.h" | 25 #include "ui/gfx/native_theme_win.h" |
25 #include "views/controls/label.h" | 26 #include "views/controls/label.h" |
26 #include "views/controls/menu/menu_2.h" | 27 #include "views/controls/menu/menu_2.h" |
27 #include "views/controls/menu/menu_win.h" | 28 #include "views/controls/menu/menu_win.h" |
28 #include "views/controls/native/native_view_host.h" | 29 #include "views/controls/native/native_view_host.h" |
29 #include "views/controls/textfield/native_textfield_views.h" | 30 #include "views/controls/textfield/native_textfield_views.h" |
30 #include "views/controls/textfield/textfield.h" | 31 #include "views/controls/textfield/textfield.h" |
31 #include "views/controls/textfield/textfield_controller.h" | 32 #include "views/controls/textfield/textfield_controller.h" |
32 #include "views/focus/focus_manager.h" | 33 #include "views/focus/focus_manager.h" |
33 #include "views/focus/focus_util_win.h" | |
34 #include "views/metrics.h" | 34 #include "views/metrics.h" |
35 #include "views/views_delegate.h" | 35 #include "views/views_delegate.h" |
36 #include "views/widget/widget.h" | 36 #include "views/widget/widget.h" |
37 | 37 |
38 namespace views { | 38 namespace views { |
39 | 39 |
40 /////////////////////////////////////////////////////////////////////////////// | 40 /////////////////////////////////////////////////////////////////////////////// |
41 // Helper classes | 41 // Helper classes |
42 | 42 |
43 NativeTextfieldWin::ScopedFreeze::ScopedFreeze(NativeTextfieldWin* edit, | 43 NativeTextfieldWin::ScopedFreeze::ScopedFreeze(NativeTextfieldWin* edit, |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 742 |
743 void NativeTextfieldWin::OnMouseLeave() { | 743 void NativeTextfieldWin::OnMouseLeave() { |
744 SetContainsMouse(false); | 744 SetContainsMouse(false); |
745 } | 745 } |
746 | 746 |
747 LRESULT NativeTextfieldWin::OnMouseWheel(UINT message, | 747 LRESULT NativeTextfieldWin::OnMouseWheel(UINT message, |
748 WPARAM w_param, | 748 WPARAM w_param, |
749 LPARAM l_param) { | 749 LPARAM l_param) { |
750 // Reroute the mouse-wheel to the window under the mouse pointer if | 750 // Reroute the mouse-wheel to the window under the mouse pointer if |
751 // applicable. | 751 // applicable. |
752 if (views::RerouteMouseWheel(m_hWnd, w_param, l_param)) | 752 if (ui::RerouteMouseWheel(m_hWnd, w_param, l_param)) |
753 return 0; | 753 return 0; |
754 return DefWindowProc(message, w_param, l_param); | 754 return DefWindowProc(message, w_param, l_param); |
755 } | 755 } |
756 | 756 |
757 void NativeTextfieldWin::OnMouseMove(UINT keys, const CPoint& point) { | 757 void NativeTextfieldWin::OnMouseMove(UINT keys, const CPoint& point) { |
758 SetContainsMouse(true); | 758 SetContainsMouse(true); |
759 // Clamp the selection to the visible text so the user can't drag to select | 759 // Clamp the selection to the visible text so the user can't drag to select |
760 // the "phantom newline". In theory we could achieve this by clipping the X | 760 // the "phantom newline". In theory we could achieve this by clipping the X |
761 // coordinate, but in practice the edit seems to behave nondeterministically | 761 // coordinate, but in practice the edit seems to behave nondeterministically |
762 // with similar sequences of clipped input coordinates fed to it. Maybe it's | 762 // with similar sequences of clipped input coordinates fed to it. Maybe it's |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 | 1149 |
1150 // static | 1150 // static |
1151 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1151 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1152 Textfield* field) { | 1152 Textfield* field) { |
1153 if (views::Widget::IsPureViews()) | 1153 if (views::Widget::IsPureViews()) |
1154 return new NativeTextfieldViews(field); | 1154 return new NativeTextfieldViews(field); |
1155 return new NativeTextfieldWin(field); | 1155 return new NativeTextfieldWin(field); |
1156 } | 1156 } |
1157 | 1157 |
1158 } // namespace views | 1158 } // namespace views |
OLD | NEW |