OLD | NEW |
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 #include "ui/views/controls/textfield/native_textfield_win.h" | 5 #include "ui/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/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/win/metro.h" | 13 #include "base/win/metro.h" |
14 #include "base/win/windows_version.h" | 14 #include "base/win/windows_version.h" |
15 #include "grit/ui_strings.h" | 15 #include "grit/ui_strings.h" |
16 #include "skia/ext/skia_utils_win.h" | 16 #include "skia/ext/skia_utils_win.h" |
17 #include "ui/base/accessibility/accessible_view_state.h" | 17 #include "ui/base/accessibility/accessible_view_state.h" |
18 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
19 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 19 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
20 #include "ui/base/events/event.h" | 20 #include "ui/base/events/event.h" |
21 #include "ui/base/ime/win/tsf_bridge.h" | 21 #include "ui/base/ime/win/tsf_bridge.h" |
22 #include "ui/base/keycodes/keyboard_codes.h" | 22 #include "ui/base/keycodes/keyboard_codes.h" |
23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/l10n/l10n_util_win.h" | 24 #include "ui/base/l10n/l10n_util_win.h" |
25 #include "ui/base/win/hwnd_util.h" | |
26 #include "ui/base/win/mouse_wheel_util.h" | 25 #include "ui/base/win/mouse_wheel_util.h" |
27 #include "ui/gfx/range/range.h" | 26 #include "ui/gfx/range/range.h" |
| 27 #include "ui/gfx/win/hwnd_util.h" |
28 #include "ui/native_theme/native_theme_win.h" | 28 #include "ui/native_theme/native_theme_win.h" |
29 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
30 #include "ui/views/controls/menu/menu_item_view.h" | 30 #include "ui/views/controls/menu/menu_item_view.h" |
31 #include "ui/views/controls/menu/menu_model_adapter.h" | 31 #include "ui/views/controls/menu/menu_model_adapter.h" |
32 #include "ui/views/controls/menu/menu_runner.h" | 32 #include "ui/views/controls/menu/menu_runner.h" |
33 #include "ui/views/controls/native/native_view_host.h" | 33 #include "ui/views/controls/native/native_view_host.h" |
34 #include "ui/views/controls/textfield/textfield.h" | 34 #include "ui/views/controls/textfield/textfield.h" |
35 #include "ui/views/controls/textfield/textfield_controller.h" | 35 #include "ui/views/controls/textfield/textfield_controller.h" |
36 #include "ui/views/focus/focus_manager.h" | 36 #include "ui/views/focus/focus_manager.h" |
37 #include "ui/views/metrics.h" | 37 #include "ui/views/metrics.h" |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 SetMsgHandled(FALSE); | 1096 SetMsgHandled(FALSE); |
1097 } | 1097 } |
1098 | 1098 |
1099 void NativeTextfieldWin::OnSysChar(TCHAR ch, UINT repeat_count, UINT flags) { | 1099 void NativeTextfieldWin::OnSysChar(TCHAR ch, UINT repeat_count, UINT flags) { |
1100 DCHECK(flags & KF_ALTDOWN); | 1100 DCHECK(flags & KF_ALTDOWN); |
1101 // Explicitly show the system menu at a good location on [Alt]+[Space]. | 1101 // Explicitly show the system menu at a good location on [Alt]+[Space]. |
1102 // Nearly all other [Alt]+<xxx> combos result in beeping rather than doing | 1102 // Nearly all other [Alt]+<xxx> combos result in beeping rather than doing |
1103 // something useful, so discard those. Note that [Ctrl]+[Alt]+<xxx> generates | 1103 // something useful, so discard those. Note that [Ctrl]+[Alt]+<xxx> generates |
1104 // WM_CHAR instead of WM_SYSCHAR, so it is not handled here. | 1104 // WM_CHAR instead of WM_SYSCHAR, so it is not handled here. |
1105 if (ch == VK_SPACE) { | 1105 if (ch == VK_SPACE) { |
1106 ui::ShowSystemMenu( | 1106 gfx::ShowSystemMenu( |
1107 container_view_->GetWidget()->GetTopLevelWidget()->GetNativeWindow()); | 1107 container_view_->GetWidget()->GetTopLevelWidget()->GetNativeWindow()); |
1108 } | 1108 } |
1109 } | 1109 } |
1110 | 1110 |
1111 void NativeTextfieldWin::OnFinalMessage(HWND hwnd) { | 1111 void NativeTextfieldWin::OnFinalMessage(HWND hwnd) { |
1112 delete this; | 1112 delete this; |
1113 } | 1113 } |
1114 | 1114 |
1115 void NativeTextfieldWin::HandleKeystroke() { | 1115 void NativeTextfieldWin::HandleKeystroke() { |
1116 const MSG* msg = GetCurrentMessage(); | 1116 const MSG* msg = GetCurrentMessage(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 return true; | 1310 return true; |
1311 MSG msg(*GetCurrentMessage()); | 1311 MSG msg(*GetCurrentMessage()); |
1312 // ATL doesn't set the |time| field. | 1312 // ATL doesn't set the |time| field. |
1313 if (!msg.time) | 1313 if (!msg.time) |
1314 msg.time = GetMessageTime(); | 1314 msg.time = GetMessageTime(); |
1315 ui::MouseEvent mouse_event(msg); | 1315 ui::MouseEvent mouse_event(msg); |
1316 return !controller->HandleMouseEvent(textfield_, mouse_event); | 1316 return !controller->HandleMouseEvent(textfield_, mouse_event); |
1317 } | 1317 } |
1318 | 1318 |
1319 } // namespace views | 1319 } // namespace views |
OLD | NEW |