mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
ShuttleGui lets you specify whether a button is default. Use that.
This commit is contained in:
parent
cd4266792a
commit
bca0afd52e
@ -238,9 +238,10 @@ AboutDialog::AboutDialog(wxWindow * parent)
|
||||
PopulateLicensePage( S );
|
||||
}
|
||||
S.EndNotebook();
|
||||
wxButton *ok = safenew wxButton(S.GetParent(), wxID_OK, _("OK"));
|
||||
ok->SetDefault();
|
||||
S.Prop(0).AddWindow( ok );
|
||||
|
||||
S.Id(wxID_OK)
|
||||
.Prop(0)
|
||||
.AddButton(_("OK"), wxALIGN_CENTER, true);
|
||||
|
||||
Fit();
|
||||
this->Centre();
|
||||
|
@ -225,7 +225,7 @@ void BenchmarkDialog::MakeBenchmarkDialog()
|
||||
{
|
||||
S.StartHorizontalLay(wxALIGN_LEFT, false);
|
||||
{
|
||||
S.Id(RunID).AddButton(_("Run"))->SetDefault();
|
||||
S.Id(RunID).AddButton(_("Run"), wxALIGN_CENTRE, true);
|
||||
S.Id(BSaveID).AddButton(_("Save"));
|
||||
/* i18n-hint verb; to empty or erase */
|
||||
S.Id(ClearID).AddButton(_("Clear"));
|
||||
|
@ -364,12 +364,12 @@ void DependencyDialog::PopulateOrExchange(ShuttleGui& S)
|
||||
PopulateList();
|
||||
|
||||
mCopySelectedFilesButton =
|
||||
S.Id(CopySelectedFilesButtonID).AddButton(
|
||||
_("Copy Selected Files"),
|
||||
wxALIGN_LEFT);
|
||||
S.Id(CopySelectedFilesButtonID)
|
||||
.AddButton(
|
||||
_("Copy Selected Files"),
|
||||
wxALIGN_LEFT, true);
|
||||
mCopySelectedFilesButton->Enable(
|
||||
mFileListCtrl->GetSelectedItemCount() > 0);
|
||||
mCopySelectedFilesButton->SetDefault();
|
||||
mCopySelectedFilesButton->SetFocus();
|
||||
}
|
||||
S.EndStatic();
|
||||
|
@ -135,7 +135,7 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
|
||||
S.StartHorizontalLay(wxALIGN_RIGHT, false);
|
||||
{
|
||||
S.SetBorder(10);
|
||||
S.Id(wxID_OK).AddButton(_("&OK"))->SetDefault();
|
||||
S.Id(wxID_OK).AddButton(_("&OK"), wxALIGN_CENTER, true);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
}
|
||||
|
@ -348,7 +348,8 @@ wxCheckBox * ShuttleGuiBase::AddCheckBoxOnRight( const wxString &Prompt, bool Se
|
||||
return pCheckBox;
|
||||
}
|
||||
|
||||
wxButton * ShuttleGuiBase::AddButton(const wxString &Text, int PositionFlags)
|
||||
wxButton * ShuttleGuiBase::AddButton(
|
||||
const wxString &Text, int PositionFlags, bool setDefault)
|
||||
{
|
||||
UseUpId();
|
||||
if( mShuttleMode != eIsCreating )
|
||||
@ -359,10 +360,13 @@ wxButton * ShuttleGuiBase::AddButton(const wxString &Text, int PositionFlags)
|
||||
mpWind->SetName(wxStripMenuCodes(Text));
|
||||
miProp=0;
|
||||
UpdateSizersCore(false, PositionFlags | wxALL);
|
||||
if (setDefault)
|
||||
pBtn->SetDefault();
|
||||
return pBtn;
|
||||
}
|
||||
|
||||
wxBitmapButton * ShuttleGuiBase::AddBitmapButton(const wxBitmap &Bitmap, int PositionFlags)
|
||||
wxBitmapButton * ShuttleGuiBase::AddBitmapButton(
|
||||
const wxBitmap &Bitmap, int PositionFlags, bool setDefault)
|
||||
{
|
||||
UseUpId();
|
||||
if( mShuttleMode != eIsCreating )
|
||||
@ -375,6 +379,8 @@ wxBitmapButton * ShuttleGuiBase::AddBitmapButton(const wxBitmap &Bitmap, int Pos
|
||||
// wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
miProp=0;
|
||||
UpdateSizersCore(false, PositionFlags | wxALL);
|
||||
if (setDefault)
|
||||
pBtn->SetDefault();
|
||||
return pBtn;
|
||||
}
|
||||
|
||||
|
@ -139,10 +139,16 @@ public:
|
||||
wxTreeCtrl * AddTree();
|
||||
wxRadioButton * AddRadioButton( const wxString & Prompt );
|
||||
wxRadioButton * AddRadioButtonToGroup( const wxString & Prompt);
|
||||
// Only the last button specified as default (if more than one) will be
|
||||
// Always ORs the flags with wxALL (which affects borders):
|
||||
wxButton * AddButton( const wxString & Text, int PositionFlags = wxALIGN_CENTRE );
|
||||
wxButton * AddButton(
|
||||
const wxString & Text, int PositionFlags = wxALIGN_CENTRE,
|
||||
bool setDefault = false );
|
||||
// Only the last button specified as default (if more than one) will be
|
||||
// Always ORs the flags with wxALL (which affects borders):
|
||||
wxBitmapButton * AddBitmapButton(const wxBitmap &Bitmap, int PositionFlags = wxALIGN_CENTRE);
|
||||
wxBitmapButton * AddBitmapButton(
|
||||
const wxBitmap &Bitmap, int PositionFlags = wxALIGN_CENTRE,
|
||||
bool setDefault = false );
|
||||
// When PositionFlags is 0, applies wxALL (which affects borders),
|
||||
// and either wxALIGN_CENTER (if bCenter) or else wxEXPAND
|
||||
wxStaticText * AddVariableText(const wxString &Str, bool bCenter = false, int PositionFlags = 0);
|
||||
|
@ -140,10 +140,11 @@ void SplashDialog::Populate( ShuttleGui & S )
|
||||
{
|
||||
S.SetBorder( 5 );
|
||||
S.Id( DontShowID).AddCheckBox( _("Don't show this again at start up"), !bShow );
|
||||
wxButton *ok = safenew wxButton(S.GetParent(), wxID_OK);
|
||||
ok->SetDefault();
|
||||
S.SetBorder( 5 );
|
||||
S.Prop(0).AddWindow( ok, wxALIGN_RIGHT| wxALL );
|
||||
|
||||
S.Id(wxID_OK)
|
||||
.Prop(0)
|
||||
.AddButton(_("OK"), wxALIGN_RIGHT| wxALL, true);
|
||||
}
|
||||
S.EndVerticalLay();
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ ProgressResult ExportCL::Export(AudacityProject *project,
|
||||
S.AddTextWindow(cmd + wxT("\n\n") + output);
|
||||
S.StartHorizontalLay(wxALIGN_CENTER, false);
|
||||
{
|
||||
S.Id(wxID_OK).AddButton(_("&OK"))->SetDefault();
|
||||
S.Id(wxID_OK).AddButton(_("&OK"), wxALIGN_CENTER, true);
|
||||
}
|
||||
dlg.GetSizer()->AddSpacer(5);
|
||||
dlg.Layout();
|
||||
|
@ -189,7 +189,7 @@ void HelpSystem::ShowHtmlText(wxWindow *pParent,
|
||||
|
||||
S.Prop(1).AddWindow( html, wxEXPAND );
|
||||
|
||||
S.Id( wxID_CANCEL ).AddButton( _("Close") )->SetDefault();
|
||||
S.Id( wxID_CANCEL ).AddButton( _("Close"), wxALIGN_CENTER, true );
|
||||
}
|
||||
S.EndPanel();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user