summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Barnes <krbarnes>2010-02-18 15:18:13 +0000
committerKevin Barnes <krbarnes>2010-02-18 15:18:13 +0000
commitc7a37ce473beb9045c99b97900ef561257b98af2 (patch)
tree0e798a8621bf91a3a067a0dbe31baed63dcb5bc6
parent9e4aa4f79d8d08d57d797296be9d3269723e755b (diff)
downloadeclipse.platform.swt-c7a37ce473beb9045c99b97900ef561257b98af2.tar.gz
eclipse.platform.swt-c7a37ce473beb9045c99b97900ef561257b98af2.tar.xz
eclipse.platform.swt-c7a37ce473beb9045c99b97900ef561257b98af2.zip
Accessibility
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java1599
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Relation.java72
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c132
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c114
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSNotificationCenter.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTableView.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java49
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java49
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java19
18 files changed, 1678 insertions, 457 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java
index 487e03e9bb..3f4cff0e78 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java
@@ -10,11 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.accessibility;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
+import java.util.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
@@ -46,35 +42,26 @@ import org.eclipse.swt.widgets.*;
*/
public class Accessible {
+ static final int MAX_RELATION_TYPES = 15;
+
static NSString[] baseAttributes = {
OS.NSAccessibilityRoleAttribute,
+ OS.NSAccessibilitySubroleAttribute,
OS.NSAccessibilityRoleDescriptionAttribute,
OS.NSAccessibilityHelpAttribute,
OS.NSAccessibilityFocusedAttribute,
OS.NSAccessibilityParentAttribute,
OS.NSAccessibilityChildrenAttribute,
+ OS.NSAccessibilityVisibleChildrenAttribute,
OS.NSAccessibilityPositionAttribute,
OS.NSAccessibilitySizeAttribute,
OS.NSAccessibilityWindowAttribute,
- OS.NSAccessibilityTopLevelUIElementAttribute
- };
-
- static NSString[] baseTextAttributes = {
- OS.NSAccessibilityNumberOfCharactersAttribute,
- OS.NSAccessibilitySelectedTextAttribute,
- OS.NSAccessibilitySelectedTextRangeAttribute,
- OS.NSAccessibilityInsertionPointLineNumberAttribute,
- OS.NSAccessibilitySelectedTextRangesAttribute,
- OS.NSAccessibilityVisibleCharacterRangeAttribute,
- OS.NSAccessibilityValueAttribute,
- };
-
- static NSString[] baseParameterizedAttributes = {
- OS.NSAccessibilityStringForRangeParameterizedAttribute,
- OS.NSAccessibilityRangeForLineParameterizedAttribute,
+ OS.NSAccessibilityTopLevelUIElementAttribute,
+ OS.NSAccessibilityServesAsTitleForUIElementsAttribute,
+ OS.NSAccessibilityTitleUIElementAttribute,
+ OS.NSAccessibilityEnabledAttribute,
};
-
NSMutableArray attributeNames = null;
NSMutableArray parameterizedAttributeNames = null;
NSMutableArray actionNames = null;
@@ -90,21 +77,20 @@ public class Accessible {
Vector accessibleValueListeners = new Vector();
Vector accessibleScrollListeners = new Vector();
Vector accessibleAttributeListeners = new Vector();
+ Relation relations[] = new Relation[MAX_RELATION_TYPES];
Accessible parent;
Control control;
- Map /*<Integer, SWTAccessibleDelegate>*/ children = new HashMap();
+ Map /*<Integer, SWTAccessibleDelegate>*/ childToIdMap = new HashMap();
+ Vector children = new Vector();
+ SWTAccessibleDelegate delegate;
+
+ int index = -1;
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Constructs a new instance of this class given its parent.
*
- * @param parent the Accessible parent, which must not be null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
+ * @param parent the Accessible parent
*
* @see Control#getAccessible
*
@@ -113,12 +99,12 @@ public class Accessible {
public Accessible(Accessible parent) {
this.parent = checkNull(parent);
this.control = parent.control;
- // TODO
+ delegate = new SWTAccessibleDelegate(this, ACC.CHILDID_SELF);
+ parent.children.add(this);
}
-
+
/**
* @since 3.5
- * @deprecated
*/
protected Accessible() {
}
@@ -127,11 +113,15 @@ public class Accessible {
this.control = control;
}
+ void addAccessibleChild(Accessible accessible) {
+ children.add(accessible);
+ }
+
static Accessible checkNull (Accessible parent) {
if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
return parent;
}
-
+
/**
* Invokes platform specific functionality to allocate a new accessible object.
* <p>
@@ -148,6 +138,16 @@ public class Accessible {
public static Accessible internal_new_Accessible(Control control) {
return new Accessible(control);
}
+
+ id accessibleHandle(Accessible accessible) {
+ if (accessible.delegate != null) return accessible.delegate;
+ if (accessible.control != null) {
+ NSView view = accessible.control.view;
+ int /*long*/ handle = OS.objc_msgSend(view.id, OS.sel_accessibleHandle);
+ return new id(handle);
+ }
+ return null;
+ }
/**
* Adds the listener to the collection of listeners who will
@@ -208,7 +208,7 @@ public class Accessible {
* be notified when an accessible client asks for custom text control
* specific information. The listener is notified by sending it
* one of the messages defined in the <code>AccessibleTextListener</code>
- * and <code>AccessibleTextExtendedListener</code> interfaces.
+ * interface.
*
* @param listener the listener that should be notified when the receiver
* is asked for custom text control specific information
@@ -222,7 +222,6 @@ public class Accessible {
* </ul>
*
* @see AccessibleTextListener
- * @see AccessibleTextExtendedListener
* @see #removeAccessibleTextListener
*
* @since 3.0
@@ -238,8 +237,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleAction</code> interface.
@@ -267,8 +264,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleHyperlink</code> interface.
@@ -296,8 +291,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleTable</code> interface.
@@ -325,8 +318,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleTableCell</code> interface.
@@ -354,8 +345,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleValue</code> interface.
@@ -383,8 +372,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Adds the listener to the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleAttribute</code> interface.
@@ -412,97 +399,337 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Adds a relation with the specified type and target
* to the receiver's set of relations.
*
- * @param type an <code>ACC</code> constant beginning with RELATION_* indicating the type of relation
+ * @param type a constant beginning with RELATION_* indicating the type of relation
* @param target the accessible that is the target for this relation
*
* @since 3.6
*/
public void addRelation(int type, Accessible target) {
checkWidget();
- // TODO
+ if (relations[type] == null) {
+ relations[type] = new Relation(this, type);
+ }
+ relations[type].addTarget(target);
}
- /**
- * WARNING: API UNDER CONSTRUCTION
- *
- * Disposes of the operating system resources associated with
- * the receiver, and removes the receiver from its parent's
- * list of children.
- * <p>
- * This method should be called when an accessible that was created
- * with the public constructor <code>Accessible(Accessible parent)</code>
- * is no longer needed. You do not need to call this when the receiver's
- * control is disposed, because all <code>Accessible</code> instances
- * associated with a control are released when the control is disposed.
- * It is also not necessary to call this for instances of <code>Accessible</code>
- * that were retrieved with <code>Control.getAccessible()</code>.
- * </p>
- *
- * @since 3.6
- */
- public void dispose () {
- if (parent == null) return;
- // TODO: dispose children
- parent = null;
+ id getColumnIndexRangeAttribute(int childID) {
+ AccessibleTableCellEvent event = new AccessibleTableCellEvent(this);
+ for (int i = 0; i < accessibleTableCellListeners.size(); i++) {
+ AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i);
+ listener.getColumnIndex(event);
+ listener.getColumnSpan(event);
+ }
+ NSRange range = new NSRange();
+ range.location = event.index;
+ range.length = event.count;
+ return NSValue.valueWithRange(range);
}
- public id internal_accessibilityActionDescription(NSString action, int childID) {
- // TODO No action support for now.
- return NSString.string();
+ id getRowIndexRangeAttribute(int childID) {
+ AccessibleTableCellEvent event = new AccessibleTableCellEvent(this);
+ for (int i = 0; i < accessibleTableCellListeners.size(); i++) {
+ AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i);
+ listener.getRowIndex(event);
+ listener.getRowSpan(event);
+ }
+ NSRange range = new NSRange();
+ range.location = event.index;
+ range.length = event.count;
+ return NSValue.valueWithRange(range);
}
- public NSArray internal_accessibilityActionNames(int childID) {
- // The supported action list depends on the role played by the control.
- AccessibleControlEvent event = new AccessibleControlEvent(this);
- event.childID = childID;
- event.detail = -1;
- for (int i = 0; i < accessibleControlListeners.size(); i++) {
- AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getRole(event);
+ id getSelectedAttribute(int childID) {
+ if (accessibleTableListeners.size() > 0) {
+ AccessibleTableEvent event = new AccessibleTableEvent(this);
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getSelectedRows(event);
+ }
+ if (event.accessibles != null) {
+ for (int i = 0; i < event.accessibles.length; i++) {
+ if (this.equals(event.accessibles[i])) return NSNumber.numberWithBool(true);
+ }
+ }
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getSelectedColumns(event);
+ }
+ if (event.accessibles != null) {
+ for (int i = 0; i < event.accessibles.length; i++) {
+ if (this.equals(event.accessibles[i])) return NSNumber.numberWithBool(true);
+ }
+ }
}
-
- // No accessible listener is overriding the role of the control, so let Cocoa return the default set for the control.
- if (event.detail == -1) {
- return null;
+ if (accessibleTableCellListeners.size() > 0) {
+ AccessibleTableCellEvent event = new AccessibleTableCellEvent(this);
+ for (int i = 0; i < accessibleTableCellListeners.size(); i++) {
+ AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i);
+ listener.isSelected(event);
+ }
+ return NSNumber.numberWithBool(event.isSelected);
}
-
- if ((childID == ACC.CHILDID_SELF) && (actionNames != null)) {
- return retainedAutoreleased(actionNames);
+ return NSNumber.numberWithBool(false);
+ }
+
+ id getIndexAttribute(int childID) {
+ return NSNumber.numberWithInt(index);
+ }
+
+ id getHeaderAttribute(int childID) {
+ id returnValue = null;
+ AccessibleTableEvent tableEvent = new AccessibleTableEvent(this);
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getColumnHeader(tableEvent);
}
+ if (tableEvent.accessible != null) returnValue = tableEvent.accessible.delegate;
- NSMutableArray returnValue = NSMutableArray.arrayWithCapacity(5);
-
- switch (event.detail) {
- case ACC.ROLE_PUSHBUTTON:
- case ACC.ROLE_RADIOBUTTON:
- case ACC.ROLE_CHECKBUTTON:
- case ACC.ROLE_TABITEM:
- returnValue.addObject(OS.NSAccessibilityPressAction);
- break;
+ return returnValue;
+ }
+
+ id getVisibleColumnsAttribute(int childID) {
+ id returnValue = null;
+ AccessibleTableEvent event = new AccessibleTableEvent(this);
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getVisibleColumns(event);
+ }
+ if (event.accessibles != null) {
+ NSMutableArray array = NSMutableArray.arrayWithCapacity(event.accessibles.length);
+ Accessible[] accessibles = event.accessibles;
+ for (int i = 0; i < accessibles.length; i++) {
+ Accessible acc = accessibles[i];
+ array.addObject(acc.delegate);
+ }
+ returnValue = array;
}
+ return returnValue == null ? NSArray.array() : returnValue;
+ }
- switch (event.detail) {
- case ACC.ROLE_COMBOBOX:
- returnValue.addObject(OS.NSAccessibilityConfirmAction);
- break;
+ id getVisibleRowsAttribute(int childID) {
+ id returnValue = null;
+ AccessibleTableEvent event = new AccessibleTableEvent(this);
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getVisibleRows(event);
+ }
+ if (event.accessibles != null) {
+ NSMutableArray array = NSMutableArray.arrayWithCapacity(event.accessibles.length);
+ Accessible[] accessibles = event.accessibles;
+ for (int i = 0; i < accessibles.length; i++) {
+ Accessible acc = accessibles[i];
+ array.addObject(acc.delegate);
+ }
+ returnValue = array;
}
+ return returnValue == null ? NSArray.array() : returnValue;
+ }
-
- if (childID == ACC.CHILDID_SELF) {
- actionNames = returnValue;
- actionNames.retain();
- return retainedAutoreleased(actionNames);
+ id getSelectedRowsAttribute(int childID) {
+ id returnValue = null;
+ AccessibleTableEvent event = new AccessibleTableEvent(this);
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getSelectedRows(event);
+ }
+ if (event.selected != null) {
+ int[] selected = (int[])event.selected;
+ NSMutableArray array = NSMutableArray.arrayWithCapacity(selected.length);
+ for (int i = 0; i < selected.length; i++) {
+ event.row = selected[i];
+ for (int j = 0; j < accessibleTableListeners.size(); j++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(j);
+ listener.getRow(event);
+ }
+ if (event.accessible != null) array.addObject(event.accessible.delegate);
+ }
+ returnValue = array;
} else {
- // Caller must retain if they want to hold on to it.
- return returnValue;
+ returnValue = NSArray.array();
+ }
+ return returnValue;
+ }
+
+ id getRowsAttribute(int childID) {
+ id returnValue = null;
+ AccessibleTableEvent event = new AccessibleTableEvent(this);
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getRows(event);
+ }
+ if (event.accessibles != null) {
+ NSMutableArray array = NSMutableArray.arrayWithCapacity(event.accessibles.length);
+ Object[] rows = event.accessibles;
+ for (int i = 0; i < rows.length; i++) {
+ Accessible acc = (Accessible) rows[i];
+ acc.index = i;
+ array.addObject(acc.delegate);
+ }
+ returnValue = array;
}
+ return returnValue == null ? NSArray.array() : returnValue;
}
+ id getSelectedColumnsAttribute(int childID) {
+ id returnValue = null;
+ AccessibleTableEvent event = new AccessibleTableEvent(this);
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getSelectedColumns(event);
+ }
+ if (event.selected != null) {
+ int[] selected = (int[])event.selected;
+ NSMutableArray array = NSMutableArray.arrayWithCapacity(selected.length);
+ for (int i = 0; i < selected.length; i++) {
+ event.column = selected[i];
+ for (int j = 0; j < accessibleTableListeners.size(); j++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(j);
+ listener.getColumn(event);
+ }
+ if (event.accessible != null) array.addObject(event.accessible.delegate);
+ }
+ returnValue = array;
+ } else {
+ returnValue = NSArray.array();
+ }
+ return returnValue;
+ }
+
+ id getColumnsAttribute(int childID) {
+ id returnValue = null;
+ AccessibleTableEvent event = new AccessibleTableEvent(this);
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getColumns(event);
+ }
+ if (event.accessibles != null) {
+ NSMutableArray array = NSMutableArray.arrayWithCapacity(event.accessibles.length);
+ Accessible[] accessibles = event.accessibles;
+ for (int i = 0; i < accessibles.length; i++) {
+ Accessible acc = accessibles[i];
+ acc.index = i;
+ array.addObject(acc.delegate);
+ }
+ returnValue = array;
+ }
+ return returnValue == null ? NSArray.array() : returnValue;
+ }
+
+ public id internal_accessibilityActionDescription(NSString action, int childID) {
+ NSString returnValue = NSString.string();
+ String actionName = action.getString();
+ if (accessibleActionListeners.size() > 0) {
+ AccessibleActionEvent event = new AccessibleActionEvent(this);
+ for (int i = 0; i < accessibleActionListeners.size(); i++) {
+ AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i);
+ listener.getActionCount(event);
+ }
+ int index = -1;
+ for (int i = 0; i < event.count; i++) {
+ event.index = i;
+ for (int j = 0; j < accessibleActionListeners.size(); j++) {
+ AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(j);
+ listener.getName(event);
+ }
+ if (actionName.equals(event.result)) {
+ index = i;
+ break;
+ }
+ }
+ if (index != -1) {
+ event.index = index;
+ event.result = null;
+ for (int i = 0; i < accessibleActionListeners.size(); i++) {
+ AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i);
+ listener.getDescription(event);
+ }
+ if (event.result != null) returnValue = NSString.stringWith(event.result);
+ }
+ }
+ return returnValue;
+ }
+
+ public NSArray internal_accessibilityActionNames(int childID) {
+ if (accessibleActionListeners.size() > 0) {
+ AccessibleActionEvent event = new AccessibleActionEvent(this);
+ for (int i = 0; i < accessibleActionListeners.size(); i++) {
+ AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i);
+ listener.getActionCount(event);
+ }
+ NSMutableArray array = NSMutableArray.arrayWithCapacity(event.count);
+ for (int i = 0; i < event.count; i++) {
+ event.index = i;
+ for (int j = 0; j < accessibleActionListeners.size(); j++) {
+ AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(j);
+ listener.getName(event);
+ }
+ array.addObject(NSString.stringWith(event.result));
+ }
+ return array;
+ } else {
+ // The supported action list depends on the role played by the control.
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = childID;
+ event.detail = -1;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getRole(event);
+ }
+
+ // No accessible listener is overriding the role of the control, so let Cocoa return the default set for the control.
+ if (event.detail == -1) {
+ return null;
+ }
+
+ if ((childID == ACC.CHILDID_SELF) && (actionNames != null)) {
+ return retainedAutoreleased(actionNames);
+ }
+
+ NSMutableArray returnValue = NSMutableArray.arrayWithCapacity(5);
+
+ switch (event.detail) {
+ case ACC.ROLE_PUSHBUTTON:
+ case ACC.ROLE_RADIOBUTTON:
+ case ACC.ROLE_CHECKBUTTON:
+ case ACC.ROLE_TABITEM:
+ case ACC.ROLE_LINK:
+ case ACC.ROLE_CHECK_MENU_ITEM:
+ case ACC.ROLE_RADIO_MENU_ITEM:
+ case ACC.ROLE_SPLITBUTTON:
+ returnValue.addObject(OS.NSAccessibilityPressAction);
+ break;
+ case ACC.ROLE_COMBOBOX:
+ returnValue.addObject(OS.NSAccessibilityConfirmAction);
+ break;
+ case ACC.ROLE_WINDOW:
+ case ACC.ROLE_DIALOG:
+// TODO
+// returnValue.addObject(OS.NSAccessibilityRaiseAction);
+ break;
+ }
+
+
+ if (childID == ACC.CHILDID_SELF) {
+ actionNames = returnValue;
+ actionNames.retain();
+ return retainedAutoreleased(actionNames);
+ } else {
+ // Caller must retain if they want to hold on to it.
+ return returnValue;
+ }
+ }
+ }
+
+ public boolean internal_accessibilityIsAttributeSettable(NSString attribute) {
+ if (accessibleValueListeners.size() > 0) {
+ if (attribute.isEqualToString(OS.NSAccessibilityValueAttribute)) return true;
+ }
+ return false;
+ }
+
public NSArray internal_accessibilityAttributeNames(int childID) {
// The supported attribute set depends on the role played by the control.
// We may need to add or remove from the base set as needed.
@@ -534,64 +761,208 @@ public class Accessible {
}
}
- if (accessibleTextListeners.size() > 0) {
- for (int i = 0; i < baseTextAttributes.length; i++) {
- if (!returnValue.containsObject(baseTextAttributes[i])) {
- returnValue.addObject(baseTextAttributes[i]);
- }
- }
- }
-
- // The following are expected to have a value (AXValue)
- switch (event.detail) {
- case ACC.ROLE_CHECKBUTTON:
- case ACC.ROLE_RADIOBUTTON:
- case ACC.ROLE_LABEL:
- case ACC.ROLE_TABITEM:
- case ACC.ROLE_TABFOLDER:
- returnValue.addObject(OS.NSAccessibilityValueAttribute);
- break;
- }
-
- // The following are expected to report their enabled status (AXEnabled)
- switch (event.detail) {
- case ACC.ROLE_CHECKBUTTON:
- case ACC.ROLE_RADIOBUTTON:
- case ACC.ROLE_LABEL:
- case ACC.ROLE_TABITEM:
- case ACC.ROLE_PUSHBUTTON:
- case ACC.ROLE_COMBOBOX:
- returnValue.addObject(OS.NSAccessibilityEnabledAttribute);
- break;
+ switch(event.detail) {
+ case ACC.ROLE_CLIENT_AREA:
+ break;
+ case ACC.ROLE_WINDOW:
+ returnValue.addObject(OS.NSAccessibilityTitleAttribute);
+// TODO
+// returnValue.addObject(OS.NSAccessibilityMainAttribute);
+// returnValue.addObject(OS.NSAccessibilityMinimizedAttribute);
+ break;
+ case ACC.ROLE_MENUBAR:
+ returnValue.addObject(OS.NSAccessibilitySelectedChildrenAttribute);
+ break;
+ case ACC.ROLE_MENU:
+ returnValue.addObject(OS.NSAccessibilitySelectedChildrenAttribute);
+ break;
+ case ACC.ROLE_MENUITEM:
+ break;
+ case ACC.ROLE_SEPARATOR:
+ returnValue.addObject(OS.NSAccessibilityMaxValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityMinValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ //TODO
+// returnValue.addObject(OS.NSAccessibilityOrientationAttribute);
+// returnValue.addObject(OS.NSAccessibilityPreviousContentsAttribute);
+// returnValue.addObject(OS.NSAccessibilityNextContentsAttribute);
+ break;
+ case ACC.ROLE_TOOLTIP:
+ returnValue.addObject(OS.NSAccessibilityTitleAttribute);
+ break;
+ case ACC.ROLE_SCROLLBAR:
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ //TODO
+// returnValue.addObject(OS.NSAccessibilityOrientationAttribute);
+ break;
+ case ACC.ROLE_DIALOG:
+ returnValue.addObject(OS.NSAccessibilityTitleAttribute);
+// TODO
+// returnValue.addObject(OS.NSAccessibilityMainAttribute);
+// returnValue.addObject(OS.NSAccessibilityMinimizedAttribute);
+ break;
+ case ACC.ROLE_LABEL:
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ break;
+ case ACC.ROLE_PUSHBUTTON:
+ returnValue.addObject(OS.NSAccessibilityTitleAttribute);
+ break;
+ case ACC.ROLE_CHECKBUTTON:
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityTitleAttribute);
+ break;
+ case ACC.ROLE_RADIOBUTTON:
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityTitleAttribute);
+ break;
+ case ACC.ROLE_SPLITBUTTON:
+ break;
+ case ACC.ROLE_COMBOBOX:
+ returnValue.addObject(OS.NSAccessibilityExpandedAttribute);
+ returnValue.addObject(OS.NSAccessibilityNumberOfCharactersAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedTextAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedTextRangeAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleCharacterRangeAttribute);
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ break;
+ case ACC.ROLE_TEXT:
+ returnValue.addObject(OS.NSAccessibilityNumberOfCharactersAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedTextAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedTextRangeAttribute);
+ returnValue.addObject(OS.NSAccessibilityInsertionPointLineNumberAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedTextRangesAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleCharacterRangeAttribute);
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ break;
+ case ACC.ROLE_TOOLBAR:
+ break;
+ case ACC.ROLE_LIST:
+ returnValue.addObject(OS.NSAccessibilityColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilityRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityHeaderAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleColumnsAttribute);
+ break;
+ case ACC.ROLE_LISTITEM:
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ break;
+ case ACC.ROLE_TABLE:
+ returnValue.addObject(OS.NSAccessibilityColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilityRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilityHeaderAttribute);
+ break;
+ case ACC.ROLE_TABLECELL:
+ returnValue.addObject(OS.NSAccessibilitySelectedAttribute);
+ if (OS.VERSION >= 0x1060) returnValue.addObject(OS.NSAccessibilityRowIndexRangeAttribute);
+ if (OS.VERSION >= 0x1060) returnValue.addObject(OS.NSAccessibilityColumnIndexRangeAttribute);
+ break;
+ case ACC.ROLE_TABLEROWHEADER:
+ returnValue.addObject(OS.NSAccessibilitySelectedAttribute);
+ returnValue.addObject(OS.NSAccessibilityIndexAttribute);
+ break;
+ case ACC.ROLE_TREE:
+ returnValue.addObject(OS.NSAccessibilityColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilityRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityHeaderAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleColumnsAttribute);
+ break;
+ case ACC.ROLE_TREEITEM:
+ returnValue.addObject(OS.NSAccessibilityColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedColumnsAttribute);
+ returnValue.addObject(OS.NSAccessibilityRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityHeaderAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleColumnsAttribute);
+ case ACC.ROLE_TABFOLDER:
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityContentsAttribute);
+ returnValue.addObject(OS.NSAccessibilityTabsAttribute);
+ break;
+ case ACC.ROLE_TABITEM:
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityTitleAttribute);
+ break;
+ case ACC.ROLE_PROGRESSBAR:
+ returnValue.addObject(OS.NSAccessibilityMaxValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityMinValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ break;
+ case ACC.ROLE_SLIDER:
+ returnValue.addObject(OS.NSAccessibilityMaxValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityMinValueAttribute);
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ //TODO
+// returnValue.addObject(OS.NSAccessibilityOrientationAttribute);
+// increment
+// decrement
+ break;
+ case ACC.ROLE_LINK:
+ //TODO
+// returnValue.addObject(OS.NSAccessibilityURLAttribute);
+// visited
+ break;
+ case ACC.ROLE_ALERT:
+ break;
+ case ACC.ROLE_ANIMATION:
+ break;
+ case ACC.ROLE_CANVAS:
+ break;
+ case ACC.ROLE_COLUMN:
+ returnValue.addObject(OS.NSAccessibilityIndexAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedAttribute);
+ returnValue.addObject(OS.NSAccessibilityRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityVisibleRowsAttribute);
+ returnValue.addObject(OS.NSAccessibilityHeaderAttribute);
+ break;
+ case ACC.ROLE_DOCUMENT:
+ break;
+ case ACC.ROLE_GRAPHIC:
+ break;
+ case ACC.ROLE_GROUP:
+ break;
+ case ACC.ROLE_HEADING:
+ break;
+ case ACC.ROLE_ROW:
+ returnValue.addObject(OS.NSAccessibilityIndexAttribute);
+ returnValue.addObject(OS.NSAccessibilitySelectedAttribute);
+ break;
+ case ACC.ROLE_SPINBUTTON:
+ break;
+ case ACC.ROLE_STATUSBAR:
+ break;
+ case ACC.ROLE_CHECK_MENU_ITEM:
+ break;
+ case ACC.ROLE_RADIO_MENU_ITEM:
+ break;
+ case ACC.ROLE_CLOCK:
+ break;
+ case ACC.ROLE_DATE_EDITOR:
+ break;
+ case ACC.ROLE_COLOR_CHOOSER:
+ returnValue.addObject(OS.NSAccessibilityValueAttribute);
+ break;
+ case ACC.ROLE_FILE_CHOOSER:
+ break;
+ case ACC.ROLE_FONT_CHOOSER:
+ break;
}
- // The following are expected to report a title (AXTitle)
- switch (event.detail) {
- case ACC.ROLE_CHECKBUTTON:
- case ACC.ROLE_RADIOBUTTON:
- case ACC.ROLE_PUSHBUTTON:
- case ACC.ROLE_TABITEM:
- returnValue.addObject(OS.NSAccessibilityTitleAttribute);
- break;
- }
-
- // Accessibility verifier says these attributes must be reported for combo boxes.
- if (event.detail == ACC.ROLE_COMBOBOX) {
- returnValue.addObject(OS.NSAccessibilityExpandedAttribute);
- }
- // Accessibility verifier says these attributes must be reported for tab folders.
- if (event.detail == ACC.ROLE_TABFOLDER) {
- returnValue.addObject(OS.NSAccessibilityContentsAttribute);
- returnValue.addObject(OS.NSAccessibilityTabsAttribute);
- }
-
/*
* Only report back sub-roles when the SWT role maps to a sub-role.
*/
if (event.detail != -1) {
String osRole = roleToOs(event.detail);
-
if (osRole.indexOf(':') == -1)
returnValue.removeObject(OS.NSAccessibilitySubroleAttribute);
}
@@ -621,10 +992,14 @@ public class Accessible {
if (attribute.isEqualToString(OS.NSAccessibilityHelpAttribute)) return getHelpAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityTitleAttribute)) return getTitleAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityValueAttribute)) return getValueAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityMaxValueAttribute)) return getMaxValueAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityMinValueAttribute)) return getMinValueAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityEnabledAttribute)) return getEnabledAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityFocusedAttribute)) return getFocusedAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityParentAttribute)) return getParentAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityChildrenAttribute)) return getChildrenAttribute(childID);
+ /* SWT has no visible children API*/
+ if (attribute.isEqualToString(OS.NSAccessibilityVisibleChildrenAttribute)) return getChildrenAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityContentsAttribute)) return getChildrenAttribute(childID);
// FIXME: There's no specific API just for tabs, which won't include the buttons (if any.)
if (attribute.isEqualToString(OS.NSAccessibilityTabsAttribute)) return getTabsAttribute(childID);
@@ -639,14 +1014,30 @@ public class Accessible {
if (attribute.isEqualToString(OS.NSAccessibilityInsertionPointLineNumberAttribute)) return getInsertionPointLineNumberAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilitySelectedTextRangesAttribute)) return getSelectedTextRangesAttribute(childID);
if (attribute.isEqualToString(OS.NSAccessibilityVisibleCharacterRangeAttribute)) return getVisibleCharacterRangeAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityServesAsTitleForUIElementsAttribute)) return getServesAsTitleForUIElementsAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityTitleUIElementAttribute)) return getTitleUIElementAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityColumnsAttribute)) return getColumnsAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilitySelectedColumnsAttribute)) return getSelectedColumnsAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityRowsAttribute)) return getRowsAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilitySelectedRowsAttribute)) return getSelectedRowsAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityVisibleRowsAttribute)) return getVisibleRowsAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityVisibleColumnsAttribute)) return getVisibleColumnsAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityHeaderAttribute)) return getHeaderAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityIndexAttribute)) return getIndexAttribute(childID);
+ if (attribute.isEqualToString(OS.NSAccessibilitySelectedAttribute)) return getSelectedAttribute(childID);
+ if (OS.VERSION >= 0x1060 && attribute.isEqualToString(OS.NSAccessibilityRowIndexRangeAttribute)) return getRowIndexRangeAttribute(childID);
+ if (OS.VERSION >= 0x1060 && attribute.isEqualToString(OS.NSAccessibilityColumnIndexRangeAttribute)) return getColumnIndexRangeAttribute(childID);
// If this object don't know how to get the value it's up to the control itself to return an attribute value.
return null;
}
-
+
public id internal_accessibilityAttributeValue_forParameter(NSString attribute, id parameter, int childID) {
if (attribute.isEqualToString(OS.NSAccessibilityStringForRangeParameterizedAttribute)) return getStringForRangeAttribute(parameter, childID);
- if (attribute.isEqualToString(OS.NSAccessibilityRangeForLineParameterizedAttribute)) return getRangeForLineParameterizedAttribute(parameter, childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityRangeForLineParameterizedAttribute)) return getRangeForLineParameterizedAttribute(parameter, childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityLineForIndexParameterizedAttribute)) return getLineForIndexParameterizedAttribute(parameter, childID);
+ if (attribute.isEqualToString(OS.NSAccessibilityBoundsForRangeParameterizedAttribute)) return getBoundsForRangeParameterizedAttribute(parameter, childID);
+ if (OS.VERSION >= 0x1060 && attribute.isEqualToString(OS.NSAccessibilityCellForColumnAndRowParameterizedAttribute)) return getCellForColumnAndRowParameter(parameter, childID);
return null;
}
@@ -716,20 +1107,35 @@ public class Accessible {
// parameterized attribute methods
public NSArray internal_accessibilityParameterizedAttributeNames(int childID) {
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = childID;
+ event.detail = -1;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getRole(event);
+ }
+ // No accessible listener is overriding the role of the control, so let Cocoa
+ // return the default set for the control.
+ if (event.detail == -1)
+ return null;
+
if ((childID == ACC.CHILDID_SELF) && (parameterizedAttributeNames != null)) {
return retainedAutoreleased(parameterizedAttributeNames);
}
NSMutableArray returnValue = NSMutableArray.arrayWithCapacity(4);
-
- if (accessibleTextListeners.size() > 0) {
- for (int i = 0; i < baseParameterizedAttributes.length; i++) {
- if (!returnValue.containsObject(baseParameterizedAttributes[i])) {
- returnValue.addObject(baseParameterizedAttributes[i]);
- }
- }
-
+
+ switch(event.detail) {
+ case ACC.ROLE_TEXT:
+ returnValue.addObject(OS.NSAccessibilityStringForRangeParameterizedAttribute);
+ returnValue.addObject(OS.NSAccessibilityRangeForLineParameterizedAttribute);
+ returnValue.addObject(OS.NSAccessibilityLineForIndexParameterizedAttribute);
+ returnValue.addObject(OS.NSAccessibilityBoundsForRangeParameterizedAttribute);
+ break;
+ case ACC.ROLE_TABLE:
+ if (OS.VERSION >= 0x1060) returnValue.addObject(OS.NSAccessibilityCellForColumnAndRowParameterizedAttribute);
+ break;
}
if (childID == ACC.CHILDID_SELF) {
@@ -742,9 +1148,65 @@ public class Accessible {
}
}
- public void internal_accessibilityPerformAction(NSString action, int childID) {
- // TODO Auto-generated method stub
- // No action support for now.
+ public boolean internal_accessibilityPerformAction(NSString action, int childID) {
+ String actionName = action.getString();
+ if (accessibleActionListeners.size() > 0) {
+ AccessibleActionEvent event = new AccessibleActionEvent(this);
+ for (int i = 0; i < accessibleActionListeners.size(); i++) {
+ AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i);
+ listener.getActionCount(event);
+ }
+ int index = -1;
+ for (int i = 0; i < event.count; i++) {
+ event.index = i;
+ for (int j = 0; j < accessibleActionListeners.size(); j++) {
+ AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(j);
+ listener.getName(event);
+ }
+ if (actionName.equals(event.result)) {
+ index = i;
+ break;
+ }
+ }
+ if (index != -1) {
+ event.index = index;
+ event.result = null;
+ for (int i = 0; i < accessibleActionListeners.size(); i++) {
+ AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i);
+ listener.doAction(event);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void internal_accessibilitySetValue_forAttribute(id value, NSString attribute) {
+ if (accessibleValueListeners.size() > 0) {
+ AccessibleValueEvent event = new AccessibleValueEvent(this);
+ NSNumber number = new NSNumber(value);
+ event.value = new Double(number.doubleValue());
+ for (int i = 0; i < accessibleValueListeners.size(); i++) {
+ AccessibleValueListener listener = (AccessibleValueListener) accessibleValueListeners.elementAt(i);
+ listener.setCurrentValue(event);
+ }
+ }
+ }
+
+ /**
+ * Disposes of the operating system resources associated with
+ * the receiver.
+ * <p>
+ * This method should be called when an accessible that was created
+ * with the public constructor is no longer needed.
+ * It is not necessary to call this for instances of Accessible that
+ * were retrieved with Control#getAccessible.
+ * </p>
+ */
+ public void dispose () {
+ if (parent == null) return;
+ release(true);
+ parent = null;
}
/**
@@ -768,21 +1230,33 @@ public class Accessible {
* </p>
*/
public void internal_dispose_Accessible() {
- if (actionNames != null) actionNames.release();
- actionNames = null;
- if (attributeNames != null) attributeNames.release();
- attributeNames = null;
- if (parameterizedAttributeNames != null) parameterizedAttributeNames.release();
- parameterizedAttributeNames = null;
-
- Collection delegates = children.values();
- Iterator iter = delegates.iterator();
- while (iter.hasNext()) {
- SWTAccessibleDelegate childDelegate = (SWTAccessibleDelegate)iter.next();
- childDelegate.internal_dispose_SWTAccessibleDelegate();
+ release(true);
+ }
+
+ id getBoundsForRangeParameterizedAttribute(id parameter, int childID) {
+ id returnValue = null;
+ NSValue parameterObject = new NSValue(parameter.id);
+ NSRange range = parameterObject.rangeValue();
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ event.start = (int)/*64*/range.location;
+ event.end = (int)/*64*/(range.location + range.length - 1);
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getTextBounds(event);
+ }
+ NSRect rect = new NSRect();
+ rect.x = event.x;
+ rect.y = event.y;
+ rect.width = event.width;
+ rect.height = event.height;
+ returnValue = NSValue.valueWithRect(rect);
+ } else {
+ //FIXME???
+ //how to implement with old listener
}
-
- children.clear();
+ return returnValue;
}
id getExpandedAttribute(int childID) {
@@ -803,7 +1277,7 @@ public class Accessible {
returnValue = NSString.stringWith(event.result);
}
- return returnValue;
+ return returnValue == null ? NSString.string() : returnValue;
}
NSString getRoleAttribute(int childID) {
@@ -873,7 +1347,7 @@ public class Accessible {
id getTitleAttribute (int childID) {
- id returnValue = null;//NSString.string();
+ id returnValue = NSString.string();
/*
* Feature of the Macintosh. The text of a Label is returned in its value,
@@ -901,80 +1375,98 @@ public class Accessible {
return returnValue;
}
- id getValueAttribute (int childID) {
+ id getTitleUIElementAttribute(int childID) {
id returnValue = null;
- AccessibleControlEvent event = new AccessibleControlEvent(this);
- event.childID = childID;
- event.detail = -1;
- event.result = null; //TODO: could pass the OS value to the app
- for (int i = 0; i < accessibleControlListeners.size(); i++) {
- AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getRole(event);
- listener.getValue(event);
+ Relation relation = relations[ACC.RELATION_LABELLED_BY];
+ if (relation != null) {
+ returnValue = relation.getTitleUIElement();
}
- int role = event.detail;
- String value = event.result;
-
- switch (role) {
- case ACC.ROLE_RADIOBUTTON: // 1 = on, 0 = off
- case ACC.ROLE_CHECKBUTTON: // 1 = checked, 0 = unchecked, 2 = mixed
- case ACC.ROLE_SCROLLBAR: // numeric value representing the position of the scroller
- case ACC.ROLE_SLIDER: // the value associated with the position of the slider thumb
- case ACC.ROLE_PROGRESSBAR: // the value associated with the fill level of the progress bar
- if (value != null) {
- try {
- int number = Integer.parseInt(value);
- returnValue = NSNumber.numberWithInt(number);
- } catch (NumberFormatException ex) {
- if (value.equalsIgnoreCase("true")) {
- returnValue = NSNumber.numberWithBool(true);
- } else if (value.equalsIgnoreCase("false")) {
- returnValue = NSNumber.numberWithBool(false);
- }
- }
- } else {
- returnValue = NSNumber.numberWithBool(false);
+ return returnValue;
+ }
+
+ id getValueAttribute (int childID) {
+ id returnValue = null;
+ if (accessibleValueListeners.size() > 0) {
+ AccessibleValueEvent event = new AccessibleValueEvent(this);
+ for (int i = 0; i < accessibleValueListeners.size(); i++) {
+ AccessibleValueListener listener = (AccessibleValueListener) accessibleValueListeners.elementAt(i);
+ listener.getCurrentValue(event);
}
- break;
- case ACC.ROLE_TABFOLDER: // the accessibility object representing the currently selected tab item
- case ACC.ROLE_TABITEM: // 1 = selected, 0 = not selected
- AccessibleControlEvent ace = new AccessibleControlEvent(this);
- ace.childID = -4;
+ returnValue = NSNumber.numberWithDouble(event.value.doubleValue());
+ } else {
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = childID;
+ event.detail = -1;
+ event.result = null; //TODO: could pass the OS value to the app
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getSelection(ace);
+ listener.getRole(event);
+ listener.getValue(event);
}
- if (ace.childID >= ACC.CHILDID_SELF) {
- if (role == ACC.ROLE_TABITEM) {
- returnValue = NSNumber.numberWithBool(ace.childID == childID);
- } else {
- returnValue = new id(OS.NSAccessibilityUnignoredAncestor(childIDToOs(ace.childID).id));
- }
- } else {
- returnValue = NSNumber.numberWithBool(false);
- }
- break;
- case ACC.ROLE_COMBOBOX: // text of the currently selected item
- case ACC.ROLE_TEXT: // text in the text field
- if (value != null) returnValue = NSString.stringWith(value);
- break;
- case ACC.ROLE_LABEL: // text in the label
- /* On a Mac, the 'value' of a label is the same as the 'name' of the label. */
- AccessibleEvent e = new AccessibleEvent(this);
- e.childID = childID;
- e.result = null;
- for (int i = 0; i < accessibleListeners.size(); i++) {
- AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
- listener.getName(e);
- }
- if (e.result != null) {
- returnValue = NSString.stringWith(e.result);
- } else {
- if (value != null) returnValue = NSString.stringWith(value);
+ int role = event.detail;
+ String value = event.result;
+
+ switch (role) {
+ case ACC.ROLE_RADIOBUTTON: // 1 = on, 0 = off
+ case ACC.ROLE_CHECKBUTTON: // 1 = checked, 0 = unchecked, 2 = mixed
+ case ACC.ROLE_SCROLLBAR: // numeric value representing the position of the scroller
+ case ACC.ROLE_SLIDER: // the value associated with the position of the slider thumb
+ case ACC.ROLE_PROGRESSBAR: // the value associated with the fill level of the progress bar
+ if (value != null) {
+ try {
+ int number = Integer.parseInt(value);
+ returnValue = NSNumber.numberWithBool(number == 0 ? false : true);
+ } catch (NumberFormatException ex) {
+ if (value.equalsIgnoreCase("true")) {
+ returnValue = NSNumber.numberWithBool(true);
+ } else if (value.equalsIgnoreCase("false")) {
+ returnValue = NSNumber.numberWithBool(false);
+ }
+ }
+ } else {
+ returnValue = NSNumber.numberWithBool(false);
+ }
+ break;
+ case ACC.ROLE_TABFOLDER: // the accessibility object representing the currently selected tab item
+ case ACC.ROLE_TABITEM: // 1 = selected, 0 = not selected
+ AccessibleControlEvent ace = new AccessibleControlEvent(this);
+ ace.childID = -4;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getSelection(ace);
+ }
+ if (ace.childID >= ACC.CHILDID_SELF) {
+ if (role == ACC.ROLE_TABITEM) {
+ returnValue = NSNumber.numberWithBool(ace.childID == childID);
+ } else {
+ returnValue = new id(OS.NSAccessibilityUnignoredAncestor(childIDToOs(ace.childID).id));
+ }
+ } else {
+ returnValue = NSNumber.numberWithBool(false);
+ }
+ break;
+ case ACC.ROLE_COMBOBOX: // text of the currently selected item
+ case ACC.ROLE_TEXT: // text in the text field
+ if (value != null) returnValue = NSString.stringWith(value);
+ break;
+ case ACC.ROLE_LABEL: // text in the label
+ /* On a Mac, the 'value' of a label is the same as the 'name' of the label. */
+ AccessibleEvent e = new AccessibleEvent(this);
+ e.childID = childID;
+ e.result = null;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getName(e);
+ }
+ if (e.result != null) {
+ returnValue = NSString.stringWith(e.result);
+ } else {
+ if (value != null) returnValue = NSString.stringWith(value);
+ }
+ returnValue = returnValue == null ? NSString.string() : returnValue;
+ break;
}
- break;
}
-
return returnValue;
}
@@ -985,8 +1477,9 @@ public class Accessible {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getState(event);
}
-
- return NSNumber.numberWithBool(control.isEnabled());
+ boolean enabled = (event.detail & ACC.STATE_ENABLED) != 0;
+ if (!enabled && delegate == null) enabled = control.isEnabled();
+ return NSNumber.numberWithBool(enabled);
}
id getFocusedAttribute (int childID) {
@@ -1025,15 +1518,26 @@ public class Accessible {
}
id getParentAttribute (int childID) {
- // Returning null here means 'let Cocoa figure it out.'
- if (childID == ACC.CHILDID_SELF)
- return null;
- else
- return new id(OS.NSAccessibilityUnignoredAncestor(control.view.id));
+ id returnValue = null;
+ if (childID == ACC.CHILDID_SELF) {
+ if (parent != null) {
+ if (parent.delegate != null) {
+ returnValue = parent.delegate;
+ } else {
+ returnValue = new id(OS.NSAccessibilityUnignoredAncestor(accessibleHandle(parent).id));
+ }
+ } else {
+ // Returning null here means 'let Cocoa figure it out.'
+ returnValue = null;
+ }
+ } else {
+ returnValue = new id(OS.NSAccessibilityUnignoredAncestor(accessibleHandle(this).id));
+ }
+ return returnValue;
}
id getChildrenAttribute (int childID) {
- id returnValue = null;
+ id returnValue = null;
if (childID == ACC.CHILDID_SELF) {
AccessibleControlEvent event = new AccessibleControlEvent(this);
event.childID = childID;
@@ -1042,28 +1546,33 @@ public class Accessible {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getChildCount(event);
}
- if (event.detail > 0) {
+ int childCount = event.detail;
+ if (childCount > 0) {
for (int i = 0; i < accessibleControlListeners.size(); i++) {
AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
listener.getChildren(event);
}
- Object [] appChildren = event.children;
- if (appChildren != null && appChildren.length > 0) {
- /* return an NSArray of NSAccessible objects. */
- NSMutableArray childArray = NSMutableArray.arrayWithCapacity(appChildren.length);
-
- for (int i = 0; i < appChildren.length; i++) {
- Object child = appChildren[i];
+ Object[] children = event.children;
+ NSMutableArray childArray = NSMutableArray.arrayWithCapacity(childCount);
+ for (int i = 0; i < childCount; i++) {
+ Object child = children[i];
+ if (child instanceof Accessible) {
+ Accessible accessible = (Accessible)child;
+ if (accessible.delegate != null) {
+ childArray.addObject(accessible.delegate);
+ } else {
+ childArray.addObject(accessibleHandle(accessible));
+ }
+ } else {
if (child instanceof Integer) {
id accChild = childIDToOs(((Integer)child).intValue());
childArray.addObject(accChild);
- } else {
- childArray.addObject(((Accessible)child).control.view);
- }
+ }
}
-
- returnValue = new id(OS.NSAccessibilityUnignoredChildren(childArray.id));
}
+ returnValue = new id(OS.NSAccessibilityUnignoredChildren(childArray.id));
+ } else {
+ returnValue = NSArray.array();
}
} else {
// Lightweight children have no children of their own.
@@ -1202,6 +1711,22 @@ public class Accessible {
return returnValue;
}
+ id getCellForColumnAndRowParameter(id parameter, int childID) {
+ id returnValue = null;
+ NSArray parameterObject = new NSArray(parameter.id);
+ if (parameterObject.count() == 2) {
+ AccessibleTableEvent event = new AccessibleTableEvent(this);
+ event.column = new NSNumber(parameterObject.objectAtIndex(0)).intValue();
+ event.row = new NSNumber(parameterObject.objectAtIndex(1)).intValue();
+ for (int i = 0; i < accessibleTableListeners.size(); i++) {
+ AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i);
+ listener.getCell(event);
+ returnValue = event.accessible.delegate;
+ }
+ }
+ return returnValue;
+ }
+
id getDescriptionAttribute (int childID) {
AccessibleEvent event = new AccessibleEvent(this);
event.childID = childID;
@@ -1225,60 +1750,158 @@ public class Accessible {
id getInsertionPointLineNumberAttribute (int childID) {
id returnValue = null;
- AccessibleControlEvent controlEvent = new AccessibleControlEvent(this);
- controlEvent.childID = childID;
- controlEvent.result = null;
- for (int i = 0; i < accessibleControlListeners.size(); i++) {
- AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getValue(controlEvent);
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getCaretOffset(event);
+ }
+ int caretOffset = event.offset;
+ event.start = caretOffset;
+ event.count = Integer.MIN_VALUE;
+ event.type = ACC.TEXT_BOUNDARY_LINE;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getText(event);
+ }
+ returnValue = NSNumber.numberWithInt(Math.max(0, -event.count));
+ } else {
+ AccessibleControlEvent controlEvent = new AccessibleControlEvent(this);
+ controlEvent.childID = childID;
+ controlEvent.result = null;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getValue(controlEvent);
+ }
+ AccessibleTextEvent textEvent = new AccessibleTextEvent(this);
+ textEvent.childID = childID;
+ textEvent.offset = -1;
+ for (int i = 0; i < accessibleTextListeners.size(); i++) {
+ AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
+ listener.getCaretOffset(textEvent);
+ }
+ if (controlEvent.result != null && textEvent.offset != -1) {
+ int lineNumber = lineNumberForOffset (controlEvent.result, textEvent.offset);
+ returnValue = NSNumber.numberWithInt(lineNumber);
+ }
}
- AccessibleTextEvent textEvent = new AccessibleTextEvent(this);
- textEvent.childID = childID;
- textEvent.offset = -1;
- for (int i = 0; i < accessibleTextListeners.size(); i++) {
- AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
- listener.getCaretOffset(textEvent);
+ return returnValue;
+ }
+
+ id getLineForIndexParameterizedAttribute (id parameter, int childID) {
+ id returnValue = null;
+ NSNumber charNumberObj = new NSNumber(parameter.id);
+ int charNumber = charNumberObj.intValue();
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ event.start = charNumber;
+ event.count = Integer.MIN_VALUE;
+ event.type = ACC.TEXT_BOUNDARY_LINE;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getText(event);
+ }
+ returnValue = NSNumber.numberWithInt(Math.max(0, -event.count));
+ } else {
+ AccessibleControlEvent controlEvent = new AccessibleControlEvent(this);
+ controlEvent.childID = childID;
+ controlEvent.result = null;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getValue(controlEvent);
+ }
+ String text = controlEvent.result;
+ if (text != null) returnValue = NSNumber.numberWithInt(lineNumberForOffset(text, charNumber));
}
- if (controlEvent.result != null && textEvent.offset != -1) {
- int lineNumber = lineNumberForOffset (controlEvent.result, textEvent.offset);
- returnValue = NSNumber.numberWithInt(lineNumber);
+ return returnValue;
+ }
+
+ id getMaxValueAttribute(int childID) {
+ id returnValue = null;
+ if (accessibleValueListeners.size() > 0) {
+ AccessibleValueEvent event = new AccessibleValueEvent(this);
+ for (int i = 0; i < accessibleValueListeners.size(); i++) {
+ AccessibleValueListener listener = (AccessibleValueListener) accessibleValueListeners.elementAt(i);
+ listener.getMaximumValue(event);
+ }
+ returnValue = NSNumber.numberWithDouble(event.value.doubleValue());
}
return returnValue;
}
- id getNumberOfCharactersAttribute (int childID) {
+ id getMinValueAttribute(int childID) {
id returnValue = null;
- AccessibleControlEvent event = new AccessibleControlEvent(this);
- event.childID = childID;
- event.result = null;
- for (int i = 0; i < accessibleControlListeners.size(); i++) {
- AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getValue(event);
+ if (accessibleValueListeners.size() > 0) {
+ AccessibleValueEvent event = new AccessibleValueEvent(this);
+ for (int i = 0; i < accessibleValueListeners.size(); i++) {
+ AccessibleValueListener listener = (AccessibleValueListener) accessibleValueListeners.elementAt(i);
+ listener.getMinimumValue(event);
+ }
+ returnValue = NSNumber.numberWithDouble(event.value.doubleValue());
}
- String appValue = event.result;
- if (appValue != null) {
- returnValue = NSNumber.numberWithInt(appValue.length());
+ return returnValue;
+ }
+
+ id getNumberOfCharactersAttribute (int childID) {
+ id returnValue = null;
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getCharacterCount(event);
+ }
+ returnValue = NSNumber.numberWithInt(event.count);
+ } else {
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = childID;
+ event.result = null;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getValue(event);
+ }
+ String appValue = event.result;
+ if (appValue != null) {
+ returnValue = NSNumber.numberWithInt(appValue.length());
+ }
}
return returnValue;
}
id getRangeForLineParameterizedAttribute (id parameter, int childID) {
id returnValue = null;
-
// The parameter is an NSNumber with the line number.
NSNumber lineNumberObj = new NSNumber(parameter.id);
int lineNumber = lineNumberObj.intValue();
- AccessibleControlEvent event = new AccessibleControlEvent(this);
- event.childID = childID;
- event.result = null;
- for (int i = 0; i < accessibleControlListeners.size(); i++) {
- AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getValue(event);
- }
- if (event.result != null) {
- NSRange range = rangeForLineNumber (lineNumber, event.result);
- if (range.location != -1) {
- returnValue = NSValue.valueWithRange(range);
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ event.start = event.end = 0;
+ event.count = lineNumber;
+ event.type = ACC.TEXT_BOUNDARY_LINE;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getText(event);
+ }
+ NSRange range = new NSRange();
+ range.location = event.start;
+ range.length = event.end - event.start + 1;
+ returnValue = NSValue.valueWithRange(range);
+ } else {
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = childID;
+ event.result = null;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getValue(event);
+ }
+ if (event.result != null) {
+ NSRange range = rangeForLineNumber (lineNumber, event.result);
+ if (range.location != -1) {
+ returnValue = NSValue.valueWithRange(range);
+ }
}
}
return returnValue;
@@ -1286,27 +1909,48 @@ public class Accessible {
id getSelectedTextAttribute (int childID) {
id returnValue = NSString.string();
- AccessibleTextEvent event = new AccessibleTextEvent(this);
- event.childID = childID;
- event.offset = -1;
- event.length = -1;
- for (int i = 0; i < accessibleTextListeners.size(); i++) {
- AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
- listener.getSelectionRange(event);
- }
- int offset = event.offset;
- int length = event.length;
- if (offset != -1 && length != -1 && length != 0) { // TODO: do we need the && length != 0 ?
- AccessibleControlEvent event2 = new AccessibleControlEvent(this);
- event2.childID = event.childID;
- event2.result = null;
- for (int i = 0; i < accessibleControlListeners.size(); i++) {
- AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getValue(event2);
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ event.index = 0;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getSelection(event);
}
- String appValue = event2.result;
- if (appValue != null) {
- returnValue = NSString.stringWith(appValue.substring(offset, offset + length));
+ int start = event.start;
+ int end = event.end;
+ if (start != end) {
+ event.type = ACC.TEXT_BOUNDARY_ALL;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getText(event);
+ }
+ }
+ String text = event.result;
+ if (text != null) returnValue = NSString.stringWith(text);
+ } else {
+ AccessibleTextEvent event = new AccessibleTextEvent(this);
+ event.childID = childID;
+ event.offset = -1;
+ event.length = -1;
+ for (int i = 0; i < accessibleTextListeners.size(); i++) {
+ AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
+ listener.getSelectionRange(event);
+ }
+ int offset = event.offset;
+ int length = event.length;
+ if (offset != -1 && length != -1 && length != 0) { // TODO: do we need the && length != 0 ?
+ AccessibleControlEvent event2 = new AccessibleControlEvent(this);
+ event2.childID = event.childID;
+ event2.result = null;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getValue(event2);
+ }
+ String appValue = event2.result;
+ if (appValue != null) {
+ returnValue = NSString.stringWith(appValue.substring(offset, offset + length));
+ }
}
}
return returnValue;
@@ -1314,85 +1958,148 @@ public class Accessible {
id getSelectedTextRangeAttribute (int childID) {
id returnValue = null;
- AccessibleTextEvent event = new AccessibleTextEvent(this);
- event.childID = childID;
- event.offset = -1;
- event.length = 0;
- for (int i = 0; i < accessibleTextListeners.size(); i++) {
- AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
- listener.getSelectionRange(event);
- }
- if (event.offset != -1) {
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ event.index = 0;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getSelection(event);
+ }
NSRange range = new NSRange();
- range.location = event.offset;
- range.length = event.length;
+ range.location = event.start;
+ range.length = event.end - event.start;
returnValue = NSValue.valueWithRange(range);
+ } else {
+ AccessibleTextEvent event = new AccessibleTextEvent(this);
+ event.childID = childID;
+ event.offset = -1;
+ event.length = 0;
+ for (int i = 0; i < accessibleTextListeners.size(); i++) {
+ AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
+ listener.getSelectionRange(event);
+ }
+ if (event.offset != -1) {
+ NSRange range = new NSRange();
+ range.location = event.offset;
+ range.length = event.length;
+ returnValue = NSValue.valueWithRange(range);
+ }
}
return returnValue;
}
+ id getServesAsTitleForUIElementsAttribute(int childID) {
+ id returnValue = null;
+ Relation relation = relations[ACC.RELATION_LABEL_FOR];
+ if (relation != null) returnValue = relation.getServesAsTitleForUIElements();
+ return returnValue == null ? NSArray.array() : returnValue;
+ }
+
id getStringForRangeAttribute (id parameter, int childID) {
id returnValue = null;
// Parameter is an NSRange wrapped in an NSValue.
NSValue parameterObject = new NSValue(parameter.id);
- NSRange range = parameterObject.rangeValue();
- AccessibleControlEvent event = new AccessibleControlEvent(this);
- event.childID = childID;
- event.result = null;
- for (int i = 0; i < accessibleControlListeners.size(); i++) {
- AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getValue(event);
- }
- String appValue = event.result;
-
- if (appValue != null) {
- returnValue = NSString.stringWith(appValue.substring((int)/*64*/range.location, (int)/*64*/(range.location + range.length)));
+ NSRange range = parameterObject.rangeValue();
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ event.start = (int) /*64*/ range.location;
+ event.end = (int) /*64*/ (range.location + range.length);
+ event.type = ACC.TEXT_BOUNDARY_ALL;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getText(event);
+ }
+ if (event.result != null) returnValue = NSString.stringWith(event.result);
+ } else {
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = childID;
+ event.result = null;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getValue(event);
+ }
+ String appValue = event.result;
+
+ if (appValue != null) {
+ returnValue = NSString.stringWith(appValue.substring((int)/*64*/range.location, (int)/*64*/(range.location + range.length)));
+ }
}
-
return returnValue;
}
id getSelectedTextRangesAttribute (int childID) {
- NSMutableArray returnValue = null;
- AccessibleTextEvent event = new AccessibleTextEvent(this);
- event.childID = childID;
- event.offset = -1;
- event.length = 0;
-
- for (int i = 0; i < accessibleTextListeners.size(); i++) {
- AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
- listener.getSelectionRange(event);
- }
-
- if (event.offset != -1) {
- returnValue = NSMutableArray.arrayWithCapacity(1);
- NSRange range = new NSRange();
- range.location = event.offset;
- range.length = event.length;
- returnValue.addObject(NSValue.valueWithRange(range));
+ NSMutableArray returnValue = null;
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getSelectionCount(event);
+ }
+ if (event.count > 0) {
+ returnValue = NSMutableArray.arrayWithCapacity(event.count);
+ for (int i = 0; i < event.count; i++) {
+ event.index = i;
+ for (int j = 0; j < accessibleTextExtendedListeners.size(); j++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(j);
+ listener.getSelection(event);
+ }
+ NSRange range = new NSRange();
+ range.location = event.start;
+ range.length = event.end - event.start + 1;
+ returnValue.addObject(NSValue.valueWithRange(range));
+ }
+ }
+ } else {
+ AccessibleTextEvent event = new AccessibleTextEvent(this);
+ event.childID = childID;
+ event.offset = -1;
+ event.length = 0;
+
+ for (int i = 0; i < accessibleTextListeners.size(); i++) {
+ AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i);
+ listener.getSelectionRange(event);
+ }
+
+ if (event.offset != -1) {
+ returnValue = NSMutableArray.arrayWithCapacity(1);
+ NSRange range = new NSRange();
+ range.location = event.offset;
+ range.length = event.length;
+ returnValue.addObject(NSValue.valueWithRange(range));
+ }
}
-
return returnValue;
}
id getVisibleCharacterRangeAttribute (int childID) {
- AccessibleControlEvent event = new AccessibleControlEvent(this);
- event.childID = childID;
- event.result = null;
- for (int i = 0; i < accessibleControlListeners.size(); i++) {
- AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
- listener.getValue(event);
- }
-
NSRange range = new NSRange();
-
- if (event.result != null) {
- range.location = 0;
- range.length = event.result.length();
+ if (accessibleTextExtendedListeners.size() > 0) {
+ AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this);
+ event.childID = childID;
+ for (int i=0; i<accessibleTextExtendedListeners.size(); i++) {
+ AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i);
+ listener.getVisibleRanges(event);
+ }
+ range.location = event.start;
+ range.length = event.end + 1;
} else {
- return null;
-// range.location = range.length = 0;
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = childID;
+ event.result = null;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getValue(event);
+ }
+ if (event.result != null) {
+ range.location = 0;
+ range.length = event.result.length();
+ } else {
+ return null;
+ }
}
return NSValue.valueWithRange(range);
@@ -1508,7 +2215,6 @@ public class Accessible {
* </ul>
*
* @see AccessibleTextListener
- * @see AccessibleTextExtendedListener
* @see #addAccessibleTextListener
*
* @since 3.0
@@ -1524,8 +2230,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleAction</code> interface.
@@ -1553,8 +2257,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleHyperlink</code> interface.
@@ -1582,8 +2284,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleTable</code> interface.
@@ -1611,8 +2311,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleTableCell</code> interface.
@@ -1640,8 +2338,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleValue</code> interface.
@@ -1669,8 +2365,6 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Removes the listener from the collection of listeners that will be
* notified when an accessible client asks for any of the properties
* defined in the <code>AccessibleAttribute</code> interface.
@@ -1698,28 +2392,23 @@ public class Accessible {
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Removes the relation with the specified type and target
* from the receiver's set of relations.
*
- * @param type an <code>ACC</code> constant beginning with RELATION_* indicating the type of relation
+ * @param type a constant beginning with RELATION_* indicating the type of relation
* @param target the accessible that is the target for this relation
*
* @since 3.6
*/
public void removeRelation(int type, Accessible target) {
- checkWidget();
- // TODO
+ //TODO: platform-specific? (we will manage the set on Windows)
}
/**
- * WARNING: API UNDER CONSTRUCTION
- *
* Sends a message to accessible clients indicating that something
* has changed within a custom control.
*
- * @param event an <code>ACC</code> constant beginning with EVENT_* indicating the message to send
+ * @param event a constant beginning with EVENT_* indicating the message to send
* @param childID an identifier specifying a child of the control or the control itself
*
* @exception SWTException <ul>
@@ -1731,9 +2420,9 @@ public class Accessible {
*/
public void sendEvent(int event, int childID) {
checkWidget();
- // TODO
+ //TODO: send platform-specific event (i.e. WinEvent with EVENT_OBJECT_* or IA2_EVENT_* on Win, Signal on ATK, Notification on Mac)
}
-
+
/**
* WARNING: API UNDER CONSTRUCTION
*
@@ -1753,7 +2442,40 @@ public class Accessible {
*/
public void sendEvent(int event, int childID, Object eventData) {
checkWidget();
- // TODO
+ //TODO
+ }
+
+ void release(boolean destroy) {
+ Iterator childIter = children.iterator();
+ while(childIter.hasNext()) {
+ Accessible accessible = (Accessible) childIter.next();
+ accessible.release(false);
+ }
+ children = null;
+ if (destroy && parent != null) parent.children.remove(this);
+
+ if (actionNames != null) actionNames.release();
+ actionNames = null;
+ if (attributeNames != null) attributeNames.release();
+ attributeNames = null;
+ if (parameterizedAttributeNames != null) parameterizedAttributeNames.release();
+ parameterizedAttributeNames = null;
+ if (delegate != null) delegate.release();
+ delegate = null;
+ relations = null;
+
+ Collection delegates = childToIdMap.values();
+ Iterator iter = delegates.iterator();
+ while (iter.hasNext()) {
+ SWTAccessibleDelegate childDelegate = (SWTAccessibleDelegate)iter.next();
+ childDelegate.internal_dispose_SWTAccessibleDelegate();
+ }
+ childToIdMap.clear();
+ childToIdMap = null;
+ }
+
+ void releaseAccessibleChildren() {
+
}
static NSArray retainedAutoreleased(NSArray inObject) {
@@ -1858,11 +2580,11 @@ public class Accessible {
}
/* Check cache for childID, if found, return corresponding osChildID. */
- SWTAccessibleDelegate childRef = (SWTAccessibleDelegate) children.get(new Integer(childID));
+ SWTAccessibleDelegate childRef = (SWTAccessibleDelegate) childToIdMap.get(new Integer(childID));
if (childRef == null) {
childRef = new SWTAccessibleDelegate(this, childID);
- children.put(new Integer(childID), childRef);
+ childToIdMap.put(new Integer(childID), childRef);
}
return childRef;
@@ -1908,8 +2630,15 @@ public class Accessible {
case ACC.ROLE_TOOLBAR: nsReturnValue = OS.NSAccessibilityToolbarRole; break;
case ACC.ROLE_LIST: nsReturnValue = OS.NSAccessibilityOutlineRole; break;
case ACC.ROLE_LISTITEM: nsReturnValue = OS.NSAccessibilityStaticTextRole; break;
+ case ACC.ROLE_COLUMN: nsReturnValue = OS.NSAccessibilityColumnRole; break;
+ case ACC.ROLE_ROW: nsReturnValue = concatStringsAsRole(OS.NSAccessibilityRowRole, OS.NSAccessibilityTableRowSubrole); break;
case ACC.ROLE_TABLE: nsReturnValue = OS.NSAccessibilityTableRole; break;
- case ACC.ROLE_TABLECELL: nsReturnValue = concatStringsAsRole(OS.NSAccessibilityRowRole, OS.NSAccessibilityTableRowSubrole); break;
+ case ACC.ROLE_TABLECELL:
+ if (OS.VERSION >= 0x1060) {
+ nsReturnValue = OS.NSAccessibilityCellRole;
+ } else {
+ nsReturnValue = concatStringsAsRole(OS.NSAccessibilityRowRole, OS.NSAccessibilityTableRowSubrole);
+ }
case ACC.ROLE_TABLECOLUMNHEADER: nsReturnValue = OS.NSAccessibilitySortButtonRole; break;
case ACC.ROLE_TABLEROWHEADER: nsReturnValue = concatStringsAsRole(OS.NSAccessibilityRowRole, OS.NSAccessibilityTableRowSubrole); break;
case ACC.ROLE_TREE: nsReturnValue = OS.NSAccessibilityOutlineRole; break;
@@ -1919,6 +2648,29 @@ public class Accessible {
case ACC.ROLE_PROGRESSBAR: nsReturnValue = OS.NSAccessibilityProgressIndicatorRole; break;
case ACC.ROLE_SLIDER: nsReturnValue = OS.NSAccessibilitySliderRole; break;
case ACC.ROLE_LINK: nsReturnValue = OS.NSAccessibilityLinkRole; break;
+
+ //10.6 only -> case ACC.ROLE_CANVAS: nsReturnValue = OS.NSAccessibilityLayoutAreaRole; break;
+ case ACC.ROLE_CANVAS: nsReturnValue = OS.NSAccessibilityGroupRole; break;
+ case ACC.ROLE_GRAPHIC: nsReturnValue = OS.NSAccessibilityImageRole; break;
+ case ACC.ROLE_COLOR_CHOOSER: nsReturnValue = OS.NSAccessibilityColorWellRole; break;
+
+ //CLIENT_AREA uses NSAccessibilityGroupRole already
+ case ACC.ROLE_GROUP: nsReturnValue = OS.NSAccessibilityGroupRole; break;
+ //SPLIT_BUTTON uses NSAccessibilityMenuButtonRole already
+ case ACC.ROLE_CHECK_MENU_ITEM: nsReturnValue = OS.NSAccessibilityMenuButtonRole; break;
+ case ACC.ROLE_RADIO_MENU_ITEM: nsReturnValue = OS.NSAccessibilityMenuButtonRole; break;
+ //don't know the right answer for these:
+ case ACC.ROLE_ALERT:
+ case ACC.ROLE_ANIMATION:
+ case ACC.ROLE_DOCUMENT:
+ case ACC.ROLE_HEADING:
+ case ACC.ROLE_SPINBUTTON:
+ case ACC.ROLE_STATUSBAR:
+ case ACC.ROLE_CLOCK:
+ case ACC.ROLE_DATE_EDITOR:
+ case ACC.ROLE_FILE_CHOOSER:
+ case ACC.ROLE_FONT_CHOOSER:
+ nsReturnValue = OS.NSAccessibilityUnknownRole;
}
return nsReturnValue.getString();
@@ -1947,15 +2699,22 @@ public class Accessible {
if (osRole.isEqualToString(OS.NSAccessibilityToolbarRole)) return ACC.ROLE_TOOLBAR;
if (osRole.isEqualToString(OS.NSAccessibilityListRole)) return ACC.ROLE_LIST;
if (osRole.isEqualToString(OS.NSAccessibilityTableRole)) return ACC.ROLE_TABLE;
- if (osRole.isEqualToString(OS.NSAccessibilityColumnRole)) return ACC.ROLE_TABLECOLUMNHEADER;
+ if (osRole.isEqualToString(OS.NSAccessibilityColumnRole)) return ACC.ROLE_COLUMN;
if (osRole.isEqualToString(concatStringsAsRole(OS.NSAccessibilityButtonRole, OS.NSAccessibilitySortButtonRole))) return ACC.ROLE_TABLECOLUMNHEADER;
- if (osRole.isEqualToString(concatStringsAsRole(OS.NSAccessibilityRowRole, OS.NSAccessibilityTableRowSubrole))) return ACC.ROLE_TABLEROWHEADER;
+ if (osRole.isEqualToString(concatStringsAsRole(OS.NSAccessibilityRowRole, OS.NSAccessibilityTableRowSubrole))) return ACC.ROLE_ROW;
if (osRole.isEqualToString(OS.NSAccessibilityOutlineRole)) return ACC.ROLE_TREE;
if (osRole.isEqualToString(concatStringsAsRole(OS.NSAccessibilityOutlineRole, OS.NSAccessibilityOutlineRowSubrole))) return ACC.ROLE_TREEITEM;
if (osRole.isEqualToString(OS.NSAccessibilityTabGroupRole)) return ACC.ROLE_TABFOLDER;
if (osRole.isEqualToString(OS.NSAccessibilityProgressIndicatorRole)) return ACC.ROLE_PROGRESSBAR;
if (osRole.isEqualToString(OS.NSAccessibilitySliderRole)) return ACC.ROLE_SLIDER;
if (osRole.isEqualToString(OS.NSAccessibilityLinkRole)) return ACC.ROLE_LINK;
+ if (osRole.isEqualToString(OS.NSAccessibilityGroupRole)) return ACC.ROLE_CANVAS;
+ if (osRole.isEqualToString(OS.NSAccessibilityGroupRole)) return ACC.ROLE_GROUP;
+ if (osRole.isEqualToString(OS.NSAccessibilityImageRole)) return ACC.ROLE_GRAPHIC;
+ if (osRole.isEqualToString(OS.NSAccessibilityMenuButtonRole)) return ACC.ROLE_CHECK_MENU_ITEM;
+ if (osRole.isEqualToString(OS.NSAccessibilityMenuButtonRole)) return ACC.ROLE_RADIO_MENU_ITEM;
+ if (osRole.isEqualToString(OS.NSAccessibilityColorWellRole)) return ACC.ROLE_COLOR_CHOOSER;
+ if (OS.VERSION >= 0x1060 && osRole.isEqualToString(OS.NSAccessibilityCellRole)) return ACC.ROLE_TABLECELL;
return ACC.ROLE_CLIENT_AREA;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Relation.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Relation.java
new file mode 100644
index 0000000000..0d5e2deab2
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Relation.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.accessibility;
+
+import org.eclipse.swt.internal.cocoa.*;
+
+class Relation {
+ Accessible accessible;
+ Accessible[] targets;
+ int type;
+
+ Relation(Accessible accessible, int type) {
+ this.accessible = accessible;
+ this.type = type;
+ this.targets = new Accessible[0];
+ }
+
+ void addTarget(Accessible target) {
+ Accessible[] newTargets = new Accessible[targets.length + 1];
+ System.arraycopy(targets, 0, newTargets, 0, targets.length);
+ newTargets[targets.length] = target;
+ targets = newTargets;
+ }
+
+ void removeTarget(Accessible target) {
+ Accessible[] newTargets = new Accessible[targets.length - 1];
+ int j = 0;
+ for (int i = 0; i < targets.length; i++) {
+ if (targets[i] != target) {
+ newTargets[j++] = targets[i];
+ }
+ }
+ targets = newTargets;
+ }
+
+ id getTitleUIElement() {
+ id result = null;
+ for (int i = 0; i < targets.length; i++) {
+ Accessible target = targets[i];
+ result = target.accessibleHandle(target);
+ }
+ return result;
+ }
+
+ id getServesAsTitleForUIElements() {
+ NSMutableArray result = NSMutableArray.arrayWithCapacity(targets.length);
+ for (int i = 0; i < targets.length; i++) {
+ Accessible target = targets[i];
+ id accessibleElement = target.accessibleHandle(target);
+ result.addObject(accessibleElement);
+ }
+ return result;
+ }
+
+ id getLinkedUIElements() {
+ NSMutableArray result = NSMutableArray.arrayWithCapacity(targets.length);
+ for (int i = 0; i < targets.length; i++) {
+ Accessible target = targets[i];
+ id accessibleElement = target.accessibleHandle(target);
+ result.addObject(accessibleElement);
+ }
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java
index e47c729245..f80d9f585a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java
@@ -29,7 +29,7 @@ class SWTAccessibleDelegate extends NSObject {
static Callback accessible2Args, accessible3Args, accessible4Args;
static int /*long*/ proc2Args, proc3Args, proc4Args;
- Accessible accessibleParent;
+ Accessible accessible;
int /*long*/ delegateJniRef;
int childID;
@@ -88,7 +88,7 @@ class SWTAccessibleDelegate extends NSObject {
public SWTAccessibleDelegate(Accessible accessible, int childID) {
super(0);
- this.accessibleParent = accessible;
+ this.accessible = accessible;
this.childID = childID;
alloc().init();
delegateJniRef = OS.NewGlobalRef(this);
@@ -101,7 +101,7 @@ class SWTAccessibleDelegate extends NSObject {
if (actionNames != null)
return retainedAutoreleased(actionNames);
- actionNames = accessibleParent.internal_accessibilityActionNames(childID);
+ actionNames = accessible.internal_accessibilityActionNames(childID);
actionNames.retain();
return retainedAutoreleased(actionNames);
}
@@ -111,13 +111,13 @@ class SWTAccessibleDelegate extends NSObject {
if (attributeNames != null)
return retainedAutoreleased(attributeNames);
- attributeNames = accessibleParent.internal_accessibilityAttributeNames(childID);
+ attributeNames = accessible.internal_accessibilityAttributeNames(childID);
attributeNames.retain();
return retainedAutoreleased(attributeNames);
}
id accessibilityAttributeValue(NSString attribute) {
- return accessibleParent.internal_accessibilityAttributeValue(attribute, childID);
+ return accessible.internal_accessibilityAttributeValue(attribute, childID);
}
// parameterized attribute methods
@@ -126,18 +126,18 @@ class SWTAccessibleDelegate extends NSObject {
if (parameterizedAttributeNames != null)
return retainedAutoreleased(parameterizedAttributeNames);
- parameterizedAttributeNames = accessibleParent.internal_accessibilityParameterizedAttributeNames(childID);
+ parameterizedAttributeNames = accessible.internal_accessibilityParameterizedAttributeNames(childID);
parameterizedAttributeNames.retain();
return retainedAutoreleased(parameterizedAttributeNames);
}
id accessibilityAttributeValue_forParameter(NSString attribute, id parameter) {
- return accessibleParent.internal_accessibilityAttributeValue_forParameter(attribute, parameter, childID);
+ return accessible.internal_accessibilityAttributeValue_forParameter(attribute, parameter, childID);
}
// Return YES if the UIElement doesn't show up to the outside world - i.e. its parent should return the UIElement's children as its own - cutting the UIElement out. E.g. NSControls are ignored when they are single-celled.
boolean accessibilityIsIgnored() {
- return accessibleParent.internal_accessibilityIsIgnored(childID);
+ return accessible.internal_accessibilityIsIgnored(childID);
}
boolean accessibilityIsAttributeSettable(NSString attribute) {
@@ -146,24 +146,24 @@ class SWTAccessibleDelegate extends NSObject {
// Returns the deepest descendant of the UIElement hierarchy that contains the point. You can assume the point has already been determined to lie within the receiver. Override this method to do deeper hit testing within a UIElement - e.g. a NSMatrix would test its cells. The point is bottom-left relative screen coordinates.
id accessibilityHitTest(NSPoint point) {
- return accessibleParent.internal_accessibilityHitTest(point, childID);
+ return accessible.internal_accessibilityHitTest(point, childID);
}
// Returns the UI Element that has the focus. You can assume that the search for the focus has already been narrowed down to the reciever. Override this method to do a deeper search with a UIElement - e.g. a NSMatrix would determine if one of its cells has the focus.
id accessibilityFocusedUIElement() {
- return accessibleParent.internal_accessibilityFocusedUIElement(childID);
+ return accessible.internal_accessibilityFocusedUIElement(childID);
}
void accessibilityPerformAction(NSString action) {
- accessibleParent.internal_accessibilityPerformAction(action, childID);
+ accessible.internal_accessibilityPerformAction(action, childID);
}
id accessibilityActionDescription(NSString action) {
- return accessibleParent.internal_accessibilityActionDescription(action, childID);
+ return accessible.internal_accessibilityActionDescription(action, childID);
}
-
void accessibilitySetValue_forAttribute(id value, NSString attribute) {
+ accessible.internal_accessibilitySetValue_forAttribute(value, attribute);
}
static NSArray retainedAutoreleased(NSArray inObject) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
index a397ccfcd8..ec1c0f26f7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
@@ -2432,6 +2432,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityActionDescription)
}
#endif
+#ifndef NO_NSAccessibilityBoundsForRangeParameterizedAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityBoundsForRangeParameterizedAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityBoundsForRangeParameterizedAttribute_FUNC);
+ rc = (jintLong)NSAccessibilityBoundsForRangeParameterizedAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityBoundsForRangeParameterizedAttribute_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilityButtonRole
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityButtonRole)
(JNIEnv *env, jclass that)
@@ -2468,6 +2480,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityChildrenAttribute)
}
#endif
+#ifndef NO_NSAccessibilityColorWellRole
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityColorWellRole)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityColorWellRole_FUNC);
+ rc = (jintLong)NSAccessibilityColorWellRole;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityColorWellRole_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilityColumnRole
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityColumnRole)
(JNIEnv *env, jclass that)
@@ -2480,6 +2504,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityColumnRole)
}
#endif
+#ifndef NO_NSAccessibilityColumnsAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityColumnsAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityColumnsAttribute_FUNC);
+ rc = (jintLong)NSAccessibilityColumnsAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityColumnsAttribute_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilityComboBoxRole
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityComboBoxRole)
(JNIEnv *env, jclass that)
@@ -2624,6 +2660,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityGroupRole)
}
#endif
+#ifndef NO_NSAccessibilityHeaderAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityHeaderAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityHeaderAttribute_FUNC);
+ rc = (jintLong)NSAccessibilityHeaderAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityHeaderAttribute_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilityHelpAttribute
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityHelpAttribute)
(JNIEnv *env, jclass that)
@@ -2696,6 +2744,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityIncrementorRole)
}
#endif
+#ifndef NO_NSAccessibilityIndexAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityIndexAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityIndexAttribute_FUNC);
+ rc = (jintLong)NSAccessibilityIndexAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityIndexAttribute_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilityInsertionPointLineNumberAttribute
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityInsertionPointLineNumberAttribute)
(JNIEnv *env, jclass that)
@@ -2756,6 +2816,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityLinkTextAttribute)
}
#endif
+#ifndef NO_NSAccessibilityLinkedUIElementsAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityLinkedUIElementsAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityLinkedUIElementsAttribute_FUNC);
+ rc = (jintLong)NSAccessibilityLinkedUIElementsAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityLinkedUIElementsAttribute_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilityListRole
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityListRole)
(JNIEnv *env, jclass that)
@@ -3124,6 +3196,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityRowRole)
}
#endif
+#ifndef NO_NSAccessibilityRowsAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityRowsAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityRowsAttribute_FUNC);
+ rc = (jintLong)NSAccessibilityRowsAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityRowsAttribute_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilityScrollAreaRole
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityScrollAreaRole)
(JNIEnv *env, jclass that)
@@ -3184,6 +3268,30 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilitySelectedChildrenChangedNotif
}
#endif
+#ifndef NO_NSAccessibilitySelectedColumnsAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilitySelectedColumnsAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilitySelectedColumnsAttribute_FUNC);
+ rc = (jintLong)NSAccessibilitySelectedColumnsAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilitySelectedColumnsAttribute_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_NSAccessibilitySelectedRowsAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilitySelectedRowsAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilitySelectedRowsAttribute_FUNC);
+ rc = (jintLong)NSAccessibilitySelectedRowsAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilitySelectedRowsAttribute_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilitySelectedTextAttribute
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilitySelectedTextAttribute)
(JNIEnv *env, jclass that)
@@ -3664,6 +3772,30 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityVisibleChildrenAttribute)
}
#endif
+#ifndef NO_NSAccessibilityVisibleColumnsAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityVisibleColumnsAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityVisibleColumnsAttribute_FUNC);
+ rc = (jintLong)NSAccessibilityVisibleColumnsAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityVisibleColumnsAttribute_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_NSAccessibilityVisibleRowsAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityVisibleRowsAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityVisibleRowsAttribute_FUNC);
+ rc = (jintLong)NSAccessibilityVisibleRowsAttribute;
+ OS_NATIVE_EXIT(env, that, NSAccessibilityVisibleRowsAttribute_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_NSAccessibilityWindowAttribute
JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityWindowAttribute)
(JNIEnv *env, jclass that)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c
index a23d49c14a..bce15be916 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c
@@ -15,6 +15,15 @@
#define OS_NATIVE(func) Java_org_eclipse_swt_internal_cocoa_OS_##func
+#define LOAD_CFSTR(var, name) \
+ static int initialized = 0; \
+ static CFStringRef *var = NULL; \
+ if (!initialized) { \
+ CFBundleRef bundle = CFBundleGetBundleWithIdentifier(CFSTR(name##_LIB)); \
+ if (bundle) var = CFBundleGetDataPointerForName(bundle, CFSTR(#name)); \
+ initialized = 1; \
+ }
+
#ifndef NO_JNIGetObject
JNIEXPORT jobject JNICALL OS_NATIVE(JNIGetObject)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -106,16 +115,99 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(isFlipped_1CALLBACK)
JNIEXPORT jintLong JNICALL OS_NATIVE(kTISPropertyUnicodeKeyLayoutData)
(JNIEnv *env, jclass that)
{
- // Technically this CFStringRef should be CFRetain'ed but we have no opportunity to release it.
- // The pointer won't disappear unless the Carbon framework bundle is somehow unloaded, which is unlikely to happen.
- static int initialized = 0;
- static CFStringRef *var = NULL;
- if (!initialized) {
- CFBundleRef bundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.Carbon"));
- if (bundle) var = (CFStringRef *)CFBundleGetDataPointerForName(bundle, CFSTR("kTISPropertyUnicodeKeyLayoutData"));
- initialized = 1;
- }
-
- return (jintLong)(*var);
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, kTISPropertyUnicodeKeyLayoutData_FUNC);
+/*
+ rc = (jintLong) kTISPropertyUnicodeKeyLayoutData;
+*/
+ {
+ LOAD_CFSTR(data, kTISPropertyUnicodeKeyLayoutData)
+ if (data) {
+ rc = (jintLong)(*data);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, kTISPropertyUnicodeKeyLayoutData_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_NSAccessibilityCellRole
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityCellRole)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityCellRole_FUNC);
+/*
+ rc = (jintLong)NSAccessibilityCellRole;
+*/
+ {
+ LOAD_CFSTR(data, NSAccessibilityCellRole)
+ if (data) {
+ rc = (jintLong)(*data);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, NSAccessibilityCellRole_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_NSAccessibilityColumnIndexRangeAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityColumnIndexRangeAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityColumnIndexRangeAttribute_FUNC);
+/*
+ rc = (jintLong)NSAccessibilityColumnIndexRangeAttribute;
+*/
+ {
+ LOAD_CFSTR(data, NSAccessibilityColumnIndexRangeAttribute)
+ if (data) {
+ rc = (jintLong)(*data);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, NSAccessibilityColumnIndexRangeAttribute_FUNC);
+ return rc;
}
#endif
+
+#ifndef NO_NSAccessibilityCellForColumnAndRowParameterizedAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityCellForColumnAndRowParameterizedAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityCellForColumnAndRowParameterizedAttribute_FUNC);
+/*
+ rc = (jintLong)NSAccessibilityCellForColumnAndRowParameterizedAttribute;
+*/
+ {
+ LOAD_CFSTR(data, NSAccessibilityCellForColumnAndRowParameterizedAttribute)
+ if (data) {
+ rc = (jintLong)(*data);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, NSAccessibilityCellForColumnAndRowParameterizedAttribute_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_NSAccessibilityRowIndexRangeAttribute
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAccessibilityRowIndexRangeAttribute)
+ (JNIEnv *env, jclass that)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, NSAccessibilityRowIndexRangeAttribute_FUNC);
+/*
+ rc = (jintLong)NSAccessibilityRowIndexRangeAttribute;
+*/
+ {
+ LOAD_CFSTR(data, NSAccessibilityRowIndexRangeAttribute)
+ if (data) {
+ rc = (jintLong)(*data);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, NSAccessibilityRowIndexRangeAttribute_FUNC);
+ return rc;
+}
+#endif
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h
index b6feb466e1..f6925dffdd 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.h
@@ -47,3 +47,8 @@
#define CancelMenuTracking_LIB "com.apple.Carbon"
#define SetSystemUIMode_LIB "com.apple.Carbon"
#define GetSystemUIMode_LIB "com.apple.Carbon"
+#define kTISPropertyUnicodeKeyLayoutData_LIB "com.apple.Carbon"
+#define NSAccessibilityCellForColumnAndRowParameterizedAttribute_LIB "com.apple.Cocoa"
+#define NSAccessibilityCellRole_LIB "com.apple.Cocoa"
+#define NSAccessibilityColumnIndexRangeAttribute_LIB "com.apple.Cocoa"
+#define NSAccessibilityRowIndexRangeAttribute_LIB "com.apple.Cocoa"
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
index 8a02eeaa48..3fa531a4fa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 538;
-int OS_nativeFunctionCallCount[538];
+int OS_nativeFunctionCount = 553;
+int OS_nativeFunctionCallCount[553];
char * OS_nativeFunctionNames[] = {
"ATSFontActivateFromFileReference",
"AcquireRootMenu",
@@ -175,10 +175,16 @@ char * OS_nativeFunctionNames[] = {
"LineTo",
"MoveTo",
"NSAccessibilityActionDescription",
+ "NSAccessibilityBoundsForRangeParameterizedAttribute",
"NSAccessibilityButtonRole",
+ "NSAccessibilityCellForColumnAndRowParameterizedAttribute",
+ "NSAccessibilityCellRole",
"NSAccessibilityCheckBoxRole",
"NSAccessibilityChildrenAttribute",
+ "NSAccessibilityColorWellRole",
+ "NSAccessibilityColumnIndexRangeAttribute",
"NSAccessibilityColumnRole",
+ "NSAccessibilityColumnsAttribute",
"NSAccessibilityComboBoxRole",
"NSAccessibilityConfirmAction",
"NSAccessibilityContentsAttribute",
@@ -191,17 +197,20 @@ char * OS_nativeFunctionNames[] = {
"NSAccessibilityFocusedUIElementChangedNotification",
"NSAccessibilityGridRole",
"NSAccessibilityGroupRole",
+ "NSAccessibilityHeaderAttribute",
"NSAccessibilityHelpAttribute",
"NSAccessibilityHelpTagRole",
"NSAccessibilityHorizontalOrientationValue",
"NSAccessibilityHorizontalScrollBarAttribute",
"NSAccessibilityImageRole",
"NSAccessibilityIncrementorRole",
+ "NSAccessibilityIndexAttribute",
"NSAccessibilityInsertionPointLineNumberAttribute",
"NSAccessibilityLabelValueAttribute",
"NSAccessibilityLineForIndexParameterizedAttribute",
"NSAccessibilityLinkRole",
"NSAccessibilityLinkTextAttribute",
+ "NSAccessibilityLinkedUIElementsAttribute",
"NSAccessibilityListRole",
"NSAccessibilityMaxValueAttribute",
"NSAccessibilityMenuBarRole",
@@ -232,12 +241,16 @@ char * OS_nativeFunctionNames[] = {
"NSAccessibilityRoleDescription",
"NSAccessibilityRoleDescriptionAttribute",
"NSAccessibilityRoleDescriptionForUIElement",
+ "NSAccessibilityRowIndexRangeAttribute",
"NSAccessibilityRowRole",
+ "NSAccessibilityRowsAttribute",
"NSAccessibilityScrollAreaRole",
"NSAccessibilityScrollBarRole",
"NSAccessibilitySelectedAttribute",
"NSAccessibilitySelectedChildrenAttribute",
"NSAccessibilitySelectedChildrenChangedNotification",
+ "NSAccessibilitySelectedColumnsAttribute",
+ "NSAccessibilitySelectedRowsAttribute",
"NSAccessibilitySelectedTextAttribute",
"NSAccessibilitySelectedTextChangedNotification",
"NSAccessibilitySelectedTextRangeAttribute",
@@ -278,6 +291,8 @@ char * OS_nativeFunctionNames[] = {
"NSAccessibilityVerticalScrollBarAttribute",
"NSAccessibilityVisibleCharacterRangeAttribute",
"NSAccessibilityVisibleChildrenAttribute",
+ "NSAccessibilityVisibleColumnsAttribute",
+ "NSAccessibilityVisibleRowsAttribute",
"NSAccessibilityWindowAttribute",
"NSAccessibilityWindowRole",
"NSAffineTransformStruct_1sizeof",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
index c09e7a55af..b5949541e4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
@@ -183,10 +183,16 @@ typedef enum {
LineTo_FUNC,
MoveTo_FUNC,
NSAccessibilityActionDescription_FUNC,
+ NSAccessibilityBoundsForRangeParameterizedAttribute_FUNC,
NSAccessibilityButtonRole_FUNC,
+ NSAccessibilityCellForColumnAndRowParameterizedAttribute_FUNC,
+ NSAccessibilityCellRole_FUNC,
NSAccessibilityCheckBoxRole_FUNC,
NSAccessibilityChildrenAttribute_FUNC,
+ NSAccessibilityColorWellRole_FUNC,
+ NSAccessibilityColumnIndexRangeAttribute_FUNC,
NSAccessibilityColumnRole_FUNC,
+ NSAccessibilityColumnsAttribute_FUNC,
NSAccessibilityComboBoxRole_FUNC,
NSAccessibilityConfirmAction_FUNC,
NSAccessibilityContentsAttribute_FUNC,
@@ -199,17 +205,20 @@ typedef enum {
NSAccessibilityFocusedUIElementChangedNotification_FUNC,
NSAccessibilityGridRole_FUNC,
NSAccessibilityGroupRole_FUNC,
+ NSAccessibilityHeaderAttribute_FUNC,
NSAccessibilityHelpAttribute_FUNC,
NSAccessibilityHelpTagRole_FUNC,
NSAccessibilityHorizontalOrientationValue_FUNC,
NSAccessibilityHorizontalScrollBarAttribute_FUNC,
NSAccessibilityImageRole_FUNC,
NSAccessibilityIncrementorRole_FUNC,
+ NSAccessibilityIndexAttribute_FUNC,
NSAccessibilityInsertionPointLineNumberAttribute_FUNC,
NSAccessibilityLabelValueAttribute_FUNC,
NSAccessibilityLineForIndexParameterizedAttribute_FUNC,
NSAccessibilityLinkRole_FUNC,
NSAccessibilityLinkTextAttribute_FUNC,
+ NSAccessibilityLinkedUIElementsAttribute_FUNC,
NSAccessibilityListRole_FUNC,
NSAccessibilityMaxValueAttribute_FUNC,
NSAccessibilityMenuBarRole_FUNC,
@@ -240,12 +249,16 @@ typedef enum {
NSAccessibilityRoleDescription_FUNC,
NSAccessibilityRoleDescriptionAttribute_FUNC,
NSAccessibilityRoleDescriptionForUIElement_FUNC,
+ NSAccessibilityRowIndexRangeAttribute_FUNC,
NSAccessibilityRowRole_FUNC,
+ NSAccessibilityRowsAttribute_FUNC,
NSAccessibilityScrollAreaRole_FUNC,
NSAccessibilityScrollBarRole_FUNC,
NSAccessibilitySelectedAttribute_FUNC,
NSAccessibilitySelectedChildrenAttribute_FUNC,
NSAccessibilitySelectedChildrenChangedNotification_FUNC,
+ NSAccessibilitySelectedColumnsAttribute_FUNC,
+ NSAccessibilitySelectedRowsAttribute_FUNC,
NSAccessibilitySelectedTextAttribute_FUNC,
NSAccessibilitySelectedTextChangedNotification_FUNC,
NSAccessibilitySelectedTextRangeAttribute_FUNC,
@@ -286,6 +299,8 @@ typedef enum {
NSAccessibilityVerticalScrollBarAttribute_FUNC,
NSAccessibilityVisibleCharacterRangeAttribute_FUNC,
NSAccessibilityVisibleChildrenAttribute_FUNC,
+ NSAccessibilityVisibleColumnsAttribute_FUNC,
+ NSAccessibilityVisibleRowsAttribute_FUNC,
NSAccessibilityWindowAttribute_FUNC,
NSAccessibilityWindowRole_FUNC,
NSAffineTransformStruct_1sizeof_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
index 726b934a16..9b3d6ae6fc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="UTF8"?>
<signatures swt_gen="mixed">
+ <constant name="NSAccessibilityBoundsForRangeParameterizedAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityButtonRole" swt_gen="true"></constant>
<constant name="NSAccessibilityCheckBoxRole" swt_gen="true"></constant>
<constant name="NSAccessibilityChildrenAttribute" swt_gen="true"></constant>
+ <constant name="NSAccessibilityColorWellRole" swt_gen="true"></constant>
<constant name="NSAccessibilityColumnRole" swt_gen="true"></constant>
+ <constant name="NSAccessibilityColumnsAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityComboBoxRole" swt_gen="true"></constant>
<constant name="NSAccessibilityConfirmAction" swt_gen="true"></constant>
<constant name="NSAccessibilityContentsAttribute" swt_gen="true"></constant>
@@ -16,17 +19,20 @@
<constant name="NSAccessibilityFocusedUIElementChangedNotification" swt_gen="true"></constant>
<constant name="NSAccessibilityGridRole" swt_gen="true"></constant>
<constant name="NSAccessibilityGroupRole" swt_gen="true"></constant>
+ <constant name="NSAccessibilityHeaderAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityHelpAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityHelpTagRole" swt_gen="true"></constant>
<constant name="NSAccessibilityHorizontalOrientationValue" swt_gen="true"></constant>
<constant name="NSAccessibilityHorizontalScrollBarAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityImageRole" swt_gen="true"></constant>
<constant name="NSAccessibilityIncrementorRole" swt_gen="true"></constant>
+ <constant name="NSAccessibilityIndexAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityInsertionPointLineNumberAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityLabelValueAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityLineForIndexParameterizedAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityLinkRole" swt_gen="true"></constant>
<constant name="NSAccessibilityLinkTextAttribute" swt_gen="true"></constant>
+ <constant name="NSAccessibilityLinkedUIElementsAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityListRole" swt_gen="true"></constant>
<constant name="NSAccessibilityMaxValueAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityMenuBarRole" swt_gen="true"></constant>
@@ -54,11 +60,14 @@
<constant name="NSAccessibilityRoleAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityRoleDescriptionAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityRowRole" swt_gen="true"></constant>
+ <constant name="NSAccessibilityRowsAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityScrollAreaRole" swt_gen="true"></constant>
<constant name="NSAccessibilityScrollBarRole" swt_gen="true"></constant>
<constant name="NSAccessibilitySelectedAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilitySelectedChildrenAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilitySelectedChildrenChangedNotification" swt_gen="true"></constant>
+ <constant name="NSAccessibilitySelectedColumnsAttribute" swt_gen="true"></constant>
+ <constant name="NSAccessibilitySelectedRowsAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilitySelectedTextAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilitySelectedTextChangedNotification" swt_gen="true"></constant>
<constant name="NSAccessibilitySelectedTextRangeAttribute" swt_gen="true"></constant>
@@ -95,6 +104,8 @@
<constant name="NSAccessibilityVerticalScrollBarAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityVisibleCharacterRangeAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityVisibleChildrenAttribute" swt_gen="true"></constant>
+ <constant name="NSAccessibilityVisibleColumnsAttribute" swt_gen="true"></constant>
+ <constant name="NSAccessibilityVisibleRowsAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityWindowAttribute" swt_gen="true"></constant>
<constant name="NSAccessibilityWindowRole" swt_gen="true"></constant>
<constant name="NSApplicationDidChangeScreenParametersNotification" swt_gen="true"></constant>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSNotificationCenter.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSNotificationCenter.java
index c09e8164c3..c383443a71 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSNotificationCenter.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSNotificationCenter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTableView.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTableView.java
index dfea590793..0a17e8347b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTableView.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTableView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java
index 3249cbc736..68ed879792 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index 62737f5d5f..0bb3c75d74 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -70,10 +70,26 @@ public class OS extends C {
public static final int /*long*/ class_WebPanelAuthenticationHandler = OS.objc_getClass("WebPanelAuthenticationHandler");
public static final int /*long*/ sel_sharedHandler = sel_registerName("sharedHandler");
public static final int /*long*/ sel_startAuthentication = sel_registerName("startAuthentication:window:");
+
+ public static final int /*long*/ sel_accessibleHandle = sel_registerName("accessibleHandle");
/* These are not generated in order to avoid creating static methods on all classes */
public static final int /*long*/ sel_isSelectorExcludedFromWebScript_ = sel_registerName("isSelectorExcludedFromWebScript:");
public static final int /*long*/ sel_webScriptNameForSelector_ = sel_registerName("webScriptNameForSelector:");
+
+ /*10.6 Accessibility Strings*/
+ /** @method flags=const dynamic no_gen*/
+ public static final native int /*long*/ NSAccessibilityRowIndexRangeAttribute();
+ public static final NSString NSAccessibilityRowIndexRangeAttribute = new NSString(NSAccessibilityRowIndexRangeAttribute());
+ /** @method flags=const dynamic no_gen*/
+ public static final native int /*long*/ NSAccessibilityColumnIndexRangeAttribute();
+ public static final NSString NSAccessibilityColumnIndexRangeAttribute = new NSString(NSAccessibilityColumnIndexRangeAttribute());
+ /** @method flags=const dynamic no_gen*/
+ public static final native int /*long*/ NSAccessibilityCellForColumnAndRowParameterizedAttribute();
+ public static final NSString NSAccessibilityCellForColumnAndRowParameterizedAttribute = new NSString(NSAccessibilityCellForColumnAndRowParameterizedAttribute());
+ /** @method flags=const dynamic no_gen*/
+ public static final native int /*long*/ NSAccessibilityCellRole();
+ public static final NSString NSAccessibilityCellRole = new NSString(NSAccessibilityCellRole());
/** JNI natives */
@@ -2134,6 +2150,9 @@ public static final int NSUTF8StringEncoding = 4;
/** Globals */
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityBoundsForRangeParameterizedAttribute();
+public static final NSString NSAccessibilityBoundsForRangeParameterizedAttribute = new NSString(NSAccessibilityBoundsForRangeParameterizedAttribute());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilityButtonRole();
public static final NSString NSAccessibilityButtonRole = new NSString(NSAccessibilityButtonRole());
/** @method flags=const */
@@ -2143,9 +2162,15 @@ public static final NSString NSAccessibilityCheckBoxRole = new NSString(NSAccess
public static final native int /*long*/ NSAccessibilityChildrenAttribute();
public static final NSString NSAccessibilityChildrenAttribute = new NSString(NSAccessibilityChildrenAttribute());
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityColorWellRole();
+public static final NSString NSAccessibilityColorWellRole = new NSString(NSAccessibilityColorWellRole());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilityColumnRole();
public static final NSString NSAccessibilityColumnRole = new NSString(NSAccessibilityColumnRole());
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityColumnsAttribute();
+public static final NSString NSAccessibilityColumnsAttribute = new NSString(NSAccessibilityColumnsAttribute());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilityComboBoxRole();
public static final NSString NSAccessibilityComboBoxRole = new NSString(NSAccessibilityComboBoxRole());
/** @method flags=const */
@@ -2182,6 +2207,9 @@ public static final NSString NSAccessibilityGridRole = new NSString(NSAccessibil
public static final native int /*long*/ NSAccessibilityGroupRole();
public static final NSString NSAccessibilityGroupRole = new NSString(NSAccessibilityGroupRole());
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityHeaderAttribute();
+public static final NSString NSAccessibilityHeaderAttribute = new NSString(NSAccessibilityHeaderAttribute());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilityHelpAttribute();
public static final NSString NSAccessibilityHelpAttribute = new NSString(NSAccessibilityHelpAttribute());
/** @method flags=const */
@@ -2200,6 +2228,9 @@ public static final NSString NSAccessibilityImageRole = new NSString(NSAccessibi
public static final native int /*long*/ NSAccessibilityIncrementorRole();
public static final NSString NSAccessibilityIncrementorRole = new NSString(NSAccessibilityIncrementorRole());
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityIndexAttribute();
+public static final NSString NSAccessibilityIndexAttribute = new NSString(NSAccessibilityIndexAttribute());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilityInsertionPointLineNumberAttribute();
public static final NSString NSAccessibilityInsertionPointLineNumberAttribute = new NSString(NSAccessibilityInsertionPointLineNumberAttribute());
/** @method flags=const */
@@ -2215,6 +2246,9 @@ public static final NSString NSAccessibilityLinkRole = new NSString(NSAccessibil
public static final native int /*long*/ NSAccessibilityLinkTextAttribute();
public static final NSString NSAccessibilityLinkTextAttribute = new NSString(NSAccessibilityLinkTextAttribute());
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityLinkedUIElementsAttribute();
+public static final NSString NSAccessibilityLinkedUIElementsAttribute = new NSString(NSAccessibilityLinkedUIElementsAttribute());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilityListRole();
public static final NSString NSAccessibilityListRole = new NSString(NSAccessibilityListRole());
/** @method flags=const */
@@ -2296,6 +2330,9 @@ public static final NSString NSAccessibilityRoleDescriptionAttribute = new NSStr
public static final native int /*long*/ NSAccessibilityRowRole();
public static final NSString NSAccessibilityRowRole = new NSString(NSAccessibilityRowRole());
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityRowsAttribute();
+public static final NSString NSAccessibilityRowsAttribute = new NSString(NSAccessibilityRowsAttribute());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilityScrollAreaRole();
public static final NSString NSAccessibilityScrollAreaRole = new NSString(NSAccessibilityScrollAreaRole());
/** @method flags=const */
@@ -2311,6 +2348,12 @@ public static final NSString NSAccessibilitySelectedChildrenAttribute = new NSSt
public static final native int /*long*/ NSAccessibilitySelectedChildrenChangedNotification();
public static final NSString NSAccessibilitySelectedChildrenChangedNotification = new NSString(NSAccessibilitySelectedChildrenChangedNotification());
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilitySelectedColumnsAttribute();
+public static final NSString NSAccessibilitySelectedColumnsAttribute = new NSString(NSAccessibilitySelectedColumnsAttribute());
+/** @method flags=const */
+public static final native int /*long*/ NSAccessibilitySelectedRowsAttribute();
+public static final NSString NSAccessibilitySelectedRowsAttribute = new NSString(NSAccessibilitySelectedRowsAttribute());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilitySelectedTextAttribute();
public static final NSString NSAccessibilitySelectedTextAttribute = new NSString(NSAccessibilitySelectedTextAttribute());
/** @method flags=const */
@@ -2419,6 +2462,12 @@ public static final NSString NSAccessibilityVisibleCharacterRangeAttribute = new
public static final native int /*long*/ NSAccessibilityVisibleChildrenAttribute();
public static final NSString NSAccessibilityVisibleChildrenAttribute = new NSString(NSAccessibilityVisibleChildrenAttribute());
/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityVisibleColumnsAttribute();
+public static final NSString NSAccessibilityVisibleColumnsAttribute = new NSString(NSAccessibilityVisibleColumnsAttribute());
+/** @method flags=const */
+public static final native int /*long*/ NSAccessibilityVisibleRowsAttribute();
+public static final NSString NSAccessibilityVisibleRowsAttribute = new NSString(NSAccessibilityVisibleRowsAttribute());
+/** @method flags=const */
public static final native int /*long*/ NSAccessibilityWindowAttribute();
public static final NSString NSAccessibilityWindowAttribute = new NSString(NSAccessibilityWindowAttribute());
/** @method flags=const */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java
index 67f85a2bd2..59b0f7dcf5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java
@@ -98,8 +98,8 @@ public Button (Composite parent, int style) {
int /*long*/ accessibilityAttributeValue (int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) {
NSString nsAttributeName = new NSString(arg0);
-
- if (accessible != null) {
+
+ if (id == view.id && accessible != null) {
id returnObject = accessible.internal_accessibilityAttributeValue(nsAttributeName, ACC.CHILDID_SELF);
if (returnObject != null) return returnObject.id;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
index c07434e4fd..be15717e6d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
@@ -120,8 +120,21 @@ boolean acceptsFirstMouse (int /*long*/ id, int /*long*/ sel, int /*long*/ theEv
return super.acceptsFirstMouse (id, sel, theEvent);
}
+int /*long*/ accessibleHandle() {
+ return view.id;
+}
+
+int /*long*/ accessibilityActionDescription(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) {
+ if (id == view.id && accessible != null) {
+ NSString actionName = new NSString(arg0);
+ id returnValue = accessible.internal_accessibilityActionDescription(actionName, ACC.CHILDID_SELF);
+ if (returnValue != null) return returnValue.id;
+ }
+ return super.accessibilityActionDescription(id, sel, arg0);
+}
+
int /*long*/ accessibilityActionNames(int /*long*/ id, int /*long*/ sel) {
- if (accessible != null) {
+ if (id == view.id && accessible != null) {
NSArray returnValue = accessible.internal_accessibilityActionNames(ACC.CHILDID_SELF);
if (returnValue != null) return returnValue.id;
}
@@ -186,6 +199,14 @@ int /*long*/ accessibilityParameterizedAttributeNames(int /*long*/ id, int /*lon
return super.accessibilityParameterizedAttributeNames(id, sel);
}
+void accessibilityPerformAction(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) {
+ if (id == view.id && accessible != null) {
+ NSString action = new NSString(arg0);
+ if (accessible.internal_accessibilityPerformAction(action, ACC.CHILDID_SELF)) return;
+ }
+ super.accessibilityPerformAction(id, sel, arg0);
+}
+
int /*long*/ accessibilityFocusedUIElement(int /*long*/ id, int /*long*/ sel) {
id returnValue = null;
@@ -225,7 +246,7 @@ int /*long*/ accessibilityAttributeValue(int /*long*/ id, int /*long*/ sel, int
int /*long*/ returnValue = 0;
id returnObject = null;
- if (accessible != null) {
+ if (id == view.id && accessible != null) {
returnObject = accessible.internal_accessibilityAttributeValue(attribute, ACC.CHILDID_SELF);
}
@@ -245,7 +266,7 @@ int /*long*/ accessibilityAttributeValue_forParameter(int /*long*/ id, int /*lon
id returnValue = null;
- if (accessible != null) {
+ if (id == view.id && accessible != null) {
id parameter = new id(arg1);
returnValue = accessible.internal_accessibilityAttributeValue_forParameter(attribute, parameter, ACC.CHILDID_SELF);
}
@@ -258,6 +279,28 @@ int /*long*/ accessibilityAttributeValue_forParameter(int /*long*/ id, int /*lon
return returnValue.id;
}
+boolean accessibilityIsAttributeSettable(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) {
+ boolean returnValue = false;
+ if (id == view.id && accessible != null) {
+ NSString attribute = new NSString (arg0);
+ returnValue = accessible.internal_accessibilityIsAttributeSettable(attribute);
+ }
+ if (!returnValue) {
+ returnValue = super.accessibilityIsAttributeSettable(id, sel, arg0);
+ }
+ return returnValue;
+}
+
+void accessibilitySetValue_forAttribute(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0, int /*long*/ arg1) {
+ if (id == view.id && accessible != null) {
+ id value = new id(arg0);
+ NSString attribute = new NSString(arg1);
+ accessible.internal_accessibilitySetValue_forAttribute(value, attribute);
+ } else {
+ super.accessibilitySetValue_forAttribute(id, sel, arg0, arg1);
+ }
+}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when the control is moved or resized, by sending
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
index d07246d8ce..f784fef4c2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
@@ -2049,7 +2049,10 @@ void addAccessibilityMethods(int /*long*/ cls, int /*long*/ proc2, int /*long*/
OS.class_addMethod(cls, OS.sel_accessibilityHitTest_, accessibilityHitTestProc, "@:{NSPoint}");
OS.class_addMethod(cls, OS.sel_accessibilityAttributeValue_forParameter_, proc4, "@:@@");
OS.class_addMethod(cls, OS.sel_accessibilityPerformAction_, proc3, "@:@");
- OS.class_addMethod(cls, OS.sel_accessibilityActionDescription_, proc3, "@:@");
+ OS.class_addMethod(cls, OS.sel_accessibilityActionDescription_, proc3, "@:@");
+ OS.class_addMethod(cls, OS.sel_accessibilityIsAttributeSettable_, proc3, "@:@");
+ OS.class_addMethod(cls, OS.sel_accessibilitySetValue_forAttribute_, proc4, "@:@@");
+ OS.class_addMethod(cls, OS.sel_accessibleHandle, proc2, "@:");
}
int /*long*/ registerCellSubclass(int /*long*/ cellClass, int size, int align, byte[] types) {
@@ -4781,6 +4784,8 @@ static int /*long*/ windowProc(int /*long*/ id, int /*long*/ sel) {
return widget.image(id, sel);
} else if (sel == OS.sel_shouldDrawInsertionPoint) {
return widget.shouldDrawInsertionPoint(id, sel) ? 1 : 0;
+ } else if (sel == OS.sel_accessibleHandle) {
+ return widget.accessibleHandle();
}
return 0;
}
@@ -4954,7 +4959,9 @@ static int /*long*/ windowProc(int /*long*/ id, int /*long*/ sel, int /*long*/ a
} else if (sel == OS.sel_accessibilityPerformAction_) {
widget.accessibilityPerformAction(id, sel, arg0);
} else if (sel == OS.sel_accessibilityActionDescription_) {
- widget.accessibilityActionDescription(id, sel, arg0);
+ return widget.accessibilityActionDescription(id, sel, arg0);
+ } else if (sel == OS.sel_accessibilityIsAttributeSettable_) {
+ return widget.accessibilityIsAttributeSettable(id, sel, arg0) ? 1 : 0;
} else if (sel == OS.sel_makeFirstResponder_) {
return widget.makeFirstResponder(id, sel, arg0) ? 1 : 0;
} else if (sel == OS.sel_tableViewColumnDidMove_) {
@@ -5068,6 +5075,8 @@ static int /*long*/ windowProc(int /*long*/ id, int /*long*/ sel, int /*long*/ a
NSPoint point = new NSPoint();
OS.memmove(point, arg1, NSPoint.sizeof);
widget.scrollClipViewToPoint (id, sel, arg0, point);
+ } else if (sel == OS.sel_accessibilitySetValue_forAttribute_) {
+ widget.accessibilitySetValue_forAttribute(id, sel, arg0, arg1);
}
return 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java
index 9462a7cc54..425a577ff9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java
@@ -163,7 +163,7 @@ int /*long*/ accessibilityAttributeValue(int /*long*/ id, int /*long*/ sel, int
NSNumber value = NSNumber.numberWithInt(selection ? 1 : 0);
return value.id;
} else if (nsAttributeName.isEqualToString(OS.NSAccessibilityEnabledAttribute)) {
- NSNumber value = NSNumber.numberWithInt(getEnabled() ? 1 : 0);
+ NSNumber value = NSNumber.numberWithBool(getEnabled());
return value.id;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
index d40a739894..41c3fd807f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
@@ -135,6 +135,10 @@ public Widget (Widget parent, int style) {
reskinWidget ();
}
+int /*long*/ accessibleHandle() {
+ return 0;
+}
+
int /*long*/ accessibilityActionDescription(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) {
return callSuperObject(id, sel, arg0);
}
@@ -169,6 +173,10 @@ int /*long*/ accessibilityHitTest(int /*long*/ id, int /*long*/ sel, NSPoint poi
return OS.objc_msgSendSuper(super_struct, sel, point);
}
+boolean accessibilityIsAttributeSettable(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0) {
+ return callSuperBoolean(id, sel, arg0);
+}
+
boolean accessibilityIsIgnored(int /*long*/ id, int /*long*/ sel) {
return callSuperBoolean(id, sel);
}
@@ -181,6 +189,10 @@ void accessibilityPerformAction(int /*long*/ id, int /*long*/ sel, int /*long*/
callSuper(id, sel, arg0);
}
+void accessibilitySetValue_forAttribute(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0, int /*long*/ arg1) {
+ callSuper(id, sel, arg0, arg1);
+}
+
String getClipboardText () {
NSPasteboard pasteboard = NSPasteboard.generalPasteboard ();
if (pasteboard == null) return "";
@@ -216,6 +228,13 @@ void callSuper(int /*long*/ id, int /*long*/ sel, NSRect arg0) {
OS.objc_msgSendSuper(super_struct, sel, arg0);
}
+void callSuper(int /*long*/ id, int /*long*/ sel, int /*long*/ arg0, int /*long*/ arg1) {
+ objc_super super_struct = new objc_super();
+ super_struct.receiver = id;
+ super_struct.super_class = OS.objc_msgSend(id, OS.sel_superclass);
+ OS.objc_msgSendSuper(super_struct, sel, arg0, arg1);
+}
+
void callSuper(int /*long*/ id, int /*long*/ sel, NSRect arg0, int /*long*/ arg1) {
objc_super super_struct = new objc_super();
super_struct.receiver = id;