OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/textfield.h" | 5 #include "views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlapp.h> | 8 #include <atlapp.h> |
9 #include <atlcrack.h> | 9 #include <atlcrack.h> |
10 #include <atlctrls.h> | 10 #include <atlctrls.h> |
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 return IsEnabled() && !IsReadOnly(); | 1172 return IsEnabled() && !IsReadOnly(); |
1173 } | 1173 } |
1174 | 1174 |
1175 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { | 1175 void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { |
1176 SelectAll(); | 1176 SelectAll(); |
1177 } | 1177 } |
1178 | 1178 |
1179 bool Textfield::SkipDefaultKeyEventProcessing(const KeyEvent& e) { | 1179 bool Textfield::SkipDefaultKeyEventProcessing(const KeyEvent& e) { |
1180 // TODO(hamaji): Figure out which keyboard combinations we need to add here, | 1180 // TODO(hamaji): Figure out which keyboard combinations we need to add here, |
1181 // similar to LocationBarView::SkipDefaultKeyEventProcessing. | 1181 // similar to LocationBarView::SkipDefaultKeyEventProcessing. |
1182 if (e.GetCharacter() == VK_BACK) | 1182 const int c = e.GetCharacter(); |
| 1183 if (c == VK_BACK) |
1183 return true; // We'll handle BackSpace ourselves. | 1184 return true; // We'll handle BackSpace ourselves. |
1184 | 1185 |
1185 // We don't translate accelerators for ALT + NumPad digit, they are used for | 1186 // We don't translate accelerators for ALT + NumPad digit, they are used for |
1186 // entering special characters. | 1187 // entering special characters. We do translate alt-home. |
1187 if (e.IsAltDown() && | 1188 if (e.IsAltDown() && (c != VK_HOME) && |
1188 win_util::IsNumPadDigit(e.GetCharacter(), e.IsExtendedKey())) | 1189 win_util::IsNumPadDigit(c, e.IsExtendedKey())) |
1189 return true; | 1190 return true; |
1190 | 1191 |
1191 return false; | 1192 return false; |
1192 } | 1193 } |
1193 | 1194 |
1194 void Textfield::UpdateEditBackgroundColor() { | 1195 void Textfield::UpdateEditBackgroundColor() { |
1195 if (!edit_) | 1196 if (!edit_) |
1196 return; | 1197 return; |
1197 | 1198 |
1198 COLORREF bg_color; | 1199 COLORREF bg_color; |
1199 if (!use_default_background_color_) | 1200 if (!use_default_background_color_) |
1200 bg_color = skia::SkColorToCOLORREF(background_color_); | 1201 bg_color = skia::SkColorToCOLORREF(background_color_); |
1201 else | 1202 else |
1202 bg_color = GetSysColor(read_only_ ? COLOR_3DFACE : COLOR_WINDOW); | 1203 bg_color = GetSysColor(read_only_ ? COLOR_3DFACE : COLOR_WINDOW); |
1203 edit_->SetBackgroundColor(bg_color); | 1204 edit_->SetBackgroundColor(bg_color); |
1204 } | 1205 } |
1205 | 1206 |
1206 } // namespace views | 1207 } // namespace views |
OLD | NEW |