From 7dab555f7118f24e70444ff6d6411433b730b889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 20 Nov 2016 17:35:32 +0100 Subject: [PATCH] Don't create wxWindowAccessible by default Don't unconditionally use wxWidgets' implementation of IAccessible for all windows when wxUSE_ACCESSIBILITY is 1, because it is inferior to the system provided one: it often lacks appropriate labels, doesn't fully support navigation and wxIAccessible isn't fully implemented. The approach, when using MSAA, recommended by Microsoft documentation is to customize accessibility for custom controls only, by proxying to the standard and overriding what is necessary. By making this change, user code is still allowed to customize accessibility if needed, without negatively impacting standard controls that don't need any custom code. See also https://github.com/wxWidgets/wxWidgets/pull/340 --- docs/changes.txt | 4 ++++ include/wx/window.h | 5 +++-- src/common/wincmn.cpp | 6 ------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 6d255dd98c..cefce2aeb3 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -38,6 +38,10 @@ Changes in behaviour not resulting in compilation errors for getting the micro version. If you override GetToolkitVersion() you need to add this new third parameter. +- wxWindow::CreateAccessible() doesn't return accessible object by default + anymore and GetOrCreateAccessible() may return NULL, indicating that native + system-provided accessibility should be used. + Changes in behaviour which may result in build errors ----------------------------------------------------- diff --git a/include/wx/window.h b/include/wx/window.h index ca168dd6fd..e65b5a6d96 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -1449,7 +1449,7 @@ public: // ---------------------- #if wxUSE_ACCESSIBILITY // Override to create a specific accessible object. - virtual wxAccessible* CreateAccessible(); + virtual wxAccessible* CreateAccessible() { return NULL; } // Sets the accessible object. void SetAccessible(wxAccessible* accessible) ; @@ -1457,7 +1457,8 @@ public: // Returns the accessible object. wxAccessible* GetAccessible() { return m_accessible; } - // Returns the accessible object, creating if necessary. + // Returns the accessible object, calling CreateAccessible if necessary. + // May return NULL, in which case system-provide accessible is used. wxAccessible* GetOrCreateAccessible() ; #endif diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 77323f2498..f9cb00a5db 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -3186,12 +3186,6 @@ wxAccessible* wxWindowBase::GetOrCreateAccessible() return m_accessible; } -// Override to create a specific accessible object. -wxAccessible* wxWindowBase::CreateAccessible() -{ - return new wxWindowAccessible((wxWindow*) this); -} - #endif // ----------------------------------------------------------------------------