Implement wxDataViewCustomRenderer::GetAccessibleDescription()

This is a default description of the renderer content (for accessibility purposes).
Thanks to this implementation there is not necessary to override GetAccessibleDescription() in the renderers derived from wxDataViewCustomRenderer.
This commit is contained in:
Artur Wieczorek 2016-10-30 20:59:51 +01:00
parent fb219aaf35
commit 9b8f46df36
3 changed files with 31 additions and 3 deletions

View File

@ -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);
};

View File

@ -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 \<ENTER\> and focus out events in order to end the editing.

View File

@ -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
// ---------------------------------------------------------