From: Vadim Zeitlin Date: Mon, 28 Apr 2008 12:32:32 +0000 (+0000) Subject: fix wxTextCtrl::operator<<('\n') in Unicode build (should use char overload, not... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9e50ed28d99a07bff5f63c9f7952c3ae6be6cab0 fix wxTextCtrl::operator<<('\n') in Unicode build (should use char overload, not int); corrected mangled documentation of these operators git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53398 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h index 5ace5a3d19..952862d44e 100644 --- a/include/wx/textctrl.h +++ b/include/wx/textctrl.h @@ -615,9 +615,10 @@ public: wxTextCtrl& operator<<(const wxString& s); wxTextCtrl& operator<<(int i); wxTextCtrl& operator<<(long i); - wxTextCtrl& operator<<(float f); + wxTextCtrl& operator<<(float f) { return *this << double(f); } wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(const wxChar c); + wxTextCtrl& operator<<(char c) { return *this << wxString(c); } + wxTextCtrl& operator<<(wchar_t c) { return *this << wxString(c); } // insert the character which would have resulted from this key event, // return true if anything has been inserted diff --git a/interface/textctrl.h b/interface/textctrl.h index 1b5ff11567..b91d166a11 100644 --- a/interface/textctrl.h +++ b/interface/textctrl.h @@ -1319,14 +1319,15 @@ public: //@{ /** - Operator definitions for appending to a text control, for example: - */ - wxTextCtrl operator(const wxString& s); - wxTextCtrl operator(int i); - wxTextCtrl operator(long i); - wxTextCtrl operator(float f); - wxTextCtrl operator(double d); - wxTextCtrl operator(char c); + Operator definitions for appending to a text control. + */ + wxTextCtrl& operator<<(const wxString& s); + wxTextCtrl& operator<<(int i); + wxTextCtrl& operator<<(long i); + wxTextCtrl& operator<<(float f); + wxTextCtrl& operator<<(double d); + wxTextCtrl& operator<<(char c); + wxTextCtrl& operator<<(wchar_t c); //@} }; diff --git a/src/common/textcmn.cpp b/src/common/textcmn.cpp index c69ba3aea1..8bc1d27754 100644 --- a/src/common/textcmn.cpp +++ b/src/common/textcmn.cpp @@ -772,41 +772,19 @@ wxTextCtrl& wxTextCtrlBase::operator<<(const wxString& s) return *TEXTCTRL(this); } -wxTextCtrl& wxTextCtrlBase::operator<<(float f) -{ - wxString str; - str.Printf(wxT("%.2f"), f); - AppendText(str); - return *TEXTCTRL(this); -} - wxTextCtrl& wxTextCtrlBase::operator<<(double d) { - wxString str; - str.Printf(wxT("%.2f"), d); - AppendText(str); - return *TEXTCTRL(this); + return *this << wxString::Format("%.2f", d); } wxTextCtrl& wxTextCtrlBase::operator<<(int i) { - wxString str; - str.Printf(wxT("%d"), i); - AppendText(str); - return *TEXTCTRL(this); -} - -wxTextCtrl& wxTextCtrlBase::operator<<(long i) -{ - wxString str; - str.Printf(wxT("%ld"), i); - AppendText(str); - return *TEXTCTRL(this); + return *this << wxString::Format("%d", i); } -wxTextCtrl& wxTextCtrlBase::operator<<(const wxChar c) +wxTextCtrl& wxTextCtrlBase::operator<<(long l) { - return operator<<(wxString(c)); + return *this << wxString::Format("%ld", l); } // ----------------------------------------------------------------------------