diff --git a/docs/doxygen/images/appear-about-simple-gtk.png b/docs/doxygen/images/appear-about-simple-gtk.png new file mode 100644 index 0000000000..24cc1b3e9e Binary files /dev/null and b/docs/doxygen/images/appear-about-simple-gtk.png differ diff --git a/docs/doxygen/images/appear-about-simple-mac.png b/docs/doxygen/images/appear-about-simple-mac.png new file mode 100644 index 0000000000..865ab352d3 Binary files /dev/null and b/docs/doxygen/images/appear-about-simple-mac.png differ diff --git a/docs/doxygen/images/appear-about-simple-msw.png b/docs/doxygen/images/appear-about-simple-msw.png new file mode 100644 index 0000000000..622d4122a6 Binary files /dev/null and b/docs/doxygen/images/appear-about-simple-msw.png differ diff --git a/docs/doxygen/images/appear-about-with-url-gtk.png b/docs/doxygen/images/appear-about-with-url-gtk.png new file mode 100644 index 0000000000..d0159b9df3 Binary files /dev/null and b/docs/doxygen/images/appear-about-with-url-gtk.png differ diff --git a/docs/doxygen/images/appear-about-with-url-mac.png b/docs/doxygen/images/appear-about-with-url-mac.png new file mode 100644 index 0000000000..1e315e6cfd Binary files /dev/null and b/docs/doxygen/images/appear-about-with-url-mac.png differ diff --git a/docs/doxygen/images/appear-about-with-url-msw.png b/docs/doxygen/images/appear-about-with-url-msw.png new file mode 100644 index 0000000000..1017c532f0 Binary files /dev/null and b/docs/doxygen/images/appear-about-with-url-msw.png differ diff --git a/include/wx/generic/aboutdlgg.h b/include/wx/generic/aboutdlgg.h index 4c6338a56d..23b6491570 100644 --- a/include/wx/generic/aboutdlgg.h +++ b/include/wx/generic/aboutdlgg.h @@ -19,6 +19,7 @@ class WXDLLIMPEXP_FWD_CORE wxAboutDialogInfo; class WXDLLIMPEXP_FWD_CORE wxSizer; class WXDLLIMPEXP_FWD_CORE wxSizerFlags; +class WXDLLIMPEXP_FWD_CORE wxStaticText; // Under GTK and OS X "About" dialogs are not supposed to be modal, unlike MSW // and, presumably, all the other platforms. @@ -71,7 +72,7 @@ protected: void AddControl(wxWindow *win); // add the text, if it's not empty, to the text sizer contents - void AddText(const wxString& text); + wxStaticText* AddText(const wxString& text); #if wxUSE_COLLPANE // add a wxCollapsiblePane containing the given text diff --git a/interface/wx/aboutdlg.h b/interface/wx/aboutdlg.h index 692fefaddb..2751c1935c 100644 --- a/interface/wx/aboutdlg.h +++ b/interface/wx/aboutdlg.h @@ -45,6 +45,13 @@ } @endcode + Example of appearance of a simple about dialog: + @appearance{about-simple} + + And that of a dialog using a web site link, which results in using the + generic version under MSW and Mac: + @appearance{about-with-url} + @library{wxcore} @category{cmndlg,data} diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index e0a5fa0c97..d296f354c1 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -3406,9 +3406,8 @@ static void InitAboutInfoMinimal(wxAboutDialogInfo& info) wxMINOR_VERSION % 2 ? "Development" : "Stable", wxVERSION_NUM_DOT_STRING )); - info.SetDescription("This sample shows different wxWidgets dialogs"); - info.SetCopyright("(C) 1998-2006 wxWidgets dev team"); - info.AddDeveloper("Vadim Zeitlin"); + info.SetDescription("This sample shows different wxWidgets dialogs."); + info.SetCopyright("(C) 1998-2023 wxWidgets dev team."); } static void InitAboutInfoWebsite(wxAboutDialogInfo& info) @@ -3422,7 +3421,8 @@ static void InitAboutInfoAll(wxAboutDialogInfo& info) { InitAboutInfoWebsite(info); - // we can add a second developer + // we can add several developers one by one + info.AddDeveloper("Vadim Zeitlin"); info.AddDeveloper("A.N. Other"); // or we can add several persons at once like this @@ -3431,6 +3431,7 @@ static void InitAboutInfoAll(wxAboutDialogInfo& info) docwriters.Add("Second One"); info.SetDocWriters(docwriters); + info.SetLicence(wxString::FromAscii( " wxWindows Library Licence, Version 3.1\n" " ======================================\n" diff --git a/src/generic/aboutdlgg.cpp b/src/generic/aboutdlgg.cpp index e7c9a2bef7..f84e0b3638 100644 --- a/src/generic/aboutdlgg.cpp +++ b/src/generic/aboutdlgg.cpp @@ -147,9 +147,8 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info, wxWindow* paren label->SetFont(fontBig); m_sizerText->Add(label, wxSizerFlags().Centre().Border()); - m_sizerText->AddSpacer(5); + m_sizerText->AddSpacer(wxSizerFlags::GetDefaultBorder()); - AddText(info.GetCopyrightToDisplay()); AddText(info.GetDescription()); if ( info.HasWebSite() ) @@ -186,6 +185,18 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info, wxWindow* paren DoAddCustomControls(); + // Separate the copyright from all the rest and use smaller font for it as + // is custom. + const wxString& copyrightText = info.GetCopyrightToDisplay(); + if ( !copyrightText.empty() ) + { + m_sizerText->AddSpacer(wxSizerFlags::GetDefaultBorder()); + + wxFont fontSmall(*wxNORMAL_FONT); + fontSmall.SetFractionalPointSize(fontSmall.GetFractionalPointSize() - 1.0); + AddText(copyrightText)->SetFont(fontSmall); + } + wxSizer *sizerIconAndText = new wxBoxSizer(wxHORIZONTAL); #if wxUSE_STATBMP @@ -235,10 +246,17 @@ void wxGenericAboutDialog::AddControl(wxWindow *win) AddControl(win, wxSizerFlags().Border(wxDOWN).Centre()); } -void wxGenericAboutDialog::AddText(const wxString& text) +wxStaticText* wxGenericAboutDialog::AddText(const wxString& text) { - if ( !text.empty() ) - AddControl(new wxStaticText(this, wxID_ANY, text)); + if ( text.empty() ) + return nullptr; + + auto *win = new wxStaticText(this, wxID_ANY, text, + wxDefaultPosition, wxDefaultSize, + wxALIGN_CENTRE); + AddControl(win); + + return win; } #if wxUSE_COLLPANE diff --git a/src/msw/aboutdlg.cpp b/src/msw/aboutdlg.cpp index 0dc65ec083..81620a92c5 100644 --- a/src/msw/aboutdlg.cpp +++ b/src/msw/aboutdlg.cpp @@ -45,19 +45,16 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent) wxString msg; msg << name; if ( info.HasVersion() ) - { - msg << wxT('\n'); - msg << info.GetLongVersion(); - } + msg << wxT(' ') << info.GetVersion(); + // Separate the title from the rest with an extra blank line. msg << wxT("\n\n"); - if ( info.HasCopyright() ) - msg << info.GetCopyrightToDisplay() << wxT('\n'); - - // add everything remaining msg << info.GetDescriptionAndCredits(); + if ( info.HasCopyright() ) + msg << wxT('\n') << info.GetCopyrightToDisplay(); + wxMessageBox(msg, wxString::Format(_("About %s"), name), wxOK | wxCENTRE, parent); } else // simple "native" version is not enough