]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/msgdlg.cpp
Add wxItemContainer::DetachClientObject() and use it in wxRearrangeList.
[wxWidgets.git] / src / msw / msgdlg.cpp
index 108beb7d1bcb4ba1e91a754edbfde98a1c9ebbbe..b25e7b84e0c6d0544df7a864ea917f7805478813 100644 (file)
@@ -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;
         }
     }
@@ -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;