| 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/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // We don't translate accelerators for ALT + NumPad digit on Windows, they are | 368 // We don't translate accelerators for ALT + NumPad digit on Windows, they are |
| 369 // used for entering special characters. We do translate alt-home. | 369 // used for entering special characters. We do translate alt-home. |
| 370 if (e.IsAltDown() && (key != ui::VKEY_HOME) && | 370 if (e.IsAltDown() && (key != ui::VKEY_HOME) && |
| 371 NativeTextfieldWin::IsNumPadDigit(key, | 371 NativeTextfieldWin::IsNumPadDigit(key, |
| 372 (e.flags() & ui::EF_EXTENDED) != 0)) | 372 (e.flags() & ui::EF_EXTENDED) != 0)) |
| 373 return true; | 373 return true; |
| 374 #endif | 374 #endif |
| 375 return false; | 375 return false; |
| 376 } | 376 } |
| 377 | 377 |
| 378 void Textfield::OnPaintBackground(gfx::Canvas* canvas) { | |
| 379 // Overridden to be public - gtk_views_entry.cc wants to call it. | |
| 380 View::OnPaintBackground(canvas); | |
| 381 } | |
| 382 | |
| 383 void Textfield::OnPaintFocusBorder(gfx::Canvas* canvas) { | 378 void Textfield::OnPaintFocusBorder(gfx::Canvas* canvas) { |
| 384 if (NativeViewHost::kRenderNativeControlFocus) | 379 if (NativeViewHost::kRenderNativeControlFocus) |
| 385 View::OnPaintFocusBorder(canvas); | 380 View::OnPaintFocusBorder(canvas); |
| 386 } | 381 } |
| 387 | 382 |
| 388 bool Textfield::OnKeyPressed(const views::KeyEvent& e) { | 383 bool Textfield::OnKeyPressed(const views::KeyEvent& e) { |
| 389 return native_wrapper_ && native_wrapper_->HandleKeyPressed(e); | 384 return native_wrapper_ && native_wrapper_->HandleKeyPressed(e); |
| 390 } | 385 } |
| 391 | 386 |
| 392 bool Textfield::OnKeyReleased(const views::KeyEvent& e) { | 387 bool Textfield::OnKeyReleased(const views::KeyEvent& e) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 native_wrapper_ = NativeTextfieldWrapper::CreateWrapper(this); | 441 native_wrapper_ = NativeTextfieldWrapper::CreateWrapper(this); |
| 447 AddChildView(native_wrapper_->GetView()); | 442 AddChildView(native_wrapper_->GetView()); |
| 448 // TODO(beng): Move this initialization to NativeTextfieldWin once it | 443 // TODO(beng): Move this initialization to NativeTextfieldWin once it |
| 449 // subclasses NativeControlWin. | 444 // subclasses NativeControlWin. |
| 450 UpdateAllProperties(); | 445 UpdateAllProperties(); |
| 451 | 446 |
| 452 #if defined(OS_WIN) && !defined(USE_AURA) | 447 #if defined(OS_WIN) && !defined(USE_AURA) |
| 453 if (!views::Widget::IsPureViews()) { | 448 if (!views::Widget::IsPureViews()) { |
| 454 // TODO(beng): remove this once NativeTextfieldWin subclasses | 449 // TODO(beng): remove this once NativeTextfieldWin subclasses |
| 455 // NativeControlWin. This is currently called to perform post-AddChildView | 450 // NativeControlWin. This is currently called to perform post-AddChildView |
| 456 // initialization for the wrapper. The GTK version subclasses things | 451 // initialization for the wrapper. |
| 457 // correctly and doesn't need this. | |
| 458 // | 452 // |
| 459 // Remove the include for native_textfield_win.h above when you fix this. | 453 // Remove the include for native_textfield_win.h above when you fix this. |
| 460 static_cast<NativeTextfieldWin*>(native_wrapper_)->AttachHack(); | 454 static_cast<NativeTextfieldWin*>(native_wrapper_)->AttachHack(); |
| 461 } | 455 } |
| 462 #endif | 456 #endif |
| 463 } | 457 } |
| 464 } | 458 } |
| 465 | 459 |
| 466 std::string Textfield::GetClassName() const { | 460 std::string Textfield::GetClassName() const { |
| 467 return kViewClassName; | 461 return kViewClassName; |
| 468 } | 462 } |
| 469 | 463 |
| 470 } // namespace views | 464 } // namespace views |
| OLD | NEW |