diff options
author | Carolyn MacLeod <carolyn> | 2010-01-21 19:47:39 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2010-01-21 19:47:39 +0000 |
commit | 4e3ace7441083b52059381fc7315ed0ffaa59c75 (patch) | |
tree | d81aec5c9a167881801af572c130f60ee47ddd98 /bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse | |
parent | 30eaec187a22ddf0998c34e45a71b135fb6c6509 (diff) | |
download | eclipse.platform.swt-4e3ace7441083b52059381fc7315ed0ffaa59c75.tar.gz eclipse.platform.swt-4e3ace7441083b52059381fc7315ed0ffaa59c75.tar.xz eclipse.platform.swt-4e3ace7441083b52059381fc7315ed0ffaa59c75.zip |
Initial Accessibility API update
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java | 471 |
1 files changed, 469 insertions, 2 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 74f00a9aef..d30c5e7c96 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 @@ -14,8 +14,18 @@ package org.eclipse.swt.accessibility; import java.util.*; import org.eclipse.swt.*; +import org.eclipse.swt.accessibility.Accessible; +import org.eclipse.swt.accessibility.AccessibleActionListener; +import org.eclipse.swt.accessibility.AccessibleAttributeListener; +import org.eclipse.swt.accessibility.AccessibleHyperlinkListener; +import org.eclipse.swt.accessibility.AccessibleTableCellListener; +import org.eclipse.swt.accessibility.AccessibleTableListener; +import org.eclipse.swt.accessibility.AccessibleTextExtendedListener; +import org.eclipse.swt.accessibility.AccessibleValueListener; +import org.eclipse.swt.accessibility.Relation; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.cocoa.*; +import org.eclipse.swt.internal.ole.win32.COM; import org.eclipse.swt.widgets.*; /** @@ -79,11 +89,42 @@ public class Accessible { Vector accessibleListeners = new Vector(); Vector accessibleControlListeners = new Vector(); Vector accessibleTextListeners = new Vector (); + Vector accessibleListeners = new Vector(); + Vector accessibleControlListeners = new Vector(); + Vector accessibleTextListeners = new Vector (); + Vector accessibleActionListeners = new Vector(); + Vector accessibleHyperlinkListeners = new Vector(); + Vector accessibleTableListeners = new Vector(); + Vector accessibleTableCellListeners = new Vector(); + Vector accessibleTextExtendedListeners = new Vector(); + Vector accessibleValueListeners = new Vector(); + Vector accessibleScrollListeners = new Vector(); + Vector accessibleAttributeListeners = new Vector(); + Accessible parent; Control control; Map /*<Integer, SWTAccessibleDelegate>*/ children = new HashMap(); /** + * 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> + * + * @see Control#getAccessible + * + * @since 3.6 + */ + public Accessible(Accessible parent) { + this.parent = checkNull(parent); + this.control = parent.control; + // TODO + } + + /** * @since 3.5 */ protected Accessible() { @@ -93,6 +134,11 @@ public class Accessible { this.control = control; } + 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> @@ -190,9 +236,211 @@ public class Accessible { public void addAccessibleTextListener (AccessibleTextListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - accessibleTextListeners.addElement (listener); + if (listener instanceof AccessibleTextExtendedListener) { + accessibleTextExtendedListeners.addElement (listener); + } else { + accessibleTextListeners.addElement (listener); + } } + /** + * 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. + * + * @param listener the listener that should be notified when the receiver + * is asked for <code>AccessibleAction</code> interface properties + * + * @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 AccessibleActionListener + * @see #removeAccessibleActionListener + * + * @since 3.6 + */ + public void addAccessibleActionListener(AccessibleActionListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleActionListeners.addElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should be notified when the receiver + * is asked for <code>AccessibleHyperlink</code> interface properties + * + * @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 AccessibleHyperlinkListener + * @see #removeAccessibleHyperlinkListener + * + * @since 3.6 + */ + public void addAccessibleHyperlinkListener(AccessibleHyperlinkListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleHyperlinkListeners.addElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should be notified when the receiver + * is asked for <code>AccessibleTable</code> interface properties + * + * @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 AccessibleTableListener + * @see #removeAccessibleTableListener + * + * @since 3.6 + */ + public void addAccessibleTableListener(AccessibleTableListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleTableListeners.addElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should be notified when the receiver + * is asked for <code>AccessibleTableCell</code> interface properties + * + * @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 AccessibleTableCellListener + * @see #removeAccessibleTableCellListener + * + * @since 3.6 + */ + public void addAccessibleTableCellListener(AccessibleTableCellListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleTableCellListeners.addElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should be notified when the receiver + * is asked for <code>AccessibleValue</code> interface properties + * + * @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 AccessibleValueListener + * @see #removeAccessibleValueListener + * + * @since 3.6 + */ + public void addAccessibleValueListener(AccessibleValueListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleValueListeners.addElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should be notified when the receiver + * is asked for <code>AccessibleAttribute</code> interface properties + * + * @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 AccessibleAttributeListener + * @see #removeAccessibleAttributeListener + * + * @since 3.6 + */ + public void addAccessibleAttributeListener(AccessibleAttributeListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleAttributeListeners.addElement(listener); + } + + /** + * 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 target the accessible that is the target for this relation + * + * @since 3.6 + */ + public void addRelation(int type, Accessible target) { + checkWidget(); + // TODO + } + + /** + * 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; + } + public id internal_accessibilityActionDescription(NSString action, int childID) { // TODO No action support for now. return NSString.string(); @@ -1257,7 +1505,226 @@ public class Accessible { public void removeAccessibleTextListener (AccessibleTextListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - accessibleTextListeners.removeElement (listener); + if (listener instanceof AccessibleTextExtendedListener) { + accessibleTextExtendedListeners.removeElement (listener); + } else { + accessibleTextListeners.removeElement (listener); + } + } + + /** + * 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. + * + * @param listener the listener that should no longer be notified when the receiver + * is asked for <code>AccessibleAction</code> interface properties + * + * @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 AccessibleActionListener + * @see #addAccessibleActionListener + * + * @since 3.6 + */ + public void removeAccessibleActionListener(AccessibleActionListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleActionListeners.removeElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should no longer be notified when the receiver + * is asked for <code>AccessibleHyperlink</code> interface properties + * + * @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 AccessibleHyperlinkListener + * @see #addAccessibleHyperlinkListener + * + * @since 3.6 + */ + public void removeAccessibleHyperlinkListener(AccessibleHyperlinkListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleHyperlinkListeners.removeElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should no longer be notified when the receiver + * is asked for <code>AccessibleTable</code> interface properties + * + * @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 AccessibleTableListener + * @see #addAccessibleTableListener + * + * @since 3.6 + */ + public void removeAccessibleTableListener(AccessibleTableListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleTableListeners.removeElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should no longer be notified when the receiver + * is asked for <code>AccessibleTableCell</code> interface properties + * + * @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 AccessibleTableCellListener + * @see #addAccessibleTableCellListener + * + * @since 3.6 + */ + public void removeAccessibleTableCellListener(AccessibleTableCellListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleTableCellListeners.removeElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should no longer be notified when the receiver + * is asked for <code>AccessibleValue</code> interface properties + * + * @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 AccessibleValueListener + * @see #addAccessibleValueListener + * + * @since 3.6 + */ + public void removeAccessibleValueListener(AccessibleValueListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleValueListeners.removeElement(listener); + } + + /** + * 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. + * + * @param listener the listener that should no longer be notified when the receiver + * is asked for <code>AccessibleAttribute</code> interface properties + * + * @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 AccessibleAttributeListener + * @see #addAccessibleAttributeListener + * + * @since 3.6 + */ + public void removeAccessibleAttributeListener(AccessibleAttributeListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleAttributeListeners.removeElement(listener); + } + + /** + * 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 target the accessible that is the target for this relation + * + * @since 3.6 + */ + public void removeRelation(int type, Accessible target) { + checkWidget(); + // TODO + } + + /** + * 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 childID an identifier specifying a child of the control or the control itself + * + * @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.6 + */ + public void sendEvent(int event, int childID) { + checkWidget(); + // TODO + } + + /** + * Sends a message with event-specific data 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 childID an identifier specifying a child of the control or the control itself + * @param eventData an object containing event-specific data + * + * @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.6 + */ + public void sendEvent(int event, int childID, Object eventData) { + checkWidget(); + // TODO } static NSArray retainedAutoreleased(NSArray inObject) { |