]>
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
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
14 #include "wx/msgdlg.h"
19 #include "wx/dialog.h"
24 #include "wx/modalhook.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()
37 WX_HOOK_MODAL_DIALOG();
40 ULONG ulStyle
= MB_OK
;
42 const long lStyle
= GetMessageDialogStyle();
44 if (!wxTheApp
->GetTopWindow())
47 // when the message box is shown from wxApp::OnInit() (i.e. before the
48 // message loop is entered), this must be done or the next message box
49 // will never be shown - just try putting 2 calls to wxMessageBox() in
52 while (wxTheApp
->Pending())
57 hWnd
= (HWND
) m_parent
->GetHWND();
60 if (lStyle
& wxYES_NO
)
62 if (lStyle
& wxCANCEL
)
63 ulStyle
= MB_YESNOCANCEL
;
67 if (lStyle
& wxNO_DEFAULT
)
68 ulStyle
|= MB_DEFBUTTON2
;
73 if (lStyle
& wxCANCEL
)
74 ulStyle
= MB_OKCANCEL
;
79 switch ( GetEffectiveIcon() )
86 ulStyle
|= MB_WARNING
;
93 case wxICON_INFORMATION
:
94 ulStyle
|= MB_INFORMATION
;
98 if (hWnd
!= HWND_DESKTOP
)
99 ulStyle
|= MB_APPLMODAL
;
101 ulStyle
|= MB_SYSTEMMODAL
;
104 // This little line of code is get message boxes under OS/2 to
105 // behve like the other ports. In OS/2 if the parent is a window
106 // it displays, clipped, in the window. This centers it on the
107 // desktop, like the other ports but still allows control over modality
111 ULONG ulAns
= ::WinMessageBox( hWnd
113 ,GetFullMessage().c_str()
135 } // end of wxMessageDialog::ShowModal