merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "wx/defs.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#endif
|
||||
|
||||
@@ -35,18 +36,105 @@
|
||||
|
||||
IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
|
||||
|
||||
wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption,
|
||||
long style, const wxPoint& pos)
|
||||
wxMessageDialog::wxMessageDialog(
|
||||
wxWindow* pParent
|
||||
, const wxString& rsMessage
|
||||
, const wxString& rsCaption
|
||||
, long lStyle
|
||||
, const wxPoint& pPos
|
||||
)
|
||||
{
|
||||
m_caption = caption;
|
||||
m_message = message;
|
||||
m_dialogStyle = style;
|
||||
m_parent = parent;
|
||||
}
|
||||
m_sCaption = rsCaption;
|
||||
m_sMessage = rsMessage;
|
||||
m_lDialogStyle = lStyle;
|
||||
m_pParent = NULL; // pParent;
|
||||
} // end of wxMessageDialog::wxMessageDialog
|
||||
|
||||
int wxMessageDialog::ShowModal()
|
||||
{
|
||||
// TODO
|
||||
return wxID_CANCEL;
|
||||
}
|
||||
HWND hWnd = 0;
|
||||
ULONG ulStyle = MB_OK;
|
||||
int nAns = wxOK;
|
||||
|
||||
if (!wxTheApp->GetTopWindow())
|
||||
{
|
||||
//
|
||||
// when the message box is shown from wxApp::OnInit() (i.e. before the
|
||||
// message loop is entered), this must be done or the next message box
|
||||
// will never be shown - just try putting 2 calls to wxMessageBox() in
|
||||
// OnInit() to see it
|
||||
//
|
||||
while (wxTheApp->Pending())
|
||||
wxTheApp->Dispatch();
|
||||
}
|
||||
|
||||
if (m_pParent)
|
||||
hWnd = (HWND) m_pParent->GetHWND();
|
||||
else
|
||||
hWnd = HWND_DESKTOP;
|
||||
if (m_lDialogStyle & wxYES_NO)
|
||||
{
|
||||
if (m_lDialogStyle & wxCANCEL)
|
||||
ulStyle = MB_YESNOCANCEL;
|
||||
else
|
||||
ulStyle = MB_YESNO;
|
||||
|
||||
if (m_lDialogStyle & wxNO_DEFAULT)
|
||||
ulStyle |= MB_DEFBUTTON2;
|
||||
}
|
||||
|
||||
if (m_lDialogStyle & wxOK)
|
||||
{
|
||||
if (m_lDialogStyle & wxCANCEL)
|
||||
ulStyle = MB_OKCANCEL;
|
||||
else
|
||||
ulStyle = MB_OK;
|
||||
}
|
||||
if (m_lDialogStyle & wxICON_EXCLAMATION)
|
||||
ulStyle |= MB_ICONEXCLAMATION;
|
||||
else if (m_lDialogStyle & wxICON_HAND)
|
||||
ulStyle |= MB_ICONHAND;
|
||||
else if (m_lDialogStyle & wxICON_INFORMATION)
|
||||
ulStyle |= MB_ICONEXCLAMATION;
|
||||
else if (m_lDialogStyle & wxICON_QUESTION)
|
||||
ulStyle |= MB_ICONQUESTION;
|
||||
|
||||
if (hWnd != HWND_DESKTOP)
|
||||
ulStyle |= MB_APPLMODAL;
|
||||
else
|
||||
ulStyle |= MB_SYSTEMMODAL;
|
||||
|
||||
//
|
||||
// This little line of code is get message boxes under OS/2 to
|
||||
// behve like the other ports. In OS/2 if the parent is a window
|
||||
// it displays, clipped, in the window. This centers it on the
|
||||
// desktop, like the other ports but still allows control over modality
|
||||
//
|
||||
hWnd = HWND_DESKTOP;
|
||||
|
||||
ULONG ulAns = ::WinMessageBox( hWnd
|
||||
,hWnd
|
||||
,(PSZ)m_sMessage.c_str()
|
||||
,(PSZ)m_sCaption.c_str()
|
||||
,0L
|
||||
,ulStyle);
|
||||
switch (ulAns)
|
||||
{
|
||||
case MBID_CANCEL:
|
||||
nAns = wxID_CANCEL;
|
||||
break;
|
||||
case MBID_OK:
|
||||
nAns = wxID_OK;
|
||||
break;
|
||||
case MBID_YES:
|
||||
nAns = wxID_YES;
|
||||
break;
|
||||
case MBID_NO:
|
||||
nAns = wxID_NO;
|
||||
break;
|
||||
default:
|
||||
nAns = wxID_CANCEL;
|
||||
}
|
||||
return nAns;
|
||||
} // end of wxMessageDialog::ShowModal
|
||||
|
||||
|
Reference in New Issue
Block a user