]>
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 wxMessageDialog::wxMessageDialog( wxWindow
* WXUNUSED(pParent
),
36 const wxString
& rsMessage
,
37 const wxString
& rsCaption
,
39 const wxPoint
& WXUNUSED(pPos
) )
41 m_sCaption
= rsCaption
;
42 m_sMessage
= rsMessage
;
43 m_pParent
= NULL
; // pParent;
44 SetMessageDialogStyle(lStyle
);
45 } // end of wxMessageDialog::wxMessageDialog
47 int wxMessageDialog::ShowModal()
50 ULONG ulStyle
= MB_OK
;
52 const long lStyle
= GetMessageDialogStyle();
54 if (!wxTheApp
->GetTopWindow())
57 // when the message box is shown from wxApp::OnInit() (i.e. before the
58 // message loop is entered), this must be done or the next message box
59 // will never be shown - just try putting 2 calls to wxMessageBox() in
62 while (wxTheApp
->Pending())
67 hWnd
= (HWND
) m_pParent
->GetHWND();
70 if (lStyle
& wxYES_NO
)
72 if (lStyle
& wxCANCEL
)
73 ulStyle
= MB_YESNOCANCEL
;
77 if (lStyle
& wxNO_DEFAULT
)
78 ulStyle
|= MB_DEFBUTTON2
;
83 if (lStyle
& wxCANCEL
)
84 ulStyle
= MB_OKCANCEL
;
88 if (lStyle
& wxICON_EXCLAMATION
)
89 ulStyle
|= MB_ICONEXCLAMATION
;
90 else if (lStyle
& wxICON_HAND
)
91 ulStyle
|= MB_ICONHAND
;
92 else if (lStyle
& wxICON_INFORMATION
)
93 ulStyle
|= MB_ICONEXCLAMATION
;
94 else if (lStyle
& wxICON_QUESTION
)
95 ulStyle
|= MB_ICONQUESTION
;
97 if (hWnd
!= HWND_DESKTOP
)
98 ulStyle
|= MB_APPLMODAL
;
100 ulStyle
|= MB_SYSTEMMODAL
;
103 // This little line of code is get message boxes under OS/2 to
104 // behve like the other ports. In OS/2 if the parent is a window
105 // it displays, clipped, in the window. This centers it on the
106 // desktop, like the other ports but still allows control over modality
110 ULONG ulAns
= ::WinMessageBox( hWnd
134 } // end of wxMessageDialog::ShowModal