summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorJan-Arve Saether <jan-arve.saether@nokia.com>2012-03-08 10:18:58 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-24 11:53:49 +0100
commit015bc43da010456460dd594d35118ce35d006469 (patch)
treeaabe8181e87566fe2f7312c8b874b7debcac76a6 /src/plugins/platforms/windows
parentd86e101d1bbee6865aa78f131a072e732e2136ae (diff)
API cleanup: remove CoordinateType enum
The bridge can do the mapping to and from screen position. This is now done in the windows bridge. Change-Id: I5ca5df0fbeeb58202539f55a0f62717fb1685092 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp9
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.h34
2 files changed, 39 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index f22349714f..719169f78f 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -1028,6 +1028,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_caretOffset(long *offset)
return E_FAIL;
}
+
HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_characterExtents(long offset,
enum IA2CoordinateType coordType,
long *x,
@@ -1037,9 +1038,8 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_characterExtents(long offse
{
accessibleDebugClientCalls(accessible);
if (QAccessibleTextInterface *text = textInterface()) {
- const QRect rect = text->characterRect(offset, (QAccessible2::CoordinateType)coordType);
- *x = rect.x();
- *y = rect.y();
+ QRect rect = text->characterRect(offset);
+ mapFromScreenPos(coordType, rect.topLeft(), x, y);
*width = rect.width();
*height = rect.height();
return S_OK;
@@ -1064,7 +1064,8 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_offsetAtPoint(long x,
{
accessibleDebugClientCalls(accessible);
if (QAccessibleTextInterface *text = textInterface()) {
- *offset = text->offsetAtPoint(QPoint(x,y), (QAccessible2::CoordinateType)coordType);
+ QPoint screenPos = mapToScreenPos(coordType, x, y);
+ *offset = text->offsetAtPoint(screenPos);
return (*offset >=0 ? S_OK : S_FALSE);
}
return E_FAIL;
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.h b/src/plugins/platforms/windows/accessible/iaccessible2.h
index a59263fba1..1af3041a79 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.h
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.h
@@ -229,6 +229,40 @@ private:
return accessible->tableCellInterface();
}
+ /*!
+ \internal
+ \a screenPos is in screen relative position
+ \a x and \y (out) is in parent relative position if coordType == IA2_COORDTYPE_PARENT_RELATIVE
+ */
+ void mapFromScreenPos(enum IA2CoordinateType coordType, const QPoint &screenPos, long *x, long *y) const {
+ if (coordType == IA2_COORDTYPE_PARENT_RELATIVE) {
+ // caller wants relative to parent
+ if (QAccessibleInterface *parent = accessible->parent()) {
+ const QRect parentScreenRect = parent->rect();
+ *x = parentScreenRect.x() - screenPos.x();
+ *y = parentScreenRect.y() - screenPos.y();
+ return;
+ }
+ }
+ *x = screenPos.x();
+ *y = screenPos.y();
+ }
+
+ /*!
+ \internal
+ \a x and \y is in parent relative position if coordType == IA2_COORDTYPE_PARENT_RELATIVE
+ \return a screen relative position
+ */
+ QPoint mapToScreenPos(enum IA2CoordinateType coordType, long x, long y) const {
+ if (coordType == IA2_COORDTYPE_PARENT_RELATIVE) {
+ if (QAccessibleInterface *parent = accessible->parent()) {
+ const QRect parentScreenRect = parent->rect();
+ return QPoint(parentScreenRect.x() + x, parentScreenRect.y() + y);
+ }
+ }
+ return QPoint(x,y);
+ }
+
HRESULT getRelationsHelper(IAccessibleRelation **relations, int startIndex, long maxRelations, long *nRelations = 0);
HRESULT wrapListOfCells(const QList<QAccessibleInterface*> &inputCells, IUnknown ***outputAccessibles, long *nCellCount);
uint uniqueID() const;