-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement IRangeValueProvider #12356
base: main
Are you sure you want to change the base?
Changes from 2 commits
5e9e1d0
416dcb1
abdbb9f
874a34b
e10b31a
aa824ce
560e408
4bf6ba9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "initial rangevalueprovider changes", | ||
"packageName": "react-native-windows", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,13 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE | |
AddRef(); | ||
} | ||
|
||
if (patternId == UIA_RangeValuePatternId) { | ||
*pRetVal = static_cast<IRangeValueProvider *>(this); | ||
AddRef(); | ||
} | ||
|
||
|
||
|
||
return S_OK; | ||
} | ||
|
||
|
@@ -405,4 +412,70 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_IsReadOnly(BOOL *pRe | |
return S_OK; | ||
} | ||
|
||
HRESULT __stdcall CompositionDynamicAutomationProvider::SetValue([in] double val) { | ||
auto strongView = m_view.view(); | ||
|
||
if (!strongView) | ||
return UIA_E_ELEMENTNOTAVAILABLE; | ||
|
||
strongView->setAcccessiblityRangeValue(val); | ||
return S_OK; | ||
} | ||
|
||
HRESULT __stdcall CompositionDynamicAutomationProvider::get_LargeChange(double* pRetVal) { | ||
if (pRetVal == nullptr) | ||
return E_POINTER; | ||
|
||
|
||
|
||
return S_OK; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are not going to implement this, you should return quiet NaN: |
||
} | ||
|
||
HRESULT __stdcall CompositionDynamicAutomationProvider::get_Maximum(double *pRetVal) { | ||
if (pRetVal == nullptr) | ||
return E_POINTER; | ||
|
||
auto strongView = m_view.view(); | ||
|
||
if (!strongView) | ||
return UIA_E_ELEMENTNOTAVAILABLE; | ||
|
||
*pRetVal = static_cast<double>(*strongView->getAcccessiblityValueMax()); | ||
|
||
return S_OK; | ||
} | ||
|
||
HRESULT __stdcall CompositionDynamicAutomationProvider::get_Minimum(double *pRetVal) { | ||
if (pRetVal == nullptr) | ||
return E_POINTER; | ||
|
||
auto strongView = m_view.view(); | ||
|
||
if (!strongView) | ||
return UIA_E_ELEMENTNOTAVAILABLE; | ||
|
||
*pRetVal = static_cast<double>(*strongView->getAcccessiblityValueMin()); | ||
|
||
return S_OK; | ||
} | ||
|
||
HRESULT __stdcall CompositionDynamicAutomationProvider::get_SmallChange(double *pRetVal) { | ||
if (pRetVal == nullptr) | ||
return E_POINTER; | ||
return S_OK; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should return quiet NaN |
||
} | ||
|
||
HRESULT __stdcall CompositionDynamicAutomationProvider::get_Value(double *pRetVal) { | ||
if (pRetVal == nullptr) | ||
return E_POINTER; | ||
auto strongView = m_view.view(); | ||
|
||
if (!strongView) | ||
return UIA_E_ELEMENTNOTAVAILABLE; | ||
|
||
*pRetVal = static_cast<double>(*strongView->getAcccessiblityValueNow()); | ||
|
||
return S_OK; | ||
} | ||
|
||
} // namespace winrt::Microsoft::ReactNative::implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably only return this pattern if the role is set to something that aligns with this pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we also do a role check for UIA_ValuePatternId as well (i.e if the role is not 'adjustable' or 'progressbar' since those roles correspond to RangeValuePattern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea i think we'll want roles checks for each of these!