1 #pragma once
2 #include "uiautomation.h"
3 
4 class resource_item_provider : public IRawElementProviderSimple,
5     public IRawElementProviderFragment,
6     public ISelectionItemProvider,
7     public IExpandCollapseProvider,
8     public IScrollItemProvider
9 {
10 public:
11 
12     // Constructor / destructor
13     resource_item_provider(resource_item *pControl);
14 
15     // IUnknown methods
16     IFACEMETHODIMP_(ULONG) AddRef();
17     IFACEMETHODIMP_(ULONG) Release();
18     IFACEMETHODIMP QueryInterface(REFIID riid, void** ppInterface);
19 
20     // IRawElementProviderSimple methods
21     IFACEMETHODIMP get_ProviderOptions(ProviderOptions* pRetVal);
22     IFACEMETHODIMP GetPatternProvider(PATTERNID iid, IUnknown** pRetVal);
23     IFACEMETHODIMP GetPropertyValue(PROPERTYID idProp, VARIANT* pRetVal);
24     IFACEMETHODIMP get_HostRawElementProvider(IRawElementProviderSimple** pRetVal);
25 
26     // IRawElementProviderFragment methods
27     IFACEMETHODIMP Navigate(NavigateDirection direction, IRawElementProviderFragment** pRetVal);
28     IFACEMETHODIMP GetRuntimeId(SAFEARRAY** pRetVal);
29     IFACEMETHODIMP get_BoundingRectangle(UiaRect* pRetVal);
30     IFACEMETHODIMP GetEmbeddedFragmentRoots(SAFEARRAY** pRetVal);
31     IFACEMETHODIMP SetFocus();
32     IFACEMETHODIMP get_FragmentRoot(IRawElementProviderFragmentRoot** pRetVal);
33 
34     // ISelectionItemProvider methods
35     IFACEMETHODIMP Select();
36     IFACEMETHODIMP AddToSelection();
37     IFACEMETHODIMP RemoveFromSelection();
38     IFACEMETHODIMP get_IsSelected(BOOL* pRetVal);
39     IFACEMETHODIMP get_SelectionContainer(IRawElementProviderSimple** pRetVal);
40 
41     // IExpandCollapseProvider methods
42     IFACEMETHODIMP Expand();
43     IFACEMETHODIMP Collapse();
44     IFACEMETHODIMP get_ExpandCollapseState(ExpandCollapseState* pRetVal);
45 
46     // IScrollItemProvider methods
47     IFACEMETHODIMP ScrollIntoView();
48 
49     // Various methods
50     void RaiseSelectElementEvent();
51     void RaiseChangeFocusEvent();
52     void RaiseExpandCollapseAutomationEvent(BOOL oldValue, BOOL newValue);
53 
54     int GetCurrentPositionInSet();
55     int GetCurrentSizeOfSet();
56     int GetCurrentLevel();
57 
58 private:
59     virtual ~resource_item_provider();
60 
61     // Ref Counter for this COM object
62     ULONG m_refCount;
63 
64     // Pointers to the owning item control and list control.
65     resource_item *m_pResItemControl;
66     resource_view *m_pResViewControl;
67 };
68