added public wxInfoMessageBox() (slightly modified patch 1828235)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-18 19:56:03 +00:00
parent e6ef9ea4ed
commit 8cf304f81b
6 changed files with 86 additions and 40 deletions

View File

@@ -169,6 +169,7 @@ the corresponding topic.
\helpref{wxGetenv}{wxgetenvmacro}\\
\helpref{wxHandleFatalExceptions}{wxhandlefatalexceptions}\\
\helpref{wxICON}{wxiconmacro}\\
\helpref{wxInfoMessageBox}{wxinfomessagebox}\\
\helpref{wxINTXX\_SWAP\_ALWAYS}{intswapalways}\\
\helpref{wxINTXX\_SWAP\_ON\_BE}{intswaponbe}\\
\helpref{wxINTXX\_SWAP\_ON\_LE}{intswaponle}\\
@@ -2355,6 +2356,23 @@ and {\tt choices}, and the client data array must have the
same length as the choices array.}
\membersection{::wxInfoMessageBox}\label{wxinfomessagebox}
\func{void}{wxInfoMessageBox}{\param{wxWindow (}{parent = \NULL}}
Shows a message box with the information about the wxWidgets build used,
including its version, most important build parameters and the version of the
underlying GUI toolkit. This is mainly used for diagnostic purposes and can be
invoked by Ctrl-Alt-middle clicking on any wxWindow which doesn't otherwise
handle this event.
\newsince{2.9.0}
\wxheading{Include files}
<wx/utils.h>
\membersection{::wxIsBusy}\label{wxisbusy}
\func{bool}{wxIsBusy}{\void}

View File

@@ -87,6 +87,11 @@ WXDLLIMPEXP_CORE void wxBell();
WXDLLIMPEXP_BASE void wxBell();
#endif
#if wxUSE_MSGDLG
// Show wxWidgets information
WXDLLIMPEXP_CORE void wxInfoMessageBox(wxWindow* parent);
#endif // wxUSE_MSGDLG
// Get OS description as a user-readable string
WXDLLIMPEXP_BASE wxString wxGetOsDescription();

View File

@@ -115,8 +115,10 @@ END_EVENT_TABLE()
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
#if wxUSE_MSGDLG
EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox)
EVT_MENU(DIALOGS_MESSAGE_BOX_WXINFO, MyFrame::MessageBoxInfo)
#endif // wxUSE_MSGDLG
#if wxUSE_COLOURDLG
EVT_MENU(DIALOGS_CHOOSE_COLOUR, MyFrame::ChooseColour)
EVT_MENU(DIALOGS_GET_COLOUR, MyFrame::GetColour)
@@ -353,7 +355,11 @@ bool MyApp::OnInit()
#endif // wxUSE_DIRDLG
#if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
#if wxUSE_STARTUP_TIPS || \
wxUSE_PROGRESSDLG || \
wxUSE_BUSYINFO || \
wxUSE_LOG_DIALOG || \
wxUSE_MSGDLG
wxMenu *info_menu = new wxMenu;
@@ -373,6 +379,11 @@ bool MyApp::OnInit()
info_menu->Append(DIALOGS_LOG_DIALOG, _T("&Log dialog\tCtrl-L"));
#endif // wxUSE_LOG_DIALOG
#if wxUSE_MSGDLG
info_menu->Append(DIALOGS_MESSAGE_BOX_WXINFO,
_T("&wxWidgets information\tCtrl-I"));
#endif // wxUSE_MSGDLG
menuDlg->Append(wxID_ANY,_T("&Informative dialogs"),info_menu);
#endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
@@ -611,6 +622,7 @@ void MyFrame::LogDialog(wxCommandEvent& WXUNUSED(event))
}
#endif // wxUSE_LOG_DIALOG
#if wxUSE_MSGDLG
void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) )
{
wxMessageDialog dialog(NULL,
@@ -646,6 +658,12 @@ void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) )
}
}
void MyFrame::MessageBoxInfo(wxCommandEvent& WXUNUSED(event))
{
::wxInfoMessageBox(this);
}
#endif // wxUSE_MSGDLG
#if wxUSE_NUMBERDLG
void MyFrame::NumericEntry(wxCommandEvent& WXUNUSED(event))
{

View File

@@ -207,7 +207,10 @@ class MyFrame: public wxFrame
public:
MyFrame(wxWindow *parent, const wxString& title);
#if wxUSE_MSGDLG
void MessageBox(wxCommandEvent& event);
void MessageBoxInfo(wxCommandEvent& event);
#endif // wxUSE_MSGDLG
#if wxUSE_COLOURDLG
void ChooseColour(wxCommandEvent& event);
@@ -347,6 +350,7 @@ enum
DIALOGS_CHOOSE_FONT,
DIALOGS_CHOOSE_FONT_GENERIC,
DIALOGS_MESSAGE_BOX,
DIALOGS_MESSAGE_BOX_WXINFO,
DIALOGS_SINGLE_CHOICE,
DIALOGS_MULTI_CHOICE,
DIALOGS_TEXT_ENTRY,

View File

@@ -1365,6 +1365,43 @@ int wxMessageBox(const wxString& message, const wxString& caption, long style,
return wxCANCEL;
}
void wxInfoMessageBox(wxWindow* parent)
{
// don't translate these strings, they're for diagnostics purposes only
wxString msg;
msg.Printf(_T("wxWidgets Library (%s port)\n")
_T("Version %d.%d.%d%s%s, compiled at %s %s\n")
_T("Runtime version of toolkit used is %d.%d.%s\n")
_T("Copyright (c) 1995-2007 wxWidgets team"),
wxPlatformInfo::Get().GetPortIdName().c_str(),
wxMAJOR_VERSION,
wxMINOR_VERSION,
wxRELEASE_NUMBER,
#if wxUSE_UNICODE
L" (Unicode)",
#else
wxEmptyString,
#endif
#ifdef __WXDEBUG__
_T(" Debug build"),
#else
wxEmptyString,
#endif
__TDATE__,
__TTIME__,
wxPlatformInfo::Get().GetToolkitMajorVersion(),
wxPlatformInfo::Get().GetToolkitMinorVersion(),
#ifdef __WXGTK__
wxString::Format(_T("\nThe compile-time GTK+ version is %d.%d.%d."), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION).c_str()
#else
wxEmptyString
#endif
);
wxMessageBox(msg, _T("wxWidgets information"),
wxICON_INFORMATION | wxOK,
parent);
}
#endif // wxUSE_MSGDLG
#if wxUSE_TEXTDLG

View File

@@ -2357,43 +2357,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
return;
}
#endif // __WXDEBUG__
#if wxUSE_MSGDLG
// don't translate these strings, they're for diagnostics purposes only
wxString msg;
msg.Printf(_T("wxWidgets Library (%s port)\n")
_T("Version %d.%d.%d%s%s, compiled at %s %s\n")
_T("Runtime version of toolkit used is %d.%d.%s\n")
_T("Copyright (c) 1995-2007 wxWidgets team"),
wxPlatformInfo::Get().GetPortIdName().c_str(),
wxMAJOR_VERSION,
wxMINOR_VERSION,
wxRELEASE_NUMBER,
#if wxUSE_UNICODE
L" (Unicode)",
#else
wxEmptyString,
#endif
#ifdef __WXDEBUG__
_T(" Debug build"),
#else
wxEmptyString,
#endif
__TDATE__,
__TTIME__,
wxPlatformInfo::Get().GetToolkitMajorVersion(),
wxPlatformInfo::Get().GetToolkitMinorVersion(),
#ifdef __WXGTK__
wxString::Format(_T("\nThe compile-time GTK+ version is %d.%d.%d."), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION).c_str()
#else
wxEmptyString
#endif
);
wxMessageBox(msg, _T("wxWidgets information"),
wxICON_INFORMATION | wxOK,
(wxWindow *)this);
#endif // wxUSE_MSGDLG
::wxInfoMessageBox((wxWindow*)this);
}
else
{