X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/57bd4c6031d438f11af0ec540136f49a928b923c..107defe36a68091303be9a11c8abb83432acee8c:/src/msw/wince/textctrlce.cpp diff --git a/src/msw/wince/textctrlce.cpp b/src/msw/wince/textctrlce.cpp index abea606670..71d62846ec 100644 --- a/src/msw/wince/textctrlce.cpp +++ b/src/msw/wince/textctrlce.cpp @@ -171,7 +171,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; if ( sizeText.x <= 0 ) { - wxLogDebug(_T("not enough space for wxSpinCtrl!")); + wxLogDebug(wxT("not enough space for wxSpinCtrl!")); } wxPoint posBtn(pos); @@ -199,7 +199,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, m_hwndBuddy = (WXHWND)::CreateWindowEx ( exStyle, // sunken border - _T("EDIT"), // window class + wxT("EDIT"), // window class valueWin, // no window title msStyle, // style (will be shown later) pos.x, pos.y, // position @@ -233,7 +233,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, if ( style & wxSP_WRAP ) spiner_style |= UDS_WRAP; - if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, _T(""), 0) ) + if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, wxT(""), 0) ) return false; // subclass the text ctrl to be able to intercept some events @@ -256,7 +256,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } - SetBestSize(size); + SetInitialSize(size); (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); @@ -393,7 +393,7 @@ wxString wxTextCtrl::GetRange(long from, long to) const return str; } -void wxTextCtrl::SetValue(const wxString& value) +void wxTextCtrl::DoSetValue(const wxString& value, int flags) { // if the text is long enough, it's faster to just set it instead of first // comparing it with the old one (chances are that it will be different @@ -401,7 +401,7 @@ void wxTextCtrl::SetValue(const wxString& value) // edit controls mostly) if ( (value.length() > 0x400) || (value != GetValue()) ) { - DoWriteText(value, false); + DoWriteText(value, flags); // for compatibility, don't move the cursor when doing SetValue() SetInsertionPoint(0); @@ -409,7 +409,8 @@ void wxTextCtrl::SetValue(const wxString& value) else // same text { // still send an event for consistency - SendUpdateEvent(); + if ( flags & SetValue_SendEvent ) + SendUpdateEvent(); } // we should reset the modified flag even if the value didn't really change @@ -424,8 +425,9 @@ void wxTextCtrl::WriteText(const wxString& value) DoWriteText(value); } -void wxTextCtrl::DoWriteText(const wxString& value, bool selectionOnly) +void wxTextCtrl::DoWriteText(const wxString& value, int flags) { + bool selectionOnly = (flags & SetValue_SelectionOnly) != 0; wxString valueDos; if ( m_windowStyle & wxTE_MULTILINE ) valueDos = wxTextFile::Translate(value, wxTextFileType_Dos); @@ -436,7 +438,7 @@ void wxTextCtrl::DoWriteText(const wxString& value, bool selectionOnly) // call below which is confusing for the client code and so should be // avoided // - if ( ( selectionOnly && HasSelection() ) ) + if ( selectionOnly && HasSelection() ) { m_suppressNextUpdate = true; } @@ -444,7 +446,7 @@ void wxTextCtrl::DoWriteText(const wxString& value, bool selectionOnly) ::SendMessage(GetBuddyHwnd(), selectionOnly ? EM_REPLACESEL : WM_SETTEXT, 0, (LPARAM)valueDos.c_str()); - if ( !selectionOnly ) + if ( !selectionOnly && !( flags & SetValue_SendEvent ) ) { // Windows already sends an update event for single-line // controls. @@ -641,7 +643,7 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value) // Set selection and remove it DoSetSelection(from, to, false); - DoWriteText(value, true); + DoWriteText(value, SetValue_SelectionOnly); } void wxTextCtrl::Remove(long from, long to) @@ -805,7 +807,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const // remove the '\n' at the end, if any (this is how this function is // supposed to work according to the docs) - if ( buf[len - 1] == _T('\n') ) + if ( buf[len - 1] == wxT('\n') ) { len--; } @@ -1085,7 +1087,7 @@ void wxTextCtrl::DoMoveWindow(int x, int y, int width, int height) int widthText = width - widthBtn - MARGIN_BETWEEN; if ( widthText <= 0 ) { - wxLogDebug(_T("not enough space for wxSpinCtrl!")); + wxLogDebug(wxT("not enough space for wxSpinCtrl!")); } if ( !::MoveWindow(GetBuddyHwnd(), x, y, widthText, height, TRUE) )