]>
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 #if !USE_SHARED_LIBRARY
41 IMPLEMENT_CLASS(wxMessageDialog
, wxDialog
)
44 wxMessageDialog::wxMessageDialog(wxWindow
*parent
, const wxString
& message
, const wxString
& caption
,
45 long style
, const wxPoint
& pos
)
49 m_dialogStyle
= style
;
53 int wxMessageDialog::ShowModal(void)
56 if (m_parent
) hWnd
= (HWND
) m_parent
->GetHWND();
57 unsigned int msStyle
= MB_OK
;
58 if (m_dialogStyle
& wxYES_NO
)
60 if (m_dialogStyle
& wxCANCEL
)
61 msStyle
= MB_YESNOCANCEL
;
65 if (m_dialogStyle
& wxNO_DEFAULT
)
66 msStyle
|= MB_DEFBUTTON2
;
69 if (m_dialogStyle
& wxOK
)
71 if (m_dialogStyle
& wxCANCEL
)
72 msStyle
= MB_OKCANCEL
;
76 if (m_dialogStyle
& wxICON_EXCLAMATION
)
77 msStyle
|= MB_ICONEXCLAMATION
;
78 else if (m_dialogStyle
& wxICON_HAND
)
79 msStyle
|= MB_ICONHAND
;
80 else if (m_dialogStyle
& wxICON_INFORMATION
)
81 msStyle
|= MB_ICONINFORMATION
;
82 else if (m_dialogStyle
& wxICON_QUESTION
)
83 msStyle
|= MB_ICONQUESTION
;
86 msStyle
|= MB_APPLMODAL
;
88 msStyle
|= MB_TASKMODAL
;
90 int msAns
= MessageBox(hWnd
, (LPCTSTR
)(const wxChar
*)m_message
, (LPCTSTR
)(const wxChar
*)m_caption
, msStyle
);