summaryrefslogtreecommitdiffstats
path: root/chrome/views/text_field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/views/text_field.cc')
-rw-r--r--chrome/views/text_field.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/views/text_field.cc b/chrome/views/text_field.cc
index 62ebdc8..79ee7b9 100644
--- a/chrome/views/text_field.cc
+++ b/chrome/views/text_field.cc
@@ -47,6 +47,7 @@ class TextField::Edit
std::wstring GetText() const;
void SetText(const std::wstring& text);
+ void AppendText(const std::wstring& text);
std::wstring GetSelectedText() const;
@@ -315,6 +316,13 @@ void TextField::Edit::SetText(const std::wstring& text) {
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 @@ void TextField::SetText(const std::wstring& text) {
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);