From 0c2c9568930a22bdbbdb4b134f9aa40b23080ea9 Mon Sep 17 00:00:00 2001 From: David Bailes Date: Sat, 10 Mar 2018 11:31:53 +0000 Subject: [PATCH] TrackPanelAx: add Navigate function for NVDA object navigation accNavigate is deprecated, but NVDA uses it for object navigation. (Jaws and narrator do not). So add Navigate function to TrackPanelAx. Info on accNavigate: https://msdn.microsoft.com/en-us/library/windows/desktop/dd318473(v=vs.85).aspx --- src/TrackPanelAx.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++ src/TrackPanelAx.h | 3 +++ 2 files changed, 62 insertions(+) diff --git a/src/TrackPanelAx.cpp b/src/TrackPanelAx.cpp index 31a6e09de..de219d066 100644 --- a/src/TrackPanelAx.cpp +++ b/src/TrackPanelAx.cpp @@ -642,4 +642,63 @@ wxAccStatus TrackPanelAx::GetFocus( int *childId, wxAccessible **child ) #endif } +// Navigates from fromId to toId/toObject +wxAccStatus TrackPanelAx::Navigate(wxNavDir navDir, int fromId, int* toId, wxAccessible** toObject) +{ + int childCount; + GetChildCount( &childCount ); + + if (fromId > childCount) + return wxACC_FAIL; + + switch (navDir) { + case wxNAVDIR_FIRSTCHILD: + if (fromId == CHILDID_SELF && childCount > 0 ) + *toId = 1; + else + return wxACC_FALSE; + break; + + case wxNAVDIR_LASTCHILD: + if (fromId == CHILDID_SELF && childCount > 0 ) + *toId = childCount; + else + return wxACC_FALSE; + break; + + case wxNAVDIR_NEXT: + case wxNAVDIR_DOWN: + if (fromId != CHILDID_SELF) { + *toId = fromId + 1; + if (*toId > childCount) + return wxACC_FALSE; + } + else + return wxACC_NOT_IMPLEMENTED; + break; + + case wxNAVDIR_PREVIOUS: + case wxNAVDIR_UP: + if (fromId != CHILDID_SELF) { + *toId = fromId - 1; + if (*toId < 1) + return wxACC_FALSE; + } + else + return wxACC_NOT_IMPLEMENTED; + break; + + case wxNAVDIR_LEFT: + case wxNAVDIR_RIGHT: + if (fromId != CHILDID_SELF) + return wxACC_FALSE; + else + return wxACC_NOT_IMPLEMENTED; + break; + } + + *toObject = nullptr; + return wxACC_OK; +} + #endif // wxUSE_ACCESSIBILITY diff --git a/src/TrackPanelAx.h b/src/TrackPanelAx.h index 9724095e9..4bb64148e 100644 --- a/src/TrackPanelAx.h +++ b/src/TrackPanelAx.h @@ -104,6 +104,9 @@ public: // Returns a localized string representing the value for the object // or child. wxAccStatus GetValue(int childId, wxString* strValue) override; + + // Navigates from fromId to toId/toObject + wxAccStatus Navigate(wxNavDir navDir, int fromId, int* toId, wxAccessible** toObject) override; #endif private: