Fix wxDataViewCtrlAccessible::GetName() and GetDescription()
Call wxDataViewRenderer::GetAccessibleDescription() to retrieve the content of the renderer instead of using a raw item value taken from wxDataViewModel. GetAccessibleDescription() returns a renderer-aware text dedicated for accessibility purposes and hence text presented in GetName() and GetDescription() is accurate in contrary to the text deduced from the item value.
This commit is contained in:
@@ -5765,23 +5765,18 @@ wxAccStatus wxDataViewCtrlAccessible::GetName(int childId, wxString* name)
|
||||
|
||||
wxVariant value;
|
||||
model->GetValue(value, item, dvCol->GetModelColumn());
|
||||
if ( !value.IsNull() && !value.IsType(wxS("bool")) )
|
||||
{
|
||||
wxString vs = value.MakeString();
|
||||
if ( value.IsNull() || value.IsType(wxS("bool")) )
|
||||
continue; // Skip non-textual items
|
||||
|
||||
wxDataViewRenderer* r = dvCol->GetRenderer();
|
||||
r->PrepareForItem(model, item, dvCol->GetModelColumn());
|
||||
wxString vs = r->GetAccessibleDescription();
|
||||
if ( !vs.empty() )
|
||||
{
|
||||
wxString colName = dvCol->GetTitle();
|
||||
// If column has no label then present its index.
|
||||
if ( colName.empty() )
|
||||
{
|
||||
// Columns are numbered from 1.
|
||||
colName = wxString::Format(_("Column %u"), col+1);
|
||||
}
|
||||
itemName = colName + wxS(": ") + vs;
|
||||
itemName = vs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( itemName.empty() )
|
||||
{
|
||||
@@ -5924,27 +5919,17 @@ wxAccStatus wxDataViewCtrlAccessible::GetDescription(int childId, wxString* desc
|
||||
if ( dvCol->IsHidden() )
|
||||
continue; // skip it
|
||||
|
||||
wxString valStr;
|
||||
wxVariant value;
|
||||
model->GetValue(value, item, dvCol->GetModelColumn());
|
||||
if ( value.IsNull() )
|
||||
{
|
||||
valStr = _("null");
|
||||
}
|
||||
else if ( value.IsType(wxS("bool")) )
|
||||
{
|
||||
valStr = value.GetBool() ? _("yes") : _("no");
|
||||
}
|
||||
else
|
||||
{
|
||||
// First textual item is returned as Name property
|
||||
// so it needs to be skipped for Description.
|
||||
valStr = value.MakeString();
|
||||
if ( !valStr.empty() && !firstTextSkipped )
|
||||
|
||||
wxDataViewRenderer* r = dvCol->GetRenderer();
|
||||
r->PrepareForItem(model, item, dvCol->GetModelColumn());
|
||||
wxString valStr = r->GetAccessibleDescription();
|
||||
// Skip first textual item
|
||||
if ( !firstTextSkipped && !value.IsNull() && !value.IsType(wxS("bool")) && !valStr.empty() )
|
||||
{
|
||||
firstTextSkipped = true;
|
||||
valStr.Empty();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !valStr.empty() )
|
||||
|
Reference in New Issue
Block a user