summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
diff options
context:
space:
mode:
authorScott Kovatch <skovatch>2008-10-24 22:50:06 +0000
committerScott Kovatch <skovatch>2008-10-24 22:50:06 +0000
commitad94482f26fdc1aa6143f6d6829c87f6afbd0735 (patch)
tree91dcc35c22c3d2c5f1a0785ff2041da2a57ec1b7 /bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
parent967b5f8ac93ceb93d50d18c1cc15a5285deca8ab (diff)
downloadeclipse.platform.swt-ad94482f26fdc1aa6143f6d6829c87f6afbd0735.tar.gz
eclipse.platform.swt-ad94482f26fdc1aa6143f6d6829c87f6afbd0735.tar.xz
eclipse.platform.swt-ad94482f26fdc1aa6143f6d6829c87f6afbd0735.zip
252064 - Label needs to override accessibility of cells for image and/or text view as opposed to the 'view' of the control.
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
index 95ea486607..253bc071d8 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
+import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.cocoa.*;
@@ -95,6 +96,45 @@ public Label (Composite parent, int style) {
super (parent, checkStyle (style));
}
+int accessibilityAttributeNames(int /*long*/ id, int /*long*/ sel) {
+
+ if (accessible != null) {
+ if ((textView != null && (id == textView.id || id == textView.cell().id)) || (imageView != null && (id == imageView.id || id == imageView.cell().id))) {
+ // See if the accessible will override or augment the standard list.
+ // Help, title, and description can be overridden.
+ NSMutableArray extraAttributes = NSMutableArray.arrayWithCapacity(3);
+ extraAttributes.addObject(OS.NSAccessibilityHelpAttribute);
+ extraAttributes.addObject(OS.NSAccessibilityDescriptionAttribute);
+ extraAttributes.addObject(OS.NSAccessibilityTitleAttribute);
+
+ for (int i = extraAttributes.count() - 1; i >= 0; i--) {
+ NSString attribute = new NSString(extraAttributes.objectAtIndex(i).id);
+ if (accessible.internal_accessibilityAttributeValue(attribute, ACC.CHILDID_SELF) == null) {
+ extraAttributes.removeObjectAtIndex(i);
+ }
+ }
+
+ if (extraAttributes.count() > 0) {
+ int superResult = super.accessibilityAttributeNames(id, sel);
+ NSArray baseAttributes = new NSArray(superResult);
+ NSMutableArray mutableAttributes = NSMutableArray.arrayWithCapacity(baseAttributes.count() + 1);
+ mutableAttributes.addObjectsFromArray(baseAttributes);
+
+ for (int i = 0; i < extraAttributes.count(); i++) {
+ id currAttribute = extraAttributes.objectAtIndex(i);
+ if (!mutableAttributes.containsObject(currAttribute)) {
+ mutableAttributes.addObject(currAttribute);
+ }
+ }
+
+ return mutableAttributes.id;
+ }
+ }
+ }
+
+ return super.accessibilityAttributeNames(id, sel);
+}
+
boolean accessibilityIsIgnored(int /*long*/ id, int /*long*/ sel) {
if (id == view.id) return true;
return super.accessibilityIsIgnored(id, sel);