]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/msgdlg.cpp
97e9b8f99c4ca1d7e317208b7a86616c1d04f355
   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
; 
  77     switch ( GetEffectiveIcon() ) 
  84             ulStyle 
|= MB_WARNING
; 
  91         case wxICON_INFORMATION
: 
  92             ulStyle 
|= MB_INFORMATION
; 
  96     if (hWnd 
!= HWND_DESKTOP
) 
  97         ulStyle 
|= MB_APPLMODAL
; 
  99         ulStyle 
|= MB_SYSTEMMODAL
; 
 102     // This little line of code is get message boxes under OS/2 to 
 103     // behve like the other ports.  In OS/2 if the parent is a window 
 104     // it displays, clipped, in the window.  This centers it on the 
 105     // desktop, like the other ports but still allows control over modality 
 109     ULONG                           ulAns 
= ::WinMessageBox( hWnd
 
 111                                                             ,GetFullMessage().c_str() 
 133 } // end of wxMessageDialog::ShowModal