diff --git a/include/wx/generic/dvrenderers.h b/include/wx/generic/dvrenderers.h index b424eeef6e..d89db266a3 100644 --- a/include/wx/generic/dvrenderers.h +++ b/include/wx/generic/dvrenderers.h @@ -36,6 +36,10 @@ public: return ActivateCell(cell, model, item, col, mouseEvent); } +#if wxUSE_ACCESSIBILITY + virtual wxString GetAccessibleDescription() const wxOVERRIDE; +#endif // wxUSE_ACCESSIBILITY + private: wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer); }; diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index f0d31c7d86..18c5f333c2 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -2234,14 +2234,15 @@ public: order to write a new renderer. You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue, - wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render and, if - @c wxUSE_ACCESSIBILITY setup symbol is set to 1, also - wxDataViewRenderer::GetAccessibleDescription. + wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render. If you want your renderer to support in-place editing then you also need to override wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl and wxDataViewCustomRenderer::GetValueFromEditorCtrl. + If @c wxUSE_ACCESSIBILITY setup symbol is set to 1, you might need to override also + wxDataViewRenderer::GetAccessibleDescription. + Note that a special event handler will be pushed onto that editor control which handles @e \ and focus out events in order to end the editing. diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index dc1d6aae3a..1b2afc11d0 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1012,6 +1012,29 @@ wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype, { } +#if wxUSE_ACCESSIBILITY +wxString wxDataViewCustomRenderer::GetAccessibleDescription() const +{ + wxVariant val; + GetValue(val); + + wxString strVal; + if ( val.IsType(wxS("bool")) ) + { + /* TRANSLATORS: Name of Boolean true value */ + strVal = val.GetBool() ? _("true") + /* TRANSLATORS: Name of Boolean false value */ + : _("false"); + } + else + { + strVal = val.MakeString(); + } + + return strVal; +} +#endif // wxUSE_ACCESSIBILITY + // --------------------------------------------------------- // wxDataViewTextRenderer // ---------------------------------------------------------