LMMS
Loading...
Searching...
No Matches
juce_win32_UIAGridProvider.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
31 public ComBaseClassHelper<ComTypes::IGridProvider>
32{
33public:
35
36 //==============================================================================
37 JUCE_COMRESULT GetItem (int row, int column, IRawElementProviderSimple** pRetVal) override
38 {
39 return withTableInterface (pRetVal, [&] (const AccessibilityTableInterface& tableInterface)
40 {
41 if (! isPositiveAndBelow (row, tableInterface.getNumRows())
42 || ! isPositiveAndBelow (column, tableInterface.getNumColumns()))
43 return E_INVALIDARG;
44
45 JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
46
47 if (auto* handler = tableInterface.getCellHandler (row, column))
48 handler->getNativeImplementation()->QueryInterface (IID_PPV_ARGS (pRetVal));
49
51
52 return S_OK;
53 });
54 }
55
56 JUCE_COMRESULT get_RowCount (int* pRetVal) override
57 {
58 return withTableInterface (pRetVal, [&] (const AccessibilityTableInterface& tableInterface)
59 {
60 *pRetVal = tableInterface.getNumRows();
61 return S_OK;
62 });
63 }
64
65 JUCE_COMRESULT get_ColumnCount (int* pRetVal) override
66 {
67 return withTableInterface (pRetVal, [&] (const AccessibilityTableInterface& tableInterface)
68 {
69 *pRetVal = tableInterface.getNumColumns();
70 return S_OK;
71 });
72 }
73
74private:
75 template <typename Value, typename Callback>
76 JUCE_COMRESULT withTableInterface (Value* pRetVal, Callback&& callback) const
77 {
78 return withCheckedComArgs (pRetVal, *this, [&]() -> HRESULT
79 {
80 if (auto* tableInterface = getHandler().getTableInterface())
81 return callback (*tableInterface);
82
83 return (HRESULT) UIA_E_NOTSUPPORTED;
84 });
85 }
86
87 //==============================================================================
89};
90
91} // namespace juce
Definition juce_AccessibilityTableInterface.h:37
virtual int getNumColumns() const =0
virtual const AccessibilityHandler * getCellHandler(int row, int column) const =0
virtual int getNumRows() const =0
ComBaseClassHelper(unsigned int initialRefCount=1)
Definition juce_win32_ComSmartPtr.h:203
Definition juce_win32_UIAGridProvider.h:32
JUCE_COMRESULT get_RowCount(int *pRetVal) override
Definition juce_win32_UIAGridProvider.h:56
JUCE_COMRESULT withTableInterface(Value *pRetVal, Callback &&callback) const
Definition juce_win32_UIAGridProvider.h:76
JUCE_COMRESULT get_ColumnCount(int *pRetVal) override
Definition juce_win32_UIAGridProvider.h:65
UIAProviderBase(AccessibilityNativeHandle *nativeHandleIn)
Definition juce_win32_UIAProviderBase.h:33
JUCE_COMRESULT GetItem(int row, int column, IRawElementProviderSimple **pRetVal) override
Definition juce_win32_UIAGridProvider.h:37
const AccessibilityHandler & getHandler() const
Definition juce_win32_UIAProviderBase.h:46
UIAProviderBase(AccessibilityNativeHandle *nativeHandleIn)
Definition juce_win32_UIAProviderBase.h:33
Definition juce_Value.h:51
#define JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE(...)
Definition juce_CompilerWarnings.h:181
#define JUCE_END_IGNORE_WARNINGS_GCC_LIKE
Definition juce_CompilerWarnings.h:182
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_COMRESULT
Definition juce_win32_ComSmartPtr.h:54
Definition carla_juce.cpp:31
JUCE_COMRESULT withCheckedComArgs(Value *pRetVal, Object &handle, Callback &&callback)
Definition juce_win32_UIAHelpers.h:106
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Definition juce_MathsFunctions.h:279
@ column
Definition juce_AccessibilityRole.h:52
@ row
Definition juce_AccessibilityRole.h:53
RECT const char void(* callback)(const char *droppath))) SWELL_API_DEFINE(BOOL
Definition swell-functions.h:1004
#define S_OK
Definition swell-types.h:53
signed int HRESULT
Definition swell-types.h:181
void handler(int signal)
Definition fileio.c:1632