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:
parent
c9ec981a28
commit
d9fbde805b
@ -109,6 +109,7 @@ All (GUI):
|
||||
- Fix wxGraphicsMatrixData::Concat() for Direct2D and Cairo renderers.
|
||||
- Fix calculating point position in wxDataViewCtrl::HitTest().
|
||||
- Fix position of the rectangle returned by wxDataViewCtrl::GetItemRect().
|
||||
- Add wxDataViewRenderer::GetAccessibleDescription().
|
||||
|
||||
wxGTK:
|
||||
|
||||
|
@ -114,6 +114,9 @@ public:
|
||||
// before a cell is rendered using this renderer
|
||||
virtual bool SetValue(const wxVariant& value) = 0;
|
||||
virtual bool GetValue(wxVariant& value) const = 0;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const = 0;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
wxString GetVariantType() const { return m_variantType; }
|
||||
|
||||
@ -384,6 +387,9 @@ public:
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
|
||||
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
private:
|
||||
long m_data;
|
||||
@ -411,6 +417,9 @@ public:
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
|
||||
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
wxString GetChoice(size_t index) const { return m_choices[index]; }
|
||||
const wxArrayString& GetChoices() const { return m_choices; }
|
||||
@ -436,6 +445,9 @@ public:
|
||||
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
|
||||
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
};
|
||||
|
||||
|
||||
@ -462,6 +474,9 @@ public:
|
||||
virtual bool GetValueFromEditorCtrl(wxWindow* editor, wxVariant &value) wxOVERRIDE;
|
||||
virtual bool SetValue(const wxVariant &value) wxOVERRIDE;
|
||||
virtual bool GetValue(wxVariant& value) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE;
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
|
||||
|
@ -61,6 +61,9 @@ public:
|
||||
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
|
||||
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
virtual bool Render(wxRect cell, wxDC *dc, int state) wxOVERRIDE;
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
@ -97,6 +100,9 @@ public:
|
||||
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
|
||||
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE;
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
@ -124,6 +130,9 @@ public:
|
||||
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
|
||||
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE;
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
@ -157,6 +166,9 @@ public:
|
||||
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
|
||||
virtual bool GetValue( wxVariant& value ) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
virtual bool Render(wxRect cell, wxDC *dc, int state) wxOVERRIDE;
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
@ -184,6 +196,9 @@ public:
|
||||
|
||||
virtual bool SetValue( const wxVariant &value ) wxOVERRIDE;
|
||||
virtual bool GetValue( wxVariant &value ) const wxOVERRIDE;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
virtual bool Render(wxRect cell, wxDC *dc, int state) wxOVERRIDE;
|
||||
virtual wxSize GetSize() const wxOVERRIDE;
|
||||
|
@ -1853,6 +1853,18 @@ public:
|
||||
*/
|
||||
void DisableEllipsize();
|
||||
|
||||
/**
|
||||
This method returns a string describing the content of the renderer
|
||||
to the class implementing accessibility features in wxDataViewCtrl.
|
||||
|
||||
@note
|
||||
The method is implemented if @c wxUSE_ACCESSIBILITY setup symbol is set
|
||||
to 1.
|
||||
|
||||
@since 3.1.1
|
||||
*/
|
||||
virtual wxString GetAccessibleDescription() const = 0;
|
||||
|
||||
/**
|
||||
Returns the alignment. See SetAlignment()
|
||||
*/
|
||||
@ -2222,7 +2234,9 @@ public:
|
||||
order to write a new renderer.
|
||||
|
||||
You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue,
|
||||
wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render.
|
||||
wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render and, if
|
||||
@c wxUSE_ACCESSIBILITY setup symbol is set to 1, also
|
||||
wxDataViewRenderer::GetAccessibleDescription.
|
||||
|
||||
If you want your renderer to support in-place editing then you also need to override
|
||||
wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl
|
||||
|
@ -1713,6 +1713,13 @@ bool wxDataViewSpinRenderer::GetValue( wxVariant &value ) const
|
||||
return true;
|
||||
}
|
||||
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
wxString wxDataViewSpinRenderer::GetAccessibleDescription() const
|
||||
{
|
||||
return wxString::Format(wxS("%li"), m_data);
|
||||
}
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
#endif // wxUSE_SPINCTRL
|
||||
|
||||
// -------------------------------------
|
||||
@ -1784,6 +1791,13 @@ bool wxDataViewChoiceRenderer::GetValue( wxVariant &value ) const
|
||||
return true;
|
||||
}
|
||||
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
wxString wxDataViewChoiceRenderer::GetAccessibleDescription() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewChoiceByIndexRenderer
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1828,7 +1842,18 @@ bool wxDataViewChoiceByIndexRenderer::GetValue( wxVariant &value ) const
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
wxString wxDataViewChoiceByIndexRenderer::GetAccessibleDescription() const
|
||||
{
|
||||
wxVariant strVal;
|
||||
if ( wxDataViewChoiceRenderer::GetValue(strVal) )
|
||||
return strVal;
|
||||
|
||||
return wxString::Format(wxS("%li"), (long)GetChoices().Index(strVal.GetString()));
|
||||
}
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
#endif // wxHAS_GENERIC_DATAVIEWCTRL
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewDateRenderer
|
||||
@ -1874,6 +1899,13 @@ bool wxDataViewDateRenderer::GetValue(wxVariant& value) const
|
||||
return true;
|
||||
}
|
||||
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
wxString wxDataViewDateRenderer::GetAccessibleDescription() const
|
||||
{
|
||||
return m_date.FormatDate();
|
||||
}
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
bool wxDataViewDateRenderer::Render(wxRect cell, wxDC* dc, int state)
|
||||
{
|
||||
wxString tmp = m_date.FormatDate();
|
||||
|
@ -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;
|
||||
|
@ -466,6 +466,35 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
virtual wxString GetAccessibleDescription() const wxOVERRIDE
|
||||
{
|
||||
wxString text = m_value.GetText();
|
||||
if ( !text.empty() )
|
||||
{
|
||||
text += wxS(" ");
|
||||
}
|
||||
|
||||
switch ( m_value.m_checkedState )
|
||||
{
|
||||
case wxCHK_CHECKED:
|
||||
/* TRANSLATORS: Checkbox state name */
|
||||
text += _("checked");
|
||||
break;
|
||||
case wxCHK_UNCHECKED:
|
||||
/* TRANSLATORS: Checkbox state name */
|
||||
text += _("unchecked");
|
||||
break;
|
||||
case wxCHK_UNDETERMINED:
|
||||
/* TRANSLATORS: Checkbox state name */
|
||||
text += _("undetermined");
|
||||
break;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
|
||||
wxSize GetSize() const wxOVERRIDE
|
||||
{
|
||||
wxSize size = GetCheckSize();
|
||||
|
Loading…
Reference in New Issue
Block a user