]>
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 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "msgdlg.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
23 #include "wx/dialog.h"
25 #include "wx/msgdlg.h"
29 #include "wx/os2/private.h"
34 #define wxDIALOG_DEFAULT_X 300
35 #define wxDIALOG_DEFAULT_Y 300
37 IMPLEMENT_CLASS(wxMessageDialog
, wxDialog
)
39 wxMessageDialog::wxMessageDialog( wxWindow
* WXUNUSED(pParent
),
40 const wxString
& rsMessage
,
41 const wxString
& rsCaption
,
43 const wxPoint
& WXUNUSED(pPos
) )
45 m_sCaption
= rsCaption
;
46 m_sMessage
= rsMessage
;
47 m_pParent
= NULL
; // pParent;
48 SetMessageDialogStyle(lStyle
);
49 } // end of wxMessageDialog::wxMessageDialog
51 int wxMessageDialog::ShowModal()
54 ULONG ulStyle
= MB_OK
;
56 const long lStyle
= GetMessageDialogStyle();
58 if (!wxTheApp
->GetTopWindow())
61 // when the message box is shown from wxApp::OnInit() (i.e. before the
62 // message loop is entered), this must be done or the next message box
63 // will never be shown - just try putting 2 calls to wxMessageBox() in
66 while (wxTheApp
->Pending())
71 hWnd
= (HWND
) m_pParent
->GetHWND();
74 if (lStyle
& wxYES_NO
)
76 if (lStyle
& wxCANCEL
)
77 ulStyle
= MB_YESNOCANCEL
;
81 if (lStyle
& wxNO_DEFAULT
)
82 ulStyle
|= MB_DEFBUTTON2
;
87 if (lStyle
& wxCANCEL
)
88 ulStyle
= MB_OKCANCEL
;
92 if (lStyle
& wxICON_EXCLAMATION
)
93 ulStyle
|= MB_ICONEXCLAMATION
;
94 else if (lStyle
& wxICON_HAND
)
95 ulStyle
|= MB_ICONHAND
;
96 else if (lStyle
& wxICON_INFORMATION
)
97 ulStyle
|= MB_ICONEXCLAMATION
;
98 else if (lStyle
& wxICON_QUESTION
)
99 ulStyle
|= MB_ICONQUESTION
;
101 if (hWnd
!= HWND_DESKTOP
)
102 ulStyle
|= MB_APPLMODAL
;
104 ulStyle
|= MB_SYSTEMMODAL
;
107 // This little line of code is get message boxes under OS/2 to
108 // behve like the other ports. In OS/2 if the parent is a window
109 // it displays, clipped, in the window. This centers it on the
110 // desktop, like the other ports but still allows control over modality
114 ULONG ulAns
= ::WinMessageBox( hWnd
116 ,(PSZ
)m_sMessage
.c_str()
117 ,(PSZ
)m_sCaption
.c_str()
138 } // end of wxMessageDialog::ShowModal