]>
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/testing.h"
26 #include "wx/os2/private.h"
31 #define wxDIALOG_DEFAULT_X 300
32 #define wxDIALOG_DEFAULT_Y 300
34 IMPLEMENT_CLASS(wxMessageDialog
, wxDialog
)
36 int wxMessageDialog::ShowModal()
38 WX_TESTING_SHOW_MODAL_HOOK();
41 ULONG ulStyle
= MB_OK
;
43 const long lStyle
= GetMessageDialogStyle();
45 if (!wxTheApp
->GetTopWindow())
48 // when the message box is shown from wxApp::OnInit() (i.e. before the
49 // message loop is entered), this must be done or the next message box
50 // will never be shown - just try putting 2 calls to wxMessageBox() in
53 while (wxTheApp
->Pending())
58 hWnd
= (HWND
) m_parent
->GetHWND();
61 if (lStyle
& wxYES_NO
)
63 if (lStyle
& wxCANCEL
)
64 ulStyle
= MB_YESNOCANCEL
;
68 if (lStyle
& wxNO_DEFAULT
)
69 ulStyle
|= MB_DEFBUTTON2
;
74 if (lStyle
& wxCANCEL
)
75 ulStyle
= MB_OKCANCEL
;
80 switch ( GetEffectiveIcon() )
87 ulStyle
|= MB_WARNING
;
94 case wxICON_INFORMATION
:
95 ulStyle
|= MB_INFORMATION
;
99 if (hWnd
!= HWND_DESKTOP
)
100 ulStyle
|= MB_APPLMODAL
;
102 ulStyle
|= MB_SYSTEMMODAL
;
105 // This little line of code is get message boxes under OS/2 to
106 // behve like the other ports. In OS/2 if the parent is a window
107 // it displays, clipped, in the window. This centers it on the
108 // desktop, like the other ports but still allows control over modality
112 ULONG ulAns
= ::WinMessageBox( hWnd
114 ,GetFullMessage().c_str()
136 } // end of wxMessageDialog::ShowModal