mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-26 15:23:48 +01:00
Fix TAB key navigation on Mac for all dialogs (not only for panels)
This commit is contained in:
@@ -68,14 +68,11 @@
|
||||
#include "MidiIOPrefs.h"
|
||||
#endif
|
||||
|
||||
BEGIN_EVENT_TABLE(PrefsDialog, wxDialog)
|
||||
BEGIN_EVENT_TABLE(PrefsDialog, wxDialogWrapper)
|
||||
EVT_BUTTON(wxID_OK, PrefsDialog::OnOK)
|
||||
EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
|
||||
EVT_BUTTON(wxID_APPLY, PrefsDialog::OnApply)
|
||||
EVT_TREE_KEY_DOWN(wxID_ANY, PrefsDialog::OnTreeKeyDown) // Handles key events when tree has focus
|
||||
|
||||
EVT_CHAR_HOOK(PrefsDialog::OnCharHook)
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
@@ -97,8 +94,8 @@ public:
|
||||
int wxTreebookExt::ChangeSelection(size_t n) {
|
||||
int i = wxTreebook::ChangeSelection(n);
|
||||
wxString Temp = GetPageText( n );
|
||||
((wxDialog*)GetParent())->SetTitle( Temp );
|
||||
((wxDialog*)GetParent())->SetName( Temp );
|
||||
static_cast<wxDialog*>(GetParent())->SetTitle( Temp );
|
||||
static_cast<wxDialog*>(GetParent())->SetName( Temp );
|
||||
return i;
|
||||
};
|
||||
|
||||
@@ -106,8 +103,8 @@ int wxTreebookExt::SetSelection(size_t n)
|
||||
{
|
||||
int i = wxTreebook::SetSelection(n);
|
||||
wxString Temp = wxString(mTitlePrefix) + GetPageText( n );
|
||||
((wxDialog*)GetParent())->SetTitle( Temp );
|
||||
((wxDialog*)GetParent())->SetName( Temp );
|
||||
static_cast<wxDialog*>(GetParent())->SetTitle( Temp );
|
||||
static_cast<wxDialog*>(GetParent())->SetName( Temp );
|
||||
|
||||
PrefsPanel *const panel = static_cast<PrefsPanel *>(GetPage(n));
|
||||
const bool showApply = panel->ShowsApplyButton();
|
||||
@@ -202,7 +199,7 @@ PrefsDialog::Factories
|
||||
|
||||
PrefsDialog::PrefsDialog
|
||||
(wxWindow * parent, const wxString &titlePrefix, Factories &factories)
|
||||
: wxDialog(parent, wxID_ANY, wxString(_("Audacity Preferences")),
|
||||
: wxDialogWrapper(parent, wxID_ANY, wxString(_("Audacity Preferences")),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
@@ -342,7 +339,7 @@ int PrefsDialog::ShowModal()
|
||||
SetName(Temp);
|
||||
}
|
||||
|
||||
return wxDialog::ShowModal();
|
||||
return wxDialogWrapper::ShowModal();
|
||||
}
|
||||
|
||||
void PrefsDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
|
||||
@@ -376,12 +373,6 @@ void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event)
|
||||
event.Skip(); // Ensure standard behavior when enter is not pressed
|
||||
}
|
||||
|
||||
void PrefsDialog::OnCharHook(wxKeyEvent &event)
|
||||
{
|
||||
// Common behavior, let's define it in just one place
|
||||
wxTabTraversalWrapperCharHook(event);
|
||||
}
|
||||
|
||||
void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
RecordExpansionState();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <wx/string.h>
|
||||
#include <wx/treebook.h>
|
||||
#include <wx/window.h>
|
||||
#include "../widgets/wxPanelWrapper.h"
|
||||
|
||||
class PrefsPanel;
|
||||
class PrefsPanelFactory;
|
||||
@@ -29,7 +30,7 @@ class PrefsPanelFactory;
|
||||
#define CONST const
|
||||
#endif
|
||||
|
||||
class PrefsDialog /* not final */ : public wxDialog
|
||||
class PrefsDialog /* not final */ : public wxDialogWrapper
|
||||
{
|
||||
public:
|
||||
// An array of PrefsNode specifies the tree of pages in pre-order traversal.
|
||||
@@ -61,8 +62,6 @@ class PrefsDialog /* not final */ : public wxDialog
|
||||
void OnApply(wxCommandEvent & e);
|
||||
void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
|
||||
|
||||
void OnCharHook(wxKeyEvent &e);
|
||||
|
||||
void SelectPageByName(const wxString &pageName);
|
||||
|
||||
// Accessor to help implementations of SavePreferredPage(),
|
||||
|
||||
Reference in New Issue
Block a user