From d383e79997968fe6cd5cbf6b55ccddeb78670b0f Mon Sep 17 00:00:00 2001 From: "v.audacity" Date: Sat, 16 Aug 2014 00:29:48 +0000 Subject: [PATCH] David Bailes's patch for Bug 742 - Track panel focus bug with NVDA screeen reader --- src/TrackPanelAx.cpp | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/TrackPanelAx.cpp b/src/TrackPanelAx.cpp index b0e29ef97..13b8cf0ed 100644 --- a/src/TrackPanelAx.cpp +++ b/src/TrackPanelAx.cpp @@ -385,7 +385,33 @@ wxAccStatus TrackPanelAx::GetSelections( wxVariant * WXUNUSED(selections) ) // Returns a state constant. wxAccStatus TrackPanelAx::GetState( int childId, long* state ) { - *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE; +#if defined(__WXMSW__) + if( childId > 0 ) + { + Track *t = FindTrack( childId ); + + *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE; + if (t) + { + if( t == mFocusedTrack ) + { + *state |= wxACC_STATE_SYSTEM_FOCUSED; + } + + if( t->GetSelected() ) + { + *state |= wxACC_STATE_SYSTEM_SELECTED; + } + } + } + else // childId == wxACC_SELF + { + *state = wxACC_STATE_SYSTEM_FOCUSABLE + wxACC_STATE_SYSTEM_FOCUSED; + } +#endif + +#if defined(__WXMAC__) + *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE; if( childId > 0 ) { @@ -404,6 +430,7 @@ wxAccStatus TrackPanelAx::GetState( int childId, long* state ) } } } +#endif return wxACC_OK; } @@ -464,17 +491,18 @@ wxAccStatus TrackPanelAx::GetValue( int childId, wxString* strValue ) wxAccStatus TrackPanelAx::GetFocus( int *childId, wxAccessible **child ) { #if defined(__WXMSW__) - if( *childId == wxACC_SELF ) + + if (mTrackPanel == wxWindow::FindFocus()) { - if( mFocusedTrack ) + if (mFocusedTrack) + { + *childId = TrackNum(mFocusedTrack); + } + else { *child = this; } } - else - { - *child = NULL; - } return wxACC_OK; #endif