コード例 #1
0
IFACEMETHODIMP CTriColorFragmentProvider::Navigate(_In_ NavigateDirection direction, _Outptr_result_maybenull_ IRawElementProviderFragment ** retVal)
{
    *retVal = nullptr;
    ComPtr<IInspectable> spFragment;
    HRESULT hr = CheckDisconnected();
    if (SUCCEEDED(hr))
    {
        if (direction == NavigateDirection_Parent)
        {
            hr = m_control->GetTriColorControlProvider(&spFragment);
        }
        else if (direction == NavigateDirection_NextSibling)
        {
            if (!TriColorValueHelper::IsLast(m_value))
            {
                hr = m_control->GetTriColorFragmentProvider(TriColorValueHelper::NextValue(m_value), &spFragment);
            }
        }
        else if (direction == NavigateDirection_PreviousSibling)
        {
            if (!TriColorValueHelper::IsFirst(m_value))
            {
                hr = m_control->GetTriColorFragmentProvider(TriColorValueHelper::PreviousValue(m_value), &spFragment);
            }
        }
    }

    if (SUCCEEDED(hr) && spFragment != nullptr)
    {
        hr = spFragment.Get()->QueryInterface(IID_PPV_ARGS(retVal));
    }

    // For the other directions (first child, last child) the default of nullptr is correct
    return hr;
}
コード例 #2
0
STDMETHODIMP CTriColorFragmentProvider::get_SelectionContainer(_Outptr_result_maybenull_ IRawElementProviderSimple **retVal)
{
    *retVal = nullptr;
    HRESULT hr = CheckDisconnected();
    if (SUCCEEDED(hr))
    {
        ComPtr<IInspectable> spParentFragment;
        hr = m_control->GetTriColorControlProvider(&spParentFragment);
        if (SUCCEEDED(hr))
        {
            hr = spParentFragment.Get()->QueryInterface(IID_PPV_ARGS(retVal));
        }
    }
    return hr;
}