]>
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"
18 #include "wx/dialog.h"
20 #include "wx/msgdlg.h"
24 #include "wx/os2/private.h"
29 #define wxDIALOG_DEFAULT_X 300
30 #define wxDIALOG_DEFAULT_Y 300
32 IMPLEMENT_CLASS(wxMessageDialog
, wxDialog
)
34 wxMessageDialog::wxMessageDialog( wxWindow
* WXUNUSED(pParent
),
35 const wxString
& rsMessage
,
36 const wxString
& rsCaption
,
38 const wxPoint
& WXUNUSED(pPos
) )
40 m_sCaption
= rsCaption
;
41 m_sMessage
= rsMessage
;
42 m_pParent
= NULL
; // pParent;
43 SetMessageDialogStyle(lStyle
);
44 } // end of wxMessageDialog::wxMessageDialog
46 int wxMessageDialog::ShowModal()
49 ULONG ulStyle
= MB_OK
;
51 const long lStyle
= GetMessageDialogStyle();
53 if (!wxTheApp
->GetTopWindow())
56 // when the message box is shown from wxApp::OnInit() (i.e. before the
57 // message loop is entered), this must be done or the next message box
58 // will never be shown - just try putting 2 calls to wxMessageBox() in
61 while (wxTheApp
->Pending())
66 hWnd
= (HWND
) m_pParent
->GetHWND();
69 if (lStyle
& wxYES_NO
)
71 if (lStyle
& wxCANCEL
)
72 ulStyle
= MB_YESNOCANCEL
;
76 if (lStyle
& wxNO_DEFAULT
)
77 ulStyle
|= MB_DEFBUTTON2
;
82 if (lStyle
& wxCANCEL
)
83 ulStyle
= MB_OKCANCEL
;
87 if (lStyle
& wxICON_EXCLAMATION
)
88 ulStyle
|= MB_ICONEXCLAMATION
;
89 else if (lStyle
& wxICON_HAND
)
90 ulStyle
|= MB_ICONHAND
;
91 else if (lStyle
& wxICON_INFORMATION
)
92 ulStyle
|= MB_ICONEXCLAMATION
;
93 else if (lStyle
& wxICON_QUESTION
)
94 ulStyle
|= MB_ICONQUESTION
;
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 ,(PSZ
)m_sMessage
.c_str()
112 ,(PSZ
)m_sCaption
.c_str()
133 } // end of wxMessageDialog::ShowModal