X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae29de8326c957145c6cef1888d35adcff110126..8429bec1e8e3fcb7d071bc3ef7c665c484b5fdc1:/src/msw/textctrl.cpp?ds=sidebyside diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 723c594aea..3def23203d 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -72,7 +72,7 @@ wxTextCtrl::wxTextCtrl(void) :streambuf() #endif { - fileName = ""; + m_fileName = ""; m_isRich = FALSE; } @@ -83,7 +83,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - fileName = ""; + m_fileName = ""; SetName(name); SetValidator(validator); if (parent) parent->AddChild(this); @@ -314,6 +314,8 @@ void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags) if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) y1 = currentY; + AdjustForParentClientOrigin(x1, y1, sizeFlags); + int cx; // button font dimensions int cy; @@ -453,7 +455,7 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value) SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0); // Now replace with 'value', by pasting. - wxSetClipboardData(wxCF_TEXT, (wxObject *) (const char *)value, 0, 0); + wxSetClipboardData(wxDF_TEXT, (wxObject *) (const char *)value, 0, 0); // Paste into edit control SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L); @@ -502,7 +504,7 @@ bool wxTextCtrl::LoadFile(const wxString& file) if (!FileExists(WXSTRINGCAST file)) return FALSE; - fileName = file; + m_fileName = file; Clear(); @@ -551,14 +553,14 @@ bool wxTextCtrl::LoadFile(const wxString& file) // Returns TRUE if succeeds. bool wxTextCtrl::SaveFile(const wxString& file) { - wxString theFile; - if (file == "") - theFile = fileName; - if (file == "") + wxString theFile(file); + if (theFile == "") + theFile = m_fileName; + if (theFile == "") return FALSE; - fileName = theFile; + m_fileName = theFile; - ofstream output(WXSTRINGCAST file); + ofstream output((char*) (const char*) theFile); if (output.bad()) return FALSE; @@ -846,47 +848,46 @@ wxTextCtrl& wxTextCtrl::operator<<(const wxString& s) wxTextCtrl& wxTextCtrl::operator<<(float f) { - static char buf[100]; - sprintf(buf, "%.2f", f); - WriteText(buf); - return *this; + wxString str; + str.Printf("%.2f", f); + WriteText(str); + return *this; } wxTextCtrl& wxTextCtrl::operator<<(double d) { - static char buf[100]; - sprintf(buf, "%.2f", d); - WriteText(buf); - return *this; + wxString str; + str.Printf("%.2f", d); + WriteText(str); + return *this; } wxTextCtrl& wxTextCtrl::operator<<(int i) { - static char buf[100]; - sprintf(buf, "%i", i); - WriteText(buf); - return *this; + wxString str; + str.Printf("%d", i); + WriteText(str); + return *this; } wxTextCtrl& wxTextCtrl::operator<<(long i) { - static char buf[100]; - sprintf(buf, "%ld", i); - WriteText(buf); - return *this; + wxString str; + str.Printf("%ld", i); + WriteText(str); + return *this; } wxTextCtrl& wxTextCtrl::operator<<(const char c) { - char buf[2]; + char buf[2]; - buf[0] = c; - buf[1] = 0; - WriteText(buf); - return *this; + buf[0] = c; + buf[1] = 0; + WriteText(buf); + return *this; } - WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { @@ -940,44 +941,14 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) long wxTextCtrl::MSWGetDlgCode() { long lRc = DLGC_WANTCHARS | DLGC_WANTARROWS; - if ( m_windowStyle & wxPROCESS_ENTER ) { + if ( m_windowStyle & wxPROCESS_ENTER ) + lRc |= DLGC_WANTMESSAGE; + else if ( m_windowStyle & wxTE_MULTILINE ) lRc |= DLGC_WANTMESSAGE; - } return lRc; } -/* -long wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - switch (nMsg) - { - case WM_GETDLGCODE: - { - if (GetWindowStyleFlag() & wxPROCESS_ENTER) - return DLGC_WANTALLKEYS; - break; - } - case WM_CHAR: // Always an ASCII character - { - if (wParam == VK_RETURN) - { - wxCommandEvent event(wxEVENT_TYPE_TEXT_ENTER_COMMAND); - event.commandString = ((wxTextCtrl *)item)->GetValue(); - event.eventObject = item; - item->ProcessCommand(event); - return FALSE; - } - break; - } - default: - break; - } - - return wxWindow::MSWWindowProc(nMsg, wParam, lParam); -} -*/ - void wxTextCtrl::OnEraseBackground(wxEraseEvent& event) { if ( m_windowStyle & wxTE_MULTILINE )