1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 08:29:27 +02:00

Fix Tab key navigation on Mac in presence of static boxes

This commit is contained in:
Paul Licameli 2019-04-30 19:12:06 -04:00 committed by James Crook
parent 2ba17c78d6
commit ad26c35d3c
3 changed files with 19 additions and 4 deletions

View File

@ -783,8 +783,6 @@ wxMenu * ShuttleGuiBase::AddMenu( const wxString & Title )
return mpMenu;
}
/// Starts a static box around a number of controls.
/// @param Str The text of the title for the box.
/// @param iProp The resizing proportion value.
@ -795,7 +793,7 @@ wxStaticBox * ShuttleGuiBase::StartStatic(const wxString &Str, int iProp)
UseUpId();
if( mShuttleMode != eIsCreating )
return NULL;
wxStaticBox * pBox = safenew wxStaticBox(GetParent(), miId,
wxStaticBox * pBox = safenew wxStaticBoxWrapper(GetParent(), miId,
Str );
pBox->SetLabel( Str );
pBox->SetName(wxStripMenuCodes(Str));

View File

@ -78,6 +78,21 @@ class Shuttle;
class WrappedType;
#ifdef __WXMAC__
#include <wx/statbox.h> // to inherit
class wxStaticBoxWrapper
: public wxStaticBox // inherit to get access to m_container
{
public:
template< typename... Args >
wxStaticBoxWrapper( Args &&...args )
: wxStaticBox( std::forward<Args>(args)... )
{
m_container.EnableSelfFocus();
}
};
/// Fix a defect in TAB key navigation to sliders, known to happen in wxWidgets
/// 3.1.1 and maybe in earlier versions
class wxSliderWrapper : public wxSlider
@ -87,6 +102,7 @@ public:
void SetFocus() override;
};
#else
using wxStaticBoxWrapper = wxStaticBox;
using wxSliderWrapper = wxSlider;
#endif

View File

@ -52,6 +52,7 @@
#include "../FileFormats.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "ImportPlugin.h"
@ -278,7 +279,7 @@ static wxString AskCopyOrEdit()
vbox->Add(message, 1, wxALL | wxEXPAND, 10);
wxStaticBox *box = safenew wxStaticBox(&dialog, -1, _("Choose an import method"));
wxStaticBox *box = safenew wxStaticBoxWrapper(&dialog, -1, _("Choose an import method"));
box->SetName(box->GetLabel());
wxRadioButton *aliasRadio;