]>
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
& wxOK
)
67 if (m_dialogStyle
& wxCANCEL
)
68 msStyle
= MB_OKCANCEL
;
72 if (m_dialogStyle
& wxICON_EXCLAMATION
)
73 msStyle
|= MB_ICONEXCLAMATION
;
74 else if (m_dialogStyle
& wxICON_HAND
)
75 msStyle
|= MB_ICONHAND
;
76 else if (m_dialogStyle
& wxICON_INFORMATION
)
77 msStyle
|= MB_ICONINFORMATION
;
78 else if (m_dialogStyle
& wxICON_QUESTION
)
79 msStyle
|= MB_ICONQUESTION
;
82 msStyle
|= MB_APPLMODAL
;
84 msStyle
|= MB_TASKMODAL
;
86 int msAns
= MessageBox(hWnd
, (LPCSTR
)(const char *)m_message
, (LPCSTR
)(const char *)m_caption
, msStyle
);