]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/msgdlg.cpp
   1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/os2/msgdlg.cpp 
   3 // Purpose:     wxMessageDialog 
   4 // Author:      David Webster 
   8 // Copyright:   (c) David Webster 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 // For compilers that support precompilation, includes "wx.h". 
  13 #include "wx/wxprec.h" 
  15 #include "wx/msgdlg.h" 
  20     #include "wx/dialog.h" 
  25 #include "wx/os2/private.h" 
  30 #define wxDIALOG_DEFAULT_X 300 
  31 #define wxDIALOG_DEFAULT_Y 300 
  33 IMPLEMENT_CLASS(wxMessageDialog
, wxDialog
) 
  35 int wxMessageDialog::ShowModal() 
  38     ULONG                           ulStyle 
= MB_OK
; 
  40     const long                      lStyle 
= GetMessageDialogStyle(); 
  42     if (!wxTheApp
->GetTopWindow()) 
  45         // when the message box is shown from wxApp::OnInit() (i.e. before the 
  46         // message loop is entered), this must be done or the next message box 
  47         // will never be shown - just try putting 2 calls to wxMessageBox() in 
  50         while (wxTheApp
->Pending()) 
  55         hWnd 
= (HWND
) m_parent
->GetHWND(); 
  58     if (lStyle 
& wxYES_NO
) 
  60         if (lStyle 
& wxCANCEL
) 
  61             ulStyle 
= MB_YESNOCANCEL
; 
  65         if (lStyle 
& wxNO_DEFAULT
) 
  66             ulStyle 
|= MB_DEFBUTTON2
; 
  71         if (lStyle 
& wxCANCEL
) 
  72             ulStyle 
= MB_OKCANCEL
; 
  76     if (lStyle 
& wxICON_EXCLAMATION
) 
  77         ulStyle 
|= MB_ICONEXCLAMATION
; 
  78     else if (lStyle 
& wxICON_HAND
) 
  79         ulStyle 
|= MB_ICONHAND
; 
  80     else if (lStyle 
& wxICON_INFORMATION
) 
  81         ulStyle 
|= MB_ICONEXCLAMATION
; 
  82     else if (lStyle 
& wxICON_QUESTION
) 
  83         ulStyle 
|= MB_ICONQUESTION
; 
  85     if (hWnd 
!= HWND_DESKTOP
) 
  86         ulStyle 
|= MB_APPLMODAL
; 
  88         ulStyle 
|= MB_SYSTEMMODAL
; 
  91     // This little line of code is get message boxes under OS/2 to 
  92     // behve like the other ports.  In OS/2 if the parent is a window 
  93     // it displays, clipped, in the window.  This centers it on the 
  94     // desktop, like the other ports but still allows control over modality 
  98     ULONG                           ulAns 
= ::WinMessageBox( hWnd
 
 100                                                             ,GetFullMessage().c_str() 
 122 } // end of wxMessageDialog::ShowModal