From 2c43b5c2d9359c562547c34108308dfcfa11e61b Mon Sep 17 00:00:00 2001 From: Iwbnwif Yiw Date: Tue, 20 Oct 2015 13:14:01 +0200 Subject: [PATCH] Use wxStdDialogButtonSizer in generic wxProgressDialog This improves the placement of the buttons by making it consistent with the platform conventions and also fixes a regression in button placement introduced in 2f3d0d96295f7d981e2b5844cf12a7090da61130 Closes #17213. --- src/generic/progdlgg.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index 9c10292871..bbac5945c7 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -241,37 +241,33 @@ bool wxGenericProgressDialog::Create( const wxString& title, m_btnAbort = m_btnSkip = NULL; - wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL); + wxStdDialogButtonSizer *buttonSizer = new wxStdDialogButtonSizer(); - const int borderFlags = -#if defined(__WXMSW__) || defined(__WXOSX__) - wxALL -#else - wxBOTTOM | wxTOP -#endif - ; + const int borderFlags = wxALL; - const wxSizerFlags sizerFlags + wxSizerFlags sizerFlags = wxSizerFlags().Border(borderFlags, LAYOUT_MARGIN); if ( HasPDFlag(wxPD_CAN_SKIP) ) { m_btnSkip = new wxButton(this, wxID_SKIP, _("&Skip")); - buttonSizer->Add(m_btnSkip, sizerFlags); + buttonSizer->SetNegativeButton(m_btnSkip); } if ( HasPDFlag(wxPD_CAN_ABORT) ) { m_btnAbort = new wxButton(this, wxID_CANCEL); - buttonSizer->Add(m_btnAbort, sizerFlags); + buttonSizer->AddButton(m_btnAbort); } if ( !HasPDFlag(wxPD_CAN_SKIP | wxPD_CAN_ABORT) ) buttonSizer->AddSpacer(LAYOUT_MARGIN); - sizerTop->Add(buttonSizer, sizerFlags); + buttonSizer->Realize(); + + sizerTop->Add(buttonSizer, sizerFlags.Expand()); SetSizerAndFit(sizerTop);