Skip to content
Snippets Groups Projects
Commit ad26c35d authored by Paul Licameli's avatar Paul Licameli Committed by James Crook
Browse files

Fix Tab key navigation on Mac in presence of static boxes

parent 2ba17c78
No related branches found
No related tags found
No related merge requests found
......@@ -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));
......
......@@ -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
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment