From 8cf304f81b482d152f0853da44d0511d6aef978c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 18 Nov 2007 19:56:03 +0000 Subject: [PATCH] added public wxInfoMessageBox() (slightly modified patch 1828235) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/function.tex | 18 ++++++++++++++++++ include/wx/utils.h | 5 +++++ samples/dialogs/dialogs.cpp | 24 ++++++++++++++++++++--- samples/dialogs/dialogs.h | 4 ++++ src/common/utilscmn.cpp | 37 ++++++++++++++++++++++++++++++++++++ src/common/wincmn.cpp | 38 +------------------------------------ 6 files changed, 86 insertions(+), 40 deletions(-) diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index f3e5b28410..f8c78e68aa 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -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} + + + + \membersection{::wxIsBusy}\label{wxisbusy} \func{bool}{wxIsBusy}{\void} diff --git a/include/wx/utils.h b/include/wx/utils.h index 6fe0851075..7a7ec0d892 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -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(); diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 6b837a6dfe..ad0fff1d44 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -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,8 +658,14 @@ 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) ) +void MyFrame::NumericEntry(wxCommandEvent& WXUNUSED(event)) { long res = wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n") _T("Even two rows of text."), diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index b371fbd106..9e46371a4e 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -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, diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 4ba9c856e1..c65b29d48a 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -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 diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 52ab77657c..c26cfb27c3 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -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 { -- 2.47.2