Implement wxDataViewRenderer::GetAccessibleDescription() method

The purpose of this method is to provide a textual description of the renderer's content to the class implementing accessibility framework in wxDVC (wxDataViewCtrlAccessible).
It is exposed if wxUSE_ACCESSIBILITY is set to 1.
This commit is contained in:
Artur Wieczorek
2016-10-24 21:52:22 +02:00
parent c9ec981a28
commit d9fbde805b
7 changed files with 153 additions and 2 deletions

View File

@@ -52,6 +52,9 @@
#include "wx/weakref.h"
#include "wx/generic/private/markuptext.h"
#include "wx/generic/private/widthcalc.h"
#if wxUSE_ACCESSIBILITY
#include "wx/private/markupparser.h"
#endif // wxUSE_ACCESSIBILITY
//-----------------------------------------------------------------------------
// classes
@@ -1069,6 +1072,17 @@ bool wxDataViewTextRenderer::GetValue( wxVariant& WXUNUSED(value) ) const
return false;
}
#if wxUSE_ACCESSIBILITY
wxString wxDataViewTextRenderer::GetAccessibleDescription() const
{
#if wxUSE_MARKUP
if ( m_markupText )
return wxMarkupParser::Strip(m_text);
#endif // wxUSE_MARKUP
return m_text;
}
#endif // wxUSE_ACCESSIBILITY
bool wxDataViewTextRenderer::HasEditorCtrl() const
{
return true;
@@ -1162,6 +1176,13 @@ bool wxDataViewBitmapRenderer::GetValue( wxVariant& WXUNUSED(value) ) const
return false;
}
#if wxUSE_ACCESSIBILITY
wxString wxDataViewBitmapRenderer::GetAccessibleDescription() const
{
return wxEmptyString;
}
#endif // wxUSE_ACCESSIBILITY
bool wxDataViewBitmapRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
{
if (m_bitmap.IsOk())
@@ -1207,6 +1228,16 @@ bool wxDataViewToggleRenderer::GetValue( wxVariant &WXUNUSED(value) ) const
return false;
}
#if wxUSE_ACCESSIBILITY
wxString wxDataViewToggleRenderer::GetAccessibleDescription() const
{
/* TRANSLATORS: Checkbox state name */
return m_toggle ? _("checked")
/* TRANSLATORS: Checkbox state name */
: _("unchecked");
}
#endif // wxUSE_ACCESSIBILITY
bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
{
int flags = 0;
@@ -1286,6 +1317,13 @@ bool wxDataViewProgressRenderer::GetValue( wxVariant &value ) const
return true;
}
#if wxUSE_ACCESSIBILITY
wxString wxDataViewProgressRenderer::GetAccessibleDescription() const
{
return wxString::Format(wxS("%i"), m_value);
}
#endif // wxUSE_ACCESSIBILITY
bool
wxDataViewProgressRenderer::Render(wxRect rect, wxDC *dc, int WXUNUSED(state))
{
@@ -1333,6 +1371,13 @@ bool wxDataViewIconTextRenderer::GetValue( wxVariant& WXUNUSED(value) ) const
return false;
}
#if wxUSE_ACCESSIBILITY
wxString wxDataViewIconTextRenderer::GetAccessibleDescription() const
{
return m_value.GetText();
}
#endif // wxUSE_ACCESSIBILITY
bool wxDataViewIconTextRenderer::Render(wxRect rect, wxDC *dc, int state)
{
int xoffset = 0;