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