]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/msgdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMessageDialog
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "msgdlg.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/dialog.h"
28 #include "wx/msgdlg.h"
31 #include "wx/msw/private.h"
37 #define wxDIALOG_DEFAULT_X 300
38 #define wxDIALOG_DEFAULT_Y 300
40 IMPLEMENT_CLASS(wxMessageDialog
, wxDialog
)
42 wxMessageDialog::wxMessageDialog(wxWindow
*parent
, const wxString
& message
, const wxString
& caption
,
43 long style
, const wxPoint
& pos
)
47 m_dialogStyle
= style
;
51 int wxMessageDialog::ShowModal(void)
54 if (m_parent
) hWnd
= (HWND
) m_parent
->GetHWND();
55 unsigned int msStyle
= MB_OK
;
56 if (m_dialogStyle
& wxYES_NO
)
58 if (m_dialogStyle
& wxCANCEL
)
59 msStyle
= MB_YESNOCANCEL
;
63 if (m_dialogStyle
& wxNO_DEFAULT
)
64 msStyle
|= MB_DEFBUTTON2
;
67 if (m_dialogStyle
& wxOK
)
69 if (m_dialogStyle
& wxCANCEL
)
70 msStyle
= MB_OKCANCEL
;
74 if (m_dialogStyle
& wxICON_EXCLAMATION
)
75 msStyle
|= MB_ICONEXCLAMATION
;
76 else if (m_dialogStyle
& wxICON_HAND
)
77 msStyle
|= MB_ICONHAND
;
78 else if (m_dialogStyle
& wxICON_INFORMATION
)
79 msStyle
|= MB_ICONINFORMATION
;
80 else if (m_dialogStyle
& wxICON_QUESTION
)
81 msStyle
|= MB_ICONQUESTION
;
84 msStyle
|= MB_APPLMODAL
;
86 msStyle
|= MB_TASKMODAL
;
88 int msAns
= MessageBox(hWnd
, (LPCTSTR
)(const wxChar
*)m_message
, (LPCTSTR
)(const wxChar
*)m_caption
, msStyle
);