summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm24
-rw-r--r--src/plugins/platforms/cocoa/qnsviewaccessibility.mm6
3 files changed, 14 insertions, 23 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
index 8251bbcea6..c22c1c84a4 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
@@ -48,16 +48,13 @@
@class QCocoaAccessibleElement;
@interface QCocoaAccessibleElement : NSObject {
- NSUInteger index;
NSString *role;
NSObject * parent;
void *accessibleInterface;
-
}
-- (id)initWithIndex:(int)aIndex parent:(id)aParent accessibleInterface:(void *)anQAccessibleInterface;
-+ (QCocoaAccessibleElement *)elementWithIndex:(int)aIndex parent:(id)aParent accessibleInterface:(void *)anQAccessibleInterface;
-- (NSUInteger)index;
+- (id)initWithInterface:(void *)anQAccessibleInterface parent:(id)aParent;
++ (QCocoaAccessibleElement *)elementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent;
@end
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 2d1d5cd1a6..1e9f021543 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -54,23 +54,21 @@ static QAccessibleInterface *acast(void *ptr)
@implementation QCocoaAccessibleElement
-- (id)initWithIndex:(int)aIndex parent:(id)aParent accessibleInterface:(void *)anQAccessibleInterface
+- (id)initWithInterface:(void *)anQAccessibleInterface parent:(id)aParent
{
self = [super init];
if (self) {
- index = aIndex;
accessibleInterface = anQAccessibleInterface;
role = QCocoaAccessible::macRole(acast(accessibleInterface)->role());
parent = aParent;
-
}
return self;
}
-+ (QCocoaAccessibleElement *)elementWithIndex:(int)aIndex parent:(id)aParent accessibleInterface:(void *)anQAccessibleInterface
++ (QCocoaAccessibleElement *)elementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent
{
- return [[[self alloc] initWithIndex:aIndex parent:aParent accessibleInterface:anQAccessibleInterface] autorelease];
+ return [[[self alloc] initWithInterface:anQAccessibleInterface parent:aParent] autorelease];
}
- (void)dealloc {
@@ -80,17 +78,14 @@ static QAccessibleInterface *acast(void *ptr)
- (BOOL)isEqual:(id)object {
if ([object isKindOfClass:[QCocoaAccessibleElement class]]) {
QCocoaAccessibleElement *other = object;
- return (index == other->index) && [role isEqualToString:other->role] && [parent isEqual:other->parent];
- } else
+ return acast(other->accessibleInterface)->object() == acast(accessibleInterface)->object();
+ } else {
return NO;
+ }
}
- (NSUInteger)hash {
- return [parent hash] + index;
-}
-
-- (NSUInteger)index {
- return index;
+ return qHash(acast(accessibleInterface)->object());
}
//
@@ -129,7 +124,7 @@ static QAccessibleInterface *acast(void *ptr)
NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids];
for (int i = 0; i < numKids; ++i) {
QAccessibleInterface *childInterface = acast(accessibleInterface)->child(i);
- [kids addObject:[QCocoaAccessibleElement elementWithIndex:i parent:self accessibleInterface:(void*)childInterface]];
+ [kids addObject:[QCocoaAccessibleElement elementWithInterface:(void*)childInterface parent:self]];
}
return NSAccessibilityUnignoredChildren(kids);
@@ -232,8 +227,7 @@ static QAccessibleInterface *acast(void *ptr)
}
// hit a child, forward to child accessible interface.
- int childIndex = acast(accessibleInterface)->indexOfChild(childInterface);
- QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:childIndex parent:self accessibleInterface: childInterface];
+ QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithInterface:childInterface parent:self];
return [accessibleElement accessibilityHitTest:point];
}
diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
index 3c16973c5a..854d292b09 100644
--- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
@@ -75,7 +75,7 @@
int numKids = m_accessibleRoot->childCount();
NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids];
for (int i = 0; i < numKids; ++i) {
- [kids addObject:[QCocoaAccessibleElement elementWithIndex:i parent:self accessibleInterface:(void*)m_accessibleRoot->child(i)]];
+ [kids addObject:[QCocoaAccessibleElement elementWithInterface: m_accessibleRoot->child(i) parent:self ]];
}
return NSAccessibilityUnignoredChildren(kids);
@@ -96,8 +96,8 @@
}
// Hit a child, forward to child accessible interface.
- int childIndex = m_accessibleRoot->indexOfChild(childInterface);
- QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:childIndex -1 parent:self accessibleInterface: childInterface];
+
+ QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithInterface: childInterface parent:self ];
return [accessibleElement accessibilityHitTest:point];
}