From 9ff563b0f832423e0b7f1c8773923d3464faac94 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 18 Dec 2016 22:37:49 +0100 Subject: [PATCH] Use special "wxDataView" Windows class name in wxMSW This makes it possible for the screen readers to handle wxDataViewCtrl specially and better than by default. --- src/generic/datavgen.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index e2e3371947..4b784898e3 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -22,6 +22,7 @@ #ifndef WX_PRECOMP #ifdef __WXMSW__ + #include "wx/app.h" // GetRegisteredClassName() #include "wx/msw/private.h" #include "wx/msw/wrapwin.h" #include "wx/msw/wrapcctl.h" // include "properly" @@ -1689,9 +1690,26 @@ wxBEGIN_EVENT_TABLE(wxDataViewMainWindow,wxWindow) wxEND_EVENT_TABLE() wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, const wxString &name ) : - wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE, name ) + const wxPoint &pos, const wxSize &size, const wxString &name ) { + // We want to use a specific class name for this window in wxMSW to make it + // possible to configure screen readers to handle it specifically. +#ifdef __WXMSW__ + CreateUsingMSWClass + ( + wxApp::GetRegisteredClassName + ( + wxT("wxDataView"), + -1, // no specific background brush + 0, // no special styles neither + wxApp::RegClass_OnlyNR + ), + parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE, name + ); +#else + Create( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE, name ) +#endif + SetOwner( parent ); m_editorRenderer = NULL;