Add wxACC_INVALID_ARG error code to wxAccStatus enum

Since accessibility framework supports signaling E_INVALIDARG error, it would be good to have a corresponding flag indicating this error in wxAccessible functions.
In response to wxACC_INVALID_ARG returned by wxAccessible functions, wxIAccessible should return E_INVALIDARG to the framework.
This commit is contained in:
Artur Wieczorek
2016-10-03 20:43:00 +02:00
parent ad684a814a
commit fb5f6c4720
4 changed files with 50 additions and 2 deletions

View File

@@ -137,6 +137,8 @@ wxMSW:
- Fix wxMemoryDC::Blit() with itself as source (Tim Roberts). - Fix wxMemoryDC::Blit() with itself as source (Tim Roberts).
- Return proper value from wxIAccessible::get_accSelection() if no children - Return proper value from wxIAccessible::get_accSelection() if no children
are selected. are selected.
- Add wxAccStatus::wxACC_INVALID_ARG error code to indicate argument-related
errors in wxAccessible methods.
wxOSX: wxOSX:

View File

@@ -27,7 +27,8 @@ enum wxAccStatus
wxACC_FALSE, wxACC_FALSE,
wxACC_OK, wxACC_OK,
wxACC_NOT_IMPLEMENTED, wxACC_NOT_IMPLEMENTED,
wxACC_NOT_SUPPORTED wxACC_NOT_SUPPORTED,
wxACC_INVALID_ARG
}; };
// Child ids are integer identifiers from 1 up. // Child ids are integer identifiers from 1 up.

View File

@@ -16,7 +16,12 @@ enum wxAccStatus
wxACC_FALSE, //!< The function returned false. wxACC_FALSE, //!< The function returned false.
wxACC_OK, //!< The function completed successfully. wxACC_OK, //!< The function completed successfully.
wxACC_NOT_IMPLEMENTED, //!< The function is not implemented. wxACC_NOT_IMPLEMENTED, //!< The function is not implemented.
wxACC_NOT_SUPPORTED //!< The function is not supported. wxACC_NOT_SUPPORTED, //!< The function is not supported.
/**
An argument is not valid (e.g. it does not make sense
for the specified object).
*/
wxACC_INVALID_ARG
}; };

View File

@@ -385,6 +385,8 @@ STDMETHODIMP wxIAccessible::accHitTest(long xLeft, long yLeft, VARIANT* pVarID)
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
@@ -451,6 +453,8 @@ STDMETHODIMP wxIAccessible::accLocation ( long* pxLeft, long* pyTop, long* pcxWi
wxAccStatus status = m_pAccessible->GetLocation(rect, varID.lVal); wxAccStatus status = m_pAccessible->GetLocation(rect, varID.lVal);
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
@@ -570,6 +574,12 @@ STDMETHODIMP wxIAccessible::accNavigate ( long navDir, VARIANT varStart, VARIANT
return E_FAIL; return E_FAIL;
} }
if (status == wxACC_INVALID_ARG)
{
wxLogTrace(wxS("access"), wxS("Invalid argument passed to wxAccessible::Navigate"));
return E_INVALIDARG;
}
if (status == wxACC_FALSE) if (status == wxACC_FALSE)
{ {
wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate found no object in this direction")); wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate found no object in this direction"));
@@ -670,6 +680,11 @@ STDMETHODIMP wxIAccessible::get_accChild ( VARIANT varChildID, IDispatch** ppDis
wxLogTrace(wxT("access"), wxT("GetChild failed")); wxLogTrace(wxT("access"), wxT("GetChild failed"));
return E_FAIL; return E_FAIL;
} }
if (status == wxACC_INVALID_ARG)
{
wxLogTrace(wxS("access"), wxS("Invalid argument passed to GetChild"));
return E_INVALIDARG;
}
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
@@ -844,6 +859,9 @@ STDMETHODIMP wxIAccessible::accDoDefaultAction(VARIANT varID)
if (status == wxACC_NOT_SUPPORTED) if (status == wxACC_NOT_SUPPORTED)
return DISP_E_MEMBERNOTFOUND; return DISP_E_MEMBERNOTFOUND;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
// Try to use child object directly. // Try to use child object directly.
@@ -887,6 +905,9 @@ STDMETHODIMP wxIAccessible::get_accDefaultAction ( VARIANT varID, BSTR* pszDefau
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_SUPPORTED) if (status == wxACC_NOT_SUPPORTED)
return DISP_E_MEMBERNOTFOUND; return DISP_E_MEMBERNOTFOUND;
@@ -946,6 +967,8 @@ STDMETHODIMP wxIAccessible::get_accDescription ( VARIANT varID, BSTR* pszDescrip
wxAccStatus status = m_pAccessible->GetDescription(varID.lVal, & description); wxAccStatus status = m_pAccessible->GetDescription(varID.lVal, & description);
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
@@ -1003,6 +1026,8 @@ STDMETHODIMP wxIAccessible::get_accHelp ( VARIANT varID, BSTR* pszHelp)
wxAccStatus status = m_pAccessible->GetHelpText(varID.lVal, & helpString); wxAccStatus status = m_pAccessible->GetHelpText(varID.lVal, & helpString);
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
@@ -1108,6 +1133,8 @@ STDMETHODIMP wxIAccessible::get_accKeyboardShortcut ( VARIANT varID, BSTR* pszKe
wxAccStatus status = m_pAccessible->GetKeyboardShortcut(varID.lVal, & keyboardShortcut); wxAccStatus status = m_pAccessible->GetKeyboardShortcut(varID.lVal, & keyboardShortcut);
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
@@ -1170,6 +1197,9 @@ STDMETHODIMP wxIAccessible::get_accName ( VARIANT varID, BSTR* pszName)
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
// Try to use child object directly. // Try to use child object directly.
@@ -1223,6 +1253,9 @@ STDMETHODIMP wxIAccessible::get_accRole ( VARIANT varID, VARIANT* pVarRole)
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
// Try to use child object directly. // Try to use child object directly.
@@ -1279,6 +1312,8 @@ STDMETHODIMP wxIAccessible::get_accState ( VARIANT varID, VARIANT* pVarState)
wxAccStatus status = m_pAccessible->GetState(varID.lVal, & wxstate); wxAccStatus status = m_pAccessible->GetState(varID.lVal, & wxstate);
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
@@ -1332,6 +1367,9 @@ STDMETHODIMP wxIAccessible::get_accValue ( VARIANT varID, BSTR* pszValue)
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {
// Try to use child object directly. // Try to use child object directly.
@@ -1382,6 +1420,8 @@ STDMETHODIMP wxIAccessible::accSelect ( long flagsSelect, VARIANT varID )
wxAccStatus status = m_pAccessible->Select(varID.lVal, wxsel); wxAccStatus status = m_pAccessible->Select(varID.lVal, wxsel);
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;
if (status == wxACC_INVALID_ARG)
return E_INVALIDARG;
if (status == wxACC_NOT_IMPLEMENTED) if (status == wxACC_NOT_IMPLEMENTED)
{ {