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;
|
wxVariant value;
|
||||||
model->GetValue(value, item, dvCol->GetModelColumn());
|
model->GetValue(value, item, dvCol->GetModelColumn());
|
||||||
if ( !value.IsNull() && !value.IsType(wxS("bool")) )
|
if ( value.IsNull() || value.IsType(wxS("bool")) )
|
||||||
{
|
continue; // Skip non-textual items
|
||||||
wxString vs = value.MakeString();
|
|
||||||
|
wxDataViewRenderer* r = dvCol->GetRenderer();
|
||||||
|
r->PrepareForItem(model, item, dvCol->GetModelColumn());
|
||||||
|
wxString vs = r->GetAccessibleDescription();
|
||||||
if ( !vs.empty() )
|
if ( !vs.empty() )
|
||||||
{
|
{
|
||||||
wxString colName = dvCol->GetTitle();
|
itemName = vs;
|
||||||
// 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;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( itemName.empty() )
|
if ( itemName.empty() )
|
||||||
{
|
{
|
||||||
@@ -5924,27 +5919,17 @@ wxAccStatus wxDataViewCtrlAccessible::GetDescription(int childId, wxString* desc
|
|||||||
if ( dvCol->IsHidden() )
|
if ( dvCol->IsHidden() )
|
||||||
continue; // skip it
|
continue; // skip it
|
||||||
|
|
||||||
wxString valStr;
|
|
||||||
wxVariant value;
|
wxVariant value;
|
||||||
model->GetValue(value, item, dvCol->GetModelColumn());
|
model->GetValue(value, item, dvCol->GetModelColumn());
|
||||||
if ( value.IsNull() )
|
|
||||||
{
|
wxDataViewRenderer* r = dvCol->GetRenderer();
|
||||||
valStr = _("null");
|
r->PrepareForItem(model, item, dvCol->GetModelColumn());
|
||||||
}
|
wxString valStr = r->GetAccessibleDescription();
|
||||||
else if ( value.IsType(wxS("bool")) )
|
// Skip first textual item
|
||||||
{
|
if ( !firstTextSkipped && !value.IsNull() && !value.IsType(wxS("bool")) && !valStr.empty() )
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
firstTextSkipped = true;
|
firstTextSkipped = true;
|
||||||
valStr.Empty();
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !valStr.empty() )
|
if ( !valStr.empty() )
|
||||||
|
Reference in New Issue
Block a user