};
// 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
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
// 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
@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
@header{wx/aboutdlg.h}
*/
-void wxGenericAboutBox(const wxAboutDialogInfo& info);
+void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
//@}
wxAboutDialogInfo info;
InitAboutInfoMinimal(info);
- wxAboutBox(info);
+ wxAboutBox(info, this);
}
void MyFrame::ShowFancyAboutDialog(wxCommandEvent& WXUNUSED(event))
wxAboutDialogInfo info;
InitAboutInfoWebsite(info);
- wxAboutBox(info);
+ wxAboutBox(info, this);
}
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
wxAboutDialogInfo info;
InitAboutInfoAll(info);
- MyAboutDialog dlg(info);
+ MyAboutDialog dlg(info, this);
dlg.ShowModal();
}
// 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;
SetSizerAndFit(sizerTop);
- CentreOnScreen();
+ CentreOnParent();
return true;
}
// 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);
// 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
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) )
{
// ============================================================================
// 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
// 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);
}
}
// 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