| 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/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/native_theme/native_theme_win.h" | |
| 24 #include "ui/base/range/range.h" | 23 #include "ui/base/range/range.h" |
| 25 #include "ui/base/win/mouse_wheel_util.h" | 24 #include "ui/base/win/mouse_wheel_util.h" |
| 25 #include "ui/gfx/native_theme_win.h" |
| 26 #include "ui/views/controls/label.h" | 26 #include "ui/views/controls/label.h" |
| 27 #include "ui/views/controls/menu/menu_item_view.h" | 27 #include "ui/views/controls/menu/menu_item_view.h" |
| 28 #include "ui/views/controls/menu/menu_model_adapter.h" | 28 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 29 #include "ui/views/controls/menu/menu_runner.h" | 29 #include "ui/views/controls/menu/menu_runner.h" |
| 30 #include "ui/views/controls/native/native_view_host.h" | 30 #include "ui/views/controls/native/native_view_host.h" |
| 31 #include "ui/views/controls/textfield/native_textfield_views.h" | 31 #include "ui/views/controls/textfield/native_textfield_views.h" |
| 32 #include "ui/views/controls/textfield/textfield.h" | 32 #include "ui/views/controls/textfield/textfield.h" |
| 33 #include "ui/views/controls/textfield/textfield_controller.h" | 33 #include "ui/views/controls/textfield/textfield_controller.h" |
| 34 #include "ui/views/focus/focus_manager.h" | 34 #include "ui/views/focus/focus_manager.h" |
| 35 #include "ui/views/metrics.h" | 35 #include "ui/views/metrics.h" |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 else if (contains_mouse_) | 913 else if (contains_mouse_) |
| 914 state = EPSHV_HOT; | 914 state = EPSHV_HOT; |
| 915 else | 915 else |
| 916 state = EPSHV_NORMAL; | 916 state = EPSHV_NORMAL; |
| 917 // Vista doesn't appear to have a unique state for readonly. | 917 // Vista doesn't appear to have a unique state for readonly. |
| 918 } | 918 } |
| 919 | 919 |
| 920 int classic_state = | 920 int classic_state = |
| 921 (!textfield_->enabled() || textfield_->read_only()) ? DFCS_INACTIVE : 0; | 921 (!textfield_->enabled() || textfield_->read_only()) ? DFCS_INACTIVE : 0; |
| 922 | 922 |
| 923 ui::NativeThemeWin::instance()->PaintTextField(hdc, part, state, | 923 gfx::NativeThemeWin::instance()->PaintTextField(hdc, part, state, |
| 924 classic_state, &window_rect, | 924 classic_state, &window_rect, |
| 925 bg_color_, false, true); | 925 bg_color_, false, true); |
| 926 | 926 |
| 927 // NOTE: I tried checking the transparent property of the theme and invoking | 927 // NOTE: I tried checking the transparent property of the theme and invoking |
| 928 // drawParentBackground, but it didn't seem to make a difference. | 928 // drawParentBackground, but it didn't seem to make a difference. |
| 929 | 929 |
| 930 ReleaseDC(hdc); | 930 ReleaseDC(hdc); |
| 931 } | 931 } |
| 932 | 932 |
| 933 void NativeTextfieldWin::OnNonLButtonDown(UINT keys, const CPoint& point) { | 933 void NativeTextfieldWin::OnNonLButtonDown(UINT keys, const CPoint& point) { |
| 934 // Interestingly, the edit doesn't seem to cancel triple clicking when the | 934 // Interestingly, the edit doesn't seem to cancel triple clicking when the |
| 935 // x-buttons (which usually means "thumb buttons") are pressed, so we only | 935 // x-buttons (which usually means "thumb buttons") are pressed, so we only |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1189 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 1190 Textfield* field) { | 1190 Textfield* field) { |
| 1191 #if defined(USE_AURA) | 1191 #if defined(USE_AURA) |
| 1192 return new NativeTextfieldViews(field); | 1192 return new NativeTextfieldViews(field); |
| 1193 #else | 1193 #else |
| 1194 return new NativeTextfieldWin(field); | 1194 return new NativeTextfieldWin(field); |
| 1195 #endif | 1195 #endif |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 } // namespace views | 1198 } // namespace views |
| OLD | NEW |