]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/msgdlg.cpp
Draw wxPropertyGrid drop down items with consistent (non-bold) font (fixes #12088)
[wxWidgets.git] / src / os2 / msgdlg.cpp
index 8aaa2313cc60038050d2efa3724d7600bf51844a..97e9b8f99c4ca1d7e317208b7a86616c1d04f355 100644 (file)
@@ -1,33 +1,29 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        msgdlg.cpp
+// Name:        src/os2/msgdlg.cpp
 // Purpose:     wxMessageDialog
 // Author:      David Webster
 // Modified by:
 // Created:     10/10/99
-// RCS-ID:      $$
+// RCS-ID:      $Id$
 // Copyright:   (c) David Webster
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "msgdlg.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#ifndef WX_PRECOMP
-#include <stdio.h>
-#include "wx/defs.h"
-#include "wx/utils.h"
-#include "wx/dialog.h"
-#include "wx/app.h"
 #include "wx/msgdlg.h"
+
+#ifndef WX_PRECOMP
+    #include <stdio.h>
+    #include "wx/utils.h"
+    #include "wx/dialog.h"
+    #include "wx/app.h"
+    #include "wx/math.h"
 #endif
 
 #include "wx/os2/private.h"
 
-#include <math.h>
 #include <stdlib.h>
 #include <string.h>
 
 
 IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
 
-wxMessageDialog::wxMessageDialog(
-  wxWindow*                         pParent
-, const wxString&                   rsMessage
-, const wxString&                   rsCaption
-, long                              lStyle
-, const wxPoint&                    pPos
-)
-{
-    m_sCaption     = rsCaption;
-    m_sMessage     = rsMessage;
-    m_lDialogStyle = lStyle;
-    m_pParent      = NULL; // pParent;
-} // end of wxMessageDialog::wxMessageDialog
-
 int wxMessageDialog::ShowModal()
 {
     HWND                            hWnd = 0;
     ULONG                           ulStyle = MB_OK;
     int                             nAns = wxOK;
+    const long                      lStyle = GetMessageDialogStyle();
 
     if (!wxTheApp->GetTopWindow())
     {
@@ -68,36 +51,47 @@ int wxMessageDialog::ShowModal()
             wxTheApp->Dispatch();
     }
 
-    if (m_pParent)
-        hWnd = (HWND) m_pParent->GetHWND();
+    if (m_parent)
+        hWnd = (HWND) m_parent->GetHWND();
     else
         hWnd = HWND_DESKTOP;
-    if (m_lDialogStyle & wxYES_NO)
+    if (lStyle & wxYES_NO)
     {
-        if (m_lDialogStyle & wxCANCEL)
+        if (lStyle & wxCANCEL)
             ulStyle = MB_YESNOCANCEL;
         else
             ulStyle = MB_YESNO;
 
-        if (m_lDialogStyle & wxNO_DEFAULT)
+        if (lStyle & wxNO_DEFAULT)
             ulStyle |= MB_DEFBUTTON2;
     }
 
-    if (m_lDialogStyle & wxOK)
+    if (lStyle & wxOK)
     {
-        if (m_lDialogStyle & wxCANCEL)
+        if (lStyle & wxCANCEL)
             ulStyle = MB_OKCANCEL;
         else
             ulStyle = MB_OK;
     }
-    if (m_lDialogStyle & wxICON_EXCLAMATION)
-        ulStyle |= MB_ICONEXCLAMATION;
-    else if (m_lDialogStyle & wxICON_HAND)
-        ulStyle |= MB_ICONHAND;
-    else if (m_lDialogStyle & wxICON_INFORMATION)
-        ulStyle |= MB_ICONEXCLAMATION;
-    else if (m_lDialogStyle & wxICON_QUESTION)
-        ulStyle |= MB_ICONQUESTION;
+
+    switch ( GetEffectiveIcon() )
+    {
+        case wxICON_ERROR:
+            ulStyle |= MB_ERROR;
+            break;
+
+        case wxICON_WARNING:
+            ulStyle |= MB_WARNING;
+            break;
+
+        case wxICON_QUESTION:
+            ulStyle |= MB_QUERY;
+            break;
+
+        case wxICON_INFORMATION:
+            ulStyle |= MB_INFORMATION;
+            break;
+    }
 
     if (hWnd != HWND_DESKTOP)
         ulStyle |= MB_APPLMODAL;
@@ -114,8 +108,8 @@ int wxMessageDialog::ShowModal()
 
     ULONG                           ulAns = ::WinMessageBox( hWnd
                                                             ,hWnd
-                                                            ,(PSZ)m_sMessage.c_str()
-                                                            ,(PSZ)m_sCaption.c_str()
+                                                            ,GetFullMessage().c_str()
+                                                            ,m_caption.c_str()
                                                             ,0L
                                                             ,ulStyle);
     switch (ulAns)
@@ -137,4 +131,3 @@ int wxMessageDialog::ShowModal()
     }
     return nAns;
 } // end of wxMessageDialog::ShowModal
-