summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/accessible/iaccessible2.cpp
diff options
context:
space:
mode:
authorJan-Arve Saether <jan-arve.saether@nokia.com>2012-04-11 07:58:20 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-13 15:50:27 +0200
commit6fc44c59263a19b6697de980c70e085f0f2922c4 (patch)
tree9895b714585ceef511ed49eacb2da5a86b46b00a /src/plugins/platforms/windows/accessible/iaccessible2.cpp
parentbfcfbc592c47a855c05929cfd6649003c16698c3 (diff)
Minor cleanup of the header file.
Move inline implementations to iaccessible2.cpp. Makes it easier to read and navigate the source code. Change-Id: I8da44ba0d40395356f612ff6b3ce2a808105838a Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'src/plugins/platforms/windows/accessible/iaccessible2.cpp')
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp68
1 files changed, 67 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index be680e7d48..ddab3cb0f2 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -114,6 +114,68 @@ HRESULT STDMETHODCALLTYPE AccessibleApplication::get_toolkitVersion(/* [retval][
}
+/**************************************************************\
+ * AccessibleRelation *
+ **************************************************************/
+AccessibleRelation::AccessibleRelation(const QList<QAccessibleInterface *> &targets,
+ QAccessible::Relation relation)
+ : m_targets(targets), m_relation(relation), m_ref(1)
+{
+ Q_ASSERT(m_targets.count());
+}
+
+/* IUnknown */
+HRESULT STDMETHODCALLTYPE AccessibleRelation::QueryInterface(REFIID id, LPVOID *iface)
+{
+ *iface = 0;
+ if (id == IID_IUnknown)
+ *iface = (IUnknown*)this;
+
+ if (*iface) {
+ AddRef();
+ return S_OK;
+ }
+
+ return E_NOINTERFACE;
+}
+
+ULONG STDMETHODCALLTYPE AccessibleRelation::AddRef()
+{
+ return ++m_ref;
+}
+
+ULONG STDMETHODCALLTYPE AccessibleRelation::Release()
+{
+ if (!--m_ref) {
+ delete this;
+ return 0;
+ }
+ return m_ref;
+}
+
+/* IAccessibleRelation */
+HRESULT STDMETHODCALLTYPE AccessibleRelation::get_relationType(
+ /* [retval][out] */ BSTR *relationType)
+{
+ *relationType = relationToBSTR(m_relation);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE AccessibleRelation::get_localizedRelationType(
+ /* [retval][out] */ BSTR *localizedRelationType)
+{
+ // Who ever needs this???
+ *localizedRelationType = relationToBSTR(m_relation);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE AccessibleRelation::get_nTargets(
+ /* [retval][out] */ long *nTargets)
+{
+ // ### always one target
+ *nTargets = m_targets.count();
+ return S_OK;
+}
/*!
\internal
@@ -140,7 +202,7 @@ HRESULT STDMETHODCALLTYPE AccessibleRelation::get_target(
(see "Special Consideration when using Arrays", in Accessible2.idl)
*/
HRESULT STDMETHODCALLTYPE AccessibleRelation::get_targets(
- /* [in] */ long maxTargets, // Hmmm, ignore ???
+ /* [in] */ long maxTargets,
/* [length_is][size_is][out] */ IUnknown **targets,
/* [retval][out] */ long *nTargets)
{
@@ -215,6 +277,10 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryInterface(REFIID id, LPVOI
return hr;
}
+
+/* Note that IUnknown is inherited from several interfaces. Therefore we must reimplement all its
+ functions in the concrete class to avoid ambiguity.
+*/
ULONG STDMETHODCALLTYPE QWindowsIA2Accessible::AddRef()
{
return QWindowsMsaaAccessible::AddRef();