Index: chrome/views/text_field.cc |
=================================================================== |
--- chrome/views/text_field.cc (revision 8567) |
+++ chrome/views/text_field.cc (working copy) |
@@ -47,6 +47,7 @@ |
std::wstring GetText() const; |
void SetText(const std::wstring& text); |
+ void AppendText(const std::wstring& text); |
std::wstring GetSelectedText() const; |
@@ -315,6 +316,13 @@ |
SetWindowText(text_to_set.c_str()); |
} |
+void TextField::Edit::AppendText(const std::wstring& text) { |
+ int text_length = GetWindowTextLength(); |
+ ::SendMessage(m_hWnd, TBM_SETSEL, true, MAKELPARAM(text_length, text_length)); |
+ ::SendMessage(m_hWnd, EM_REPLACESEL, false, |
+ reinterpret_cast<LPARAM>(text.c_str())); |
+} |
+ |
std::wstring TextField::Edit::GetSelectedText() const { |
// Figure out the length of the selection. |
long start; |
@@ -953,6 +961,12 @@ |
edit_->SetText(text); |
} |
+void TextField::AppendText(const std::wstring& text) { |
+ text_ += text; |
+ if (edit_) |
+ edit_->AppendText(text); |
+} |
+ |
void TextField::CalculateInsets(gfx::Insets* insets) { |
DCHECK(insets); |