summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties21
-rw-r--r--bundles/org.eclipse.swt/.classpath_carbon2
-rw-r--r--bundles/org.eclipse.swt/.classpath_carbon_j2me2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java865
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/make_macosx.mak2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c60
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java315
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java22
12 files changed, 1348 insertions, 13 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties
index 0c1ddb847b..844b3a86a9 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties
@@ -717,6 +717,19 @@ OS_ATSUTextInserted_0=cast=(ATSUTextLayout)
OS_ATSUTextInserted_1=
OS_ATSUTextInserted_2=
+OS_AXNotificationHIObjectNotify=
+OS_AXNotificationHIObjectNotify_0=cast=(CFStringRef)
+OS_AXNotificationHIObjectNotify_1=cast=(HIObjectRef)
+OS_AXNotificationHIObjectNotify_2=cast=(UInt64)
+
+OS_AXUIElementCreateWithHIObjectAndIdentifier=
+OS_AXUIElementCreateWithHIObjectAndIdentifier_0=cast=(HIObjectRef)
+OS_AXUIElementCreateWithHIObjectAndIdentifier_1=cast=(UInt64)
+
+OS_AXUIElementGetIdentifier=
+OS_AXUIElementGetIdentifier_0=cast=(AXUIElementRef)
+OS_AXUIElementGetIdentifier_1=cast=(UInt64 *)
+
OS_ActiveNonFloatingWindow=
OS_AddDataBrowserItems=
@@ -779,6 +792,10 @@ OS_CFDataGetBytes_2=cast=(UInt8 *)
OS_CFDataGetLength=
OS_CFDataGetLength_0=cast=(CFDataRef)
+OS_CFEqual=
+OS_CFEqual_0=cast=CFStringRef
+OS_CFEqual_1=cast=CFStringRef
+
OS_CFLocaleCopyCurrent=
OS_CFNumberFormatterCopyProperty=
@@ -2730,6 +2747,10 @@ OS_HIComboBoxRemoveItemAtIndex=
OS_HIComboBoxRemoveItemAtIndex_0=cast=(HIViewRef)
OS_HIComboBoxRemoveItemAtIndex_1=cast=(CFIndex)
+OS_HICopyAccessibilityRoleDescription=
+OS_HICopyAccessibilityRoleDescription_0=cast=(CFStringRef)
+OS_HICopyAccessibilityRoleDescription_1=cast=(CFStringRef)
+
OS_HICreateTransformedCGImage=flags=dynamic
OS_HICreateTransformedCGImage_0=cast=CGImageRef
OS_HICreateTransformedCGImage_1=
diff --git a/bundles/org.eclipse.swt/.classpath_carbon b/bundles/org.eclipse.swt/.classpath_carbon
index fe96039da5..04e632fd1b 100644
--- a/bundles/org.eclipse.swt/.classpath_carbon
+++ b/bundles/org.eclipse.swt/.classpath_carbon
@@ -15,7 +15,7 @@
</classpathentry>
<classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
<classpathentry kind="src" path="Eclipse SWT Accessibility/common"/>
- <classpathentry kind="src" path="Eclipse SWT Accessibility/emulated"/>
+ <classpathentry kind="src" path="Eclipse SWT Accessibility/carbon"/>
<classpathentry kind="src" path="Eclipse SWT AWT/common"/>
<classpathentry kind="src" path="Eclipse SWT AWT/emulated"/>
<classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
diff --git a/bundles/org.eclipse.swt/.classpath_carbon_j2me b/bundles/org.eclipse.swt/.classpath_carbon_j2me
index c06ca2e25f..b6153e5b43 100644
--- a/bundles/org.eclipse.swt/.classpath_carbon_j2me
+++ b/bundles/org.eclipse.swt/.classpath_carbon_j2me
@@ -14,7 +14,7 @@
</attributes>
</classpathentry>
<classpathentry kind="src" path="Eclipse SWT PI/common_j2me"/>
- <classpathentry kind="src" path="Eclipse SWT Accessibility/emulated"/>
+ <classpathentry kind="src" path="Eclipse SWT Accessibility/carbon"/>
<classpathentry kind="src" path="Eclipse SWT Accessibility/common"/>
<classpathentry kind="src" path="Eclipse SWT Drag and Drop/emulated"/>
<classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java
new file mode 100644
index 0000000000..0168902b29
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java
@@ -0,0 +1,865 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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 java.util.Vector;
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.internal.carbon.*;
+
+/**
+ * Instances of this class provide a bridge between application
+ * code and assistive technology clients. Many platforms provide
+ * default accessible behavior for most widgets, and this class
+ * allows that default behavior to be overridden. Applications
+ * can get the default Accessible object for a control by sending
+ * it <code>getAccessible</code>, and then add an accessible listener
+ * to override simple items like the name and help string, or they
+ * can add an accessible control listener to override complex items.
+ * As a rule of thumb, an application would only want to use the
+ * accessible control listener to implement accessibility for a
+ * custom control.
+ *
+ * @see Control#getAccessible
+ * @see AccessibleListener
+ * @see AccessibleEvent
+ * @see AccessibleControlListener
+ * @see AccessibleControlEvent
+ *
+ * @since 2.0
+ */
+public class Accessible {
+ Vector accessibleListeners = new Vector();
+ Vector accessibleControlListeners = new Vector();
+ Vector textListeners = new Vector ();
+ Control control;
+ int axuielementref = 0;
+ int[] osChildIDCache = new int[0];
+ String osRoleAttribute = null;
+
+ Accessible(Control control) {
+ this.control = control;
+ axuielementref = OS.AXUIElementCreateWithHIObjectAndIdentifier(control.handle, 0);
+ }
+
+ /**
+ * Invokes platform specific functionality to allocate a new accessible object.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Accessible</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param control the control to get the accessible object for
+ * @return the platform specific accessible object
+ */
+ public static Accessible internal_new_Accessible(Control control) {
+ return new Accessible(control);
+ }
+
+ /**
+ * Adds the listener to the collection of listeners who will
+ * be notified when an accessible client asks for certain strings,
+ * such as name, description, help, or keyboard shortcut. The
+ * listener is notified by sending it one of the messages defined
+ * in the <code>AccessibleListener</code> interface.
+ *
+ * @param listener the listener that should be notified when the receiver
+ * is asked for a name, description, help, or keyboard shortcut string
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see AccessibleListener
+ * @see #removeAccessibleListener
+ */
+ public void addAccessibleListener(AccessibleListener listener) {
+ checkWidget();
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleListeners.addElement(listener);
+ }
+
+ /**
+ * Adds the listener to the collection of listeners who will
+ * be notified when an accessible client asks for custom control
+ * specific information. The listener is notified by sending it
+ * one of the messages defined in the <code>AccessibleControlListener</code>
+ * interface.
+ *
+ * @param listener the listener that should be notified when the receiver
+ * is asked for custom control specific information
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see AccessibleControlListener
+ * @see #removeAccessibleControlListener
+ */
+ public void addAccessibleControlListener(AccessibleControlListener listener) {
+ checkWidget();
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleControlListeners.addElement(listener);
+ }
+
+ /**
+ * Adds the listener to the collection of listeners who will
+ * 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>
+ * interface.
+ *
+ * @param listener the listener that should be notified when the receiver
+ * is asked for custom text control specific information
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see AccessibleTextListener
+ * @see #removeAccessibleTextListener
+ *
+ * @since 3.0
+ */
+ public void addAccessibleTextListener (AccessibleTextListener listener) {
+ checkWidget ();
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ textListeners.addElement (listener);
+ }
+
+ /**
+ * Returns the control for this Accessible object.
+ *
+ * @return the receiver's control
+ * @since 3.0
+ */
+ public Control getControl() {
+ return control;
+ }
+
+ /**
+ * Invokes platform specific functionality to dispose an accessible object.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Accessible</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ */
+ public void internal_dispose_Accessible() {
+ if (axuielementref != 0) {
+ OS.CFRelease(axuielementref);
+ axuielementref = 0;
+ for (int index = 1; index < osChildIDCache.length; index += 2) {
+ OS.CFRelease(osChildIDCache [index]);
+ }
+ osChildIDCache = new int[0];
+ }
+ }
+
+ /**
+ * Invokes platform specific functionality to handle a window message.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Accessible</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ */
+ public int internal_kEventAccessibleGetChildAtPoint (int nextHandler, int theEvent, int userData) {
+ if (axuielementref != 0) {
+ int childID = getChildIDFromEvent(theEvent);
+
+ CGPoint pt = new CGPoint ();
+ OS.GetEventParameter (theEvent, OS.kEventParamMouseLocation, OS.typeHIPoint, null, CGPoint.sizeof, null, pt);
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.x = (int) pt.x;
+ event.y = (int) pt.y;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getChildAtPoint(event);
+ }
+ if (event.accessible != null) {
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleChild, OS.typeCFTypeRef, 4, new int[] {event.accessible.axuielementref});
+ return OS.noErr;
+ }
+ if (event.childID == ACC.CHILDID_SELF || event.childID == ACC.CHILDID_NONE || event.childID == childID) {
+ /*
+ * From the Carbon doc for kEventAccessibleGetChildAtPoint: "If there is no child at the given point,
+ * you should still return noErr, but leave the parameter empty (do not call SetEventParameter)."
+ */
+ return OS.noErr;
+ }
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleChild, OS.typeCFTypeRef, 4, new int[] {childIDToOs(event.childID)});
+ return OS.noErr;
+ }
+ return OS.eventNotHandledErr;
+ }
+
+ /**
+ * Invokes platform specific functionality to handle a window message.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Accessible</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ */
+ public int internal_kEventAccessibleGetNamedAttribute (int nextHandler, int theEvent, int userData) {
+ if (axuielementref != 0) {
+ int [] stringRef = new int [1];
+ OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeName, OS.typeCFStringRef, null, 4, null, stringRef);
+ int length = OS.CFStringGetLength (stringRef [0]);
+ char [] buffer= new char [length];
+ CFRange range = new CFRange ();
+ range.length = length;
+ OS.CFStringGetCharacters (stringRef [0], range, buffer);
+ String attributeName = new String(buffer);
+ if (attributeName.equals(OS.kAXRoleAttribute)) return getRoleAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXSubroleAttribute)) return getSubroleAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXRoleDescriptionAttribute)) return getRoleDescriptionAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXHelpAttribute)) return getHelpAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXTitleAttribute)) return getTitleAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXValueAttribute)) return getValueAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXEnabledAttribute)) return getEnabledAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXFocusedAttribute)) return getFocusedAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXParentAttribute)) return getParentAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXChildrenAttribute)) return getChildrenAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXSelectedChildrenAttribute)) return getSelectedChildrenAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXVisibleChildrenAttribute)) return getVisibleChildrenAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXWindowAttribute)) return getWindowAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXTopLevelUIElementAttribute)) return getTopLevelUIElementAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXPositionAttribute)) return getPositionAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXSizeAttribute)) return getSizeAttribute(nextHandler, theEvent, userData);
+ if (attributeName.equals(OS.kAXDescriptionAttribute)) return getDescriptionAttribute(nextHandler, theEvent, userData);
+ return getAttribute(nextHandler, theEvent, userData);
+ }
+ return OS.eventNotHandledErr;
+ }
+
+ public int internal_kEventAccessibleGetAllAttributeNames (int nextHandler, int theEvent, int userData) {
+ if (axuielementref != 0) {
+ int [] arrayRef = new int[1];
+ OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeNames, OS.typeCFMutableArrayRef, null, 4, null, arrayRef);
+ int stringArrayRef = arrayRef[0];
+ int length = OS.CFArrayGetCount(stringArrayRef);
+ String [] osAllAttributes = new String [length];
+ for (int i = 0; i < length; i++) {
+ int stringRef = OS.CFArrayGetValueAtIndex(stringArrayRef, i);
+ osAllAttributes[i] = stringRefToString (stringRef);
+ }
+ /* Add our list of supported attributes to the array. */
+ String [] requiredAttributes = {
+ OS.kAXRoleAttribute,
+ OS.kAXSubroleAttribute,
+ OS.kAXRoleDescriptionAttribute,
+ OS.kAXHelpAttribute,
+ OS.kAXTitleAttribute,
+ OS.kAXValueAttribute,
+ OS.kAXEnabledAttribute,
+ OS.kAXFocusedAttribute,
+ OS.kAXParentAttribute,
+ OS.kAXChildrenAttribute,
+ OS.kAXSelectedChildrenAttribute,
+ OS.kAXVisibleChildrenAttribute,
+ OS.kAXWindowAttribute,
+ OS.kAXTopLevelUIElementAttribute,
+ OS.kAXPositionAttribute,
+ OS.kAXSizeAttribute,
+ OS.kAXDescriptionAttribute,
+ };
+ for (int i = 0; i < requiredAttributes.length; i++) {
+ OS.CFArrayAppendValue(stringArrayRef, stringToStringRef(requiredAttributes[i]));
+ }
+ return OS.noErr;
+ }
+ return OS.eventNotHandledErr;
+ }
+
+ int getAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ if (code == OS.eventNotHandledErr) {
+ /* If the childID was created by the application, delegate to the accessible for the control. */
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleObject, OS.typeCFTypeRef, 4, new int [] {axuielementref});
+ code = OS.CallNextEventHandler (nextHandler, theEvent);
+ }
+ return code;
+ }
+
+ int getHelpAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ String osHelpAttribute = null;
+ int [] stringRef = new int [1];
+ if (code == OS.noErr) {
+ OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
+ osHelpAttribute = stringRefToString (stringRef [0]);
+ }
+ AccessibleEvent event = new AccessibleEvent(this);
+ event.childID = getChildIDFromEvent(theEvent);
+ event.result = osHelpAttribute;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getHelp(event);
+ }
+ if (event.result == null) return code;
+ stringRef [0] = stringToStringRef (event.result);
+ if (stringRef [0] == 0) return code;
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef);
+ return OS.noErr;
+ }
+
+ int getRoleAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ osRoleAttribute = null;
+ int [] stringRef = new int [1];
+ if (code == OS.noErr) {
+ OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
+ osRoleAttribute = stringRefToString (stringRef [0]);
+ }
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = getChildIDFromEvent(theEvent);
+ event.detail = osToRole(osRoleAttribute);
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getRole(event);
+ }
+ stringRef [0] = stringToStringRef (roleToOs (event.detail));
+ if (stringRef [0] == 0) return code;
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef);
+ return OS.noErr;
+ }
+
+ int getSubroleAttribute (int nextHandler, int theEvent, int userData) {
+ return getAttribute (nextHandler, theEvent, userData);
+ }
+
+ int getRoleDescriptionAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ String osRoleDescriptionAttribute = null;
+ int [] stringRef = new int [1];
+ if (code == OS.noErr) {
+ OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
+ osRoleDescriptionAttribute = stringRefToString (stringRef [0]);
+ }
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = getChildIDFromEvent(theEvent);
+ event.detail = osToRole(osRoleAttribute);
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getRole(event);
+ }
+ stringRef [0] = stringToStringRef (roleToOs (event.detail));
+ if (stringRef [0] == 0) return code;
+ int [] stringRef2 = new int [1];
+ stringRef2 [0] = OS.HICopyAccessibilityRoleDescription (stringRef [0], 0);
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef2);
+ return OS.noErr;
+ }
+
+ int getTitleAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ String osTitleAttribute = null;
+ int [] stringRef = new int [1];
+ if (code == OS.noErr) {
+ int status = OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, null, 4, null, stringRef);
+ if (status == OS.noErr) {
+ osTitleAttribute = stringRefToString (stringRef [0]);
+ }
+ }
+ AccessibleEvent event = new AccessibleEvent(this);
+ event.childID = getChildIDFromEvent(theEvent);
+ event.result = osTitleAttribute;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getName(event);
+ }
+ if (event.result == null) return code;
+ stringRef [0] = stringToStringRef (event.result);
+ if (stringRef [0] == 0) return code;
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, stringRef);
+ return OS.noErr;
+ }
+
+ int getValueAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ String osValueAttribute = null;
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = getChildIDFromEvent(theEvent);
+ event.result = osValueAttribute;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getRole(event);
+ listener.getValue(event);
+ }
+ switch (event.detail) {
+ 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_TABITEM: // 1 = selected, 0 = not selected
+ 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 (event.result == null) return code;
+ int number = Integer.parseInt(event.result);
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFTypeRef, 4, new int [] {number});
+ break;
+ case ACC.ROLE_TABFOLDER: // the accessibility object representing the currently selected tab item
+ case ACC.ROLE_COMBOBOX: // text of the currently selected item
+ case ACC.ROLE_TEXT: // text in the text field
+ if (event.result == null) return code;
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringToStringRef(event.result)});
+ 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 = getChildIDFromEvent(theEvent);
+ e.result = osValueAttribute;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getName(e);
+ }
+ if (e.result == null) return code;
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringToStringRef(e.result)});
+ break;
+ }
+ return OS.noErr;
+ }
+
+ int getEnabledAttribute (int nextHandler, int theEvent, int userData) {
+ return getAttribute (nextHandler, theEvent, userData);
+ }
+
+ int getFocusedAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ boolean osFocusedAttribute = false;
+ int [] booleanRef = new int [1];
+ if (code == OS.noErr) {
+ int status = OS.GetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFBooleanRef, null, 4, null, booleanRef);
+ if (status == OS.noErr) {
+ osFocusedAttribute = booleanRef [0] != 0;
+ }
+ }
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = getChildIDFromEvent(theEvent);
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getFocus(event);
+ }
+ return OS.noErr;
+ }
+
+ int getParentAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ if (code == OS.eventNotHandledErr) {
+ /* If the childID was created by the application, the parent is the accessible for the control. */
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {axuielementref});
+ return OS.noErr;
+ }
+ return code;
+ }
+
+ int getChildrenAttribute (int nextHandler, int theEvent, int userData) {
+ return getAttribute (nextHandler, theEvent, userData);
+ }
+
+ int getSelectedChildrenAttribute (int nextHandler, int theEvent, int userData) {
+ return getAttribute (nextHandler, theEvent, userData);
+ }
+
+ int getVisibleChildrenAttribute (int nextHandler, int theEvent, int userData) {
+ return getAttribute (nextHandler, theEvent, userData);
+ }
+
+ int getWindowAttribute (int nextHandler, int theEvent, int userData) {
+ return getAttribute (nextHandler, theEvent, userData);
+ }
+
+ int getTopLevelUIElementAttribute (int nextHandler, int theEvent, int userData) {
+ return getAttribute (nextHandler, theEvent, userData);
+ }
+
+ int getPositionAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ CGPoint osPositionAttribute = new CGPoint ();
+ if (code == OS.noErr) {
+ OS.GetEventParameter (theEvent, OS.kEventParamMouseLocation, OS.typeHIPoint, null, CGPoint.sizeof, null, osPositionAttribute);
+ }
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = getChildIDFromEvent(theEvent);
+ event.x = (int) osPositionAttribute.x;
+ event.y = (int) osPositionAttribute.y;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getLocation(event);
+ }
+ osPositionAttribute.x = event.x;
+ osPositionAttribute.y = event.y;
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeHIPoint, CGPoint.sizeof, osPositionAttribute);
+ return OS.noErr;
+ }
+
+ int getSizeAttribute (int nextHandler, int theEvent, int userData) {
+ int code = OS.CallNextEventHandler (nextHandler, theEvent);
+ CGPoint osSizeAttribute = new CGPoint ();
+ if (code == OS.noErr) {
+ OS.GetEventParameter (theEvent, OS.kEventParamMouseLocation, OS.typeHIPoint, null, CGPoint.sizeof, null, osSizeAttribute);
+ }
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = getChildIDFromEvent(theEvent);
+ event.width = (int) osSizeAttribute.x;
+ event.height = (int) osSizeAttribute.y;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getLocation(event);
+ }
+ osSizeAttribute.x = event.width;
+ osSizeAttribute.y = event.height;
+ OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeHIPoint, CGPoint.sizeof, osSizeAttribute);
+ return OS.noErr;
+ }
+
+ int getDescriptionAttribute (int nextHandler, int theEvent, int userData) {
+ return getAttribute (nextHandler, theEvent, userData);
+ }
+
+ /**
+ * Removes the listener from the collection of listeners who will
+ * be notified when an accessible client asks for certain strings,
+ * such as name, description, help, or keyboard shortcut.
+ *
+ * @param listener the listener that should no longer be notified when the receiver
+ * is asked for a name, description, help, or keyboard shortcut string
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see AccessibleListener
+ * @see #addAccessibleListener
+ */
+ public void removeAccessibleListener(AccessibleListener listener) {
+ checkWidget();
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleListeners.removeElement(listener);
+ }
+
+ /**
+ * Removes the listener from the collection of listeners who will
+ * be notified when an accessible client asks for custom control
+ * specific information.
+ *
+ * @param listener the listener that should no longer be notified when the receiver
+ * is asked for custom control specific information
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see AccessibleControlListener
+ * @see #addAccessibleControlListener
+ */
+ public void removeAccessibleControlListener(AccessibleControlListener listener) {
+ checkWidget();
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleControlListeners.removeElement(listener);
+ }
+
+ /**
+ * Removes the listener from the collection of listeners who will
+ * be notified when an accessible client asks for custom text control
+ * specific information.
+ *
+ * @param listener the listener that should no longer be notified when the receiver
+ * is asked for custom text control specific information
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see AccessibleTextListener
+ * @see #addAccessibleTextListener
+ *
+ * @since 3.0
+ */
+ public void removeAccessibleTextListener (AccessibleTextListener listener) {
+ checkWidget ();
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ textListeners.removeElement (listener);
+ }
+
+ /**
+ * Sends a message to accessible clients that the child selection
+ * within a custom container control has changed.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @since 3.0
+ */
+ public void selectionChanged () {
+ checkWidget();
+ }
+
+ /**
+ * Sends a message to accessible clients indicating that the focus
+ * has changed within a custom control.
+ *
+ * @param childID an identifier specifying a child of the control
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ */
+ public void setFocus(int childID) {
+ checkWidget();
+ }
+
+ /**
+ * Sends a message to accessible clients that the text
+ * caret has moved within a custom control.
+ *
+ * @param index the new caret index within the control
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @since 3.0
+ */
+ public void textCaretMoved (int index) {
+ }
+
+ /**
+ * Sends a message to accessible clients that the text
+ * within a custom control has changed.
+ *
+ * @param type the type of change, one of <code>ACC.NOTIFY_TEXT_INSERT</code>
+ * or <code>ACC.NOTIFY_TEXT_DELETE</code>
+ * @param startIndex the text index within the control where the insertion or deletion begins
+ * @param length the non-negative length in characters of the insertion or deletion
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @see ACC#TEXT_INSERT
+ * @see ACC#TEXT_DELETE
+ *
+ * @since 3.0
+ */
+ public void textChanged (int type, int startIndex, int length) {
+ }
+
+ /**
+ * Sends a message to accessible clients that the text
+ * selection has changed within a custom control.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li>
+ * </ul>
+ *
+ * @since 3.0
+ */
+ public void textSelectionChanged () {
+ checkWidget();
+ }
+
+ int getChildIDFromEvent(int theEvent) {
+ int[] ref = new int[1];
+ OS.GetEventParameter (theEvent, OS.kEventParamAccessibleObject, OS.typeCFTypeRef, null, 4, null, ref);
+ return osToChildID(ref[0]);
+ }
+
+ int childIDToOs(int childID) {
+ if (childID == ACC.CHILDID_SELF) {
+ return axuielementref;
+ }
+ /* Check cache for childID, if found, return corresponding osChildID. */
+ int index;
+ for (index = 0; index < osChildIDCache.length; index += 2) {
+ if (childID == osChildIDCache [index]) {
+ return osChildIDCache [index + 1];
+ }
+ }
+ /* If childID not in cache, create osChildID, grow cache by 2,
+ * add childID/osChildID to cache, and return new osChildID. */
+ int osChildID = OS.AXUIElementCreateWithHIObjectAndIdentifier(control.handle, (long) (childID + 1));
+ int [] newCache = new int [osChildIDCache.length + 2];
+ System.arraycopy (osChildIDCache, 0, newCache, 0, osChildIDCache.length);
+ osChildIDCache = newCache;
+ osChildIDCache [index] = childID;
+ osChildIDCache [index + 1] = osChildID;
+ return osChildID;
+ }
+
+ int osToChildID(int osChildID) {
+ if (OS.CFEqual(osChildID, axuielementref)) {
+ return ACC.CHILDID_SELF;
+ }
+
+ /* osChildID is an AXUIElementRef containing the control handle and a long identifier. */
+ long[] childID = new long[1];
+ OS.AXUIElementGetIdentifier(osChildID, childID);
+ if (childID[0] == 0) {
+ return ACC.CHILDID_SELF;
+ }
+ return (int) childID[0] - 1;
+ }
+
+ int stateToOs(int state) {
+// int osState = 0;
+// if ((state & ACC.STATE_SELECTED) != 0) osState |= OS.;
+// return osState;
+ return state;
+ }
+
+ int osToState(int osState) {
+// int state = ACC.STATE_NORMAL;
+// if ((osState & OS.) != 0) state |= ACC.STATE_SELECTED;
+// return state;
+ return osState;
+ }
+
+ String roleToOs(int role) {
+ switch (role) {
+ case ACC.ROLE_CLIENT_AREA: return OS.kAXWindowRole;
+ case ACC.ROLE_WINDOW: return OS.kAXWindowRole;
+ case ACC.ROLE_MENUBAR: return OS.kAXMenuBarRole;
+ case ACC.ROLE_MENU: return OS.kAXMenuRole;
+ case ACC.ROLE_MENUITEM: return OS.kAXMenuItemRole;
+ case ACC.ROLE_SEPARATOR: return OS.kAXSplitterRole;
+ case ACC.ROLE_TOOLTIP: return OS.kAXHelpTagRole;
+ case ACC.ROLE_SCROLLBAR: return OS.kAXScrollBarRole;
+ case ACC.ROLE_DIALOG: return OS.kAXWindowRole + ':' + OS.kAXDialogSubrole;
+ case ACC.ROLE_LABEL: return OS.kAXStaticTextRole;
+ case ACC.ROLE_PUSHBUTTON: return OS.kAXButtonRole;
+ case ACC.ROLE_CHECKBUTTON: return OS.kAXCheckBoxRole;
+ case ACC.ROLE_RADIOBUTTON: return OS.kAXRadioButtonRole;
+ case ACC.ROLE_COMBOBOX: return OS.kAXComboBoxRole;
+ case ACC.ROLE_TEXT: return OS.kAXTextFieldRole;
+ case ACC.ROLE_TOOLBAR: return OS.kAXToolbarRole;
+ case ACC.ROLE_LIST: return OS.kAXOutlineRole;
+ case ACC.ROLE_LISTITEM: return OS.kAXStaticTextRole;
+ case ACC.ROLE_TABLE: return OS.kAXTableRole;
+ case ACC.ROLE_TABLECELL: return OS.kAXRowRole + ':' + OS.kAXTableRowSubrole;
+ case ACC.ROLE_TABLECOLUMNHEADER: return OS.kAXButtonRole + ':' + OS.kAXSortButtonSubrole;
+ case ACC.ROLE_TABLEROWHEADER: return OS.kAXRowRole + ':' + OS.kAXTableRowSubrole;
+ case ACC.ROLE_TREE: return OS.kAXOutlineRole;
+ case ACC.ROLE_TREEITEM: return OS.kAXOutlineRole + ':' + OS.kAXOutlineRowSubrole;
+ case ACC.ROLE_TABFOLDER: return OS.kAXTabGroupRole;
+ case ACC.ROLE_TABITEM: return OS.kAXRadioButtonRole;
+ case ACC.ROLE_PROGRESSBAR: return OS.kAXProgressIndicatorRole;
+ case ACC.ROLE_SLIDER: return OS.kAXSliderRole;
+ case ACC.ROLE_LINK: return OS.kAXLinkRole;
+ }
+ return OS.kAXUnknownRole;
+ }
+
+ int osToRole(String osRole) {
+ if (osRole.equals(OS.kAXWindowRole)) return ACC.ROLE_WINDOW;
+ if (osRole.equals(OS.kAXMenuBarRole)) return ACC.ROLE_MENUBAR;
+ if (osRole.equals(OS.kAXMenuRole)) return ACC.ROLE_MENU;
+ if (osRole.equals(OS.kAXMenuItemRole)) return ACC.ROLE_MENUITEM;
+ if (osRole.equals(OS.kAXSplitterRole)) return ACC.ROLE_SEPARATOR;
+ if (osRole.equals(OS.kAXHelpTagRole)) return ACC.ROLE_TOOLTIP;
+ if (osRole.equals(OS.kAXScrollBarRole)) return ACC.ROLE_SCROLLBAR;
+ if (osRole.equals(OS.kAXScrollAreaRole)) return ACC.ROLE_LIST;
+ if (osRole.equals(OS.kAXWindowRole + ':' + OS.kAXDialogSubrole)) return ACC.ROLE_DIALOG;
+ if (osRole.equals(OS.kAXWindowRole + ':' + OS.kAXSystemDialogSubrole)) return ACC.ROLE_DIALOG;
+ if (osRole.equals(OS.kAXStaticTextRole)) return ACC.ROLE_LABEL;
+ if (osRole.equals(OS.kAXButtonRole)) return ACC.ROLE_PUSHBUTTON;
+ if (osRole.equals(OS.kAXCheckBoxRole)) return ACC.ROLE_CHECKBUTTON;
+ if (osRole.equals(OS.kAXRadioButtonRole)) return ACC.ROLE_RADIOBUTTON;
+ if (osRole.equals(OS.kAXComboBoxRole)) return ACC.ROLE_COMBOBOX;
+ if (osRole.equals(OS.kAXTextFieldRole)) return ACC.ROLE_TEXT;
+ if (osRole.equals(OS.kAXTextAreaRole)) return ACC.ROLE_TEXT;
+ if (osRole.equals(OS.kAXToolbarRole)) return ACC.ROLE_TOOLBAR;
+ if (osRole.equals(OS.kAXListRole)) return ACC.ROLE_LIST;
+ if (osRole.equals(OS.kAXTableRole)) return ACC.ROLE_TABLE;
+ if (osRole.equals(OS.kAXColumnRole)) return ACC.ROLE_TABLECOLUMNHEADER;
+ if (osRole.equals(OS.kAXButtonRole + ':' + OS.kAXSortButtonSubrole)) return ACC.ROLE_TABLECOLUMNHEADER;
+ if (osRole.equals(OS.kAXRowRole + ':' + OS.kAXTableRowSubrole)) return ACC.ROLE_TABLEROWHEADER;
+ if (osRole.equals(OS.kAXOutlineRole)) return ACC.ROLE_TREE;
+ if (osRole.equals(OS.kAXOutlineRole + ':' + OS.kAXOutlineRowSubrole)) return ACC.ROLE_TREEITEM;
+ if (osRole.equals(OS.kAXTabGroupRole)) return ACC.ROLE_TABFOLDER;
+ if (osRole.equals(OS.kAXProgressIndicatorRole)) return ACC.ROLE_PROGRESSBAR;
+ if (osRole.equals(OS.kAXSliderRole)) return ACC.ROLE_SLIDER;
+ if (osRole.equals(OS.kAXLinkRole)) return ACC.ROLE_LINK;
+ return ACC.ROLE_CLIENT_AREA;
+ }
+
+ /* Return a CFStringRef representing the given java String. */
+ int stringToStringRef(String string) {
+ char [] buffer = new char [string.length ()];
+ string.getChars (0, buffer.length, buffer, 0);
+ return OS.CFStringCreateWithCharacters (OS.kCFAllocatorDefault, buffer, buffer.length);
+ }
+
+ /* Return a Java String representing the given CFStringRef.
+ * Note that the caller is responsible for calling OS.CFRelease
+ * when they are done with the stringRef.
+ */
+ String stringRefToString(int stringRef) {
+ int length = OS.CFStringGetLength (stringRef);
+ char [] buffer= new char [length];
+ CFRange range = new CFRange ();
+ range.length = length;
+ OS.CFStringGetCharacters (stringRef, range, buffer);
+ return new String(buffer);
+ }
+
+ /* checkWidget was copied from Widget, and rewritten to work in this package */
+ void checkWidget () {
+ if (!isValidThread ()) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (control.isDisposed ()) SWT.error (SWT.ERROR_WIDGET_DISPOSED);
+ }
+
+ /* isValidThread was copied from Widget, and rewritten to work in this package */
+ boolean isValidThread () {
+ return control.getDisplay ().getThread () == Thread.currentThread ();
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/make_macosx.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/make_macosx.mak
index 0e77e493d3..9135bb4a40 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/make_macosx.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/make_macosx.mak
@@ -28,7 +28,7 @@ AGL_LIB=lib$(SWTAGL_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).jnilib
#NATIVE_STATS = -DNATIVE_STATS
#SWT_DEBUG = -g
-ARCHS = -arch i386 -arch ppc
+ARCHS = #-arch i386 -arch ppc
CFLAGS = -c $(ARCHS) -DSWT_VERSION=$(SWT_VERSION) $(NATIVE_STATS) $(SWT_DEBUG) -DCARBON -I /System/Library/Frameworks/JavaVM.framework/Headers
LFLAGS = -bundle $(ARCHS) -framework JavaVM -framework Carbon
WEBKITCFLAGS = -c $(ARCHS) -xobjective-c -I /System/Library/Frameworks/JavaVM.framework/Headers -I /System/Library/Frameworks/Cocoa.framework/Headers -I /System/Library/Frameworks/WebKit.framework/Headers
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
index 680a0a8d14..adc5e6e2c7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
@@ -718,6 +718,42 @@ JNIEXPORT jint JNICALL OS_NATIVE(ATSUTextInserted)
}
#endif
+#ifndef NO_AXNotificationHIObjectNotify
+JNIEXPORT void JNICALL OS_NATIVE(AXNotificationHIObjectNotify)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jlong arg2)
+{
+ OS_NATIVE_ENTER(env, that, AXNotificationHIObjectNotify_FUNC);
+ AXNotificationHIObjectNotify((CFStringRef)arg0, (HIObjectRef)arg1, (UInt64)arg2);
+ OS_NATIVE_EXIT(env, that, AXNotificationHIObjectNotify_FUNC);
+}
+#endif
+
+#ifndef NO_AXUIElementCreateWithHIObjectAndIdentifier
+JNIEXPORT jint JNICALL OS_NATIVE(AXUIElementCreateWithHIObjectAndIdentifier)
+ (JNIEnv *env, jclass that, jint arg0, jlong arg1)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, AXUIElementCreateWithHIObjectAndIdentifier_FUNC);
+ rc = (jint)AXUIElementCreateWithHIObjectAndIdentifier((HIObjectRef)arg0, (UInt64)arg1);
+ OS_NATIVE_EXIT(env, that, AXUIElementCreateWithHIObjectAndIdentifier_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_AXUIElementGetIdentifier
+JNIEXPORT void JNICALL OS_NATIVE(AXUIElementGetIdentifier)
+ (JNIEnv *env, jclass that, jint arg0, jlongArray arg1)
+{
+ jlong *lparg1=NULL;
+ OS_NATIVE_ENTER(env, that, AXUIElementGetIdentifier_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetLongArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ AXUIElementGetIdentifier((AXUIElementRef)arg0, (UInt64 *)lparg1);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseLongArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, AXUIElementGetIdentifier_FUNC);
+}
+#endif
+
#ifndef NO_ActiveNonFloatingWindow
JNIEXPORT jint JNICALL OS_NATIVE(ActiveNonFloatingWindow)
(JNIEnv *env, jclass that)
@@ -901,6 +937,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(CFDataGetLength)
}
#endif
+#ifndef NO_CFEqual
+JNIEXPORT jboolean JNICALL OS_NATIVE(CFEqual)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, CFEqual_FUNC);
+ rc = (jboolean)CFEqual((CFStringRef)arg0, (CFStringRef)arg1);
+ OS_NATIVE_EXIT(env, that, CFEqual_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_CFLocaleCopyCurrent
JNIEXPORT jint JNICALL OS_NATIVE(CFLocaleCopyCurrent)
(JNIEnv *env, jclass that)
@@ -6845,6 +6893,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(HIComboBoxRemoveItemAtIndex)
}
#endif
+#ifndef NO_HICopyAccessibilityRoleDescription
+JNIEXPORT jint JNICALL OS_NATIVE(HICopyAccessibilityRoleDescription)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, HICopyAccessibilityRoleDescription_FUNC);
+ rc = (jint)HICopyAccessibilityRoleDescription((CFStringRef)arg0, (CFStringRef)arg1);
+ OS_NATIVE_EXIT(env, that, HICopyAccessibilityRoleDescription_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_HICreateTransformedCGImage
JNIEXPORT jint JNICALL OS_NATIVE(HICreateTransformedCGImage)
(JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c
index 77422b6fa2..86d67a24e4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 912;
-int OS_nativeFunctionCallCount[912];
+int OS_nativeFunctionCount = 917;
+int OS_nativeFunctionCallCount[917];
char * OS_nativeFunctionNames[] = {
"AECountItems",
"AEGetNthPtr",
@@ -59,6 +59,9 @@ char * OS_nativeFunctionNames[] = {
"ATSUSetTransientFontMatching",
"ATSUTextDeleted",
"ATSUTextInserted",
+ "AXNotificationHIObjectNotify",
+ "AXUIElementCreateWithHIObjectAndIdentifier",
+ "AXUIElementGetIdentifier",
"ActiveNonFloatingWindow",
"AddDataBrowserItems",
"AddDataBrowserListViewColumn",
@@ -73,6 +76,7 @@ char * OS_nativeFunctionNames[] = {
"CFArrayGetValueAtIndex",
"CFDataGetBytes",
"CFDataGetLength",
+ "CFEqual",
"CFLocaleCopyCurrent",
"CFNumberFormatterCopyProperty",
"CFNumberFormatterCreate",
@@ -494,6 +498,7 @@ char * OS_nativeFunctionNames[] = {
"HIComboBoxGetItemCount",
"HIComboBoxInsertTextItemAtIndex",
"HIComboBoxRemoveItemAtIndex",
+ "HICopyAccessibilityRoleDescription",
"HICreateTransformedCGImage",
"HIObjectCopyClassID",
"HIObjectCreate",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h
index 91d017a072..0d3c3b4da9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h
@@ -63,6 +63,9 @@ typedef enum {
ATSUSetTransientFontMatching_FUNC,
ATSUTextDeleted_FUNC,
ATSUTextInserted_FUNC,
+ AXNotificationHIObjectNotify_FUNC,
+ AXUIElementCreateWithHIObjectAndIdentifier_FUNC,
+ AXUIElementGetIdentifier_FUNC,
ActiveNonFloatingWindow_FUNC,
AddDataBrowserItems_FUNC,
AddDataBrowserListViewColumn_FUNC,
@@ -77,6 +80,7 @@ typedef enum {
CFArrayGetValueAtIndex_FUNC,
CFDataGetBytes_FUNC,
CFDataGetLength_FUNC,
+ CFEqual_FUNC,
CFLocaleCopyCurrent_FUNC,
CFNumberFormatterCopyProperty_FUNC,
CFNumberFormatterCreate_FUNC,
@@ -498,6 +502,7 @@ typedef enum {
HIComboBoxGetItemCount_FUNC,
HIComboBoxInsertTextItemAtIndex_FUNC,
HIComboBoxRemoveItemAtIndex_FUNC,
+ HICopyAccessibilityRoleDescription_FUNC,
HICreateTransformedCGImage_FUNC,
HIObjectCopyClassID_FUNC,
HIObjectCreate_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java
index 1626bcfc90..bcabf6675f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java
@@ -44,6 +44,7 @@ public class OS extends Platform {
public static final int errUnknownControl = -30584;
public static final int eventLoopTimedOutErr = -9875;
public static final int eventNotHandledErr = -9874;
+ public static final int eventParameterNotFoundErr = -9870;
public static final int gestaltSystemVersion = ('s'<<24) + ('y'<<16) + ('s'<<8) + 'v';
public static final int inContent = 3;
public static final int inMenuBar = 1;
@@ -842,7 +843,11 @@ public class OS extends Platform {
public static final int teJustLeft = 0;
public static final int teJustCenter = 1;
public static final int teJustRight = -1;
- public static final int typeCGContextRef= ('c'<<24) + ('n'<<16) + ('t'<<8) + 'x';
+ public static final int typeCFBooleanRef = ('c'<<24) + ('f'<<16) + ('b'<<8) + 'o';
+ public static final int typeCFMutableArrayRef = ('c'<<24) + ('f'<<16) + ('m'<<8) + 'a';
+ public static final int typeCFStringRef = ('c'<<24) + ('f'<<16) + ('s'<<8) + 't';
+ public static final int typeCFTypeRef = ('c'<<24) + ('f'<<16) + ('t'<<8) + 'y';
+ public static final int typeCGContextRef = ('c'<<24) + ('n'<<16) + ('t'<<8) + 'x';
public static final int typeChar = ('T'<<24) + ('E'<<16) + ('X'<<8) + 'T';
public static final int typeClickActivationResult = ('c'<<24) + ('l'<<16) + ('a'<<8) + 'c';
public static final int typeControlPartCode = ('c'<<24) + ('p'<<16) + ('r'<<8) + 't';
@@ -868,6 +873,7 @@ public class OS extends Platform {
public static final int typeType = ('t'<<24) + ('y'<<16) + ('p'<<8) + 'e';
public static final int typeUInt32 = ('m'<<24) + ('a'<<16) + ('g'<<8) + 'n';
public static final int typeUnicodeText = ('u'<<24) + ('t'<<16) + ('x'<<8) + 't';
+ public static final int typeWildCard = ('w'<<24) + ('i'<<16) + ('l'<<8) + 'd';
public static final int typeWindowDefPartCode = ('w'<<24) + ('d'<<16) + ('p'<<8) + 't';
public static final int typeWindowRef = ('w'<<24) + ('i'<<16) + ('n'<<8) + 'd';
public static final int typeWindowRegionCode = ('w'<<24) + ('s'<<16) + ('h'<<8) + 'p';
@@ -944,6 +950,7 @@ public static final native int CFArrayGetCount(int theArray);
public static final native int CFArrayGetValueAtIndex(int theArray, int idx);
public static final native void CFDataGetBytes(int theData, CFRange range, byte[] buffer);
public static final native int CFDataGetLength(int theData);
+public static final native boolean CFEqual(int theString, int theOtherString);
public static final native int CFLocaleCopyCurrent();
public static final native int CFNumberFormatterCopyProperty(int formatter, int key);
public static final native int CFNumberFormatterCreate(int alloc, int locale, int style);
@@ -1365,6 +1372,7 @@ public static final native int HIComboBoxCreate(CGRect boundsRect, int text, Con
public static final native int HIComboBoxGetItemCount(int inComboBox);
public static final native int HIComboBoxInsertTextItemAtIndex(int inComboBox, int inIndex, int inText);
public static final native int HIComboBoxRemoveItemAtIndex(int inComboBox, int inIndex);
+public static final native int HICopyAccessibilityRoleDescription(int inRole, int inSubrole);
public static final native int HIObjectCopyClassID(int inObject);
public static final native int HIObjectCreate(int inClassID, int inConstructData, int[] outObject);
public static final native int HIObjectRegisterSubclass(int inClassID, int inBaseClassID, int inOptions, int inConstructProc, int inNumEvents, int[] inEventList, int inConstructData, int[] outClassRef);
@@ -1792,4 +1800,309 @@ public static final native void memcpy(int[] dest, TXNTab src, int size);
public static final native void memcpy(float[] dest, int src, int size);
public static final native void memset(int dest, int value, int size);
public static final native int strlen(int ptr);
+
+
+public static final native int AXUIElementCreateWithHIObjectAndIdentifier(int inHIObject, long inIdentifier);
+
+public static final native void AXNotificationHIObjectNotify(int inNotification, int inHIObject, long inIdentifier);
+
+public static final native void AXUIElementGetIdentifier(int inUIElement, long[] outIdentifier);
+
+public static final int kEventClassAccessibility = ('a'<<24) + ('c'<<16) + ('c'<<8) + 'e';
+
+public static final int kEventAccessibleGetChildAtPoint = 1;
+public static final int kEventAccessibleGetFocusedChild = 2;
+public static final int kEventAccessibleGetAllAttributeNames = 21;
+public static final int kEventAccessibleGetAllParameterizedAttributeNames = 25;
+public static final int kEventAccessibleGetNamedAttribute = 22;
+public static final int kEventAccessibleSetNamedAttribute = 23;
+public static final int kEventAccessibleIsNamedAttributeSettable = 24;
+public static final int kEventAccessibleGetAllActionNames = 41;
+public static final int kEventAccessiblePerformNamedAction = 42;
+public static final int kEventAccessibleGetNamedActionDescription = 44;
+
+public static final int kEventParamAccessibleObject = ('a'<<24) + ('o'<<16) + ('b'<<8) + 'j';
+public static final int kEventParamAccessibleChild = ('a'<<24) + ('c'<<16) + ('h'<<8) + 'l';
+public static final int kEventParamAccessibleAttributeName = ('a'<<24) + ('t'<<16) + ('n'<<8) + 'm';
+public static final int kEventParamAccessibleAttributeNames = ('a'<<24) + ('t'<<16) + ('n'<<8) + 's';
+public static final int kEventParamAccessibleAttributeValue = ('a'<<24) + ('t'<<16) + ('v'<<8) + 'l';
+public static final int kEventParamAccessibleAttributeSettable = ('a'<<24) + ('t'<<16) + ('s'<<8) + 't';
+public static final int kEventParamAccessibleAttributeParameter = ('a'<<24) + ('t'<<16) + ('p'<<8) + 'a';
+public static final int kEventParamAccessibleActionName = ('a'<<24) + ('c'<<16) + ('n'<<8) + 'm';
+public static final int kEventParamAccessibleActionNames = ('a'<<24) + ('c'<<16) + ('n'<<8) + 's';
+public static final int kEventParamAccessibleActionDescription = ('a'<<24) + ('c'<<16) + ('d'<<8) + 's';
+public static final int kEventParamAccessibleEventQueued = ('a'<<24) + ('e'<<16) + ('q'<<8) + 'u';
+
+public static final String kAXApplicationRole = "AXApplication";
+public static final String kAXSystemWideRole = "AXSystemWide";
+public static final String kAXWindowRole = "AXWindow";
+public static final String kAXSheetRole = "AXSheet";
+public static final String kAXDrawerRole = "AXDrawer";
+public static final String kAXGrowAreaRole = "AXGrowArea";
+public static final String kAXImageRole = "AXImage";
+public static final String kAXUnknownRole = "AXUnknown";
+public static final String kAXButtonRole = "AXButton";
+public static final String kAXRadioButtonRole = "AXRadioButton";
+public static final String kAXCheckBoxRole = "AXCheckBox";
+public static final String kAXPopUpButtonRole = "AXPopUpButton";
+public static final String kAXMenuButtonRole = "AXMenuButton";
+public static final String kAXTabGroupRole = "AXTabGroup";
+public static final String kAXTableRole = "AXTable";
+public static final String kAXColumnRole = "AXColumn";
+public static final String kAXRowRole = "AXRow";
+public static final String kAXOutlineRole = "AXOutline";
+public static final String kAXBrowserRole = "AXBrowser";
+public static final String kAXScrollAreaRole = "AXScrollArea";
+public static final String kAXScrollBarRole = "AXScrollBar";
+public static final String kAXRadioGroupRole = "AXRadioGroup";
+public static final String kAXListRole = "AXList";
+public static final String kAXGroupRole = "AXGroup";
+public static final String kAXValueIndicatorRole = "AXValueIndicator";
+public static final String kAXComboBoxRole = "AXComboBox";
+public static final String kAXSliderRole = "AXSlider";
+public static final String kAXIncrementorRole = "AXIncrementor";
+public static final String kAXBusyIndicatorRole = "AXBusyIndicator";
+public static final String kAXProgressIndicatorRole = "AXProgressIndicator";
+public static final String kAXRelevanceIndicatorRole = "AXRelevanceIndicator";
+public static final String kAXToolbarRole = "AXToolbar";
+public static final String kAXDisclosureTriangleRole = "AXDisclosureTriangle";
+public static final String kAXTextFieldRole = "AXTextField";
+public static final String kAXTextAreaRole = "AXTextArea";
+public static final String kAXStaticTextRole = "AXStaticText";
+public static final String kAXMenuBarRole = "AXMenuBar";
+public static final String kAXMenuBarItemRole = "AXMenuBarItem";
+public static final String kAXMenuRole = "AXMenu";
+public static final String kAXMenuItemRole = "AXMenuItem";
+public static final String kAXSplitGroupRole = "AXSplitGroup";
+public static final String kAXSplitterRole = "AXSplitter";
+public static final String kAXColorWellRole = "AXColorWell";
+public static final String kAXTimeFieldRole = "AXTimeField";
+public static final String kAXDateFieldRole = "AXDateField";
+public static final String kAXHelpTagRole = "AXHelpTag";
+public static final String kAXMatteRole = "AXMatteRole";
+public static final String kAXDockItemRole = "AXDockItem";
+public static final String kAXLinkRole = "AXLink"; // as seen in Safari
+
+public static final String kAXCloseButtonSubrole = "AXCloseButton";
+public static final String kAXMinimizeButtonSubrole = "AXMinimizeButton";
+public static final String kAXZoomButtonSubrole = "AXZoomButton";
+public static final String kAXToolbarButtonSubrole = "AXToolbarButton";
+public static final String kAXSecureTextFieldSubrole = "AXSecureTextField";
+public static final String kAXTableRowSubrole = "AXTableRow";
+public static final String kAXOutlineRowSubrole = "AXOutlineRow";
+public static final String kAXUnknownSubrole = "AXUnknown";
+public static final String kAXStandardWindowSubrole = "AXStandardWindow";
+public static final String kAXDialogSubrole = "AXDialog";
+public static final String kAXSystemDialogSubrole = "AXSystemDialog";
+public static final String kAXFloatingWindowSubrole = "AXFloatingWindow";
+public static final String kAXSystemFloatingWindowSubrole = "AXSystemFloatingWindow";
+public static final String kAXIncrementArrowSubrole = "AXIncrementArrow";
+public static final String kAXDecrementArrowSubrole = "AXDecrementArrow";
+public static final String kAXIncrementPageSubrole = "AXIncrementPage";
+public static final String kAXDecrementPageSubrole = "AXDecrementPage";
+public static final String kAXSortButtonSubrole = "AXSortButton";
+public static final String kAXSearchFieldSubrole = "AXSearchField";
+public static final String kAXApplicationDockItemSubrole = "AXApplicationDockItem";
+public static final String kAXDocumentDockItemSubrole = "AXDocumentDockItem";
+public static final String kAXFolderDockItemSubrole = "AXFolderDockItem";
+public static final String kAXMinimizedWindowDockItemSubrole= "AXMinimizedWindowDockItem";
+public static final String kAXURLDockItemSubrole = "AXURLDockItem";
+public static final String kAXDockExtraDockItemSubrole = "AXDockExtraDockItem";
+public static final String kAXTrashDockItemSubrole = "AXTrashDockItem";
+public static final String kAXProcessSwitcherListSubrole = "AXProcessSwitcherList";
+
+//General attributes
+public static final String kAXRoleAttribute = "AXRole";
+public static final String kAXSubroleAttribute = "AXSubrole";
+public static final String kAXRoleDescriptionAttribute = "AXRoleDescription";
+public static final String kAXHelpAttribute = "AXHelp";
+public static final String kAXTitleAttribute = "AXTitle";
+public static final String kAXValueAttribute = "AXValue";
+public static final String kAXMinValueAttribute = "AXMinValue";
+public static final String kAXMaxValueAttribute = "AXMaxValue";
+public static final String kAXValueIncrementAttribute = "AXValueIncrement";
+public static final String kAXAllowedValuesAttribute = "AXAllowedValues";
+public static final String kAXEnabledAttribute = "AXEnabled";
+public static final String kAXFocusedAttribute = "AXFocused";
+public static final String kAXParentAttribute = "AXParent";
+public static final String kAXChildrenAttribute = "AXChildren";
+public static final String kAXSelectedChildrenAttribute = "AXSelectedChildren";
+public static final String kAXVisibleChildrenAttribute = "AXVisibleChildren";
+public static final String kAXWindowAttribute = "AXWindow";
+public static final String kAXTopLevelUIElementAttribute = "AXTopLevelUIElement";
+public static final String kAXPositionAttribute = "AXPosition";
+public static final String kAXSizeAttribute = "AXSize";
+public static final String kAXOrientationAttribute = "AXOrientation";
+public static final String kAXDescriptionAttribute = "AXDescription";
+
+// Text-specific attributes
+public static final String kAXSelectedTextAttribute = "AXSelectedText";
+public static final String kAXVisibleCharacterRangeAttribute = "AXVisibleCharacterRange";
+public static final String kAXSelectedTextRangeAttribute = "AXSelectedTextRange";
+public static final String kAXNumberOfCharactersAttribute = "AXNumberOfCharacters";
+public static final String kAXSharedTextUIElementsAttribute = "AXSharedTextUIElements";
+public static final String kAXSharedCharacterRangeAttribute = "AXSharedCharacterRange";
+
+// Window-specific attributes
+public static final String kAXMainAttribute = "AXMain";
+public static final String kAXMinimizedAttribute = "AXMinimized";
+public static final String kAXCloseButtonAttribute = "AXCloseButton";
+public static final String kAXZoomButtonAttribute = "AXZoomButton";
+public static final String kAXMinimizeButtonAttribute = "AXMinimizeButton";
+public static final String kAXToolbarButtonAttribute = "AXToolbarButton";
+public static final String kAXGrowAreaAttribute = "AXGrowArea";
+public static final String kAXProxyAttribute = "AXProxy";
+public static final String kAXModalAttribute = "AXModal";
+public static final String kAXDefaultButtonAttribute = "AXDefaultButton";
+public static final String kAXCancelButtonAttribute = "AXCancelButton";
+
+// Menu-specific attributes
+public static final String kAXMenuItemCmdCharAttribute = "AXMenuItemCmdChar";
+public static final String kAXMenuItemCmdVirtualKeyAttribute = "AXMenuItemCmdVirtualKey";
+public static final String kAXMenuItemCmdGlyphAttribute = "AXMenuItemCmdGlyph";
+public static final String kAXMenuItemCmdModifiersAttribute = "AXMenuItemCmdModifiers";
+public static final String kAXMenuItemMarkCharAttribute = "AXMenuItemMarkChar";
+public static final String kAXMenuItemPrimaryUIElementAttribute = "AXMenuItemPrimaryUIElement";
+
+// Application-specific attributes
+public static final String kAXMenuBarAttribute = "AXMenuBar";
+public static final String kAXWindowsAttribute = "AXWindows";
+public static final String kAXFrontmostAttribute = "AXFrontmost";
+public static final String kAXHiddenAttribute = "AXHidden";
+public static final String kAXMainWindowAttribute = "AXMainWindow";
+public static final String kAXFocusedWindowAttribute = "AXFocusedWindow";
+public static final String kAXFocusedUIElementAttribute = "AXFocusedUIElement";
+
+// Miscellaneous attributes
+public static final String kAXHeaderAttribute = "AXHeader";
+public static final String kAXEditedAttribute = "AXEdited";
+public static final String kAXValueWrapsAttribute = "AXValueWraps";
+public static final String kAXTabsAttribute = "AXTabs";
+public static final String kAXTitleUIElementAttribute = "AXTitleUIElement";
+public static final String kAXHorizontalScrollBarAttribute = "AXHorizontalScrollBar";
+public static final String kAXVerticalScrollBarAttribute = "AXVerticalScrollBar";
+public static final String kAXOverflowButtonAttribute = "AXOverflowButton";
+public static final String kAXFilenameAttribute = "AXFilename";
+public static final String kAXExpandedAttribute = "AXExpanded";
+public static final String kAXSelectedAttribute = "AXSelected";
+public static final String kAXSplittersAttribute = "AXSplitters";
+public static final String kAXNextContentsAttribute = "AXNextContents";
+public static final String kAXDocumentAttribute = "AXDocument";
+public static final String kAXDecrementButtonAttribute = "AXDecrementButton";
+public static final String kAXIncrementButtonAttribute = "AXIncrementButton";
+public static final String kAXPreviousContentsAttribute = "AXPreviousContents";
+public static final String kAXContentsAttribute = "AXContents";
+public static final String kAXIncrementorAttribute = "AXIncrementor";
+public static final String kAXHourFieldAttribute = "AXHourField";
+public static final String kAXMinuteFieldAttribute = "AXMinuteField";
+public static final String kAXSecondFieldAttribute = "AXSecondField";
+public static final String kAXAMPMFieldAttribute = "AXAMPMField";
+public static final String kAXDayFieldAttribute = "AXDayField";
+public static final String kAXMonthFieldAttribute = "AXMonthField";
+public static final String kAXYearFieldAttribute = "AXYearField";
+public static final String kAXColumnTitleAttribute = "AXColumnTitles";
+public static final String kAXURLAttribute = "AXURL";
+public static final String kAXLabelUIElementsAttribute = "AXLabelUIElements";
+public static final String kAXLabelValueAttribute = "AXLabelValue";
+public static final String kAXShownMenuUIElementAttribute = "AXShownMenuUIElement";
+public static final String kAXServesAsTitleForUIElementsAttribute = "AXServesAsTitleForUIElements";
+public static final String kAXLinkedUIElementsAttribute = "AXLinkedUIElements";
+
+// Table and outline view attributes
+public static final String kAXRowsAttribute = "AXRows";
+public static final String kAXVisibleRowsAttribute = "AXVisibleRows";
+public static final String kAXSelectedRowsAttribute = "AXSelectedRows";
+public static final String kAXColumnsAttribute = "AXColumns";
+public static final String kAXVisibleColumnsAttribute = "AXVisibleColumns";
+public static final String kAXSelectedColumnsAttribute = "AXSelectedColumns";
+public static final String kAXSortDirectionAttribute = "AXSortDirection";
+public static final String kAXColumnHeaderUIElementsAttribute = "AXColumnHeaderUIElements";
+public static final String kAXIndexAttribute = "AXIndex";
+public static final String kAXDisclosingAttribute = "AXDisclosing";
+public static final String kAXDisclosedRowsAttribute = "AXDisclosedRows";
+public static final String kAXDisclosedByRowAttribute = "AXDisclosedByRow";
+
+// Matte attributes
+public static final String kAXMatteHoleAttribute = "AXMatteHole";
+public static final String kAXMatteContentUIElementAttribute = "AXMatteContentUIElement";
+
+// Dock attributes
+public static final String kAXIsApplicationRunningAttribute = "AXIsApplicationRunning";
+
+// System-wide attributes
+public static final String kAXFocusedApplicationAttribute = "AXFocusedApplication";
+
+// Text-suite parameterized attributes
+public static final String kAXLineForIndexParameterizedAttribute = "AXLineForIndex";
+public static final String kAXRangeForLineParameterizedAttribute = "AXRangeForLine";
+public static final String kAXStringForRangeParameterizedAttribute = "AXStringForRange";
+public static final String kAXRangeForPositionParameterizedAttribute = "AXRangeForPosition";
+public static final String kAXRangeForIndexParameterizedAttribute = "AXRangeForIndex";
+public static final String kAXBoundsForRangeParameterizedAttribute = "AXBoundsForRange";
+public static final String kAXRTFForRangeParameterizedAttribute = "AXRTFForRange";
+public static final String kAXAttributedStringForRangeParameterizedAttribute = "AXAttributedStringForRange";
+public static final String kAXStyleRangeForIndexParameterizedAttribute = "AXStyleRangeForIndex";
+public static final String kAXInsertionPointLineNumberAttribute = "AXInsertionPointLineNumber";
+
+// Accessibility actions.
+public static final String kAXPressAction = "AXPress";
+public static final String kAXIncrementAction = "AXIncrement";
+public static final String kAXDecrementAction = "AXDecrement";
+public static final String kAXConfirmAction = "AXConfirm";
+public static final String kAXCancelAction = "AXCancel";
+public static final String kAXRaiseAction = "AXRaise";
+public static final String kAXShowMenuAction = "AXShowMenu";
+
+// Focus notifications
+public static final String kAXMainWindowChangedNotification = "AXMainWindowChanged";
+public static final String kAXFocusedWindowChangedNotification = "AXFocusedWindowChanged";
+public static final String kAXFocusedUIElementChangedNotification = "AXFocusedUIElementChanged";
+
+// Application notifications
+public static final String kAXApplicationActivatedNotification = "AXApplicationActivated";
+public static final String kAXApplicationDeactivatedNotification = "AXApplicationDeactivated";
+public static final String kAXApplicationHiddenNotification = "AXApplicationHidden";
+public static final String kAXApplicationShownNotification = "AXApplicationShown";
+
+// Window notifications
+public static final String kAXWindowCreatedNotification = "AXWindowCreated";
+public static final String kAXWindowMovedNotification = "AXWindowMoved";
+public static final String kAXWindowResizedNotification = "AXWindowResized";
+public static final String kAXWindowMiniaturizedNotification = "AXWindowMiniaturized";
+public static final String kAXWindowDeminiaturizedNotification = "AXWindowDeminiaturized";
+
+// New drawer, sheet, and help tag notifications
+public static final String kAXDrawerCreatedNotification = "AXDrawerCreated";
+public static final String kAXSheetCreatedNotification = "AXSheetCreated";
+public static final String kAXHelpTagCreatedNotification = "AXHelpTagCreated";
+
+// Element notifications
+public static final String kAXValueChangedNotification = "AXValueChanged";
+public static final String kAXUIElementDestroyedNotification = "AXUIElementDestroyed";
+
+// Menu notifications
+public static final String kAXMenuOpenedNotification = "AXMenuOpened";
+public static final String kAXMenuClosedNotification = "AXMenuClosed";
+public static final String kAXMenuItemSelectedNotification = "AXMenuItemSelected";
+
+// Table and outline view notifications
+public static final String kAXRowCountChangedNotification = "AXRowCountChanged";
+
+// Miscellaneous notifications
+public static final String kAXSelectedChildrenChangedNotification = "AXSelectedChildrenChanged";
+public static final String kAXResizedNotification = "AXResized";
+public static final String kAXMovedNotification = "AXMoved";
+public static final String kAXCreatedNotification = "AXCreated";
+
+// Error codes
+public static final int kAXErrorIllegalArgument = -25201;
+public static final int kAXErrorInvalidUIElement = -25202;
+public static final int kAXErrorInvalidUIElementObserver = -25203;
+public static final int kAXErrorCannotComplete = -25204;
+public static final int kAXErrorAttributeUnsupported = -25205;
+public static final int kAXErrorActionUnsupported = -25206;
+public static final int kAXErrorAPIDisabled = -25211;
+public static final int kAXErrorParameterizedAttributeUnsupported = -25213;
+
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
index d441d03b75..b4940962b0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
@@ -833,9 +833,7 @@ public boolean forceFocus () {
*/
public Accessible getAccessible () {
checkWidget ();
- if (accessible == null) {
- accessible = Accessible.internal_new_Accessible (this);
- }
+ if (accessible == null) accessible = new_Accessible (this);
return accessible;
}
@@ -1275,6 +1273,13 @@ void hookEvents () {
};
int controlTarget = OS.GetControlEventTarget (handle);
OS.InstallEventHandler (controlTarget, controlProc, mask.length / 2, mask, handle, null);
+ int accessibilityProc = display.accessibilityProc;
+ mask = new int [] {
+ OS.kEventClassAccessibility, OS.kEventAccessibleGetChildAtPoint,
+ OS.kEventClassAccessibility, OS.kEventAccessibleGetAllAttributeNames,
+ OS.kEventClassAccessibility, OS.kEventAccessibleGetNamedAttribute,
+ };
+ OS.InstallEventHandler (controlTarget, accessibilityProc, mask.length / 2, mask, handle, null);
int helpProc = display.helpProc;
OS.HMInstallControlContentCallback (handle, helpProc);
int colorProc = display.colorProc;
@@ -1593,6 +1598,27 @@ Decorations menuShell () {
return parent.menuShell ();
}
+int kEventAccessibleGetChildAtPoint (int nextHandler, int theEvent, int userData) {
+ if (accessible != null) {
+ return accessible.internal_kEventAccessibleGetChildAtPoint (nextHandler, theEvent, userData);
+ }
+ return OS.eventNotHandledErr;
+}
+
+int kEventAccessibleGetAllAttributeNames (int nextHandler, int theEvent, int userData) {
+ if (accessible != null) {
+ return accessible.internal_kEventAccessibleGetAllAttributeNames (nextHandler, theEvent, userData);
+ }
+ return OS.eventNotHandledErr;
+}
+
+int kEventAccessibleGetNamedAttribute (int nextHandler, int theEvent, int userData) {
+ if (accessible != null) {
+ return accessible.internal_kEventAccessibleGetNamedAttribute (nextHandler, theEvent, userData);
+ }
+ return OS.eventNotHandledErr;
+}
+
int kEventControlContextualMenuClick (int nextHandler, int theEvent, int userData) {
int x, y;
Rect rect = new Rect ();
@@ -1840,6 +1866,10 @@ public void moveBelow (Control control) {
setZOrder (control, false);
}
+Accessible new_Accessible (Control control) {
+ return Accessible.internal_new_Accessible (this);
+}
+
/**
* Causes the receiver to be resized to its preferred size.
* For a composite, this involves computing the preferred size
@@ -1969,6 +1999,10 @@ void releaseWidget () {
visibleRgn = 0;
menu = null;
layoutData = null;
+ if (accessible != null) {
+ accessible.internal_dispose_Accessible ();
+ }
+ accessible = null;
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java
index 6694b18ecb..f0bce13473 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java
@@ -105,11 +105,11 @@ public class Display extends Device {
static final int WAKE_CLASS = 'S' << 24 | 'W' << 16 | 'T' << 8 | '-';
static final int WAKE_KIND = 1;
Event [] eventQueue;
- Callback actionCallback, appleEventCallback, commandCallback, controlCallback, appearanceCallback;
+ Callback actionCallback, appleEventCallback, commandCallback, controlCallback, accessibilityCallback, appearanceCallback;
Callback drawItemCallback, itemDataCallback, itemNotificationCallback, itemCompareCallback;
Callback hitTestCallback, keyboardCallback, menuCallback, mouseHoverCallback, helpCallback;
Callback mouseCallback, trackingCallback, windowCallback, colorCallback, textInputCallback;
- int actionProc, appleEventProc, commandProc, controlProc, appearanceProc;
+ int actionProc, appleEventProc, commandProc, controlProc, appearanceProc, accessibilityProc;
int drawItemProc, itemDataProc, itemNotificationProc, itemCompareProc, helpProc;
int hitTestProc, keyboardProc, menuProc, mouseHoverProc;
int mouseProc, trackingProc, windowProc, colorProc, textInputProc;
@@ -831,6 +831,12 @@ int controlProc (int nextHandler, int theEvent, int userData) {
return OS.eventNotHandledErr;
}
+int accessibilityProc (int nextHandler, int theEvent, int userData) {
+ Widget widget = getWidget (userData);
+ if (widget != null) return widget.accessibilityProc (nextHandler, theEvent, userData);
+ return OS.eventNotHandledErr;
+}
+
static String convertToLf(String text) {
char Cr = '\r';
char Lf = '\n';
@@ -1973,6 +1979,9 @@ void initializeCallbacks () {
controlCallback = new Callback (this, "controlProc", 3);
controlProc = controlCallback.getAddress ();
if (controlProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+ accessibilityCallback = new Callback (this, "accessibilityProc", 3);
+ accessibilityProc = accessibilityCallback.getAddress ();
+ if (accessibilityProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
drawItemCallback = new Callback (this, "drawItemProc", 7);
drawItemProc = drawItemCallback.getAddress ();
if (drawItemProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
@@ -2983,6 +2992,7 @@ void releaseDisplay () {
caretCallback.dispose ();
commandCallback.dispose ();
controlCallback.dispose ();
+ accessibilityCallback.dispose ();
drawItemCallback.dispose ();
itemCompareCallback.dispose ();
itemDataCallback.dispose ();
@@ -2999,12 +3009,12 @@ void releaseDisplay () {
textInputCallback.dispose ();
appearanceCallback.dispose ();
actionCallback = appleEventCallback = caretCallback = commandCallback = appearanceCallback = null;
- controlCallback = drawItemCallback = itemDataCallback = itemNotificationCallback = null;
+ accessibilityCallback = controlCallback = drawItemCallback = itemDataCallback = itemNotificationCallback = null;
helpCallback = hitTestCallback = keyboardCallback = menuCallback = itemCompareCallback = null;
mouseHoverCallback = mouseCallback = trackingCallback = windowCallback = colorCallback = null;
textInputCallback = null;
actionProc = appleEventProc = caretProc = commandProc = appearanceProc = 0;
- controlProc = drawItemProc = itemDataProc = itemNotificationProc = itemCompareProc = 0;
+ accessibilityProc = controlProc = drawItemProc = itemDataProc = itemNotificationProc = itemCompareProc = 0;
helpProc = hitTestProc = keyboardProc = menuProc = 0;
mouseHoverProc = mouseProc = trackingProc = windowProc = colorProc = 0;
textInputProc = 0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
index 3cd4957036..b0df5624ab 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
@@ -358,6 +358,16 @@ int controlProc (int nextHandler, int theEvent, int userData) {
return OS.eventNotHandledErr;
}
+int accessibilityProc (int nextHandler, int theEvent, int userData) {
+ int eventKind = OS.GetEventKind (theEvent);
+ switch (eventKind) {
+ case OS.kEventAccessibleGetChildAtPoint: return kEventAccessibleGetChildAtPoint (nextHandler, theEvent, userData);
+ case OS.kEventAccessibleGetAllAttributeNames: return kEventAccessibleGetAllAttributeNames (nextHandler, theEvent, userData);
+ case OS.kEventAccessibleGetNamedAttribute: return kEventAccessibleGetNamedAttribute (nextHandler, theEvent, userData);
+ }
+ return OS.eventNotHandledErr;
+}
+
int createCIcon (Image image) {
int imageHandle = image.handle;
int width = OS.CGImageGetWidth(imageHandle);
@@ -929,6 +939,18 @@ int itemNotificationProc (int browser, int item, int message) {
return OS.noErr;
}
+int kEventAccessibleGetChildAtPoint (int nextHandler, int theEvent, int userData) {
+ return OS.eventNotHandledErr;
+}
+
+int kEventAccessibleGetAllAttributeNames (int nextHandler, int theEvent, int userData) {
+ return OS.eventNotHandledErr;
+}
+
+int kEventAccessibleGetNamedAttribute (int nextHandler, int theEvent, int userData) {
+ return OS.eventNotHandledErr;
+}
+
int kEventProcessCommand (int nextHandler, int theEvent, int userData) {
return OS.eventNotHandledErr;
}