Fix truncation of translated "Finish" button label in wxWizard
Ensure that the button is wide enough to show both "Next" and "Finish" and also make all the buttons of the same size, as they look better like this. Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org> Closes #22200. Closes #22221.
This commit is contained in:
parent
5f011b84c1
commit
af9e7fd460
@ -439,6 +439,37 @@ void wxWizard::AddButtonRow(wxBoxSizer *mainColumn)
|
||||
#endif
|
||||
m_btnPrev = new wxButton(this, wxID_BACKWARD, _("< &Back"), wxDefaultPosition, wxDefaultSize, buttonStyle);
|
||||
|
||||
// compute the maximum width of the buttons and use it for all of them
|
||||
// (except for the "Help" button under Mac which is special there)
|
||||
wxSize buttonSize;
|
||||
buttonSize.IncTo(m_btnPrev->GetBestSize());
|
||||
buttonSize.IncTo(m_btnNext->GetBestSize());
|
||||
buttonSize.IncTo(btnCancel->GetBestSize());
|
||||
|
||||
// use the other possible label for the "Next" button temporarily, so that
|
||||
// we could make it big enough to fit it too if it's longer
|
||||
m_btnNext->SetLabel(m_finishLabel);
|
||||
buttonSize.IncTo(m_btnNext->GetBestSize());
|
||||
|
||||
#ifndef __WXMAC__
|
||||
if (btnHelp)
|
||||
buttonSize.IncTo(btnHelp->GetBestSize());
|
||||
#endif
|
||||
|
||||
// now do make all buttons of the same (and big enough) size
|
||||
m_btnPrev->SetMinSize(buttonSize);
|
||||
m_btnNext->SetMinSize(buttonSize);
|
||||
btnCancel->SetMinSize(buttonSize);
|
||||
|
||||
#ifndef __WXMAC__
|
||||
if (btnHelp)
|
||||
btnHelp->SetMinSize(buttonSize);
|
||||
#endif
|
||||
|
||||
// restore the initial label of the 'next' button after temporarily
|
||||
// changing it above
|
||||
m_btnNext->SetLabel(m_nextLabel);
|
||||
|
||||
if (btnHelp)
|
||||
{
|
||||
buttonRow->Add(
|
||||
|
Loading…
Reference in New Issue
Block a user