X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42c097b83e20818d1894e9cbf3995d2752a4ba16..17d98558b35b75e3cad68d96841b4fa5a0c7e6ee:/src/msw/msgdlg.cpp diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index 829b4a855e..b25e7b84e0 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -201,9 +201,9 @@ void wxMessageDialog::ReplaceStaticWithEdit() // find the static control to replace: normally there are two of them, the // icon and the text itself so search for all of them and ignore the icon // ones - HWND hwndStatic = ::FindWindowEx(GetHwnd(), NULL, _T("STATIC"), NULL); + HWND hwndStatic = ::FindWindowEx(GetHwnd(), NULL, wxT("STATIC"), NULL); if ( ::GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON ) - hwndStatic = ::FindWindowEx(GetHwnd(), hwndStatic, _T("STATIC"), NULL); + hwndStatic = ::FindWindowEx(GetHwnd(), hwndStatic, wxT("STATIC"), NULL); if ( !hwndStatic ) { @@ -246,11 +246,12 @@ void wxMessageDialog::ReplaceStaticWithEdit() // ignored by the static control but result in extra lines and hence extra // scrollbar position in the edit one wxString text(wxGetWindowText(hwndStatic)); - for ( wxString::iterator i = text.end() - 1; i != text.begin(); --i ) + for ( wxString::reverse_iterator i = text.rbegin(); i != text.rend(); ++i ) { if ( *i != '\n' ) { - text.erase(i + 1, text.end()); + // found last non-newline char, remove everything after it and stop + text.erase(i.base() + 1, text.end()); break; } } @@ -258,7 +259,7 @@ void wxMessageDialog::ReplaceStaticWithEdit() // do create the new control HWND hwndEdit = ::CreateWindow ( - _T("EDIT"), + wxT("EDIT"), wxTextBuffer::Translate(text).wx_str(), WS_CHILD | WS_VSCROLL | WS_VISIBLE | ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL, @@ -266,7 +267,7 @@ void wxMessageDialog::ReplaceStaticWithEdit() rc.right - rc.left, rc.bottom - rc.top, GetHwnd(), NULL, - wxhInstance, + wxGetInstance(), NULL ); @@ -442,8 +443,7 @@ int wxMessageDialog::ShowModal() } // use the top level window as parent if none specified - if ( !m_parent ) - m_parent = GetParentForModalDialog(); + m_parent = GetParentForModalDialog(); HWND hWnd = m_parent ? GetHwndOf(m_parent) : NULL; #if wxUSE_INTL @@ -506,14 +506,25 @@ int wxMessageDialog::ShowModal() } } - if (wxStyle & wxICON_EXCLAMATION) - msStyle |= MB_ICONEXCLAMATION; - else if (wxStyle & wxICON_HAND) - msStyle |= MB_ICONHAND; - else if (wxStyle & wxICON_INFORMATION) - msStyle |= MB_ICONINFORMATION; - else if (wxStyle & wxICON_QUESTION) - msStyle |= MB_ICONQUESTION; + // set the icon style + switch ( GetEffectiveIcon() ) + { + case wxICON_ERROR: + msStyle |= MB_ICONHAND; + break; + + case wxICON_WARNING: + msStyle |= MB_ICONEXCLAMATION; + break; + + case wxICON_QUESTION: + msStyle |= MB_ICONQUESTION; + break; + + case wxICON_INFORMATION: + msStyle |= MB_ICONINFORMATION; + break; + } if ( wxStyle & wxSTAY_ON_TOP ) msStyle |= MB_TOPMOST; @@ -557,7 +568,7 @@ int wxMessageDialog::ShowModal() switch (msAns) { default: - wxFAIL_MSG(_T("unexpected ::MessageBox() return code")); + wxFAIL_MSG(wxT("unexpected ::MessageBox() return code")); // fall through case IDCANCEL: