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
|
// 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
|
#endif // wxUSE_ABOUTDLG
|
||||||
|
|
||||||
|
@ -35,15 +35,15 @@ public:
|
|||||||
wxGenericAboutDialog() { Init(); }
|
wxGenericAboutDialog() { Init(); }
|
||||||
|
|
||||||
// ctor which fully initializes the object
|
// ctor which fully initializes the object
|
||||||
wxGenericAboutDialog(const wxAboutDialogInfo& info)
|
wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
(void)Create(info);
|
(void)Create(info, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this method must be called if and only if the default ctor was used
|
// 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:
|
protected:
|
||||||
// this virtual method may be overridden to add some more controls to the
|
// 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,
|
// unlike wxAboutBox which can show either the native or generic about dialog,
|
||||||
// this function always shows the generic one
|
// 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
|
#endif // wxUSE_ABOUTDLG
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ public:
|
|||||||
|
|
||||||
@header{wx/aboutdlg.h}
|
@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
|
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}
|
@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;
|
wxAboutDialogInfo info;
|
||||||
InitAboutInfoMinimal(info);
|
InitAboutInfoMinimal(info);
|
||||||
|
|
||||||
wxAboutBox(info);
|
wxAboutBox(info, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ShowFancyAboutDialog(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ShowFancyAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||||
@ -1749,7 +1749,7 @@ void MyFrame::ShowFancyAboutDialog(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxAboutDialogInfo info;
|
wxAboutDialogInfo info;
|
||||||
InitAboutInfoWebsite(info);
|
InitAboutInfoWebsite(info);
|
||||||
|
|
||||||
wxAboutBox(info);
|
wxAboutBox(info, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ShowFullAboutDialog(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ShowFullAboutDialog(wxCommandEvent& WXUNUSED(event))
|
||||||
@ -1757,16 +1757,16 @@ void MyFrame::ShowFullAboutDialog(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxAboutDialogInfo info;
|
wxAboutDialogInfo info;
|
||||||
InitAboutInfoAll(info);
|
InitAboutInfoAll(info);
|
||||||
|
|
||||||
wxAboutBox(info);
|
wxAboutBox(info, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// a trivial example of a custom dialog class
|
// a trivial example of a custom dialog class
|
||||||
class MyAboutDialog : public wxGenericAboutDialog
|
class MyAboutDialog : public wxGenericAboutDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyAboutDialog(const wxAboutDialogInfo& info)
|
MyAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent)
|
||||||
{
|
{
|
||||||
Create(info);
|
Create(info, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add some custom controls
|
// add some custom controls
|
||||||
@ -1783,7 +1783,7 @@ void MyFrame::ShowCustomAboutDialog(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxAboutDialogInfo info;
|
wxAboutDialogInfo info;
|
||||||
InitAboutInfoAll(info);
|
InitAboutInfoAll(info);
|
||||||
|
|
||||||
MyAboutDialog dlg(info);
|
MyAboutDialog dlg(info, this);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,10 +113,9 @@ wxString wxAboutDialogInfo::GetCopyrightToDisplay() const
|
|||||||
// wxGenericAboutDialog
|
// 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(parent, wxID_ANY, _("About ") + info.GetName(),
|
||||||
if ( !wxDialog::Create(GetParentForModalDialog(), wxID_ANY, _("About ") + info.GetName(),
|
|
||||||
wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE) )
|
wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -196,7 +195,7 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info)
|
|||||||
|
|
||||||
SetSizerAndFit(sizerTop);
|
SetSizerAndFit(sizerTop);
|
||||||
|
|
||||||
CentreOnScreen();
|
CentreOnParent();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -240,10 +239,10 @@ void wxGenericAboutDialog::AddCollapsiblePane(const wxString& title,
|
|||||||
// public functions
|
// public functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxGenericAboutBox(const wxAboutDialogInfo& info)
|
void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
||||||
{
|
{
|
||||||
#if !defined(__WXGTK__) && !defined(__WXMAC__)
|
#if !defined(__WXGTK__) && !defined(__WXMAC__)
|
||||||
wxGenericAboutDialog dlg(info);
|
wxGenericAboutDialog dlg(info, parent);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
#else
|
#else
|
||||||
wxGenericAboutDialog* dlg = new wxGenericAboutDialog(info);
|
wxGenericAboutDialog* dlg = new wxGenericAboutDialog(info);
|
||||||
@ -255,9 +254,9 @@ void wxGenericAboutBox(const wxAboutDialogInfo& info)
|
|||||||
// the others we provide a generic fallback here
|
// the others we provide a generic fallback here
|
||||||
#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXGTK26__)
|
#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
|
#endif // platforms without native about dialog
|
||||||
|
@ -109,7 +109,7 @@ wxGtkAboutDialogOnLink(GtkAboutDialog * WXUNUSED(about),
|
|||||||
wxLaunchDefaultBrowser(wxGTK_CONV_BACK_SYS(link));
|
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) )
|
if ( !gtk_check_version(2,6,0) )
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// our public entry point
|
// 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
|
// 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
|
// 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
|
// add everything remaining
|
||||||
msg << info.GetDescriptionAndCredits();
|
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
|
else // simple "native" version is not enough
|
||||||
{
|
{
|
||||||
// we need to use the full-blown generic version
|
// we need to use the full-blown generic version
|
||||||
wxGenericAboutBox(info);
|
wxGenericAboutBox(info, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
// implementation
|
// 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
|
// Mac native about box currently can show only name, version, copyright
|
||||||
// and description fields and we also shoehorn the credits text into the
|
// and description fields and we also shoehorn the credits text into the
|
||||||
|
Loading…
Reference in New Issue
Block a user