add parent parameter to wxAboutBox() (closes #9952)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60389 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
6418ad5ec8
commit
c173e541b8
@ -151,7 +151,7 @@ private:
|
||||
};
|
||||
|
||||
// functions to show the about dialog box
|
||||
WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info);
|
||||
WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
|
||||
|
||||
#endif // wxUSE_ABOUTDLG
|
||||
|
||||
|
@ -35,15 +35,15 @@ public:
|
||||
wxGenericAboutDialog() { Init(); }
|
||||
|
||||
// ctor which fully initializes the object
|
||||
wxGenericAboutDialog(const wxAboutDialogInfo& info)
|
||||
wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(info);
|
||||
(void)Create(info, parent);
|
||||
}
|
||||
|
||||
// this method must be called if and only if the default ctor was used
|
||||
bool Create(const wxAboutDialogInfo& info);
|
||||
bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
|
||||
|
||||
protected:
|
||||
// this virtual method may be overridden to add some more controls to the
|
||||
@ -79,7 +79,7 @@ private:
|
||||
|
||||
// unlike wxAboutBox which can show either the native or generic about dialog,
|
||||
// this function always shows the generic one
|
||||
WXDLLIMPEXP_ADV void wxGenericAboutBox(const wxAboutDialogInfo& info);
|
||||
WXDLLIMPEXP_ADV void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
|
||||
|
||||
#endif // wxUSE_ABOUTDLG
|
||||
|
||||
|
@ -201,7 +201,7 @@ public:
|
||||
|
||||
@header{wx/aboutdlg.h}
|
||||
*/
|
||||
void wxAboutBox(const wxAboutDialogInfo& info);
|
||||
void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
|
||||
|
||||
/**
|
||||
This function does the same thing as wxAboutBox() except that it always uses
|
||||
@ -218,6 +218,6 @@ void wxAboutBox(const wxAboutDialogInfo& info);
|
||||
|
||||
@header{wx/aboutdlg.h}
|
||||
*/
|
||||
void wxGenericAboutBox(const wxAboutDialogInfo& info);
|
||||
void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
|
||||
|
||||
//@}
|
||||
|
@ -1741,7 +1741,7 @@ void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||
wxAboutDialogInfo info;
|
||||
InitAboutInfoMinimal(info);
|
||||
|
||||
wxAboutBox(info);
|
||||
wxAboutBox(info, this);
|
||||
}
|
||||
|
||||
void MyFrame::ShowFancyAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||
@ -1749,7 +1749,7 @@ void MyFrame::ShowFancyAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||
wxAboutDialogInfo info;
|
||||
InitAboutInfoWebsite(info);
|
||||
|
||||
wxAboutBox(info);
|
||||
wxAboutBox(info, this);
|
||||
}
|
||||
|
||||
void MyFrame::ShowFullAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||
@ -1757,16 +1757,16 @@ void MyFrame::ShowFullAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||
wxAboutDialogInfo info;
|
||||
InitAboutInfoAll(info);
|
||||
|
||||
wxAboutBox(info);
|
||||
wxAboutBox(info, this);
|
||||
}
|
||||
|
||||
// a trivial example of a custom dialog class
|
||||
class MyAboutDialog : public wxGenericAboutDialog
|
||||
{
|
||||
public:
|
||||
MyAboutDialog(const wxAboutDialogInfo& info)
|
||||
MyAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent)
|
||||
{
|
||||
Create(info);
|
||||
Create(info, parent);
|
||||
}
|
||||
|
||||
// add some custom controls
|
||||
@ -1783,7 +1783,7 @@ void MyFrame::ShowCustomAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||
wxAboutDialogInfo info;
|
||||
InitAboutInfoAll(info);
|
||||
|
||||
MyAboutDialog dlg(info);
|
||||
MyAboutDialog dlg(info, this);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
@ -113,10 +113,9 @@ wxString wxAboutDialogInfo::GetCopyrightToDisplay() const
|
||||
// wxGenericAboutDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info)
|
||||
bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info, wxWindow* parent)
|
||||
{
|
||||
// this is a modal dialog thus we'll use GetParentForModalDialog:
|
||||
if ( !wxDialog::Create(GetParentForModalDialog(), wxID_ANY, _("About ") + info.GetName(),
|
||||
if ( !wxDialog::Create(parent, wxID_ANY, _("About ") + info.GetName(),
|
||||
wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE) )
|
||||
return false;
|
||||
|
||||
@ -196,7 +195,7 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info)
|
||||
|
||||
SetSizerAndFit(sizerTop);
|
||||
|
||||
CentreOnScreen();
|
||||
CentreOnParent();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -240,10 +239,10 @@ void wxGenericAboutDialog::AddCollapsiblePane(const wxString& title,
|
||||
// public functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxGenericAboutBox(const wxAboutDialogInfo& info)
|
||||
void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
||||
{
|
||||
#if !defined(__WXGTK__) && !defined(__WXMAC__)
|
||||
wxGenericAboutDialog dlg(info);
|
||||
wxGenericAboutDialog dlg(info, parent);
|
||||
dlg.ShowModal();
|
||||
#else
|
||||
wxGenericAboutDialog* dlg = new wxGenericAboutDialog(info);
|
||||
@ -255,9 +254,9 @@ void wxGenericAboutBox(const wxAboutDialogInfo& info)
|
||||
// the others we provide a generic fallback here
|
||||
#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXGTK26__)
|
||||
|
||||
void wxAboutBox(const wxAboutDialogInfo& info)
|
||||
void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
||||
{
|
||||
wxGenericAboutBox(info);
|
||||
wxGenericAboutBox(info, parent);
|
||||
}
|
||||
|
||||
#endif // platforms without native about dialog
|
||||
|
@ -109,7 +109,7 @@ wxGtkAboutDialogOnLink(GtkAboutDialog * WXUNUSED(about),
|
||||
wxLaunchDefaultBrowser(wxGTK_CONV_BACK_SYS(link));
|
||||
}
|
||||
|
||||
void wxAboutBox(const wxAboutDialogInfo& info)
|
||||
void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent))
|
||||
{
|
||||
if ( !gtk_check_version(2,6,0) )
|
||||
{
|
||||
|
@ -37,7 +37,7 @@
|
||||
// ============================================================================
|
||||
|
||||
// our public entry point
|
||||
void wxAboutBox(const wxAboutDialogInfo& info)
|
||||
void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
||||
{
|
||||
// we prefer to show a simple message box if we don't have any fields which
|
||||
// can't be shown in it because as much as there is a standard about box
|
||||
@ -62,12 +62,12 @@ void wxAboutBox(const wxAboutDialogInfo& info)
|
||||
// add everything remaining
|
||||
msg << info.GetDescriptionAndCredits();
|
||||
|
||||
wxMessageBox(msg, wxString::Format(_("About %s"), name));
|
||||
wxMessageBox(msg, wxString::Format(_("About %s"), name, wxOK | wxCENTRE, parent));
|
||||
}
|
||||
else // simple "native" version is not enough
|
||||
{
|
||||
// we need to use the full-blown generic version
|
||||
wxGenericAboutBox(info);
|
||||
wxGenericAboutBox(info, parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
void wxAboutBox(const wxAboutDialogInfo& info)
|
||||
void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent))
|
||||
{
|
||||
// Mac native about box currently can show only name, version, copyright
|
||||
// and description fields and we also shoehorn the credits text into the
|
||||
|
Loading…
Reference in New Issue
Block a user