Return proper value from wxIAccessible::get_accSelection() if no children are selected

VT_EMPTY VARIANT should be returned if wxAccessible::GetSelections() returns empty list of selected children.
This commit is contained in:
Artur Wieczorek 2016-09-29 23:44:30 +02:00
parent fae271c21c
commit ac96d3949b
3 changed files with 17 additions and 5 deletions

View File

@ -75,6 +75,8 @@ All:
- Handle strings with embedded NULs in wxDataStream (Nitch).
- Don't crash in wxTextFile::GetLastLine() if the file is empty (crohr).
- Add wxString::cbegin() and cend() method (Lauri Nurmi).
- Return proper value from wxIAccessible::get_accSelection() if no children
are selected.
All (GUI):

View File

@ -355,11 +355,13 @@ public:
Gets a variant representing the selected children of this object.
Acceptable values are:
@li a null variant (IsNull() returns @true)
@li a list variant (GetType() == "list")
@li a null variant (@c IsNull() returns @true) if no children
are selected
@li a @c void* pointer to a wxAccessible of selected child object
@li an integer representing the selected child element,
or 0 if this object is selected (GetType() == "long")
@li a "void*" pointer to a wxAccessible child object
or 0 if this object is selected (@c GetType() @c == @c "long")
@li a list variant (@c GetType() @c == @c "list") if multiple child
objects are selected
*/
virtual wxAccStatus GetSelections(wxVariant* selections);

View File

@ -1503,7 +1503,13 @@ STDMETHODIMP wxIAccessible::get_accSelection ( VARIANT * pVarChildren)
}
else
{
if (selections.GetType() == wxT("long"))
if ( selections.IsNull() )
{
pVarChildren->vt = VT_EMPTY;
return S_OK;
}
else if (selections.GetType() == wxT("long"))
{
pVarChildren->vt = VT_I4;
pVarChildren->lVal = selections.GetLong();
@ -1526,6 +1532,8 @@ STDMETHODIMP wxIAccessible::get_accSelection ( VARIANT * pVarChildren)
}
else if (selections.GetType() == wxT("list"))
{
wxASSERT_MSG( selections.GetCount() > 1,
wxS("Multiple child objects should be selected") );
// TODO: should we AddRef for every "void*" member??
wxIEnumVARIANT* enumVariant = new wxIEnumVARIANT(selections);