diff options
55 files changed, 12476 insertions, 1456 deletions
diff --git a/bundles/org.eclipse.swt/.settings/.api_filters b/bundles/org.eclipse.swt/.settings/.api_filters index 83bb5c8cad..3c9fd18c74 100644 --- a/bundles/org.eclipse.swt/.settings/.api_filters +++ b/bundles/org.eclipse.swt/.settings/.api_filters @@ -1,5 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <component id="org.eclipse.swt" version="2"> +<resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionListener.java" type="org.eclipse.swt.accessibility.AccessibleActionListener"> +<filter id="576720909"> +<message_arguments> +<message_argument value="SWTEventListener"/> +<message_argument value="AccessibleActionListener"/> +</message_arguments> +</filter> +</resource> +<resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java" type="org.eclipse.swt.accessibility.AccessibleAttributeListener"> +<filter id="576720909"> +<message_arguments> +<message_argument value="SWTEventListener"/> +<message_argument value="AccessibleAttributeListener"/> +</message_arguments> +</filter> +</resource> <resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlListener.java" type="org.eclipse.swt.accessibility.AccessibleControlListener"> <filter id="576720909"> <message_arguments> @@ -8,6 +24,14 @@ </message_arguments> </filter> </resource> +<resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkListener.java" type="org.eclipse.swt.accessibility.AccessibleHyperlinkListener"> +<filter id="576720909"> +<message_arguments> +<message_argument value="SWTEventListener"/> +<message_argument value="AccessibleHyperlinkListener"/> +</message_arguments> +</filter> +</resource> <resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleListener.java" type="org.eclipse.swt.accessibility.AccessibleListener"> <filter id="576720909"> <message_arguments> @@ -16,6 +40,30 @@ </message_arguments> </filter> </resource> +<resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellListener.java" type="org.eclipse.swt.accessibility.AccessibleTableCellListener"> +<filter id="576720909"> +<message_arguments> +<message_argument value="SWTEventListener"/> +<message_argument value="AccessibleTableCellListener"/> +</message_arguments> +</filter> +</resource> +<resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableListener.java" type="org.eclipse.swt.accessibility.AccessibleTableListener"> +<filter id="576720909"> +<message_arguments> +<message_argument value="SWTEventListener"/> +<message_argument value="AccessibleTableListener"/> +</message_arguments> +</filter> +</resource> +<resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java" type="org.eclipse.swt.accessibility.AccessibleTextExtendedListener"> +<filter id="576720909"> +<message_arguments> +<message_argument value="SWTEventListener"/> +<message_argument value="AccessibleTextExtendedListener"/> +</message_arguments> +</filter> +</resource> <resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextListener.java" type="org.eclipse.swt.accessibility.AccessibleTextListener"> <filter id="576720909"> <message_arguments> @@ -24,6 +72,14 @@ </message_arguments> </filter> </resource> +<resource path="Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueListener.java" type="org.eclipse.swt.accessibility.AccessibleValueListener"> +<filter id="576720909"> +<message_arguments> +<message_argument value="SWTEventListener"/> +<message_argument value="AccessibleValueListener"/> +</message_arguments> +</filter> +</resource> <resource path="Eclipse SWT Browser/common/org/eclipse/swt/browser/AuthenticationListener.java" type="org.eclipse.swt.browser.AuthenticationListener"> <filter id="576720909"> <message_arguments> 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 index 43e797e555..944e58096a 100644 --- 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 @@ -14,7 +14,17 @@ package org.eclipse.swt.accessibility; import java.util.Vector; import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; +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.internal.carbon.*; +import org.eclipse.swt.internal.ole.win32.COM; /** * Instances of this class provide a bridge between application @@ -71,11 +81,39 @@ public class Accessible { 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; int axuielementref = 0; int[] osChildIDCache = new int[0]; /** + * 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() { @@ -87,6 +125,11 @@ public class Accessible { OS.HIObjectSetAccessibilityIgnored(control.handle, false); } + 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> @@ -184,10 +227,212 @@ 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; + } + + /** * Returns the control for this Accessible object. * * @return the receiver's control @@ -1115,7 +1360,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 } /** 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) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java index 79179c52ce..54c63d7775 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java @@ -37,6 +37,21 @@ public class ACC { public static final int STATE_OFFSCREEN = 0x10000; public static final int STATE_SIZEABLE = 0x20000; public static final int STATE_LINKED = 0x400000; + /** @since 3.6 */ + public static final int STATE_ENABLED = 0x1; // Note: map to STATE_SYSTEM_UNAVAILABLE +// public static final int STATE_DEFAULT = 0x100; +// public static final int STATE_FLOATING = 0x1000; +// public static final int STATE_MARQUEED = 0x2000; +// public static final int STATE_ANIMATED = 0x4000; +// public static final int STATE_MOVEABLE = 0x40000; +// public static final int STATE_SELFVOICING = 0x80000; +// public static final int STATE_TRAVERSED = 0x800000; +// public static final int STATE_EXTSELECTABLE = 0x2000000; +// public static final int STATE_ALERT_LOW = 0x4000000; +// public static final int STATE_ALERT_MEDIUM = 0x8000000; +// public static final int STATE_ALERT_HIGH = 0x10000000; +// public static final int STATE_PROTECTED = 0x20000000; +// public static final int STATE_HASPOPUP = 0x40000000; public static final int ROLE_CLIENT_AREA = 0xa; public static final int ROLE_WINDOW = 0x9; @@ -71,6 +86,42 @@ public class ACC { public static final int ROLE_PROGRESSBAR = 0x30; public static final int ROLE_SLIDER = 0x33; public static final int ROLE_LINK = 0x1e; + /** @since 3.6 */ + public static final int ROLE_ALERT = 0x08; + /** @since 3.6 */ + public static final int ROLE_ANIMATION = 0x36; + /** @since 3.6 */ + public static final int ROLE_CANVAS = 0x401; + /** @since 3.6 */ + public static final int ROLE_COLUMN = 0x1b; + /** @since 3.6 */ + public static final int ROLE_DOCUMENT = 0x0f; + /** @since 3.6 */ + public static final int ROLE_GRAPHIC = 0x28; + /** @since 3.6 */ + public static final int ROLE_GROUP = 0x14; + /** @since 3.6 */ + public static final int ROLE_HEADING = 0x414; + /** @since 3.6 */ + public static final int ROLE_ROW = 0x1c; + /** @since 3.6 */ + public static final int ROLE_SPINBUTTON = 0x34; + /** @since 3.6 */ + public static final int ROLE_STATUSBAR = 0x17; + /** @since 3.6 */ + public static final int ROLE_CHECK_MENU_ITEM = 0x403; // maybe ?? + /** @since 3.6 */ + public static final int ROLE_RADIO_MENU_ITEM = 0x431; // maybe ?? + /** @since 3.6 */ + public static final int ROLE_CLOCK = 0x3d; // maybe ?? + /** @since 3.6 */ + public static final int ROLE_DATE_EDITOR = 0x405; // maybe ?? + /** @since 3.6 */ + public static final int ROLE_COLOR_CHOOSER = 0x404; // maybe ?? + /** @since 3.6 */ + public static final int ROLE_FILE_CHOOSER = 0x412; // maybe ?? + /** @since 3.6 */ + public static final int ROLE_FONT_CHOOSER = 0x413; // maybe ?? public static final int CHILDID_SELF = -1; public static final int CHILDID_NONE = -2; @@ -78,4 +129,446 @@ public class ACC { public static final int TEXT_INSERT = 0; public static final int TEXT_DELETE = 1; + + /** + * Typically, a single character is returned. In some cases more than one + * character is returned, for example, when a document contains field data + * such as a field containing a date, time, or footnote reference. In this + * case the caret can move over several characters in one movement of the + * caret. Note that after the caret moves, the caret offset changes by the + * number of characters in the field, e.g. by 8 characters in the following + * date: 03/26/07. + * + * @since 3.6 + */ + public static final int TEXT_BOUNDARY_CHAR = 0; + + /** + * The range provided matches the range observed when the application + * processes the Ctrl + left arrow and Ctrl + right arrow key sequences. + * Typically this is from the start of one word to the start of the next, + * but various applications are inconsistent in the handling of the end of a + * line. + * + * @since 3.6 + */ + public static final int TEXT_BOUNDARY_WORD = 1; + + /** + * Range is from start of one sentence to the start of another sentence. + * + * @since 3.6 + */ + public static final int TEXT_BOUNDARY_SENTENCE = 2; + + /** + * Range is from start of one paragraph to the start of another paragraph. + * + * @since 3.6 + */ + public static final int TEXT_BOUNDARY_PARAGRAPH = 3; + + /** + * Range is from start of one line to the start of another line. This often + * means that an end-of-line character will appear at the end of the range. + * However in the case of some applications an end-of-line character + * indicates the end of a paragraph and the lines composing the paragraph, + * other than the last line, do not contain an end of line character. + * + * @since 3.6 + */ + public static final int TEXT_BOUNDARY_LINE = 4; + + /** + * Using this value will cause all text to be returned. + * + * @since 3.6 + */ + public static final int TEXT_BOUNDARY_ALL = 5; + + /** + * Scroll the top left corner of the object or substring such that the top + * left corner (and as much as possible of the rest of the object or + * substring) is within the top level window. In cases where the entire + * object or substring fits within the top level window, the placement of + * the object or substring is dependent on the application. For example, the + * object or substring may be scrolled to the closest edge, the furthest + * edge, or midway between those two edges. In cases where there is a + * hierarchy of nested scrollable controls, more than one control may have + * to be scrolled. + * + * @since 3.6 + */ + public static final int SCROLL_TYPE_TOP_LEFT = 0; + + /** + * Scroll the bottom right corner of the object or substring such that the + * bottom right corner (and as much as possible of the rest of the object or + * substring) is within the top level window. In cases where the entire + * object or substring fits within the top level window, the placement of + * the object or substring is dependent on the application. For example, the + * object or substring may be scrolled to the closest edge, the furthest + * edge, or midway between those two edges. In cases where there is a + * hierarchy of nested scrollable controls, more than one control may have + * to be scrolled. + * + * @since 3.6 + */ + public static final int SCROLL_TYPE_BOTTOM_RIGHT = 1; + + /** + * Scroll the top edge of the object or substring such that the top edge + * (and as much as possible of the rest of the object or substring) is + * within the top level window. In cases where the entire object or substring + * fits within the top level window, the placement of the object or + * substring is dependent on the application. For example, the object or + * substring may be scrolled to the closest edge, the furthest edge, or + * midway between those two edges. In cases where there is a hierarchy of + * nested scrollable controls, more than one control may have to be + * scrolled. + * + * @since 3.6 + */ + public static final int SCROLL_TYPE_TOP_EDGE = 2; + + /** + * Scroll the bottom edge of the object or substring such that the bottom + * edge (and as much as possible of the rest of the object or substring) is + * within the top level window. In cases where the entire object or + * substring fits within the top level window, the placement of the object + * or substring is dependent on the application. For example, the object or + * substring may be scrolled to the closest edge, the furthest edge, or + * midway between those two edges. In cases where there is a hierarchy of + * nested scrollable controls, more than one control may have to be + * scrolled. + * + * @since 3.6 + */ + public static final int SCROLL_TYPE_BOTTOM_EDGE = 3; + + /** + * Scroll the left edge of the object or substring such that the left edge + * (and as much as possible of the rest of the object or substring) is + * within the top level window. In cases where the entire object or substring + * fits within the top level window, the placement of the object or + * substring is dependent on the application. For example, the object or + * substring may be scrolled to the closest edge, the furthest edge, or + * midway between those two edges. In cases where there is a hierarchy of + * nested scrollable controls, more than one control may have to be + * scrolled. + * + * @since 3.6 + */ + public static final int SCROLL_TYPE_LEFT_EDGE = 4; + + /** + * Scroll the right edge of the object or substring such that the right edge + * (and as much as possible of the rest of the object or substring) is + * within the top level window. In cases where the entire object or + * substring fits within the top level window, the placement of the object + * or substring is dependent on the application. For example, the object or + * substring may be scrolled to the closest edge, the furthest edge, or + * midway between those two edges. In cases where there is a hierarchy of + * nested scrollable controls, more than one control may have to be + * scrolled. + * + * @since 3.6 + */ + public static final int SCROLL_TYPE_RIGHT_EDGE = 5; + + /** + * Scroll the object or substring such that as much as possible of the + * object or substring is within the top level window. The placement of the + * object is dependent on the application. For example, the object or + * substring may be scrolled to to closest edge, the furthest edge, or + * midway between those two edges. + * + * @since 3.6 + */ + public static final int SCROLL_TYPE_ANYWHERE = 6; + + /** + * Scroll the top left corner of the object or substring to the specified point. + * + * @since 3.6 + */ + public static final int SCROLL_TYPE_POINT = 7; + + /** + * Sent when an object is shown, for example for tool tips, + * or child objects within a browser document. + * + * @since 3.6 + */ + static final int EVENT_SHOW = 0x8002; + + /** + * Sent when an object is hidden, for example for child objects within a browser document. + * Note: do not send this for child objects when parent object is hidden. + * + * @since 3.6 + */ + static final int EVENT_HIDE = 0x8003; + + /** + * Sent when the z-order of objects in a container has changed, + * for example for a browser document which has been loaded or refreshed. + * + * @since 3.6 + */ + static final int EVENT_REORDER = 0x8004; + + /** + * Sent when the item with the selection is moved to a different item within a container. + * + * @since 3.6 + */ + static final int EVENT_SELECTION = 0x8006; + + /** + * Sent when a new item has been added to the selection within a container. + * + * @since 3.6 + */ + static final int EVENT_SELECTIONADD = 0x8007; + + /** + * Sent when an item has been removed from the selection within a container. + * + * @since 3.6 + */ + static final int EVENT_SELECTIONREMOVE = 0x8008; + + /** + * Sent when an object's text selection has changed. + * + * @since 3.6 + */ + static final int EVENT_TEXTSELECTIONCHANGED = 0x8014; + + /** + * Sent when an object's state has changed, for example enabled/disabled, pressed/released, or checked/unchecked. + * + * @since 3.6 + */ + static final int EVENT_STATECHANGE = 0x800A; + + /** + * Sent when an object moves. Note: only send one notification for the topmost object that has changed. + * + * @since 3.6 + */ + static final int EVENT_LOCATIONCHANGE = 0x800B; + + /** + * Sent when an object's name has changed. + * + * @since 3.6 + */ + static final int EVENT_NAMECHANGE = 0x800C; + + /** + * Sent when an object's description has changed. + * + * @since 3.6 + */ + static final int EVENT_DESCRIPTIONCHANGE = 0x800D; + + /** + * Sent when an object's value has changed. + * + * @since 3.6 + */ + static final int EVENT_VALUECHANGE = 0x800E; + + /** + * Sent when entering into menu mode. + * + * @since 3.6 + */ + static final int EVENT_MENUSTART = 0x0004; + + /** + * Sent when leaving from menu mode. + * + * @since 3.6 + */ + static final int EVENT_MENUEND = 0x0005; + + /** + * Sent when a popup menu comes up. + * + * @since 3.6 + */ + static final int EVENT_MENUPOPUPSTART = 0x0006; + + /** + * Sent just before a popup menu is taken down. + * + * @since 3.6 + */ + static final int EVENT_MENUPOPUPEND = 0x0007; + + /** + * Sent when the loading of a document has completed. + * + * @since 3.6 + */ + public static final int EVENT_DOCUMENT_LOAD_COMPLETE = 0x105; + + /** + * Sent when the loading of a document was interrupted. + * + * @since 3.6 + */ + public static final int EVENT_DOCUMENT_LOAD_STOPPED = 0x106; + + /** + * Sent when the document contents are being reloaded. + * + * @since 3.6 + */ + public static final int EVENT_DOCUMENT_RELOAD = 0x107; + + /** + * Sent when a slide changed in a presentation document + * or a page boundary was crossed in a word processing document. + * + * @since 3.6 + */ + public static final int EVENT_PAGE_CHANGED = 0x111; + + /** + * Sent when the caret moved from one section to the next. + * + * @since 3.6 + */ + public static final int EVENT_SECTION_CHANGED = 0x112; + + /** + * Sent when the caret has moved to a new position. + * + * @since 3.6 + */ + public static final int EVENT_TEXT_CARET_MOVED = 0x11b; + + /** + * Sent when the caret moved from one column to the next. + * + * @since 3.6 + */ + public static final int EVENT_TEXT_COLUMN_CHANGED = 0x11d; + + /** + * Some attribute of this object is affected by a target object. + * + * @since 3.6 + */ + public static final int RELATION_CONTROLLED_BY = 0; + + /** + * This object is interactive and controls some attribute of a target object. + * + * @since 3.6 + */ + public static final int RELATION_CONTROLLER_FOR = 1; + + /** + * This object is described by the target object. + * + * @since 3.6 + */ + public static final int RELATION_DESCRIBED_BY = 2; + + /** + * This object is describes the target object. + * + * @since 3.6 + */ + public static final int RELATION_DESCRIPTION_FOR = 3; + + /** + * This object is embedded by a target object. + * + * @since 3.6 + */ + public static final int RELATION_EMBEDDED_BY = 4; + + /** + * This object embeds a target object. This relation can be used on a + * control's accessible to show where the content areas are. + * + * @since 3.6 + */ + public static final int RELATION_EMBEDS = 5; + + /** + * Content flows to this object from a target object. + * This relation and RELATION_FLOWS_TO are useful to tie text and non-text + * objects together in order to allow assistive technology to follow the + * intended reading order. + * + * @since 3.6 + */ + public static final int RELATION_FLOWS_FROM = 6; + + /** + * Content flows from this object to a target object. + * + * @since 3.6 + */ + public static final int RELATION_FLOWS_TO = 7; + + /** + * This object is label for a target object. + * + * @since 3.6 + */ + public static final int RELATION_LABEL_FOR = 8; + + /** + * This object is labelled by a target object. + * + * @since 3.6 + */ + public static final int RELATION_LABELLED_BY = 9; + + /** + * This object is a member of a group of one or more objects. When + * there is more than one object in the group each member may have one and the + * same target, e.g. a grouping object. It is also possible that each member has + * multiple additional targets, e.g. one for every other member in the group. + * + * @since 3.6 + */ + public static final int RELATION_MEMBER_OF = 10; + + /** + * This object is a child of a target object. + * + * @since 3.6 + */ + public static final int RELATION_NODE_CHILD_OF = 11; + + /** + * This object is a parent window of the target object. + * + * @since 3.6 + */ + public static final int RELATION_PARENT_WINDOW_OF = 12; + + /** + * This object is a transient component related to the target object. + * When this object is activated the target object doesn't lose focus. + * + * @since 3.6 + */ + public static final int RELATION_POPUP_FOR = 13; + + /** + * This object is a sub window of a target object. + * + * @since 3.6 + */ + public static final int RELATION_SUBWINDOW_OF = 14; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionAdapter.java new file mode 100644 index 0000000000..5666c41cd5 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionAdapter.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +/** + * WARNING: API UNDER COSTRUCTION + * + * This adapter class provides default implementations for the + * methods in the <code>AccessibleActionListener</code> interface. + * <p> + * Classes that wish to deal with <code>AccessibleAction</code> events can + * extend this class and override only the methods that they are + * interested in. + * </p> + * + * @see AccessibleActionListener + * @see AccessibleActionEvent + * + * @since 3.6 + */ +public class AccessibleActionAdapter implements AccessibleActionListener { + /** + * Returns the number of accessible actions available in this object. + * <p> + * If there are more than one, the first one (index 0) is considered the + * "default" action of the object. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of actions, or zero if there are no actions + * </ul> + */ + public void getActionCount(AccessibleActionEvent e) {} + + /** + * Performs the specified action on the object. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index specifying the action to perform. + * If the index lies outside the valid range no action is performed. + * </ul> + */ + public void doAction(AccessibleActionEvent e) {} + + /** + * Returns a description of the specified action. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index specifying which action's description to return + * <li>[out] result - a localized string describing the specified action, + * or null if the index lies outside the valid range + * </ul> + */ + public void getDescription(AccessibleActionEvent e) {} + + /** + * Returns a string representing one or more key bindings, if there + * are any, associated with the specified action. + * <p> + * The returned string is of the following form: mnemonic;accelerator + * for example: "C;CTRL+C" for the Copy item in a typical Edit menu. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index specifying which action's key bindings to return + * <li>[out] result - a semicolon-delimited string of localized key bindings + * (example: "C;CTRL+C"), or null if the index lies outside the valid range + * </ul> + */ + public void getKeyBinding(AccessibleActionEvent e) {} + + /** + * Returns the non-localized name of the specified action. + * <p> + * There is no need to implement this method for single action controls + * since that would be redundant with AccessibleControlListener.getDefaultAction. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index specifying which action's non-localized name to return + * <li>[out] result - the name of the specified action, + * or null if the index lies outside the valid range + * </ul> + */ + public void getName(AccessibleActionEvent e) {} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionEvent.java new file mode 100644 index 0000000000..8620745b7e --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionEvent.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.*; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Instances of this class are sent as a result of accessibility clients + * sending AccessibleAction messages to an accessible object. + * + * @see AccessibleActionListener + * @see AccessibleActionAdapter + * + * @since 3.6 + */ +public class AccessibleActionEvent extends SWTEventObject { + + /** + * The value of this field must be set in the accessible table listener method + * before returning. What to set it to depends on the listener method called. + */ + public String result; + public int count; + public int index; + + static final long serialVersionUID = 0L; // TODO: run serialver -show + +/** + * Constructs a new instance of this class. + * + * @param source the object that fired the event + */ +public AccessibleActionEvent(Object source) { + super(source); +} + +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public String toString () { + return "AccessibleActionEvent {" + + "string=" + result //$NON-NLS-1$ + + " count=" + count //$NON-NLS-1$ + + " index=" + index //$NON-NLS-1$ + + "}"; //$NON-NLS-1$ +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionListener.java new file mode 100644 index 0000000000..588ed9d46f --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleActionListener.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.SWTEventListener; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Classes which implement this interface provide methods + * that handle AccessibleAction events. + * <p> + * After creating an instance of a class that implements + * this interface it can be added to an accessible using the + * <code>addAccessibleActionListener</code> method and removed using + * the <code>removeAccessibleActionListener</code> method. + * </p> + * + * @see AccessibleActionAdapter + * @see AccessibleActionEvent + * + * @since 3.6 + */ +public interface AccessibleActionListener extends SWTEventListener { + /** + * Returns the number of accessible actions available in this object. + * <p> + * If there are more than one, the first one (index 0) is considered the + * "default" action of the object. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of actions, or zero if there are no actions + * </ul> + */ + public void getActionCount(AccessibleActionEvent e); + + /** + * Performs the specified action on the object. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index specifying the action to perform. + * If the index lies outside the valid range no action is performed. + * </ul> + */ + public void doAction(AccessibleActionEvent e); + + /** + * Returns a description of the specified action. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index specifying which action's description to return + * <li>[out] result - a localized string describing the specified action, + * or null if the index lies outside the valid range + * </ul> + */ + public void getDescription(AccessibleActionEvent e); + + /** + * Returns a string representing one or more key bindings, if there + * are any, associated with the specified action. + * <p> + * The returned string is of the following form: mnemonic;accelerator + * for example: "C;CTRL+C" for the Copy item in a typical Edit menu. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index specifying which action's key bindings to return + * <li>[out] result - a semicolon-delimited string of localized key bindings + * (example: "C;CTRL+C"), or null if the index lies outside the valid range + * </ul> + */ + public void getKeyBinding(AccessibleActionEvent e); + + /** + * Returns the non-localized name of the specified action. + * <p> + * There is no need to implement this method for single action controls + * since that would be redundant with AccessibleControlListener.getDefaultAction. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index specifying which action's non-localized name to return + * <li>[out] result - the name of the specified action, + * or null if the index lies outside the valid range + * </ul> + */ + public void getName(AccessibleActionEvent e); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java new file mode 100644 index 0000000000..609b49a494 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +/** + * WARNING: API UNDER COSTRUCTION + * + * This adapter class provides default implementations for the + * methods in the <code>AccessibleAttributeListener</code> interface. + * <p> + * Classes that wish to deal with <code>AccessibleAttribute</code> events can + * extend this class and override only the methods that they are + * interested in. + * </p> + * + * @see AccessibleAttributeListener + * @see AccessibleAttributeEvent + * @see AccessibleTextAttributeEvent + * + * @since 3.6 + */ +public class AccessibleAttributeAdapter implements AccessibleAttributeListener { + /** + * Returns attributes specific to this Accessible object. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] topMargin the top margin in pixels + * <li>[out] bottomMargin the bottom margin in pixels + * <li>[out] leftMargin the left margin in pixels + * <li>[out] rightMargin the right margin in pixels + * <li>[out] tabStops an array of pixel locations + * <li>[out] justify whether or not to justify the text + * <li>[out] alignment one of <code>SWT#LEFT</code>, <code>SWT#RIGHT</code> or <code>SWT#CENTER</code> + * <li>[out] indent the indent in pixels + * </ul> + */ + public void getAttributes(AccessibleAttributeEvent e) {} + + /** + * Returns text attributes specific to this Accessible object. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] offset the text offset (0 based) + * <li>[out] start the starting offset of the character range + * over which all text attributes match those of offset (0 based) + * <li>[out] end the offset of the first character past the character range + * over which all text attributes match those of offset (0 based) + * <li>[out] textStyle the TextStyle of the character range + * </ul> + */ + public void getTextAttributes(AccessibleTextAttributeEvent e) {} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java new file mode 100644 index 0000000000..ab93bdb184 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.*; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Instances of this class are sent as a result of accessibility clients + * sending AccessibleAttribute messages to an accessible object. + * + * @see AccessibleAttributeListener + * @see AccessibleAttributeAdapter + * + * @since 3.6 + */ +public class AccessibleAttributeEvent extends SWTEventObject { + + public int topMargin; + public int bottomMargin; + public int leftMargin; + public int rightMargin; + public int[] tabStops; + public boolean justify; + public int alignment; + public int indent; + + static final long serialVersionUID = 0L; // TODO: run serialver -show + +/** + * Constructs a new instance of this class. + * + * @param source the object that fired the event + */ +public AccessibleAttributeEvent(Object source) { + super(source); +} + +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public String toString () { + return "AccessibleAttributeEvent {" + + " topMargin=" + topMargin //$NON-NLS-1$ + + " bottomMargin=" + bottomMargin //$NON-NLS-1$ + + " leftMargin=" + leftMargin //$NON-NLS-1$ + + " rightMargin=" + rightMargin //$NON-NLS-1$ + + " tabStops=" + tabStops //$NON-NLS-1$ + + " justify=" + justify //$NON-NLS-1$ + + " alignment=" + alignment //$NON-NLS-1$ + + " indent=" + indent //$NON-NLS-1$ + + "}"; //$NON-NLS-1$ +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java new file mode 100644 index 0000000000..43e16ff4f1 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.SWTEventListener; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Classes which implement this interface provide methods + * that handle AccessibleAttribute events. + * <p> + * After creating an instance of a class that implements + * this interface it can be added to an accessible using the + * <code>addAccessibleAttributeListener</code> method and removed using + * the <code>removeAccessibleAttributeListener</code> method. + * </p> + * + * @see AccessibleAttributeAdapter + * @see AccessibleAttributeEvent + * @see AccessibleTextAttributeEvent + * + * @since 3.6 + */ +public interface AccessibleAttributeListener extends SWTEventListener { + /** + * Returns attributes specific to this Accessible object. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] topMargin the top margin in pixels + * <li>[out] bottomMargin the bottom margin in pixels + * <li>[out] leftMargin the left margin in pixels + * <li>[out] rightMargin the right margin in pixels + * <li>[out] tabStops an array of pixel locations + * <li>[out] justify whether or not to justify the text + * <li>[out] alignment one of <code>SWT#LEFT</code>, <code>SWT#RIGHT</code> or <code>SWT#CENTER</code> + * <li>[out] indent the indent in pixels + * </ul> + */ + public void getAttributes(AccessibleAttributeEvent e); + + /** + * Returns text attributes specific to this Accessible object. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] offset the text offset (0 based) + * <li>[out] start the starting offset of the character range + * over which all text attributes match those of offset (0 based) + * <li>[out] end the offset of the first character past the character range + * over which all text attributes match those of offset (0 based) + * <li>[out] textStyle the TextStyle of the character range + * </ul> + */ + public void getTextAttributes(AccessibleTextAttributeEvent e); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlAdapter.java index 27f1e0c563..c7dc1c7789 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlAdapter.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlAdapter.java @@ -186,6 +186,7 @@ public abstract class AccessibleControlAdapter implements AccessibleControlListe * * @param e an event object containing the following fields:<ul> * <li>childID [Typical OUT] - the ID of the selected child, or CHILDID_SELF, or CHILDID_MULTIPLE, or CHILDID_NONE</li> + * <li>children [Optional OUT] - the array of childIDs for the selected children if CHILDID_MULTIPLE is returned</li> * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li> * </ul> */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlListener.java index 537f57bab4..f7b67ce8e8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlListener.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlListener.java @@ -174,6 +174,7 @@ public interface AccessibleControlListener extends SWTEventListener { * * @param e an event object containing the following fields:<ul> * <li>childID [Typical OUT] - the ID of the selected child, or CHILDID_SELF, or CHILDID_MULTIPLE, or CHILDID_NONE</li> + * <li>children [Optional OUT] - the array of childIDs for the selected children if CHILDID_MULTIPLE is returned</li> * <li>accessible [Optional OUT] - the accessible object for the control or child may be returned instead of the childID</li> * </ul> */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkAdapter.java new file mode 100644 index 0000000000..fc1fbd6f79 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkAdapter.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +/** + * WARNING: API UNDER COSTRUCTION + * + * This adapter class provides default implementations for the + * methods in the <code>AccessibleHyperlinkListener</code> interface. + * <p> + * Classes that wish to deal with <code>AccessibleHyperlink</code> events can + * extend this class and override only the methods that they are + * interested in. + * </p> + * + * @see AccessibleHyperlinkListener + * @see AccessibleHyperlinkEvent + * + * @since 3.6 + */ +public class AccessibleHyperlinkAdapter implements AccessibleHyperlinkListener { + /** + * Returns the anchor for the link at the specified index. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index identifying the anchor if this object + * has more than one link, as in the case of an image map + * <li>[typical out] result - the returned anchor + * <li>[optional out] accessible - the returned anchor. + * Note: The returned anchor can either be a string or an accessible. + * For example, for a text link this could be the substring of the containing string + * where the substring is overridden with link behavior, and for an image link this could be + * the accessible for the image. + * </ul> + */ + public void getAnchor(AccessibleHyperlinkEvent e) {} + + /** + * Returns the target of the link at the specified index. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index identifying the anchor if this object + * has more than one link, as in the case of an image map + * <li>[typical out] result - the returned target + * <li>[optional out] accessible - the returned target. + * Note: The returned target can either be a string or an accessible. + * For example, this could be a string URI, or the accessible for the target + * object to be activated when the link is activated. + * </ul> + */ + public void getAnchorTarget(AccessibleHyperlinkEvent e) {} + + /** + * Returns the 0 based character offset at which the textual representation of the hyperlink starts. + * <p> + * The returned value is related to the AccessibleTextExtended interface of the object that + * owns this hyperlink. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] index + * </ul> + */ + public void getStartIndex(AccessibleHyperlinkEvent e) {} + + /** + * Returns the 0 based character offset at which the textual representation of the hyperlink ends. + * <p> + * The returned value is related to the AccessibleTextExtended interface of the object that + * owns this hyperlink. The character at the index is not part of the hypertext. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] index + * </ul> + */ + public void getEndIndex(AccessibleHyperlinkEvent e) {} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkEvent.java new file mode 100644 index 0000000000..fdddc57b0b --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkEvent.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.*; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Instances of this class are sent as a result of accessibility clients + * sending AccessibleHyperlink messages to an accessible object. + * + * @see AccessibleHyperlinkListener + * @see AccessibleHyperlinkAdapter + * + * @since 3.6 + */ +public class AccessibleHyperlinkEvent extends SWTEventObject { + + public Accessible accessible; + + /** + * The value of this field must be set in the accessible table listener method + * before returning. What to set it to depends on the listener method called. + */ + public String result; + + public int index; + + static final long serialVersionUID = 0L; // TODO: run serialver -show + +/** + * Constructs a new instance of this class. + * + * @param source the object that fired the event + */ +public AccessibleHyperlinkEvent(Object source) { + super(source); +} + +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public String toString () { + return "AccessibleHyperlinkEvent {" + + "accessible=" + accessible //$NON-NLS-1$ + + " string=" + result //$NON-NLS-1$ + + " index=" + index //$NON-NLS-1$ + + "}"; //$NON-NLS-1$ +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkListener.java new file mode 100644 index 0000000000..9d088aafc6 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleHyperlinkListener.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.SWTEventListener; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Classes which implement this interface provide methods + * that handle AccessibleHyperlink events. + * <p> + * After creating an instance of a class that implements + * this interface it can be added to an accessible using the + * <code>addAccessibleHyperlinkListener</code> method and removed using + * the <code>removeAccessibleHyperlinkListener</code> method. + * </p> + * + * @see AccessibleHyperlinkAdapter + * @see AccessibleHyperlinkEvent + * + * @since 3.6 + */ +public interface AccessibleHyperlinkListener extends SWTEventListener { + /** + * Returns the anchor for the link at the specified index. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index identifying the anchor if this object + * has more than one link, as in the case of an image map + * <li>[typical out] result - the returned anchor + * <li>[optional out] accessible - the returned anchor. + * Note: The returned anchor can either be a string or an accessible. + * For example, for a text link this could be the substring of the containing string + * where the substring is overridden with link behavior, and for an image link this could be + * the accessible for the image. + * </ul> + */ + public void getAnchor(AccessibleHyperlinkEvent e); + + /** + * Returns the target of the link at the specified index. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - a 0 based index identifying the anchor if this object + * has more than one link, as in the case of an image map + * <li>[typical out] result - the returned target + * <li>[optional out] accessible - the returned target. + * Note: The returned target can either be a string or an accessible. + * For example, this could be a string URI, or the accessible for the target + * object to be activated when the link is activated. + * </ul> + */ + public void getAnchorTarget(AccessibleHyperlinkEvent e); + + /** + * Returns the 0 based character offset at which the textual representation of the hyperlink starts. + * <p> + * The returned value is related to the AccessibleTextExtended interface of the object that + * owns this hyperlink. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] index + * </ul> + */ + public void getStartIndex(AccessibleHyperlinkEvent e); + + /** + * Returns the 0 based character offset at which the textual representation of the hyperlink ends. + * <p> + * The returned value is related to the AccessibleTextExtended interface of the object that + * owns this hyperlink. The character at the index is not part of the hypertext. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] index + * </ul> + */ + public void getEndIndex(AccessibleHyperlinkEvent e); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableAdapter.java new file mode 100644 index 0000000000..f198e5ada1 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableAdapter.java @@ -0,0 +1,319 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +/** + * WARNING: API UNDER COSTRUCTION + * + * This adapter class provides default implementations for the + * methods in the <code>AccessibleTableListener</code> interface. + * <p> + * Classes that wish to deal with <code>AccessibleTable</code> events can + * extend this class and override only the methods that they are + * interested in. + * </p><p> + * Many methods in this adapter return cell accessible objects + * (accessible objects with role cell). These accessible objects + * should implement <code>AccessibleTableCellListener</code>. + * </p> + * + * @see AccessibleTableAdapter + * @see AccessibleTableEvent + * @see AccessibleTableCellListener + * @see AccessibleTableCellEvent + * + * @since 3.6 + */ +public class AccessibleTableAdapter implements AccessibleTableListener { + /** + * Deselects one column, leaving other selected columns selected (if any). + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - 0 based index of the column to be unselected. + * </ul> + */ + public void deselectColumn(AccessibleTableEvent e) {} + + /** + * Deselects one row, leaving other selected rows selected (if any). + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - 0 based index of the row to be unselected + * </ul> + */ + public void deselectRow(AccessibleTableEvent e) {} + + /** + * Returns the caption for the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessible - the caption for the table, + * or null if the table does not have a caption + * </ul> + */ + public void getCaption(AccessibleTableEvent e) {} + + /** + * Returns the accessible object at the specified row and column in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - the 0 based row index for which to retrieve the accessible cell + * <li>[in] column - the 0 based column index for which to retrieve the accessible cell + * <li>[out] accessible - the table cell at the specified row and column index, + * or null if the row or column index are not valid + * </ul> + */ + public void getCell(AccessibleTableEvent e) {} + + /** + * Returns the accessible object for the specified column in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - the 0 based column index for which to retrieve the accessible column + * <li>[out] accessible - the table column at the specified column index, + * or null if the column index is not valid + * </ul> + */ + public void getColumn(AccessibleTableEvent e) {} + + /** + * Returns the total number of columns in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of columns in the table + * </ul> + */ + public void getColumnCount(AccessibleTableEvent e) {} + + /** + * Returns the description text of the specified column in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - the 0 based index of the column for which to retrieve the description + * <li>[out] result - the description text of the specified column in the table, + * or null if the column does not have a description + * </ul> + */ + public void getColumnDescription(AccessibleTableEvent e) {} + + /** + * Returns the column headers as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with role cell, + * or null if there are no column headers + * </ul> + */ + public void getColumnHeaders(AccessibleTableEvent e) {} + + /** + * Returns the columns as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with column role, + * or null if there are no columns + * </ul> + */ + public void getColumns(AccessibleTableEvent e) {} + + /** + * Returns the accessible object for the specified row in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - the 0 based row index for which to retrieve the accessible row + * <li>[out] accessible - the table row at the specified row index, + * or null if the row index is not valid + * </ul> + */ + public void getRow(AccessibleTableEvent e) {} + + /** + * Returns the total number of rows in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of rows in the table + * </ul> + */ + public void getRowCount(AccessibleTableEvent e) {} + + /** + * Returns the description text of the specified row in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - the 0 based index of the row for which to retrieve the description + * <li>[out] result - the description text of the specified row in the table, + * or null if the row does not have a description + * </ul> + */ + public void getRowDescription(AccessibleTableEvent e) {} + + /** + * Returns the row headers as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with cell role, + * or null if there are no row headers + * </ul> + */ + public void getRowHeaders(AccessibleTableEvent e) {} + + /** + * Returns the rows as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with row role, + * or null if there are no rows + * </ul> + */ + public void getRows(AccessibleTableEvent e) {} + + /** + * Returns the number of selected cells. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of cells currently selected + * </ul> + */ + public void getSelectedCellCount(AccessibleTableEvent e) {} + + /** + * Returns the currently selected cells. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - array containing the selected accessible cells + * </ul> + */ + public void getSelectedCells(AccessibleTableEvent e) {} + + /** + * Returns the number of selected columns. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of columns currently selected + * </ul> + */ + public void getSelectedColumnCount(AccessibleTableEvent e) {} + + /** + * Returns the column indexes that are currently selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] selected - an array of 0 based column indexes of selected columns + * </ul> + */ + public void getSelectedColumns(AccessibleTableEvent e) {} + + /** + * Returns the number of selected rows. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of rows currently selected + * </ul> + */ + public void getSelectedRowCount(AccessibleTableEvent e) {} + + /** + * Returns the row indexes that are currently selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] selected - an array of 0 based row indexes of selected rows + * </ul> + */ + public void getSelectedRows(AccessibleTableEvent e) {} + + /** + * Returns the summary description of the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessible - the summary for the table, + * or null if the table does not have a summary + * </ul> + */ + public void getSummary(AccessibleTableEvent e) {} + + /** + * Returns the visible columns as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with column role, + * or null if there are no columns + * </ul> + */ + public void getVisibleColumns(AccessibleTableEvent e) {} + + /** + * Returns the visible rows as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with row role, + * or null if there are no rows + * </ul> + */ + public void getVisibleRows(AccessibleTableEvent e) {} + + /** + * Returns a boolean value indicating whether the specified column is + * completely selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - 0 based index of the column for which to determine whether it is selected + * <li>[out] isSelected - true if the specified column is selected completely, and false otherwise + * </ul> + */ + public void isColumnSelected(AccessibleTableEvent e) {} + + /** + * Returns a boolean value indicating whether the specified row is + * completely selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - 0 based index of the row for which to determine whether it is selected + * <li>[out] isSelected - true if the specified row is selected completely, and false otherwise + * </ul> + */ + public void isRowSelected(AccessibleTableEvent e) {} + + /** + * Selects a column. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - 0 based index of the column to be selected + * </ul> + */ + public void selectColumn(AccessibleTableEvent e) {} + + /** + * Selects a row. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - 0 based index of the row to be selected + * </ul> + */ + public void selectRow(AccessibleTableEvent e) {} + + /** + * Selects a column and deselects all previously selected columns. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - 0 based index of the column to be selected + * </ul> + */ + public void setSelectedColumn(AccessibleTableEvent e) {} + + /** + * Selects a row and deselects all previously selected rows. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - 0 based index of the row to be selected + * </ul> + */ + public void setSelectedRow(AccessibleTableEvent e) {} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellAdapter.java new file mode 100644 index 0000000000..7f3b8716cb --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellAdapter.java @@ -0,0 +1,113 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +/** + * WARNING: API UNDER COSTRUCTION + * + * This adapter class provides default implementations for the + * methods in the <code>AccessibleTableCellListener</code> interface. + * <p> + * Classes that wish to deal with <code>AccessibleTableCell</code> events can + * extend this class and override only the methods that they are + * interested in. + * </p> + * + * @see AccessibleTableCellListener + * @see AccessibleTableCellEvent + * + * @since 3.6 + */ +public class AccessibleTableCellAdapter implements AccessibleTableCellListener { + /** + * Returns the number of columns occupied by this cell accessible. + * <p> + * This is 1 if the specified cell is only in one column, or + * more than 1 if the specified cell spans multiple columns. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the 1 based number of columns spanned by the specified cell + * </ul> + */ + public void getColumnSpan(AccessibleTableCellEvent e) {} + + /** + * Returns the column headers as an array of cell accessibles. + * TODO: doc that this is a more efficient way to get headers of a cell than TableListener.getRow/ColHeaders + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of cell accessibles, or null if there are no column headers + * </ul> + */ + public void getColumnHeaders(AccessibleTableCellEvent e) {} + + /** + * Translates this cell accessible into the corresponding column index. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] index - the 0 based column index of the specified cell, + * or the index of the first column if the cell spans multiple columns + * </ul> + */ + public void getColumnIndex(AccessibleTableCellEvent e) {} + + /** + * Returns the number of rows occupied by this cell accessible. + * <p> + * This is 1 if the specified cell is only in one row, or + * more than 1 if the specified cell spans multiple rows. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the 1 based number of rows spanned by the specified cell + * </ul> + */ + public void getRowSpan(AccessibleTableCellEvent e) {} + + /** + * Returns the row headers as an array of cell accessibles. + * TODO: doc that this is a more efficient way to get headers of a cell than TableListener.getRow/ColHeaders + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of cell accessibles, or null if there are no row headers + * </ul> + */ + public void getRowHeaders(AccessibleTableCellEvent e) {} + + /** + * Translates this cell accessible into the corresponding row index. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] index - the 0 based row index of the specified cell, + * or the index of the first row if the cell spans multiple rows + * </ul> + */ + public void getRowIndex(AccessibleTableCellEvent e) {} + + /** + * Returns the accessible for the table containing this cell. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessible - the accessible for the containing table + * </ul> + */ + public void getTable(AccessibleTableCellEvent e) {} + + /** + * Returns a boolean value indicating whether this cell is selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] isSelected - true if the specified cell is selected and false otherwise + * </ul> + */ + public void isSelected(AccessibleTableCellEvent e) {} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellEvent.java new file mode 100644 index 0000000000..41e508ec49 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellEvent.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.*; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Instances of this class are sent as a result of accessibility clients + * sending AccessibleTableCell messages to an accessible object. + * + * @see AccessibleTableCellListener + * @see AccessibleTableCellAdapter + * + * @since 3.6 + */ +public class AccessibleTableCellEvent extends SWTEventObject { + + public Accessible accessible; + public Accessible[] accessibles; + public boolean isSelected; + public int count; + public int index; + + static final long serialVersionUID = 0L; // TODO: run serialver -show + +/** + * Constructs a new instance of this class. + * + * @param source the object that fired the event + */ +public AccessibleTableCellEvent(Object source) { + super(source); +} + +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public String toString () { + return "AccessibleTableCellEvent {" + + " accessibles=" + accessibles //$NON-NLS-1$ + + " isSelected=" + isSelected //$NON-NLS-1$ + + " count=" + count //$NON-NLS-1$ + + " index=" + index //$NON-NLS-1$ + + "}"; //$NON-NLS-1$ +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellListener.java new file mode 100644 index 0000000000..5dddfe23b1 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableCellListener.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.SWTEventListener; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Classes which implement this interface provide methods + * that handle AccessibleTableCell events. + * <p> + * After creating an instance of a class that implements + * this interface it can be added to an accessible using the + * <code>addAccessibleTableCellListener</code> method and removed using + * the <code>removeAccessibleTableCellListener</code> method. + * </p> + * + * @see AccessibleTableCellAdapter + * @see AccessibleTableCellEvent + * + * @since 3.6 + */ +public interface AccessibleTableCellListener extends SWTEventListener { + /** + * Returns the number of columns occupied by this cell accessible. + * <p> + * This is 1 if the specified cell is only in one column, or + * more than 1 if the specified cell spans multiple columns. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the 1 based number of columns spanned by the specified cell + * </ul> + */ + public void getColumnSpan(AccessibleTableCellEvent e); + + /** + * Returns the column headers as an array of cell accessibles. + * TODO: doc that this is a more efficient way to get headers of a cell than TableListener.getRow/ColHeaders + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of cell accessibles, or null if there are no column headers + * </ul> + */ + public void getColumnHeaders(AccessibleTableCellEvent e); + + /** + * Translates this cell accessible into the corresponding column index. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] index - the 0 based column index of the specified cell, + * or the index of the first column if the cell spans multiple columns + * </ul> + */ + public void getColumnIndex(AccessibleTableCellEvent e); + + /** + * Returns the number of rows occupied by this cell accessible. + * <p> + * This is 1 if the specified cell is only in one row, or + * more than 1 if the specified cell spans multiple rows. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the 1 based number of rows spanned by the specified cell + * </ul> + */ + public void getRowSpan(AccessibleTableCellEvent e); + + /** + * Returns the row headers as an array of cell accessibles. + * TODO: doc that this is a more efficient way to get headers of a cell than TableListener.getRow/ColHeaders + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of cell accessibles, or null if there are no row headers + * </ul> + */ + public void getRowHeaders(AccessibleTableCellEvent e); + + /** + * Translates this cell accessible into the corresponding row index. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] index - the 0 based row index of the specified cell, + * or the index of the first row if the cell spans multiple rows + * </ul> + */ + public void getRowIndex(AccessibleTableCellEvent e); + + /** + * Returns the accessible for the table containing this cell. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessible - the accessible for the containing table + * </ul> + */ + public void getTable(AccessibleTableCellEvent e); + + /** + * Returns a boolean value indicating whether this cell is selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] isSelected - true if the specified cell is selected and false otherwise + * </ul> + */ + public void isSelected(AccessibleTableCellEvent e); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableEvent.java new file mode 100644 index 0000000000..3cc8e8b324 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableEvent.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.*; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Instances of this class are sent as a result of accessibility clients + * sending AccessibleTable messages to an accessible object. + * + * @see AccessibleTableListener + * @see AccessibleTableAdapter + * + * @since 3.6 + */ +public class AccessibleTableEvent extends SWTEventObject { + + public Accessible accessible; + public Accessible[] accessibles; + + /** + * The value of this field must be set in the accessible table listener method + * before returning. What to set it to depends on the listener method called. + */ + public String result; + + public int column; + public int row; + public int count; + public boolean isSelected; + public int[] selected; + + static final long serialVersionUID = 0L; // TODO: run serialver -show + +/** + * Constructs a new instance of this class. + * + * @param source the object that fired the event + */ +public AccessibleTableEvent(Object source) { + super(source); +} + +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public String toString () { + return "AccessibleTableEvent {" + + "accessible=" + accessible //$NON-NLS-1$ + + " accessibles=" + accessibles //$NON-NLS-1$ + + " string=" + result //$NON-NLS-1$ + + " isSelected=" + isSelected //$NON-NLS-1$ + + " column=" + column //$NON-NLS-1$ + + " count=" + count //$NON-NLS-1$ + + " row=" + row //$NON-NLS-1$ + + " selected=" + selected //$NON-NLS-1$ + + "}"; //$NON-NLS-1$ +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableListener.java new file mode 100644 index 0000000000..00def9bbda --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTableListener.java @@ -0,0 +1,322 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.SWTEventListener; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Classes which implement this interface provide methods + * that handle AccessibleTable events. + * <p> + * After creating an instance of a class that implements + * this interface it can be added to an accessible using the + * <code>addAccessibleTableListener</code> method and removed using + * the <code>removeAccessibleTableListener</code> method. + * </p><p> + * Many methods in this listener return cell accessible objects + * (accessible objects with role cell). These accessible objects + * should implement <code>AccessibleTableCellListener</code>. + * </p> + * + * @see AccessibleTableAdapter + * @see AccessibleTableEvent + * @see AccessibleTableCellListener + * @see AccessibleTableCellEvent + * + * @since 3.6 + */ +public interface AccessibleTableListener extends SWTEventListener { + /** + * Deselects one column, leaving other selected columns selected (if any). + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - 0 based index of the column to be unselected. + * </ul> + */ + public void deselectColumn(AccessibleTableEvent e); + + /** + * Deselects one row, leaving other selected rows selected (if any). + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - 0 based index of the row to be unselected + * </ul> + */ + public void deselectRow(AccessibleTableEvent e); + + /** + * Returns the caption for the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessible - the caption for the table, + * or null if the table does not have a caption + * </ul> + */ + public void getCaption(AccessibleTableEvent e); + + /** + * Returns the accessible object at the specified row and column in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - the 0 based row index for which to retrieve the accessible cell + * <li>[in] column - the 0 based column index for which to retrieve the accessible cell + * <li>[out] accessible - the table cell at the specified row and column index, + * or null if the row or column index are not valid + * </ul> + */ + public void getCell(AccessibleTableEvent e); + + /** + * Returns the accessible object for the specified column in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - the 0 based column index for which to retrieve the accessible column + * <li>[out] accessible - the table column at the specified column index, + * or null if the column index is not valid + * </ul> + */ + public void getColumn(AccessibleTableEvent e); + + /** + * Returns the total number of columns in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of columns in the table + * </ul> + */ + public void getColumnCount(AccessibleTableEvent e); + + /** + * Returns the description text of the specified column in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - the 0 based index of the column for which to retrieve the description + * <li>[out] result - the description text of the specified column in the table, + * or null if the column does not have a description + * </ul> + */ + public void getColumnDescription(AccessibleTableEvent e); + + /** + * Returns the column headers as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with role cell, + * or null if there are no column headers + * </ul> + */ + public void getColumnHeaders(AccessibleTableEvent e); + + /** + * Returns the columns as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with column role, + * or null if there are no columns + * </ul> + */ + public void getColumns(AccessibleTableEvent e); + + /** + * Returns the accessible object for the specified row in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - the 0 based row index for which to retrieve the accessible row + * <li>[out] accessible - the table row at the specified row index, + * or null if the row index is not valid + * </ul> + */ + public void getRow(AccessibleTableEvent e); + + /** + * Returns the total number of rows in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of rows in the table + * </ul> + */ + public void getRowCount(AccessibleTableEvent e); + + /** + * Returns the description text of the specified row in the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - the 0 based index of the row for which to retrieve the description + * <li>[out] result - the description text of the specified row in the table, + * or null if the row does not have a description + * </ul> + */ + public void getRowDescription(AccessibleTableEvent e); + + /** + * Returns the row headers as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with cell role, + * or null if there are no row headers + * </ul> + */ + public void getRowHeaders(AccessibleTableEvent e); + + /** + * Returns the rows as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with row role, + * or null if there are no rows + * </ul> + */ + public void getRows(AccessibleTableEvent e); + + /** + * Returns the number of selected cells. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of cells currently selected + * </ul> + */ + public void getSelectedCellCount(AccessibleTableEvent e); + + /** + * Returns the currently selected cells. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - array containing the selected accessible cells + * </ul> + */ + public void getSelectedCells(AccessibleTableEvent e); + + /** + * Returns the number of selected columns. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of columns currently selected + * </ul> + */ + public void getSelectedColumnCount(AccessibleTableEvent e); + + /** + * Returns the column indexes that are currently selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] selected - an array of 0 based column indexes of selected columns + * </ul> + */ + public void getSelectedColumns(AccessibleTableEvent e); + + /** + * Returns the number of selected rows. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of rows currently selected + * </ul> + */ + public void getSelectedRowCount(AccessibleTableEvent e); + + /** + * Returns the row indexes that are currently selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] selected - an array of 0 based row indexes of selected rows + * </ul> + */ + public void getSelectedRows(AccessibleTableEvent e); + + /** + * Returns the summary description of the table. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessible - the summary for the table, + * or null if the table does not have a summary + * </ul> + */ + public void getSummary(AccessibleTableEvent e); + + /** + * Returns the visible columns as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with column role, + * or null if there are no columns + * </ul> + */ + public void getVisibleColumns(AccessibleTableEvent e); + + /** + * Returns the visible rows as an array of accessible objects. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] accessibles - an array of accessible objects with row role, + * or null if there are no rows + * </ul> + */ + public void getVisibleRows(AccessibleTableEvent e); + + /** + * Returns a boolean value indicating whether the specified column is + * completely selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - 0 based index of the column for which to determine whether it is selected + * <li>[out] isSelected - true if the specified column is selected completely, and false otherwise + * </ul> + */ + public void isColumnSelected(AccessibleTableEvent e); + + /** + * Returns a boolean value indicating whether the specified row is + * completely selected. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - 0 based index of the row for which to determine whether it is selected + * <li>[out] isSelected - true if the specified row is selected completely, and false otherwise + * </ul> + */ + public void isRowSelected(AccessibleTableEvent e); + + /** + * Selects a column. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - 0 based index of the column to be selected + * </ul> + */ + public void selectColumn(AccessibleTableEvent e); + + /** + * Selects a row. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - 0 based index of the row to be selected + * </ul> + */ + public void selectRow(AccessibleTableEvent e); + + /** + * Selects a column and deselects all previously selected columns. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] column - 0 based index of the column to be selected + * </ul> + */ + public void setSelectedColumn(AccessibleTableEvent e); + + /** + * Selects a row and deselects all previously selected rows. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] row - 0 based index of the row to be selected + * </ul> + */ + public void setSelectedRow(AccessibleTableEvent e); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java new file mode 100644 index 0000000000..61e408ccde --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextAttributeEvent.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Instances of this class are sent as a result of accessibility clients + * sending AccessibleAttribute messages to an accessible object. + * + * @see AccessibleAttributeListener + * @see AccessibleAttributeAdapter + * + * @since 3.6 + */ +public class AccessibleTextAttributeEvent extends SWTEventObject { + + public int offset; + public int start, end; + public TextStyle textStyle; + + static final long serialVersionUID = 0L; // TODO: run serialver -show + +/** + * Constructs a new instance of this class. + * + * @param source the object that fired the event + */ +public AccessibleTextAttributeEvent(Object source) { + super(source); +} + +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public String toString () { + return "AccessibleAttributeEvent {" + + " offset=" + offset //$NON-NLS-1$ + + " startOffset=" + start //$NON-NLS-1$ + + " endOffset=" + end //$NON-NLS-1$ + + " textStyle=" + textStyle //$NON-NLS-1$ + + "}"; //$NON-NLS-1$ +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedAdapter.java new file mode 100644 index 0000000000..3bcd1d30a5 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedAdapter.java @@ -0,0 +1,290 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +/** + * WARNING: API UNDER COSTRUCTION + * + * This adapter class provides default implementations for the + * methods in the <code>AccessibleTextExtendedListener</code> interface. + * <p> + * Classes that wish to deal with <code>AccessibleTextExtended</code> events can + * extend this class and override only the methods that they are + * interested in. + * </p> + * + * @see AccessibleTextExtendedListener + * @see AccessibleTextExtendedEvent + * + * @since 3.6 + */ +public class AccessibleTextExtendedAdapter extends AccessibleTextAdapter implements AccessibleTextExtendedListener { + /** + * Adds a text selection. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] start - the 0 based offset of the first character of the new selection + * <li>[in] end - the 0 based offset of the last character of the new selection + * </ul> + */ + public void addSelection(AccessibleTextExtendedEvent e) {} + + /** + * Returns the total number of characters in the text. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the total number of characters + * </ul> + */ + public void getCharacterCount(AccessibleTextExtendedEvent e) {} + + /** + * Returns the number of links and link groups contained within this hypertext + * paragraph. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of links and link groups within this hypertext paragraph, + * or 0 if there are none + * </ul> + */ + public void getHyperlinkCount(AccessibleTextExtendedEvent e) {} + + /** + * Returns the specified hyperlink. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - the 0 based index of the hyperlink to return + * <li>[out] accessible - the specified hyperlink object, or null if the index is invalid + * </ul> + */ + public void getHyperlink(AccessibleTextExtendedEvent e) {} + + /** + * Returns the index of the hyperlink that is associated with this character offset. + * <p> + * This is the case when a link spans the given character index. + * </p> + * @param e an event object containing the following fields:<ul> + * <li>[in] offset - the 0 based offset of the character for which to return the link index. + * <li>[out] index - the 0 based index of the hyperlink that is associated with this + * character offset, or -1 if the offset is not in a link + * </ul> + */ + public void getHyperlinkIndex(AccessibleTextExtendedEvent e) {} + + /** + * Returns the offset of the character under the specified point. + * <p> + * The same functionality could be achieved by using the bounding + * boxes for each character as returned by getCharacterBounds. + * The method getOffsetAtPoint, however, can be implemented more efficiently. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] x - the x value in display coordinates for which to look up the offset of the character + * that is rendered on the display at that point + * <li>[in] y - the position's y value for which to look up the offset of the character + * that is rendered on the display at that point + * <li>[out] offset - the 0 based offset of the character under the given point, + * or -1 if the point is invalid or there is no character under the point + * </ul> + */ + public void getOffsetAtPoint(AccessibleTextExtendedEvent e) {} + + /** + * Returns the text range(s) contained within the given bounding box. + * <p> + * Partially visible characters are included in the returned ranges. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] x - the X coordinate of the top left corner of the bounding box + * <li>[in] y - the Y coordinate of the top left corner of the bounding box + * <li>[in] width - the width of the bounding box + * <li>[in] height - the height of the bounding box + * <li>[typical out] start - the 0 based offset of the first character of the substring in the bounding box + * <li>[typical out] end - the 0 based offset of the last character of the substring in the bounding box + * <li>[optional out] ranges - an array of pairs specifying the start and end offsets of each range, + * if the text range is clipped + * </ul> + */ + public void getRanges(AccessibleTextExtendedEvent e) {} + + /** + * Returns the character offsets of the specified text selection. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - the 0 based index of the selection + * <li>[out] start - the 0 based offset of first selected character + * <li>[out] end - the 0 based offset of the last selected character + * </ul> + */ + public void getSelection(AccessibleTextExtendedEvent e) {} + + /** + * Returns the number of active non-contiguous selections. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of active non-contiguous selections + * </ul> + */ + public void getSelectionCount(AccessibleTextExtendedEvent e) {} + + /** + * Returns a substring and its range for the given range, count and boundary type. + * <p> + * Returns the substring of the specified boundary type that is located count + * positions from the given character range. Also returns the start and end + * offsets of the returned substring. + * </p><p> + * For example, if the boundary type is TEXT_BOUNDARY_WORD, then the complete + * word that is located count words from the specified range is returned. + * If count is negative, then return the word that is count words before start. + * If count is positive, then return the word that is count words after end. + * If count is zero, start and end are the same, so return the word at start. + * </p><p> + * The whole text can be requested by passing start == 0 and end == getCharacterCount, + * TEXT_BOUNDARY_ALL, and 0 for count. Alternatively the whole text can be requested + * by calling AccessibleControlListener.getValue(). + * </p><p> + * If start and end are valid, but no suitable word (or other boundary type) is found, + * the returned string is null and the returned range is degenerate (start == end). + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] type - the boundary type of the substring to return. One of:<ul> + * <li> TEXT_BOUNDARY_CHAR + * <li> TEXT_BOUNDARY_WORD + * <li> TEXT_BOUNDARY_SENTENCE + * <li> TEXT_BOUNDARY_PARAGRAPH + * <li> TEXT_BOUNDARY_LINE + * <li> TEXT_BOUNDARY_ALL + * </ul> + * <li>[in,out] start - the 0 based offset of first character of the substring + * <li>[in,out] end - the 0 based offset of last character of the substring + * <li>[in,out] count - the number of boundary type units to move to find the substring to return.<ul> + * <li>in: look count units before start if count < 0, or after end if count > 0. Look at start if count == 0. + * <li>out: the actual number of boundary type units that were moved. This may be fewer than the input count. + * </ul> + * <li>[out] result - the requested substring. This may be empty or null + * when no appropriate substring is found, or if the type is invalid. + * </ul> + */ + public void getText(AccessibleTextExtendedEvent e) {} + + /** + * Returns the bounding box(es) of the specified text range in display coordinates. + * <p> + * Note: The virtual character after the last character of the represented text, + * i.e. the one at offset getCharacterCount, is a special case. It represents the + * current input position and will therefore typically be queried by AT more + * often than other positions. Because it does not represent an existing character + * its bounding box is defined in relation to preceding characters. It should be + * roughly equivalent to the bounding box of some character when inserted at the + * end of the text; its height typically being the maximal height of all the + * characters in the text or the height of the preceding character, its width + * being at least one pixel so that the bounding box is not degenerate. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] start - the 0 based offset of the first character of the substring for which to get the bounding box + * <li>[in] end - the 0 based offset of the last character of the substring for which to get the bounding box + * <li>[typical out] x - the X coordinate of the top left corner of the bounding box of the referenced substring + * <li>[typical out] y - the Y coordinate of the top left corner of the bounding box of the referenced substring + * <li>[typical out] width - the width of the bounding box of the referenced substring + * <li>[typical out] height - the height of the bounding box of the referenced substring + * <li>[optional out] rectangles - a set of disjoint bounding rectangles, if the substring is clipped + * </ul> + */ + public void getTextBounds(AccessibleTextExtendedEvent e) {} + + /** + * Returns the visible text range(s). + * <p> + * Partially visible characters are included in the returned ranges. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[typical out] start - the 0 based offset of the first character of the visible substring + * <li>[typical out] end - the 0 based offset of the last character of the visible substring + * <li>[optional out] ranges - an array of pairs specifying the start and end offsets of each range, + * if the visible text range is clipped + * </ul> + */ + public void getVisibleRanges(AccessibleTextExtendedEvent e) {} + + /** + * Deselects a range of text. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - the 0 based index of selection to remove + * </ul> + */ + public void removeSelection(AccessibleTextExtendedEvent e) {} + + /** + * Scrolls a specific part of a substring according to the scroll type. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] start - the 0 based offset of the first character of the substring. + * <li>[in] end - the 0 based offset of the last character of the substring. + * <li>[in] type - a scroll type indicating where the substring should be placed + * on the screen. One of:<ul> + * <li>SCROLL_TYPE_TOP_LEFT + * <li>SCROLL_TYPE_BOTTOM_RIGHT + * <li>SCROLL_TYPE_TOP_EDGE + * <li>SCROLL_TYPE_BOTTOM_EDGE + * <li>SCROLL_TYPE_LEFT_EDGE + * <li>SCROLL_TYPE_RIGHT_EDGE + * <li>SCROLL_TYPE_ANYWHERE + * <li>SCROLL_TYPE_POINT + * </ul> + * </ul> + * <li>[optional in] x - for SCROLL_TYPE_POINT, the x coordinate of the destination point in display coordinates + * <li>[optional in] y - for SCROLL_TYPE_POINT, the y coordinate of the destination point in display coordinates + */ + public void scrollText(AccessibleTextExtendedEvent e) {} + + /** + * Sets the position of the caret. + * <p> + * The caret position is that of the character logically following it, + * e.g. to the right of it in a left to right language. + * The caret is actually placed to the leading side of the character with + * that offset. An offset of 0 places the caret so that the next insertion + * goes before the first character. An offset of getCharacterCount places + * the caret so that the next insertion goes after the last character. + * </p><p> + * Setting the caret position may or may not alter the current selection. A + * change of the selection is notified to the accessibility event listeners with + * an EVENT_TEXT_SELECTION_CHANGED event. + * </p><p> + * When the new caret position differs from the old one, this is notified to the + * accessibility event listeners with an EVENT_TEXT_CARET_MOVED event. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] offset - the new offset of the caret + * </ul> + */ + public void setCaretOffset(AccessibleTextExtendedEvent e) {} + + /** + * Changes the bounds of an existing selection. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - the 0 based index of the selection to change + * <li>[in] start - the new 0 based starting offset + * <li>[in] end - the new 0 based ending offset + * </ul> + */ + public void setSelection(AccessibleTextExtendedEvent e) {} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedEvent.java new file mode 100644 index 0000000000..6c1ac91a8a --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedEvent.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.graphics.*; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Instances of this class are sent as a result of accessibility clients + * sending AccessibleTextExtended messages to an accessible object. + * + * @see AccessibleTextExtendedListener + * @see AccessibleTextExtendedAdapter + * + * @since 3.6 + */ +public class AccessibleTextExtendedEvent extends AccessibleTextEvent { + + public Accessible accessible; + + /** + * The value of this field must be set in the accessible table listener method + * before returning. What to set it to depends on the listener method called. + */ + public String result; + + public int count; + public int index; + public int start, end; + public int type; + public int x, y, width, height; + public int [] ranges; + public Rectangle [] rectangles; + + static final long serialVersionUID = 0L; // TODO: run serialver -show + +/** + * Constructs a new instance of this class. + * + * @param source the object that fired the event + */ +public AccessibleTextExtendedEvent(Object source) { + super(source); +} + +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public String toString () { + return "AccessibleTextExtendedEvent {" + + "accessible=" + accessible //$NON-NLS-1$ + + " string=" + result //$NON-NLS-1$ + + " count=" + count //$NON-NLS-1$ + + " index=" + index //$NON-NLS-1$ + + " offset=" + offset //$NON-NLS-1$ + + " length=" + length //$NON-NLS-1$ + + " start=" + start //$NON-NLS-1$ + + " end=" + end //$NON-NLS-1$ + + " type=" + type //$NON-NLS-1$ + + " x=" + x //$NON-NLS-1$ + + " y=" + y //$NON-NLS-1$ + + " width=" + width //$NON-NLS-1$ + + " height=" + height //$NON-NLS-1$ + + " ranges=" + ranges //$NON-NLS-1$ + + " rectangles=" + rectangles //$NON-NLS-1$ + + "}"; //$NON-NLS-1$ +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java new file mode 100644 index 0000000000..57a9dd94b1 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleTextExtendedListener.java @@ -0,0 +1,291 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Classes which implement this interface provide methods + * that handle AccessibleTextExtended events. + * <p> + * After creating an instance of a class that implements + * this interface it can be added to an accessible using the + * <code>addAccessibleTextExtendedListener</code> method and removed using + * the <code>removeAccessibleTextExtendedListener</code> method. + * </p> + * + * @see AccessibleTextExtendedAdapter + * @see AccessibleTextExtendedEvent + * + * @since 3.6 + */ +public interface AccessibleTextExtendedListener extends AccessibleTextListener { + /** + * Adds a text selection. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] start - the 0 based offset of the first character of the new selection + * <li>[in] end - the 0 based offset after the last character of the new selection + * </ul> + */ + public void addSelection(AccessibleTextExtendedEvent e); + + /** + * Returns the total number of characters in the text. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the total number of characters + * </ul> + */ + public void getCharacterCount(AccessibleTextExtendedEvent e); + + /** + * Returns the number of links and link groups contained within this hypertext + * paragraph. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of links and link groups within this hypertext paragraph, + * or 0 if there are none + * </ul> + */ + public void getHyperlinkCount(AccessibleTextExtendedEvent e); + + /** + * Returns the specified hyperlink. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - the 0 based index of the hyperlink to return + * <li>[out] accessible - the specified hyperlink object, or null if the index is invalid + * </ul> + */ + public void getHyperlink(AccessibleTextExtendedEvent e); + + /** + * Returns the index of the hyperlink that is associated with this character offset. + * <p> + * This is the case when a link spans the given character index. + * </p> + * @param e an event object containing the following fields:<ul> + * <li>[in] offset - the 0 based offset of the character for which to return the link index. + * <li>[out] index - the 0 based index of the hyperlink that is associated with this + * character offset, or -1 if the offset is not in a link + * </ul> + */ + public void getHyperlinkIndex(AccessibleTextExtendedEvent e); + + /** + * Returns the offset of the character under the specified point. + * <p> + * The same functionality could be achieved by using the bounding + * boxes for each character as returned by getCharacterBounds. + * The method getOffsetAtPoint, however, can be implemented more efficiently. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] x - the x value in display coordinates for which to look up the offset of the character + * that is rendered on the display at that point + * <li>[in] y - the position's y value for which to look up the offset of the character + * that is rendered on the display at that point + * <li>[out] offset - the 0 based offset of the character under the given point, + * or -1 if the point is invalid or there is no character under the point + * </ul> + */ + public void getOffsetAtPoint(AccessibleTextExtendedEvent e); + + /** + * Returns the text range(s) contained within the given bounding box. + * <p> + * Partially visible characters are included in the returned ranges. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] x - the X coordinate of the top left corner of the bounding box + * <li>[in] y - the Y coordinate of the top left corner of the bounding box + * <li>[in] width - the width of the bounding box + * <li>[in] height - the height of the bounding box + * <li>[typical out] start - the 0 based offset of the first character of the substring in the bounding box + * <li>[typical out] end - the 0 based offset of the last character of the substring in the bounding box + * <li>[optional out] ranges - an array of pairs specifying the start and end offsets of each range, + * if the text range is clipped + * </ul> + */ + public void getRanges(AccessibleTextExtendedEvent e); + + /** + * Returns the character offsets of the specified text selection. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - the 0 based index of the selection + * <li>[out] start - the 0 based offset of first selected character + * <li>[out] end - the 0 based offset after the last selected character + * </ul> + */ + public void getSelection(AccessibleTextExtendedEvent e); + + /** + * Returns the number of active non-contiguous selections. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] count - the number of active non-contiguous selections + * </ul> + */ + public void getSelectionCount(AccessibleTextExtendedEvent e); + + /** + * Returns a substring and its range for the given range, count and boundary type. + * <p> + * Returns the substring of the specified boundary type that is located count + * positions from the given character range. Also returns the start and end + * offsets of the returned substring. + * </p><p> + * For example, if the boundary type is TEXT_BOUNDARY_WORD, then the complete + * word that is located count words from the specified range is returned. + * If count is negative, then return the word that is count words before start. + * If count is positive, then return the word that is count words after end. + * If count is zero, start and end are the same, so return the word at start. + * </p><p> + * The whole text can be requested by passing start == 0 and end == getCharacterCount, + * TEXT_BOUNDARY_ALL, and 0 for count. Alternatively the whole text can be requested + * by calling AccessibleControlListener.getValue(). + * </p><p> + * If start and end are valid, but no suitable word (or other boundary type) is found, + * the returned string is null and the returned range is degenerate (start == end). + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] type - the boundary type of the substring to return. One of:<ul> + * <li> TEXT_BOUNDARY_CHAR + * <li> TEXT_BOUNDARY_WORD + * <li> TEXT_BOUNDARY_SENTENCE + * <li> TEXT_BOUNDARY_PARAGRAPH + * <li> TEXT_BOUNDARY_LINE + * <li> TEXT_BOUNDARY_ALL + * </ul> + * <li>[in,out] start - the 0 based offset of first character of the substring + * <li>[in,out] end - the 0 based offset of last character of the substring + * <li>[in,out] count - the number of boundary type units to move to find the substring to return.<ul> + * <li>in: look count units before start if count < 0, or after end if count > 0. Look at start if count == 0. + * <li>out: the actual number of boundary type units that were moved. This may be fewer than the input count. + * </ul> + * <li>[out] result - the requested substring. This may be empty or null + * when no appropriate substring is found, or if the type is invalid. + * </ul> + */ + public void getText(AccessibleTextExtendedEvent e); + + /** + * Returns the bounding box(es) of the specified text range in display coordinates. + * <p> + * Note: The virtual character after the last character of the represented text, + * i.e. the one at offset getCharacterCount, is a special case. It represents the + * current input position and will therefore typically be queried by AT more + * often than other positions. Because it does not represent an existing character + * its bounding box is defined in relation to preceding characters. It should be + * roughly equivalent to the bounding box of some character when inserted at the + * end of the text; its height typically being the maximal height of all the + * characters in the text or the height of the preceding character, its width + * being at least one pixel so that the bounding box is not degenerate. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] start - the 0 based offset of the first character of the substring for which to get the bounding box + * <li>[in] end - the 0 based offset of the last character of the substring for which to get the bounding box + * <li>[typical out] x - the X coordinate of the top left corner of the bounding box of the referenced substring + * <li>[typical out] y - the Y coordinate of the top left corner of the bounding box of the referenced substring + * <li>[typical out] width - the width of the bounding box of the referenced substring + * <li>[typical out] height - the height of the bounding box of the referenced substring + * <li>[optional out] rectangles - a set of disjoint bounding rectangles, if the substring is clipped + * </ul> + */ + public void getTextBounds(AccessibleTextExtendedEvent e); + + /** + * Returns the visible text range(s). + * <p> + * Partially visible characters are included in the returned ranges. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[typical out] start - the 0 based offset of the first character of the visible substring + * <li>[typical out] end - the 0 based offset of the last character of the visible substring + * <li>[optional out] ranges - an array of pairs specifying the start and end offsets of each range, + * if the visible text range is clipped + * </ul> + */ + public void getVisibleRanges(AccessibleTextExtendedEvent e); + + /** + * Deselects a range of text. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - the 0 based index of selection to remove + * </ul> + */ + public void removeSelection(AccessibleTextExtendedEvent e); + + /** + * Scrolls a specific part of a substring according to the scroll type. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] start - the 0 based offset of the first character of the substring. + * <li>[in] end - the 0 based offset after the last character of the substring. + * <li>[in] type - a scroll type indicating where the substring should be placed + * on the screen. One of:<ul> + * <li>SCROLL_TYPE_TOP_LEFT + * <li>SCROLL_TYPE_BOTTOM_RIGHT + * <li>SCROLL_TYPE_TOP_EDGE + * <li>SCROLL_TYPE_BOTTOM_EDGE + * <li>SCROLL_TYPE_LEFT_EDGE + * <li>SCROLL_TYPE_RIGHT_EDGE + * <li>SCROLL_TYPE_ANYWHERE + * <li>SCROLL_TYPE_POINT + * </ul> + * </ul> + * <li>[optional in] x - for SCROLL_TYPE_POINT, the x coordinate of the destination point in display coordinates + * <li>[optional in] y - for SCROLL_TYPE_POINT, the y coordinate of the destination point in display coordinates + */ + public void scrollText(AccessibleTextExtendedEvent e); + + /** + * Sets the position of the caret. + * <p> + * The caret position is that of the character logically following it, + * e.g. to the right of it in a left to right language. + * The caret is actually placed to the leading side of the character with + * that offset. An offset of 0 places the caret so that the next insertion + * goes before the first character. An offset of getCharacterCount places + * the caret so that the next insertion goes after the last character. + * </p><p> + * Setting the caret position may or may not alter the current selection. A + * change of the selection is notified to the accessibility event listeners with + * an EVENT_TEXT_SELECTION_CHANGED event. + * </p><p> + * When the new caret position differs from the old one, this is notified to the + * accessibility event listeners with an EVENT_TEXT_CARET_MOVED event. + * </p> + * + * @param e an event object containing the following fields:<ul> + * <li>[in] offset - the new offset of the caret + * </ul> + */ + public void setCaretOffset(AccessibleTextExtendedEvent e); + + /** + * Changes the bounds of an existing selection. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] index - the 0 based index of the selection to change + * <li>[in] start - the new 0 based starting offset + * <li>[in] end - the new 0 based ending offset + * </ul> + */ + public void setSelection(AccessibleTextExtendedEvent e); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueAdapter.java new file mode 100644 index 0000000000..b1301b1e31 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueAdapter.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +/** + * WARNING: API UNDER COSTRUCTION + * + * This adapter class provides default implementations for the + * methods in the <code>AccessibleValueListener</code> interface. + * <p> + * Classes that wish to deal with <code>AccessibleValue</code> events can + * extend this class and override only the methods that they are + * interested in. + * </p> + * + * @see AccessibleValueListener + * @see AccessibleValueEvent + * + * @since 3.6 + */ +public class AccessibleValueAdapter implements AccessibleValueListener { + /** + * Returns the value of this object as a number. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] value - the number that is the current value of this object + * </ul> + */ + public void getCurrentValue(AccessibleValueEvent e) {} + + /** + * Sets the value of this object to the given number. + * + * The argument is clipped to the valid interval whose upper and lower + * bounds are returned by getMaximumValue and getMinimumValue, + * i.e. if it is lower than the minimum value the new value will be the minimum, + * and if it is greater than the maximum then the new value will be the maximum. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] value - the number that will be the new value of this object + * </ul> + */ + public void setCurrentValue(AccessibleValueEvent e) {} + + /** + * Returns the maximum value that can be represented by this object. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] value - the number that is the maximum value that this object can represent. + * If this object has no upper bound then null is returned. + * </ul> + */ + public void getMaximumValue(AccessibleValueEvent e) {} + + /** + * Returns the minimum value that can be represented by this object. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] value - the number that is the minimum value that this object can represent. + * If this object has no lower bound then null is returned. + * </ul> + */ + public void getMinimumValue(AccessibleValueEvent e) {} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueEvent.java new file mode 100644 index 0000000000..b1b6123ceb --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueEvent.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.*; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Instances of this class are sent as a result of accessibility clients + * sending AccessibleValue messages to an accessible object. + * + * @see AccessibleValueListener + * @see AccessibleValueAdapter + * + * @since 3.6 + */ +public class AccessibleValueEvent extends SWTEventObject { + + public Number value; + + static final long serialVersionUID = 0L; // TODO: run serialver -show + +/** + * Constructs a new instance of this class. + * + * @param source the object that fired the event + */ +public AccessibleValueEvent(Object source) { + super(source); +} + +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public String toString () { + return "AccessibleValueEvent {" + + "value=" + value //$NON-NLS-1$ + + "}"; //$NON-NLS-1$ +} +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueListener.java new file mode 100644 index 0000000000..ee4a7dbe44 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleValueListener.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.SWTEventListener; + +/** + * WARNING: API UNDER COSTRUCTION + * + * Classes which implement this interface provide methods + * that handle AccessibleValue events. + * <p> + * After creating an instance of a class that implements + * this interface it can be added to an accessible using the + * <code>addAccessibleValueListener</code> method and removed using + * the <code>removeAccessibleValueListener</code> method. + * </p> + * + * @see AccessibleValueAdapter + * @see AccessibleValueEvent + * + * @since 3.6 + */ +public interface AccessibleValueListener extends SWTEventListener { + /** + * Returns the value of this object as a number. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] value - the number that is the current value of this object + * </ul> + */ + public void getCurrentValue(AccessibleValueEvent e); + + /** + * Sets the value of this object to the given number. + * + * The argument is clipped to the valid interval whose upper and lower + * bounds are returned by getMaximumValue and getMinimumValue, + * i.e. if it is lower than the minimum value the new value will be the minimum, + * and if it is greater than the maximum then the new value will be the maximum. + * + * @param e an event object containing the following fields:<ul> + * <li>[in] value - the number that will be the new value of this object + * </ul> + */ + public void setCurrentValue(AccessibleValueEvent e); + + /** + * Returns the maximum value that can be represented by this object. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] value - the number that is the maximum value that this object can represent. + * If this object has no upper bound then null is returned. + * </ul> + */ + public void getMaximumValue(AccessibleValueEvent e); + + /** + * Returns the minimum value that can be represented by this object. + * + * @param e an event object containing the following fields:<ul> + * <li>[out] value - the number that is the minimum value that this object can represent. + * If this object has no lower bound then null is returned. + * </ul> + */ + public void getMinimumValue(AccessibleValueEvent e); +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/emulated/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/emulated/org/eclipse/swt/accessibility/Accessible.java index f93e22fb3a..f3d9384a91 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/emulated/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/emulated/org/eclipse/swt/accessibility/Accessible.java @@ -11,6 +11,17 @@ package org.eclipse.swt.accessibility; +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +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.AccessibleValueListener; +import org.eclipse.swt.accessibility.Relation; +import org.eclipse.swt.internal.ole.win32.COM; import org.eclipse.swt.widgets.Control; /** @@ -40,6 +51,22 @@ public class Accessible { Control control; /** + * 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) { + } + + /** * @since 3.5 */ protected Accessible() { @@ -209,6 +236,181 @@ public class Accessible { } /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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 () { + } + + /** * Returns the control for this Accessible object. * * @return the receiver's control @@ -219,6 +421,197 @@ public class Accessible { } /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** + * 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) { + } + + /** * Sends a message to accessible clients that the child selection * within a custom container control has changed. * diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java index 6a2a5d57ed..db3800c63f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java @@ -41,17 +41,57 @@ import org.eclipse.swt.widgets.*; */ public class Accessible { Vector accessibleListeners = new Vector (); - Vector controlListeners = new Vector (); - Vector textListeners = 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; AccessibleObject accessibleObject; Control control; + Vector relations; + static class Relation { + int type; + Accessible target; + + public Relation(int type, Accessible target) { + this.type = type; + this.target = target; + } + } + + /** + * Constructs a new instance of this class given its parent. + * + * @param parent the Accessible parent + * + * @see Control#getAccessible + * + * @since 3.6 + */ + public Accessible(Accessible parent) { + this.parent = checkNull(parent); + this.control = parent.control; + //TODO: (platform-specific?) code to add this accessible to the parent's children + } + /** * @since 3.5 */ protected Accessible() { } + static Accessible checkNull (Accessible parent) { + if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + return parent; + } + Accessible (Control control) { super (); this.control = control; @@ -114,7 +154,7 @@ public class Accessible { public void addAccessibleControlListener (AccessibleControlListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - controlListeners.addElement (listener); + accessibleControlListeners.addElement (listener); } /** @@ -143,10 +183,242 @@ public class Accessible { public void addAccessibleTextListener (AccessibleTextListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - textListeners.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>AccessibleScroll</code> interface. + * + * @param listener the listener that should be notified when the receiver + * is asked for <code>AccessibleScroll</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 AccessibleScrollListener + * @see #removeAccessibleScrollListener + * + * @since 3.6 + */ + public void addAccessibleScrollListener(AccessibleScrollListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleScrollListeners.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 a constant beginning with RELATION_* indicating the type of relation + * @param target the accessible that is the target for this relation + * + * @since 3.6 + */ + public void addRelation(int type, Accessible target) { + checkWidget(); + if (relations == null) relations = new Vector(); + relations.add(new Relation(type, target)); + if (accessibleObject != null) accessibleObject.addRelation(type, target); + } + + void addRelations () { + if (relations == null) return; + if (accessibleObject == null) return; + for (int i = 0; i < relations.size(); i++) { + Relation relation = (Relation)relations.elementAt(i); + accessibleObject.addRelation(relation.type, relation.target); + } + } + + /** + * Disposes of the operating system resources associated with + * the receiver. + * <p> + * This method should be called when an accessible that was created + * with the public constructor is no longer needed. + * It is not necessary to call this for instances of Accessible that + * were retrieved with Control#getAccessible. + * </p> + */ + public void dispose () { + // TODO: platform-specific code to dispose a lightweight accessible + } + + /** * Returns the control for this Accessible object. * * @return the receiver's control @@ -162,31 +434,10 @@ public class Accessible { if (control.isDisposed ()) SWT.error (SWT.ERROR_WIDGET_DISPOSED); } - AccessibleListener[] getAccessibleListeners () { - if (accessibleListeners == null) return null; - AccessibleListener[] result = new AccessibleListener [accessibleListeners.size ()]; - accessibleListeners.copyInto (result); - return result; - } - int /*long*/ getControlHandle () { return control.handle; } - AccessibleControlListener[] getControlListeners () { - if (controlListeners == null) return null; - AccessibleControlListener[] result = new AccessibleControlListener [controlListeners.size ()]; - controlListeners.copyInto (result); - return result; - } - - AccessibleTextListener[] getTextListeners () { - if (textListeners == null) return null; - AccessibleTextListener[] result = new AccessibleTextListener [textListeners.size ()]; - textListeners.copyInto (result); - return result; - } - /** * Invokes platform specific functionality to allocate a new accessible object. * <p> @@ -210,7 +461,7 @@ public class Accessible { } void release () { - AccessibleFactory.unregisterAccessible (Accessible.this); + AccessibleFactory.unregisterAccessible (this); if (accessibleObject != null) { accessibleObject.release (); accessibleObject = null; @@ -238,7 +489,7 @@ public class Accessible { public void removeAccessibleControlListener (AccessibleControlListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - controlListeners.removeElement (listener); + accessibleControlListeners.removeElement (listener); } /** @@ -290,7 +541,263 @@ public class Accessible { public void removeAccessibleTextListener (AccessibleTextListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - textListeners.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>AccessibleScroll</code> interface. + * + * @param listener the listener that should no longer be notified when the receiver + * is asked for <code>AccessibleScroll</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 AccessibleScrollListener + * @see #addAccessibleScrollListener + * + * @since 3.6 + */ + public void removeAccessibleScrollListener(AccessibleScrollListener listener) { + checkWidget(); + if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + accessibleScrollListeners.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 a constant beginning with RELATION_* indicating the type of relation + * @param target the accessible that is the target for this relation + * + * @since 3.6 + */ + public void removeRelation(int type, Accessible target) { + checkWidget(); + if (relations == null) return; + for (int i = relations.size() - 1; i >= 0; i--) { + Relation relation = (Relation)relations.elementAt(i); + if (relation.type == type && relation.target == target) { + relations.remove(i); + if (accessibleObject != null) { + accessibleObject.removeRelation(relation.type, relation.target); + } + break; + } + } + } + + /** + * Sends a message to accessible clients indicating that something + * has changed within a custom control. + * + * @param event a constant beginning with EVENT_* indicating the message to send + * @param childID an identifier specifying a child of the control or the control itself + * + * @exception SWTException <ul> + * <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: send platform-specific event (i.e. WinEvent with EVENT_OBJECT_* or IA2_EVENT_* on Win, Signal on ATK, Notification on Mac) + } + + /** + * 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: send platform-specific event (i.e. WinEvent with EVENT_OBJECT_* or IA2_EVENT_* on Win, Signal on ATK, Notification on Mac) } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java index c6f6300d66..865e3b2fdb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleFactory.java @@ -18,43 +18,51 @@ import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.*; class AccessibleFactory { - int /*long*/ handle; - int /*long*/ objectParentType; - int /*long*/ widgetTypeName; - Callback atkObjectFactoryCB_create_accessible; - Callback gTypeInfo_base_init_factory; - Hashtable accessibles = new Hashtable (9); - - static final Hashtable Types = new Hashtable (9); + static final Hashtable Accessibles = new Hashtable (9); static final Hashtable Factories = new Hashtable (9); - static final int /*long*/ DefaultParentType = OS.g_type_from_name (Converter.wcsToMbcs (null, "GtkAccessible", true)); //$NON-NLS-1$ - static final byte[] FACTORY_PARENTTYPENAME = Converter.wcsToMbcs (null, "AtkObjectFactory", true); //$NON-NLS-1$ - static final byte[] SWT_TYPE_PREFIX = Converter.wcsToMbcs (null, "SWT", false); //$NON-NLS-1$ - static final byte[] CHILD_TYPENAME = Converter.wcsToMbcs (null, "Child", false); //$NON-NLS-1$ - static final byte[] FACTORY_TYPENAME = Converter.wcsToMbcs (null, "SWTFactory", true); //$NON-NLS-1$ + static final String SWT_TYPE_PREFIX = "SWTAccessible"; //$NON-NLS-1$ + static final String CHILD_TYPENAME = "Child"; //$NON-NLS-1$ + static final String FACTORY_TYPENAME = "SWTFactory"; //$NON-NLS-1$ static final int[] actionRoles = { ACC.ROLE_CHECKBUTTON, ACC.ROLE_COMBOBOX, ACC.ROLE_LINK, ACC.ROLE_MENUITEM, ACC.ROLE_PUSHBUTTON, ACC.ROLE_RADIOBUTTON, ACC.ROLE_SPLITBUTTON, }; - static final int[] hypertextRoles = {ACC.ROLE_LINK}; + static final int[] hypertextRoles = { + ACC.ROLE_LINK + }; static final int[] selectionRoles = { ACC.ROLE_LIST, ACC.ROLE_TABFOLDER, ACC.ROLE_TABLE, ACC.ROLE_TREE, }; static final int[] textRoles = { ACC.ROLE_COMBOBOX, ACC.ROLE_LINK, ACC.ROLE_LABEL, ACC.ROLE_TEXT, }; + static final int[] tableRoles = { + ACC.ROLE_TABLE, ACC.ROLE_TREE, + }; + static final int[] valueRoles = { + ACC.ROLE_SCROLLBAR, ACC.ROLE_SPINBUTTON, ACC.ROLE_PROGRESSBAR, + }; - /* AT callbacks*/ + /* Action callbacks */ + static final Callback AtkActionCB_do_action; + static final Callback AtkActionCB_get_n_actions; + static final Callback AtkActionCB_get_description; static final Callback AtkActionCB_get_keybinding; static final Callback AtkActionCB_get_name; + + /* Component callbacks */ static final Callback AtkComponentCB_get_extents; static final Callback AtkComponentCB_get_position; static final Callback AtkComponentCB_get_size; static final Callback AtkComponentCB_ref_accessible_at_point; + + /* Hypertext callbacks */ static final Callback AtkHypertextCB_get_link; static final Callback AtkHypertextCB_get_n_links; static final Callback AtkHypertextCB_get_link_index; + + /* Object callbacks */ static final Callback AtkObjectCB_get_description; static final Callback AtkObjectCB_get_index_in_parent; static final Callback AtkObjectCB_get_n_children; @@ -63,9 +71,46 @@ class AccessibleFactory { static final Callback AtkObjectCB_get_role; static final Callback AtkObjectCB_ref_child; static final Callback AtkObjectCB_ref_state_set; + + /* Selection callbacks */ static final Callback AtkSelectionCB_is_child_selected; static final Callback AtkSelectionCB_ref_selection; + + /* Table callbacks */ + static final Callback AtkTableCB_ref_at; + static final Callback AtkTableCB_get_index_at; + static final Callback AtkTableCB_get_column_at_index; + static final Callback AtkTableCB_get_row_at_index; + static final Callback AtkTableCB_get_n_columns; + static final Callback AtkTableCB_get_n_rows; + static final Callback AtkTableCB_get_column_extent_at; + static final Callback AtkTableCB_get_row_extent_at; + static final Callback AtkTableCB_get_summary; + static final Callback AtkTableCB_get_caption; + static final Callback AtkTableCB_get_column_description; + static final Callback AtkTableCB_get_row_description; + static final Callback AtkTableCB_get_column_header; + static final Callback AtkTableCB_get_row_header; + static final Callback AtkTableCB_get_selected_columns; + static final Callback AtkTableCB_get_selected_rows; + static final Callback AtkTableCB_is_column_selected; + static final Callback AtkTableCB_is_row_selected; + static final Callback AtkTableCB_is_selected; + static final Callback AtkTableCB_add_column_selection; + static final Callback AtkTableCB_add_row_selection; + static final Callback AtkTableCB_remove_column_selection; + static final Callback AtkTableCB_remove_row_selection; + + /* Text callbacks */ + static final Callback AtkTextCB_get_character_extents; + static final Callback AtkTextCB_get_range_extents; + static final Callback AtkTextCB_get_run_attributes; + static final Callback AtkTextCB_get_offset_at_point; + static final Callback AtkTextCB_add_selection; + static final Callback AtkTextCB_remove_selection; + static final Callback AtkTextCB_set_selection; static final Callback AtkTextCB_get_caret_offset; + static final Callback AtkTextCB_set_caret_offset; static final Callback AtkTextCB_get_n_selections; static final Callback AtkTextCB_get_selection; static final Callback AtkTextCB_get_text; @@ -74,22 +119,39 @@ class AccessibleFactory { static final Callback AtkTextCB_get_text_before_offset; static final Callback AtkTextCB_get_character_at_offset; static final Callback AtkTextCB_get_character_count; + static final Callback AtkTextCB_get_bounded_ranges; + + /* Value callbacks */ + static final Callback AtkValueCB_get_current_value; + static final Callback AtkValueCB_get_maximum_value; + static final Callback AtkValueCB_get_minimum_value; + static final Callback AtkValueCB_set_current_value; + static final Callback GObjectClass_finalize; + static final Callback AtkObjectFactoryCB_create_accessible; + /* interface initialization callbacks */ static final Callback InitActionIfaceCB; static final Callback InitComponentIfaceCB; static final Callback InitHypertextIfaceCB; static final Callback GTypeInfo_base_init_type; static final Callback InitSelectionIfaceCB; + static final Callback InitTableIfaceCB; static final Callback InitTextIfaceCB; + static final Callback InitValueIfaceCB; + static final Callback GTypeInfo_base_init_factory; /* interface definitions */ - static int /*long*/ ObjectIfaceDefinition; static final int /*long*/ ActionIfaceDefinition; static final int /*long*/ ComponentIfaceDefinition; static final int /*long*/ HypertextIfaceDefinition; static final int /*long*/ SelectionIfaceDefinition; + static final int /*long*/ TableIfaceDefinition; static final int /*long*/ TextIfaceDefinition; + static final int /*long*/ ValueIfaceDefinition; static { + AtkActionCB_do_action = newCallback (AccessibleObject.class, "atkAction_do_action", 2); //$NON-NLS-1$ + AtkActionCB_get_n_actions = newCallback (AccessibleObject.class, "atkAction_get_n_actions", 1); //$NON-NLS-1$ + AtkActionCB_get_description = newCallback (AccessibleObject.class, "atkAction_get_description", 2); //$NON-NLS-1$ AtkActionCB_get_keybinding = newCallback (AccessibleObject.class, "atkAction_get_keybinding", 2); //$NON-NLS-1$ AtkActionCB_get_name = newCallback (AccessibleObject.class, "atkAction_get_name", 2); //$NON-NLS-1$ AtkComponentCB_get_extents = newCallback (AccessibleObject.class, "atkComponent_get_extents", 6); //$NON-NLS-1$ @@ -109,7 +171,38 @@ class AccessibleFactory { AtkObjectCB_ref_child = newCallback (AccessibleObject.class, "atkObject_ref_child", 2); //$NON-NLS-1$ AtkSelectionCB_is_child_selected = newCallback (AccessibleObject.class, "atkSelection_is_child_selected", 2); //$NON-NLS-1$ AtkSelectionCB_ref_selection = newCallback (AccessibleObject.class, "atkSelection_ref_selection", 2); //$NON-NLS-1$ + AtkTableCB_ref_at = newCallback (AccessibleObject.class, "atkTable_ref_at", 3); //$NON-NLS-1$ + AtkTableCB_get_index_at = newCallback (AccessibleObject.class, "atkTable_get_index_at", 3); //$NON-NLS-1$ + AtkTableCB_get_column_at_index = newCallback (AccessibleObject.class, "atkTable_get_column_at_index", 2); //$NON-NLS-1$ + AtkTableCB_get_row_at_index = newCallback (AccessibleObject.class, "atkTable_get_row_at_index", 2); //$NON-NLS-1$ + AtkTableCB_get_n_columns = newCallback (AccessibleObject.class, "atkTable_get_n_columns", 1); //$NON-NLS-1$ + AtkTableCB_get_n_rows = newCallback (AccessibleObject.class, "atkTable_get_n_rows", 1); //$NON-NLS-1$ + AtkTableCB_get_column_extent_at = newCallback (AccessibleObject.class, "atkTable_get_column_extent_at", 3); //$NON-NLS-1$ + AtkTableCB_get_row_extent_at = newCallback (AccessibleObject.class, "atkTable_get_row_extent_at", 3); //$NON-NLS-1$ + AtkTableCB_get_caption = newCallback (AccessibleObject.class, "atkTable_get_caption", 1); //$NON-NLS-1$ + AtkTableCB_get_summary = newCallback (AccessibleObject.class, "atkTable_get_summary", 1); //$NON-NLS-1$ + AtkTableCB_get_column_description = newCallback (AccessibleObject.class, "atkTable_get_column_description", 2); //$NON-NLS-1$ + AtkTableCB_get_row_description = newCallback (AccessibleObject.class, "atkTable_get_row_description", 2); //$NON-NLS-1$ + AtkTableCB_get_column_header = newCallback (AccessibleObject.class, "atkTable_get_column_header", 2); //$NON-NLS-1$ + AtkTableCB_get_row_header = newCallback (AccessibleObject.class, "atkTable_get_row_header", 2); //$NON-NLS-1$ + AtkTableCB_get_selected_columns = newCallback (AccessibleObject.class, "atkTable_get_selected_columns", 2); //$NON-NLS-1$ + AtkTableCB_get_selected_rows = newCallback (AccessibleObject.class, "atkTable_get_selected_rows", 2); //$NON-NLS-1$ + AtkTableCB_is_column_selected = newCallback (AccessibleObject.class, "atkTable_is_column_selected", 2); //$NON-NLS-1$ + AtkTableCB_is_row_selected = newCallback (AccessibleObject.class, "atkTable_is_row_selected", 2); //$NON-NLS-1$ + AtkTableCB_is_selected = newCallback (AccessibleObject.class, "atkTable_is_selected", 3); //$NON-NLS-1$ + AtkTableCB_add_column_selection = newCallback (AccessibleObject.class, "atkTable_add_column_selection", 2); //$NON-NLS-1$ + AtkTableCB_add_row_selection = newCallback (AccessibleObject.class, "atkTable_add_row_selection", 2); //$NON-NLS-1$ + AtkTableCB_remove_column_selection = newCallback (AccessibleObject.class, "atkTable_remove_column_selection", 2); //$NON-NLS-1$ + AtkTableCB_remove_row_selection = newCallback (AccessibleObject.class, "atkTable_remove_row_selection", 2); //$NON-NLS-1$ + AtkTextCB_get_character_extents = newCallback (AccessibleObject.class, "atkText_get_character_extents", 7); //$NON-NLS-1$ + AtkTextCB_get_range_extents = newCallback (AccessibleObject.class, "atkText_get_range_extents", 5); //$NON-NLS-1$ + AtkTextCB_get_run_attributes = newCallback (AccessibleObject.class, "atkText_get_run_attributes", 4); //$NON-NLS-1$ + AtkTextCB_get_offset_at_point = newCallback (AccessibleObject.class, "atkText_get_offset_at_point", 4); //$NON-NLS-1$ + AtkTextCB_add_selection = newCallback (AccessibleObject.class, "atkText_add_selection", 3); //$NON-NLS-1$ + AtkTextCB_remove_selection = newCallback (AccessibleObject.class, "atkText_remove_selection", 2); //$NON-NLS-1$ + AtkTextCB_set_selection = newCallback (AccessibleObject.class, "atkText_set_selection", 4); //$NON-NLS-1$ AtkTextCB_get_caret_offset = newCallback (AccessibleObject.class, "atkText_get_caret_offset", 1); //$NON-NLS-1$ + AtkTextCB_set_caret_offset = newCallback (AccessibleObject.class, "atkText_set_caret_offset", 2); //$NON-NLS-1$ AtkTextCB_get_n_selections = newCallback (AccessibleObject.class, "atkText_get_n_selections", 1); //$NON-NLS-1$ AtkTextCB_get_selection = newCallback (AccessibleObject.class, "atkText_get_selection", 4); //$NON-NLS-1$ AtkTextCB_get_text = newCallback (AccessibleObject.class, "atkText_get_text", 3); //$NON-NLS-1$ @@ -118,8 +211,15 @@ class AccessibleFactory { AtkTextCB_get_text_before_offset = newCallback (AccessibleObject.class, "atkText_get_text_before_offset", 5); //$NON-NLS-1$ AtkTextCB_get_character_at_offset = newCallback (AccessibleObject.class, "atkText_get_character_at_offset", 2); //$NON-NLS-1$ AtkTextCB_get_character_count = newCallback (AccessibleObject.class, "atkText_get_character_count", 1); //$NON-NLS-1$ + AtkTextCB_get_bounded_ranges = newCallback (AccessibleObject.class, "atkText_get_bounded_ranges", 5); //$NON-NLS-1$ + AtkValueCB_get_current_value = newCallback (AccessibleObject.class, "atkValue_get_current_value", 2); //$NON-NLS-1$ + AtkValueCB_get_maximum_value = newCallback (AccessibleObject.class, "atkValue_get_maximum_value", 2); //$NON-NLS-1$ + AtkValueCB_get_minimum_value = newCallback (AccessibleObject.class, "atkValue_get_minimum_value", 2); //$NON-NLS-1$ + AtkValueCB_set_current_value = newCallback (AccessibleObject.class, "atkValue_set_current_value", 2); //$NON-NLS-1$ GObjectClass_finalize = newCallback (AccessibleObject.class, "gObjectClass_finalize", 1); //$NON-NLS-1$ GTypeInfo_base_init_type = newCallback (AccessibleFactory.class, "gTypeInfo_base_init_type", 1); //$NON-NLS-1$ + GTypeInfo_base_init_factory = newCallback (AccessibleFactory.class, "gTypeInfo_base_init_factory", 1); //$NON-NLS-1$ + AtkObjectFactoryCB_create_accessible = newCallback (AccessibleFactory.class, "atkObjectFactory_create_accessible", 1); //$NON-NLS-1$ /* Action interface */ InitActionIfaceCB = newCallback (AccessibleFactory.class, "initActionIfaceCB", 1); //$NON-NLS-1$ GInterfaceInfo interfaceInfo = new GInterfaceInfo (); @@ -145,11 +245,23 @@ class AccessibleFactory { SelectionIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (SelectionIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); /* Text interface */ + InitTableIfaceCB = newCallback (AccessibleFactory.class, "initTableIfaceCB", 1); //$NON-NLS-1$ + interfaceInfo = new GInterfaceInfo (); + interfaceInfo.interface_init = InitTableIfaceCB.getAddress (); + TableIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + OS.memmove (TableIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); + /* Text interface */ InitTextIfaceCB = newCallback (AccessibleFactory.class, "initTextIfaceCB", 1); //$NON-NLS-1$ interfaceInfo = new GInterfaceInfo (); interfaceInfo.interface_init = InitTextIfaceCB.getAddress (); TextIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); OS.memmove (TextIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); + /* Value interface */ + InitValueIfaceCB = newCallback (AccessibleFactory.class, "initValueIfaceCB", 1); //$NON-NLS-1$ + interfaceInfo = new GInterfaceInfo (); + interfaceInfo.interface_init = InitValueIfaceCB.getAddress (); + ValueIfaceDefinition = OS.g_malloc (GInterfaceInfo.sizeof); + OS.memmove (ValueIfaceDefinition, interfaceInfo, GInterfaceInfo.sizeof); } static private Callback newCallback (Object object, String method, int argCount) { @@ -158,51 +270,26 @@ class AccessibleFactory { return callback; } - private AccessibleFactory (int /*long*/ widgetType) { - super (); - widgetTypeName = OS.g_type_name (widgetType); - int widgetTypeNameLength = OS.strlen (widgetTypeName) + 1; + static String getTypeName (int /*long*/ type) { + int /*long*/ typeName = OS.g_type_name (type); + int widgetTypeNameLength = OS.strlen (typeName); byte[] buffer = new byte [widgetTypeNameLength]; - OS.memmove (buffer, widgetTypeName, widgetTypeNameLength); - byte[] factoryName = new byte [FACTORY_TYPENAME.length + widgetTypeNameLength - 1]; - System.arraycopy (FACTORY_TYPENAME, 0, factoryName, 0, FACTORY_TYPENAME.length); - System.arraycopy (buffer, 0, factoryName, FACTORY_TYPENAME.length - 1, widgetTypeNameLength); - if (OS.g_type_from_name (factoryName) == 0) { - /* register the factory */ - int /*long*/ registry = ATK.atk_get_default_registry (); - int /*long*/ previousFactory = ATK.atk_registry_get_factory (registry, widgetType); - objectParentType = ATK.atk_object_factory_get_accessible_type (previousFactory); - if (objectParentType == 0) objectParentType = DefaultParentType; - int /*long*/ factoryParentType = OS.g_type_from_name (FACTORY_PARENTTYPENAME); - gTypeInfo_base_init_factory = new Callback (this, "gTypeInfo_base_init_factory", 1); //$NON-NLS-1$ - int /*long*/ address = gTypeInfo_base_init_factory.getAddress (); - if (address == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - GTypeInfo typeInfo = new GTypeInfo (); - typeInfo.base_init = address; - typeInfo.class_size = (short)ATK.AtkObjectFactoryClass_sizeof (); - typeInfo.instance_size = (short)ATK.AtkObjectFactory_sizeof (); - int /*long*/ info = OS.g_malloc (GTypeInfo.sizeof); - OS.memmove (info, typeInfo, GTypeInfo.sizeof); - int /*long*/ swtFactoryType = OS.g_type_register_static (factoryParentType, factoryName, info, 0); - ATK.atk_registry_set_factory_type (registry, widgetType, swtFactoryType); - handle = ATK.atk_registry_get_factory (registry, widgetType); - } + OS.memmove (buffer, typeName, widgetTypeNameLength); + return new String(Converter.mbcsToWcs(null, buffer)); } - - void addAccessible (Accessible accessible) { - int /*long*/ controlHandle = accessible.getControlHandle (); - accessibles.put (new LONG (controlHandle), accessible); - ATK.atk_object_factory_create_accessible (handle, controlHandle); + + static int /*long*/ getParentType (int /*long*/ widgetType) { + return ((LONG) Factories.get(new LONG(widgetType))).value; } - int /*long*/ atkObjectFactory_create_accessible (int /*long*/ widget) { - Accessible accessible = (Accessible) accessibles.get (new LONG (widget)); + static int /*long*/ atkObjectFactory_create_accessible (int /*long*/ widget) { + Accessible accessible = (Accessible) Accessibles.get (new LONG (widget)); if (accessible == null) { /* * we don't care about this control, so create it with the parent's * type so that its accessibility callbacks will not pass though here */ - int /*long*/ result = OS.g_object_new (objectParentType, 0); + int /*long*/ result = OS.g_object_new (getParentType(OS.G_OBJECT_TYPE (widget)), 0); ATK.atk_object_initialize (result, widget); return result; } @@ -210,31 +297,30 @@ class AccessibleFactory { if (accessible.accessibleObject != null) { return accessible.accessibleObject.handle; } - int typeNameLength = OS.strlen (widgetTypeName); - byte[] buffer = new byte [typeNameLength]; - OS.memmove (buffer, widgetTypeName, typeNameLength); - int /*long*/ type = getType (buffer, accessible, objectParentType, ACC.CHILDID_SELF); - AccessibleObject object = new AccessibleObject (type, widget, accessible, objectParentType, false); + int /*long*/ widgetType = OS.G_OBJECT_TYPE (widget); + int /*long*/ parentType = getParentType (widgetType); + if (parentType == 0) parentType = ATK.GTK_TYPE_ACCESSIBLE(); + int /*long*/ type = getType (getTypeName(widgetType), accessible, parentType, ACC.CHILDID_SELF); + AccessibleObject object = new AccessibleObject (type, widget, accessible, false); accessible.accessibleObject = object; + accessible.addRelations (); return object.handle; } - static int /*long*/ getChildType (Accessible accessible, int childIndex) { - return getType (CHILD_TYPENAME, accessible, DefaultParentType, childIndex); + static AccessibleObject createChildAccessible (Accessible accessible, int childIndex) { + int /*long*/ childType = getType (CHILD_TYPENAME, accessible, ATK.GTK_TYPE_ACCESSIBLE(), childIndex); + return new AccessibleObject(childType, 0, accessible, true); } - static int /*long*/ getDefaultParentType () { - return DefaultParentType; - } - - static int /*long*/ getType (byte[] widgetTypeName, Accessible accessible, int /*long*/ parentType, int childId) { + static int /*long*/ getType (String widgetTypeName, Accessible accessible, int /*long*/ parentType, int childId) { AccessibleControlEvent event = new AccessibleControlEvent (accessible); event.childID = childId; - AccessibleControlListener[] listeners = accessible.getControlListeners (); - for (int i = 0; i < listeners.length; i++) { - listeners [i].getRole (event); + Vector listeners = accessible.accessibleControlListeners; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getRole (event); } - boolean action = false, hypertext = false, selection = false, text = false; + boolean action = false, hypertext = false, selection = false, table = false, text = false, value = false; if (event.detail != 0) { /* a role was specified */ for (int i = 0; i < actionRoles.length; i++) { if (event.detail == actionRoles [i]) { @@ -254,27 +340,39 @@ class AccessibleFactory { break; } } + for (int i = 0; i < tableRoles.length; i++) { + if (event.detail == tableRoles [i]) { + table = true; + break; + } + } for (int i = 0; i < textRoles.length; i++) { if (event.detail == textRoles [i]) { text = true; break; } } + for (int i = 0; i < valueRoles.length; i++) { + if (event.detail == valueRoles [i]) { + value = true; + break; + } + } } else { - action = hypertext = selection = text = true; + action = hypertext = selection = table = text = value = true; } - String swtTypeName = new String (SWT_TYPE_PREFIX); - swtTypeName += new String (widgetTypeName); + String swtTypeName = SWT_TYPE_PREFIX + widgetTypeName; if (action) swtTypeName += "Action"; //$NON-NLS-1$ if (hypertext) swtTypeName += "Hypertext"; //$NON-NLS-1$ if (selection) swtTypeName += "Selection"; //$NON-NLS-1$ + if (table) swtTypeName += "Table"; //$NON-NLS-1$ if (text) swtTypeName += "Text"; //$NON-NLS-1$ + if (value) swtTypeName += "Value"; //$NON-NLS-1$ - int /*long*/ type = 0; - LONG typeInt = (LONG)Types.get (swtTypeName); - if (typeInt != null) { - type = typeInt.value; - } else { + byte[] nameBytes = Converter.wcsToMbcs(null, swtTypeName, true); + int /*long*/ type = OS.g_type_from_name(nameBytes); + if (type == 0) { + if (AccessibleObject.DEBUG) System.out.println("-->New Type=" + swtTypeName); //$NON-NLS-1$ /* define the type */ int /*long*/ queryPtr = OS.g_malloc (GTypeQuery.sizeof); OS.g_type_query (parentType, queryPtr); @@ -285,29 +383,25 @@ class AccessibleFactory { typeInfo.base_init = GTypeInfo_base_init_type.getAddress (); typeInfo.class_size = (short) query.class_size; typeInfo.instance_size = (short) query.instance_size; - ObjectIfaceDefinition = OS.g_malloc (GTypeInfo.sizeof); - OS.memmove (ObjectIfaceDefinition, typeInfo, GTypeInfo.sizeof); - byte[] nameBytes = Converter.wcsToMbcs(null, swtTypeName, true); - type = OS.g_type_register_static (parentType, nameBytes, ObjectIfaceDefinition, 0); - OS.g_type_add_interface_static (type, AccessibleObject.ATK_COMPONENT_TYPE, ComponentIfaceDefinition); - if (action) OS.g_type_add_interface_static (type, AccessibleObject.ATK_ACTION_TYPE, ActionIfaceDefinition); - if (hypertext) OS.g_type_add_interface_static (type, AccessibleObject.ATK_HYPERTEXT_TYPE, HypertextIfaceDefinition); - if (selection) OS.g_type_add_interface_static (type, AccessibleObject.ATK_SELECTION_TYPE, SelectionIfaceDefinition); - if (text) OS.g_type_add_interface_static (type, AccessibleObject.ATK_TEXT_TYPE, TextIfaceDefinition); - Types.put (swtTypeName, new LONG (type)); + int /*long*/ definition = OS.g_malloc (GTypeInfo.sizeof); + OS.memmove (definition, typeInfo, GTypeInfo.sizeof); + type = OS.g_type_register_static (parentType, nameBytes, definition, 0); + OS.g_type_add_interface_static (type, ATK.ATK_TYPE_COMPONENT(), ComponentIfaceDefinition); + if (action) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_ACTION(), ActionIfaceDefinition); + if (hypertext) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_HYPERTEXT(), HypertextIfaceDefinition); + if (selection) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_SELECTION(), SelectionIfaceDefinition); + if (table) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_TABLE(), TableIfaceDefinition); + if (text) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_TEXT(), TextIfaceDefinition); + if (value) OS.g_type_add_interface_static (type, ATK.ATK_TYPE_VALUE(), ValueIfaceDefinition); } return type; } - int /*long*/ gTypeInfo_base_init_factory (int /*long*/ klass) { - int /*long*/ atkObjectFactoryClass = ATK.ATK_OBJECT_FACTORY_CLASS (klass); - AtkObjectFactoryClass objectFactoryClassStruct = new AtkObjectFactoryClass (); - ATK.memmove (objectFactoryClassStruct, atkObjectFactoryClass); - atkObjectFactoryCB_create_accessible = new Callback (this, "atkObjectFactory_create_accessible", 1); //$NON-NLS-1$ - int /*long*/ address = atkObjectFactoryCB_create_accessible.getAddress (); - if (address == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - objectFactoryClassStruct.create_accessible = address; - ATK.memmove (atkObjectFactoryClass, objectFactoryClassStruct); + static int /*long*/ gTypeInfo_base_init_factory (int /*long*/ klass) { + AtkObjectFactoryClass objectClass = new AtkObjectFactoryClass (); + ATK.memmove (objectClass, klass); + objectClass.create_accessible = AtkObjectFactoryCB_create_accessible.getAddress (); + ATK.memmove (klass, objectClass); return 0; } @@ -332,83 +426,141 @@ class AccessibleFactory { } static int /*long*/ initActionIfaceCB (int /*long*/ iface) { - AtkActionIface actionIface = new AtkActionIface (); - ATK.memmove (actionIface, iface); - actionIface.get_keybinding = AtkActionCB_get_keybinding.getAddress (); - actionIface.get_name = AtkActionCB_get_name.getAddress (); - ATK.memmove (iface, actionIface); + AtkActionIface inter = new AtkActionIface (); + ATK.memmove (inter, iface); + inter.do_action = AtkActionCB_do_action.getAddress (); + inter.get_n_actions = AtkActionCB_get_n_actions.getAddress (); + inter.get_description = AtkActionCB_get_description.getAddress (); + inter.get_keybinding = AtkActionCB_get_keybinding.getAddress (); + inter.get_name = AtkActionCB_get_name.getAddress (); + ATK.memmove (iface, inter); return 0; } static int /*long*/ initComponentIfaceCB (int /*long*/ iface) { - AtkComponentIface componentIface = new AtkComponentIface (); - ATK.memmove (componentIface, iface); - componentIface.get_extents = AtkComponentCB_get_extents.getAddress (); - componentIface.get_position = AtkComponentCB_get_position.getAddress (); - componentIface.get_size = AtkComponentCB_get_size.getAddress (); - componentIface.ref_accessible_at_point = AtkComponentCB_ref_accessible_at_point.getAddress (); - ATK.memmove (iface, componentIface); + AtkComponentIface inter = new AtkComponentIface (); + ATK.memmove (inter, iface); + inter.get_extents = AtkComponentCB_get_extents.getAddress (); + inter.get_position = AtkComponentCB_get_position.getAddress (); + inter.get_size = AtkComponentCB_get_size.getAddress (); + inter.ref_accessible_at_point = AtkComponentCB_ref_accessible_at_point.getAddress (); + ATK.memmove (iface, inter); return 0; } static int /*long*/ initHypertextIfaceCB (int /*long*/ iface) { - AtkHypertextIface hypertextIface = new AtkHypertextIface (); - ATK.memmove (hypertextIface, iface); - hypertextIface.get_link = AtkHypertextCB_get_link.getAddress (); - hypertextIface.get_link_index = AtkHypertextCB_get_link_index.getAddress (); - hypertextIface.get_n_links = AtkHypertextCB_get_n_links.getAddress (); - ATK.memmove (iface, hypertextIface); + AtkHypertextIface inter = new AtkHypertextIface (); + ATK.memmove (inter, iface); + inter.get_link = AtkHypertextCB_get_link.getAddress (); + inter.get_link_index = AtkHypertextCB_get_link_index.getAddress (); + inter.get_n_links = AtkHypertextCB_get_n_links.getAddress (); + ATK.memmove (iface, inter); return 0; } static int /*long*/ initSelectionIfaceCB (int /*long*/ iface) { - AtkSelectionIface selectionIface = new AtkSelectionIface (); - ATK.memmove (selectionIface, iface); - selectionIface.is_child_selected = AtkSelectionCB_is_child_selected.getAddress (); - selectionIface.ref_selection = AtkSelectionCB_ref_selection.getAddress (); - ATK.memmove (iface, selectionIface); + AtkSelectionIface inter = new AtkSelectionIface (); + ATK.memmove (inter, iface); + inter.is_child_selected = AtkSelectionCB_is_child_selected.getAddress (); + inter.ref_selection = AtkSelectionCB_ref_selection.getAddress (); + ATK.memmove (iface, inter); + return 0; + } + + static int /*long*/ initTableIfaceCB (int /*long*/ iface) { + AtkTableIface inter = new AtkTableIface (); + ATK.memmove (inter, iface); + inter.ref_at = AtkTableCB_ref_at.getAddress(); + inter.get_index_at = AtkTableCB_get_index_at.getAddress(); + inter.get_column_at_index = AtkTableCB_get_column_at_index.getAddress(); + inter.get_row_at_index = AtkTableCB_get_row_at_index.getAddress(); + inter.get_n_columns = AtkTableCB_get_n_columns.getAddress(); + inter.get_n_rows = AtkTableCB_get_n_rows.getAddress(); + inter.get_column_extent_at = AtkTableCB_get_column_extent_at.getAddress(); + inter.get_row_extent_at = AtkTableCB_get_row_extent_at.getAddress(); + inter.get_caption = AtkTableCB_get_caption.getAddress(); + inter.get_summary = AtkTableCB_get_summary.getAddress(); + inter.get_column_description = AtkTableCB_get_column_description.getAddress(); + inter.get_row_description = AtkTableCB_get_row_description.getAddress(); + inter.get_column_header = AtkTableCB_get_column_header.getAddress(); + inter.get_row_header = AtkTableCB_get_row_header.getAddress(); + inter.get_selected_columns = AtkTableCB_get_selected_columns.getAddress(); + inter.get_selected_rows = AtkTableCB_get_selected_rows.getAddress(); + inter.is_column_selected = AtkTableCB_is_column_selected.getAddress(); + inter.is_row_selected = AtkTableCB_is_row_selected.getAddress(); + inter.is_selected = AtkTableCB_is_selected.getAddress(); + inter.add_column_selection = AtkTableCB_add_column_selection.getAddress(); + inter.add_row_selection = AtkTableCB_add_row_selection.getAddress(); + inter.remove_column_selection = AtkTableCB_remove_column_selection.getAddress(); + inter.remove_row_selection = AtkTableCB_remove_row_selection.getAddress(); + ATK.memmove (iface, inter); return 0; } static int /*long*/ initTextIfaceCB (int /*long*/ iface) { - AtkTextIface textInterface = new AtkTextIface (); - ATK.memmove (textInterface, iface); - textInterface.get_caret_offset = AtkTextCB_get_caret_offset.getAddress (); - textInterface.get_character_at_offset = AtkTextCB_get_character_at_offset.getAddress (); - textInterface.get_character_count = AtkTextCB_get_character_count.getAddress (); - textInterface.get_n_selections = AtkTextCB_get_n_selections.getAddress (); - textInterface.get_selection = AtkTextCB_get_selection.getAddress (); - textInterface.get_text = AtkTextCB_get_text.getAddress (); - textInterface.get_text_after_offset = AtkTextCB_get_text_after_offset.getAddress (); - textInterface.get_text_at_offset = AtkTextCB_get_text_at_offset.getAddress (); - textInterface.get_text_before_offset = AtkTextCB_get_text_before_offset.getAddress (); - ATK.memmove (iface, textInterface); + AtkTextIface inter = new AtkTextIface (); + ATK.memmove (inter, iface); + inter.get_range_extents = AtkTextCB_get_range_extents.getAddress (); + inter.get_character_extents = AtkTextCB_get_character_extents.getAddress (); + inter.get_run_attributes= AtkTextCB_get_run_attributes.getAddress (); + inter.get_offset_at_point = AtkTextCB_get_offset_at_point.getAddress (); + inter.add_selection = AtkTextCB_add_selection.getAddress (); + inter.remove_selection = AtkTextCB_remove_selection.getAddress (); + inter.set_selection = AtkTextCB_set_selection.getAddress (); + inter.get_caret_offset = AtkTextCB_get_caret_offset.getAddress (); + inter.set_caret_offset = AtkTextCB_set_caret_offset.getAddress (); + inter.get_character_at_offset = AtkTextCB_get_character_at_offset.getAddress (); + inter.get_character_count = AtkTextCB_get_character_count.getAddress (); + inter.get_n_selections = AtkTextCB_get_n_selections.getAddress (); + inter.get_selection = AtkTextCB_get_selection.getAddress (); + inter.get_text = AtkTextCB_get_text.getAddress (); + inter.get_text_after_offset = AtkTextCB_get_text_after_offset.getAddress (); + inter.get_text_at_offset = AtkTextCB_get_text_at_offset.getAddress (); + inter.get_text_before_offset = AtkTextCB_get_text_before_offset.getAddress (); + inter.get_bounded_ranges = AtkTextCB_get_bounded_ranges.getAddress (); + ATK.memmove (iface, inter); + return 0; + } + + static int /*long*/ initValueIfaceCB (int /*long*/ iface) { + AtkValueIface inter = new AtkValueIface (); + ATK.memmove (inter, iface); + inter.get_current_value = AtkValueCB_get_current_value.getAddress (); + inter.get_maximum_value = AtkValueCB_get_maximum_value.getAddress (); + inter.get_minimum_value = AtkValueCB_get_minimum_value.getAddress (); + inter.set_current_value = AtkValueCB_set_current_value.getAddress (); + ATK.memmove (iface, inter); return 0; } static void registerAccessible (Accessible accessible) { - /* If DefaultParentType is 0 then OS accessibility is not active */ - if (DefaultParentType == 0) return; - int /*long*/ controlHandle = accessible.getControlHandle (); - int /*long*/ widgetType = OS.G_OBJECT_TYPE (controlHandle); - AccessibleFactory factory = (AccessibleFactory) Factories.get (new LONG (widgetType)); - if (factory == null) { - factory = new AccessibleFactory (widgetType); - Factories.put (new LONG (widgetType), factory); + int /*long*/ widget = accessible.getControlHandle (); + int /*long*/ widgetType = OS.G_OBJECT_TYPE (widget); + int /*long*/ registry = ATK.atk_get_default_registry (); + int /*long*/ factory = ATK.atk_registry_get_factory (registry, widgetType); + /* If NO_OP factory is registered then OS accessibility is not active */ + if (ATK.ATK_IS_NO_OP_OBJECT_FACTORY(factory)) return; + String name = FACTORY_TYPENAME + getTypeName(widgetType); + byte[] factoryName = Converter.wcsToMbcs(null, name, true); + if (OS.g_type_from_name (factoryName) == 0) { + if (AccessibleObject.DEBUG) System.out.println("-->New Factory=" + name); //$NON-NLS-1$ + /* register the factory */ + GTypeInfo typeInfo = new GTypeInfo (); + typeInfo.base_init = GTypeInfo_base_init_factory.getAddress (); + typeInfo.class_size = (short)ATK.AtkObjectFactoryClass_sizeof (); + typeInfo.instance_size = (short)ATK.AtkObjectFactory_sizeof (); + int /*long*/ info = OS.g_malloc (GTypeInfo.sizeof); + OS.memmove (info, typeInfo, GTypeInfo.sizeof); + int /*long*/ swtFactoryType = OS.g_type_register_static (ATK.ATK_TYPE_OBJECT_FACTORY(), factoryName, info, 0); + int /*long*/ parentType = ATK.atk_object_factory_get_accessible_type(factory); + ATK.atk_registry_set_factory_type (registry, widgetType, swtFactoryType); + Factories.put (new LONG (widgetType), new LONG (parentType)); } - factory.addAccessible (accessible); - } - - void removeAccessible (Accessible accessible) { - accessibles.remove (new LONG (accessible.getControlHandle ())); + Accessibles.put (new LONG (widget), accessible); } static void unregisterAccessible (Accessible accessible) { - int /*long*/ controlHandle = accessible.getControlHandle (); - int /*long*/ widgetType = OS.G_OBJECT_TYPE (controlHandle); - AccessibleFactory factory = (AccessibleFactory) Factories.get (new LONG (widgetType)); - if (factory != null) { - factory.removeAccessible (accessible); - } + int /*long*/ widget = accessible.getControlHandle (); + Accessibles.remove (new LONG (widget)); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java index 1293d93bff..0318c25eb5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java @@ -12,14 +12,16 @@ package org.eclipse.swt.accessibility; import java.util.*; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.accessibility.gtk.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.widgets.*; class AccessibleObject { int /*long*/ handle; - int /*long*/ parentType; int index = -1, id = ACC.CHILDID_SELF; Accessible accessible; AccessibleObject parent; @@ -35,17 +37,11 @@ class AccessibleObject { static int /*long*/ keybindingPtr = -1; static int /*long*/ namePtr = -1; static final Hashtable AccessibleObjects = new Hashtable (9); - static final int /*long*/ ATK_ACTION_TYPE = ATK.g_type_from_name (Converter.wcsToMbcs (null, "AtkAction", true)); - static final int /*long*/ ATK_COMPONENT_TYPE = ATK.g_type_from_name (Converter.wcsToMbcs (null, "AtkComponent", true)); - static final int /*long*/ ATK_HYPERTEXT_TYPE = ATK.g_type_from_name (Converter.wcsToMbcs (null, "AtkHypertext", true)); - static final int /*long*/ ATK_SELECTION_TYPE = ATK.g_type_from_name (Converter.wcsToMbcs (null, "AtkSelection", true)); - static final int /*long*/ ATK_TEXT_TYPE = ATK.g_type_from_name (Converter.wcsToMbcs (null, "AtkText", true)); - static final boolean DEBUG = Display.DEBUG; - - AccessibleObject (int /*long*/ type, int /*long*/ widget, Accessible accessible, int /*long*/ parentType, boolean isLightweight) { + static final boolean DEBUG = true; + + AccessibleObject (int /*long*/ type, int /*long*/ widget, Accessible accessible, boolean isLightweight) { super (); handle = ATK.g_object_new (type, 0); - this.parentType = parentType; ATK.atk_object_initialize (handle, widget); this.accessible = accessible; this.isLightweight = isLightweight; @@ -58,536 +54,733 @@ class AccessibleObject { child.setParent (this); } + void addRelation (int type, Accessible target) { + OS.gtk_widget_get_accessible (target.getControlHandle ()); + OS.atk_object_add_relationship(handle, toATKRelation(type), target.accessibleObject.handle); + } + + static AtkActionIface getActionIface (int /*long*/ atkObject) { + if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_ACTION())) { + AtkActionIface iface = new AtkActionIface (); + ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_ACTION_GET_IFACE (atkObject))); + return iface; + } + return null; + } + + static int /*long*/ atkAction_do_action (int /*long*/ atkObject, int /*long*/ index) { + if (DEBUG) System.out.println ("-->atkAction_do_action"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleActionListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleActionEvent event = new AccessibleActionEvent(accessible); + event.index = (int)/*64*/index; + for (int i = 0; i < length; i++) { + AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i); + listener.doAction(event); + } + return 0; + } + } + int /*long*/ parentResult = 0; + AtkActionIface iface = getActionIface (atkObject); + if (iface != null && iface.do_action != 0) { + parentResult = ATK.call (iface.do_action, atkObject, index); + } + return parentResult; + } + + static int /*long*/ atkAction_get_n_actions (int /*long*/ atkObject) { + if (DEBUG) System.out.println ("-->atkAction_get_n_actions"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleActionListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleActionEvent event = new AccessibleActionEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i); + listener.getActionCount(event); + } + return event.count; + } + } + int /*long*/ parentResult = 0; + AtkActionIface iface = getActionIface (atkObject); + if (iface != null && iface.get_n_actions != 0) { + parentResult = ATK.call (iface.get_n_actions, atkObject); + } + return parentResult; + } + + static int /*long*/ atkAction_get_description (int /*long*/ atkObject, int /*long*/ index) { + if (DEBUG) System.out.println ("-->atkAction_get_description"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleActionListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleActionEvent event = new AccessibleActionEvent(accessible); + event.index = (int)/*64*/index; + for (int i = 0; i < length; i++) { + AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i); + listener.getDescription(event); + } + if (event.result == null) return 0; + if (descriptionPtr != -1) OS.g_free (descriptionPtr); + return descriptionPtr = getStringPtr (event.result); + } + } + int /*long*/ parentResult = 0; + AtkActionIface iface = getActionIface (atkObject); + if (iface != null && iface.get_description != 0) { + parentResult = ATK.call (iface.get_description, atkObject, index); + } + return parentResult; + } + static int /*long*/ atkAction_get_keybinding (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) System.out.println ("-->atkAction_get_keybinding"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - if (ATK.g_type_is_a (object.parentType, ATK_ACTION_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_ACTION_GET_IFACE (object.handle)); - AtkActionIface actionIface = new AtkActionIface (); - ATK.memmove (actionIface, superType); - if (actionIface.get_keybinding != 0) { - parentResult = ATK.call (actionIface.get_keybinding, object.handle, index); - } - } - AccessibleListener[] listeners = object.getAccessibleListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleEvent event = new AccessibleEvent (object.accessible); - event.childID = object.id; - if (parentResult != 0) { - int length = OS.strlen (parentResult); - byte [] buffer = new byte [length]; - OS.memmove (buffer, parentResult, length); - event.result = new String (Converter.mbcsToWcs (null, buffer)); - } - for (int i = 0; i < listeners.length; i++) { - listeners [i].getKeyboardShortcut (event); - } - if (event.result == null) return parentResult; - if (keybindingPtr != -1) OS.g_free (keybindingPtr); - byte[] name = Converter.wcsToMbcs (null, event.result, true); - keybindingPtr = OS.g_malloc (name.length); - OS.memmove (keybindingPtr, name, name.length); - return keybindingPtr; + AtkActionIface iface = getActionIface (atkObject); + if (iface != null && iface.get_keybinding != 0) { + parentResult = ATK.call (iface.get_keybinding, atkObject, index); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleActionListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleActionEvent event = new AccessibleActionEvent(accessible); + event.index = (int)/*64*/index; + for (int i = 0; i < length; i++) { + AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i); + listener.getKeyBinding(event); + } + if (event.result != null) { + if (keybindingPtr != -1) OS.g_free (keybindingPtr); + return keybindingPtr = getStringPtr (event.result); + } + } + listeners = accessible.accessibleListeners; + length = listeners.size(); + if (length > 0) { + AccessibleEvent event = new AccessibleEvent (accessible); + event.childID = object.id; + if (parentResult != 0) event.result = getString (parentResult); + for (int i = 0; i < length; i++) { + AccessibleListener listener = (AccessibleListener) listeners.elementAt(i); + listener.getKeyboardShortcut (event); + } + if (event.result != null) { + if (keybindingPtr != -1) OS.g_free (keybindingPtr); + return keybindingPtr = getStringPtr (event.result); + } + } + } + return parentResult; } static int /*long*/ atkAction_get_name (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) System.out.println ("-->atkAction_get_name"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - if (ATK.g_type_is_a (object.parentType, ATK_ACTION_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_ACTION_GET_IFACE (object.handle)); - AtkActionIface actionIface = new AtkActionIface (); - ATK.memmove (actionIface, superType); - if (actionIface.get_name != 0) { - parentResult = ATK.call (actionIface.get_name, object.handle, index); - } - } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - if (parentResult != 0) { - int length = OS.strlen (parentResult); - byte [] buffer = new byte [length]; - OS.memmove (buffer, parentResult, length); - event.result = new String (Converter.mbcsToWcs (null, buffer)); - } - for (int i = 0; i < listeners.length; i++) { - listeners [i].getDefaultAction (event); - } - if (event.result == null) return parentResult; - if (actionNamePtr != -1) OS.g_free (actionNamePtr); - byte[] name = Converter.wcsToMbcs (null, event.result, true); - actionNamePtr = OS.g_malloc (name.length); - OS.memmove (actionNamePtr, name, name.length); - return actionNamePtr; - } + AtkActionIface iface = getActionIface (atkObject); + if (iface != null && iface.get_name != 0) { + parentResult = ATK.call (iface.get_name, atkObject, index); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleActionListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleActionEvent event = new AccessibleActionEvent(accessible); + event.index = (int)/*64*/index; + for (int i = 0; i < length; i++) { + AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i); + listener.getName(event); + } + if (event.result != null) { + if (actionNamePtr != -1) OS.g_free (actionNamePtr); + return actionNamePtr = getStringPtr (event.result); + } + } + if (index == 0) { + listeners = accessible.accessibleControlListeners; + length = listeners.size(); + if (length > 0) { + AccessibleControlEvent event = new AccessibleControlEvent (accessible); + event.childID = object.id; + if (parentResult != 0) event.result = getString (parentResult); + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener) listeners.elementAt(i); + listener.getDefaultAction (event); + } + if (event.result != null) { + if (actionNamePtr != -1) OS.g_free (actionNamePtr); + return actionNamePtr = getStringPtr (event.result); + } + } + } + } + return parentResult; + } + + static AtkComponentIface getComponentIface (int /*long*/ atkObject) { + if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_COMPONENT())) { + AtkComponentIface iface = new AtkComponentIface (); + ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_COMPONENT_GET_IFACE (atkObject))); + return iface; + } + return null; + } static int /*long*/ atkComponent_get_extents (int /*long*/ atkObject, int /*long*/ x, int /*long*/ y, int /*long*/ width, int /*long*/ height, int /*long*/ coord_type) { if (DEBUG) System.out.println ("-->atkComponent_get_extents"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; OS.memmove (x, new int[] {0}, 4); OS.memmove (y, new int[] {0}, 4); OS.memmove (width, new int[] {0}, 4); OS.memmove (height, new int[] {0}, 4); - if (ATK.g_type_is_a (object.parentType, ATK_COMPONENT_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_COMPONENT_GET_IFACE (object.handle)); - AtkComponentIface componentIface = new AtkComponentIface (); - ATK.memmove (componentIface, superType); - if (componentIface.get_extents != 0) { - ATK.call (componentIface.get_extents, object.handle, x, y, width, height, coord_type); - } - } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return 0; - - int[] parentX = new int [1], parentY = new int [1]; - int[] parentWidth = new int [1], parentHeight = new int [1]; - OS.memmove (parentX, x, 4); - OS.memmove (parentY, y, 4); - OS.memmove (parentWidth, width, 4); - OS.memmove (parentHeight, height, 4); - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - event.x = parentX [0]; event.y = parentY [0]; - event.width = parentWidth [0]; event.height = parentHeight [0]; - if (coord_type == ATK.ATK_XY_WINDOW) { - /* translate control -> display, for filling in event to be dispatched */ - int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (object.handle); - GtkAccessible gtkAccessible = new GtkAccessible (); - ATK.memmove (gtkAccessible, gtkAccessibleHandle); - int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); - int[] topWindowX = new int [1], topWindowY = new int [1]; - OS.gdk_window_get_origin (window, topWindowX, topWindowY); - event.x += topWindowX [0]; - event.y += topWindowY [0]; - } - for (int i = 0; i < listeners.length; i++) { - listeners [i].getLocation (event); - } - if (coord_type == ATK.ATK_XY_WINDOW) { - /* translate display -> control, for answering to the OS */ - int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (object.handle); - GtkAccessible gtkAccessible = new GtkAccessible (); - ATK.memmove (gtkAccessible, gtkAccessibleHandle); - int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); - int[] topWindowX = new int [1], topWindowY = new int [1]; - OS.gdk_window_get_origin (window, topWindowX, topWindowY); - event.x -= topWindowX [0]; - event.y -= topWindowY [0]; - } - OS.memmove (x, new int[] {event.x}, 4); - OS.memmove (y, new int[] {event.y}, 4); - OS.memmove (width, new int[] {event.width}, 4); - OS.memmove (height, new int[] {event.height}, 4); + AtkComponentIface iface = getComponentIface (atkObject); + if (iface != null && iface.get_extents != 0) { + ATK.call (iface.get_extents, atkObject, x, y, width, height, coord_type); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + int[] parentX = new int [1], parentY = new int [1]; + int[] parentWidth = new int [1], parentHeight = new int [1]; + OS.memmove (parentX, x, 4); + OS.memmove (parentY, y, 4); + OS.memmove (parentWidth, width, 4); + OS.memmove (parentHeight, height, 4); + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + event.x = parentX [0]; event.y = parentY [0]; + event.width = parentWidth [0]; event.height = parentHeight [0]; + if (coord_type == ATK.ATK_XY_WINDOW) { + /* translate control -> display, for filling in event to be dispatched */ + int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (atkObject); + GtkAccessible gtkAccessible = new GtkAccessible (); + ATK.memmove (gtkAccessible, gtkAccessibleHandle); + int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); + int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int[] topWindowX = new int [1], topWindowY = new int [1]; + OS.gdk_window_get_origin (window, topWindowX, topWindowY); + event.x += topWindowX [0]; + event.y += topWindowY [0]; + } + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getLocation (event); + } + if (coord_type == ATK.ATK_XY_WINDOW) { + /* translate display -> control, for answering to the OS */ + int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (atkObject); + GtkAccessible gtkAccessible = new GtkAccessible (); + ATK.memmove (gtkAccessible, gtkAccessibleHandle); + int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); + int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int[] topWindowX = new int [1], topWindowY = new int [1]; + OS.gdk_window_get_origin (window, topWindowX, topWindowY); + event.x -= topWindowX [0]; + event.y -= topWindowY [0]; + } + OS.memmove (x, new int[] {event.x}, 4); + OS.memmove (y, new int[] {event.y}, 4); + OS.memmove (width, new int[] {event.width}, 4); + OS.memmove (height, new int[] {event.height}, 4); + } + } return 0; } static int /*long*/ atkComponent_get_position (int /*long*/ atkObject, int /*long*/ x, int /*long*/ y, int /*long*/ coord_type) { if (DEBUG) System.out.println ("-->atkComponent_get_position, object: " + atkObject + " x: " + x + " y: " + y + " coord: " + coord_type); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; OS.memmove (x, new int[] {0}, 4); OS.memmove (y, new int[] {0}, 4); - if (ATK.g_type_is_a (object.parentType, ATK_COMPONENT_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_COMPONENT_GET_IFACE (object.handle)); - AtkComponentIface componentIface = new AtkComponentIface (); - ATK.memmove (componentIface, superType); - if (componentIface.get_extents != 0) { - ATK.call (componentIface.get_position, object.handle, x, y, coord_type); - } - } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return 0; - - int[] parentX = new int [1], parentY = new int [1]; - OS.memmove (parentX, x, 4); - OS.memmove (parentY, y, 4); - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - event.x = parentX [0]; event.y = parentY [0]; - if (coord_type == ATK.ATK_XY_WINDOW) { - /* translate control -> display, for filling in event to be dispatched */ - int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (object.handle); - GtkAccessible gtkAccessible = new GtkAccessible (); - ATK.memmove (gtkAccessible, gtkAccessibleHandle); - int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); - int[] topWindowX = new int [1], topWindowY = new int [1]; - OS.gdk_window_get_origin (window, topWindowX, topWindowY); - event.x += topWindowX [0]; - event.y += topWindowY [0]; - } - for (int i = 0; i < listeners.length; i++) { - listeners [i].getLocation (event); - } - if (coord_type == ATK.ATK_XY_WINDOW) { - /* translate display -> control, for answering to the OS */ - int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (object.handle); - GtkAccessible gtkAccessible = new GtkAccessible (); - ATK.memmove (gtkAccessible, gtkAccessibleHandle); - int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); - int[] topWindowX = new int [1], topWindowY = new int [1]; - OS.gdk_window_get_origin (window, topWindowX, topWindowY); - event.x -= topWindowX [0]; - event.y -= topWindowY [0]; - } - OS.memmove (x, new int[] {event.x}, 4); - OS.memmove (y, new int[] {event.y}, 4); + AtkComponentIface iface = getComponentIface (atkObject); + if (iface != null && iface.get_position != 0) { + ATK.call (iface.get_position, atkObject, x, y, coord_type); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + int[] parentX = new int [1], parentY = new int [1]; + OS.memmove (parentX, x, 4); + OS.memmove (parentY, y, 4); + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + event.x = parentX [0]; event.y = parentY [0]; + if (coord_type == ATK.ATK_XY_WINDOW) { + /* translate control -> display, for filling in event to be dispatched */ + int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (atkObject); + GtkAccessible gtkAccessible = new GtkAccessible (); + ATK.memmove (gtkAccessible, gtkAccessibleHandle); + int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); + int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int[] topWindowX = new int [1], topWindowY = new int [1]; + OS.gdk_window_get_origin (window, topWindowX, topWindowY); + event.x += topWindowX [0]; + event.y += topWindowY [0]; + } + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getLocation (event); + } + if (coord_type == ATK.ATK_XY_WINDOW) { + /* translate display -> control, for answering to the OS */ + int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (atkObject); + GtkAccessible gtkAccessible = new GtkAccessible (); + ATK.memmove (gtkAccessible, gtkAccessibleHandle); + int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); + int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int[] topWindowX = new int [1], topWindowY = new int [1]; + OS.gdk_window_get_origin (window, topWindowX, topWindowY); + event.x -= topWindowX [0]; + event.y -= topWindowY [0]; + } + OS.memmove (x, new int[] {event.x}, 4); + OS.memmove (y, new int[] {event.y}, 4); + } + } return 0; } static int /*long*/ atkComponent_get_size (int /*long*/ atkObject, int /*long*/ width, int /*long*/ height, int /*long*/ coord_type) { if (DEBUG) System.out.println ("-->atkComponent_get_size"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; OS.memmove (width, new int[] {0}, 4); OS.memmove (height, new int[] {0}, 4); - if (ATK.g_type_is_a (object.parentType, ATK_COMPONENT_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_COMPONENT_GET_IFACE (object.handle)); - AtkComponentIface componentIface = new AtkComponentIface (); - ATK.memmove (componentIface, superType); - if (componentIface.get_extents != 0) { - ATK.call (componentIface.get_size, object.handle, width, height, coord_type); - } - } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return 0; - - int[] parentWidth = new int [1], parentHeight = new int [1]; - OS.memmove (parentWidth, width, 4); - OS.memmove (parentHeight, height, 4); - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - event.width = parentWidth [0]; event.height = parentHeight [0]; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getLocation (event); - } - OS.memmove (width, new int[] {event.width}, 4); - OS.memmove (height, new int[] {event.height}, 4); + AtkComponentIface iface = getComponentIface (atkObject); + if (iface != null && iface.get_size != 0) { + ATK.call (iface.get_size, atkObject, width, height, coord_type); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + int[] parentWidth = new int [1], parentHeight = new int [1]; + OS.memmove (parentWidth, width, 4); + OS.memmove (parentHeight, height, 4); + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + event.width = parentWidth [0]; event.height = parentHeight [0]; + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getLocation (event); + } + OS.memmove (width, new int[] {event.width}, 4); + OS.memmove (height, new int[] {event.height}, 4); + } + } return 0; } static int /*long*/ atkComponent_ref_accessible_at_point (int /*long*/ atkObject, int /*long*/ x, int /*long*/ y, int /*long*/ coord_type) { if (DEBUG) System.out.println ("-->atkComponent_ref_accessible_at_point"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - if (ATK.g_type_is_a (object.parentType, ATK_COMPONENT_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_COMPONENT_GET_IFACE (object.handle)); - AtkComponentIface componentIface = new AtkComponentIface (); - ATK.memmove (componentIface, superType); - if (componentIface.ref_accessible_at_point != 0) { - parentResult = ATK.call (componentIface.ref_accessible_at_point, object.handle, x, y, coord_type); - } - } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - event.x = (int)/*64*/x; event.y = (int)/*64*/y; - if (coord_type == ATK.ATK_XY_WINDOW) { - /* translate control -> display, for filling in the event to be dispatched */ - int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (object.handle); - GtkAccessible gtkAccessible = new GtkAccessible (); - ATK.memmove (gtkAccessible, gtkAccessibleHandle); - int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); - int[] topWindowX = new int [1], topWindowY = new int [1]; - OS.gdk_window_get_origin (window, topWindowX, topWindowY); - event.x += topWindowX [0]; - event.y += topWindowY [0]; - } - for (int i = 0; i < listeners.length; i++) { - listeners [i].getChildAtPoint (event); - } - if (event.childID == object.id) event.childID = ACC.CHILDID_SELF; - AccessibleObject accObj = object.getChildByID (event.childID); - if (accObj != null) { - if (parentResult > 0) OS.g_object_unref (parentResult); - OS.g_object_ref (accObj.handle); - return accObj.handle; + AtkComponentIface iface = getComponentIface (atkObject); + if (iface != null && iface.ref_accessible_at_point != 0) { + parentResult = ATK.call (iface.ref_accessible_at_point, atkObject, x, y, coord_type); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + event.x = (int)/*64*/x; event.y = (int)/*64*/y; + if (coord_type == ATK.ATK_XY_WINDOW) { + /* translate control -> display, for filling in the event to be dispatched */ + int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (atkObject); + GtkAccessible gtkAccessible = new GtkAccessible (); + ATK.memmove (gtkAccessible, gtkAccessibleHandle); + int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); + int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int[] topWindowX = new int [1], topWindowY = new int [1]; + OS.gdk_window_get_origin (window, topWindowX, topWindowY); + event.x += topWindowX [0]; + event.y += topWindowY [0]; + } + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getChildAtPoint (event); + } + if (event.childID == object.id) event.childID = ACC.CHILDID_SELF; + AccessibleObject accObj = object.getChildByID (event.childID); + if (accObj != null) { + if (parentResult > 0) OS.g_object_unref (parentResult); + OS.g_object_ref (accObj.handle); + return accObj.handle; + } + } } return parentResult; } + static AtkHypertextIface getHypertextIface (int /*long*/ atkObject) { + if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_HYPERTEXT())) { + AtkHypertextIface iface = new AtkHypertextIface (); + ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_HYPERTEXT_GET_IFACE (atkObject))); + return iface; + } + return null; + } + static int /*long*/ atkHypertext_get_link (int /*long*/ atkObject, int /*long*/ link_index) { if (DEBUG) System.out.println ("-->atkHypertext_get_link"); - return 0; + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.index = (int)/*int*/link_index; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getHyperlink(event); + } + Accessible result = event.accessible; + return result != null ? result.accessibleObject.handle : 0; + } + } + int /*long*/ parentResult = 0; + AtkHypertextIface iface = getHypertextIface (atkObject); + if (iface != null && iface.get_link != 0) { + parentResult = ATK.call (iface.get_link, atkObject, link_index); + } + return parentResult; } static int /*long*/ atkHypertext_get_n_links (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkHypertext_get_n_links"); - return 0; /* read hyperlink's name */ + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getHyperlinkCount(event); + } + return event.count; + } + } + int /*long*/ parentResult = 0; + AtkHypertextIface iface = getHypertextIface (atkObject); + if (iface != null && iface.get_n_links != 0) { + parentResult = ATK.call (iface.get_n_links, atkObject); + } + return parentResult; } static int /*long*/ atkHypertext_get_link_index (int /*long*/ atkObject, int /*long*/ char_index) { if (DEBUG) System.out.println ("-->atkHypertext_get_link_index"); - return 0; + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.offset = (int)/*int*/char_index; + event.index = -1; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getHyperlinkIndex(event); + } + return event.index; + } + } + int /*long*/ parentResult = 0; + AtkHypertextIface iface = getHypertextIface (atkObject); + if (iface != null && iface.get_link != 0) { + parentResult = ATK.call (iface.get_link, atkObject, char_index); + } + return parentResult; + } + + static AtkObjectClass getObjectClass (int /*long*/ atkObject) { + AtkObjectClass objectClass = new AtkObjectClass (); + ATK.memmove (objectClass, ATK.g_type_class_peek (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)))); + return objectClass; } static int /*long*/ atkObject_get_description (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkObject_get_description"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkObjectClass objectClass = new AtkObjectClass (); - ATK.memmove (objectClass, superType); + AtkObjectClass objectClass = getObjectClass (atkObject); if (objectClass.get_description != 0) { - parentResult = ATK.call (objectClass.get_description, object.handle); - } - AccessibleListener[] listeners = object.getAccessibleListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleEvent event = new AccessibleEvent (object.accessible); - event.childID = object.id; - if (parentResult != 0) { - int length = OS.strlen (parentResult); - byte [] buffer = new byte [length]; - OS.memmove (buffer, parentResult, length); - event.result = new String (Converter.mbcsToWcs (null, buffer)); - } - for (int i = 0; i < listeners.length; i++) { - listeners [i].getDescription (event); - } - if (event.result == null) return parentResult; - if (descriptionPtr != -1) OS.g_free (descriptionPtr); - byte[] name = Converter.wcsToMbcs (null, event.result, true); - descriptionPtr = OS.g_malloc (name.length); - OS.memmove (descriptionPtr, name, name.length); - return descriptionPtr; + parentResult = ATK.call (objectClass.get_description, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleEvent event = new AccessibleEvent (object.accessible); + event.childID = object.id; + if (parentResult != 0) event.result = getString (parentResult); + for (int i = 0; i < length; i++) { + AccessibleListener listener = (AccessibleListener)listeners.elementAt (i); + listener.getDescription (event); + } + if (event.result == null) return parentResult; + if (descriptionPtr != -1) OS.g_free (descriptionPtr); + return descriptionPtr = getStringPtr (event.result); + } + } + return parentResult; } static int /*long*/ atkObject_get_name (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkObject_get_name: " + atkObject); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkObjectClass objectClass = new AtkObjectClass (); - ATK.memmove (objectClass, superType); + AtkObjectClass objectClass = getObjectClass (atkObject); if (objectClass.get_name != 0) { - parentResult = ATK.call (objectClass.get_name, object.handle); - } - AccessibleListener[] listeners = object.getAccessibleListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleEvent event = new AccessibleEvent (object.accessible); - event.childID = object.id; - if (parentResult != 0) { - int length = OS.strlen (parentResult); - byte [] buffer = new byte [length]; - OS.memmove (buffer, parentResult, length); - event.result = new String (Converter.mbcsToWcs (null, buffer)); - } - for (int i = 0; i < listeners.length; i++) { - listeners [i].getName (event); - } - if (event.result == null) return parentResult; - if (namePtr != -1) OS.g_free (namePtr); - byte[] name = Converter.wcsToMbcs (null, event.result, true); - namePtr = OS.g_malloc (name.length); - OS.memmove (namePtr, name, name.length); - return namePtr; + parentResult = ATK.call (objectClass.get_name, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleEvent event = new AccessibleEvent (object.accessible); + event.childID = object.id; + if (parentResult != 0) event.result = getString (parentResult); + for (int i = 0; i < length; i++) { + AccessibleListener listener = (AccessibleListener)listeners.elementAt (i); + listener.getName (event); + } + if (event.result == null) return parentResult; + if (namePtr != -1) OS.g_free (namePtr); + return namePtr = getStringPtr (event.result); + } + } + return parentResult; } static int /*long*/ atkObject_get_n_children (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkObject_get_n_children: " + atkObject); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkObjectClass objectClass = new AtkObjectClass (); - ATK.memmove (objectClass, superType); + AtkObjectClass objectClass = getObjectClass (atkObject); if (objectClass.get_n_children != 0) { - parentResult = ATK.call (objectClass.get_n_children, object.handle); + parentResult = ATK.call (objectClass.get_n_children, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + event.detail = (int)/*64*/parentResult; + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getChildCount (event); + } + return event.detail; + } } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - event.detail = (int)/*64*/parentResult; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getChildCount (event); - } - return event.detail; + return parentResult; } static int /*long*/ atkObject_get_index_in_parent (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkObjectCB_get_index_in_parent. "); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - if (object.index != -1) return object.index; - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkObjectClass objectClass = new AtkObjectClass (); - ATK.memmove (objectClass, superType); + if (object != null) { + if (object.index != -1) return object.index; + } + AtkObjectClass objectClass = getObjectClass (atkObject); if (objectClass.get_index_in_parent == 0) return 0; - return ATK.call (objectClass.get_index_in_parent,object. handle); + return ATK.call (objectClass.get_index_in_parent, atkObject); } static int /*long*/ atkObject_get_parent (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkObject_get_parent: " + atkObject); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - if (object.parent != null) return object.parent.handle; - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkObjectClass objectClass = new AtkObjectClass (); - ATK.memmove (objectClass, superType); + if (object != null) { + if (object.parent != null) return object.parent.handle; + } + AtkObjectClass objectClass = getObjectClass (atkObject); if (objectClass.get_parent == 0) return 0; - return ATK.call (objectClass.get_parent, object.handle); + return ATK.call (objectClass.get_parent, atkObject); } static int /*long*/ atkObject_get_role (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkObject_get_role: " + atkObject); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - if (object.getAccessibleListeners ().length != 0) { - AccessibleControlListener[] listeners = object.getControlListeners (); - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - event.detail = -1; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getRole (event); - } - if (event.detail != -1) { - switch (event.detail) { - /* Convert from win32 role values to atk role values */ - case ACC.ROLE_CHECKBUTTON: return ATK.ATK_ROLE_CHECK_BOX; - case ACC.ROLE_CLIENT_AREA: return ATK.ATK_ROLE_DRAWING_AREA; - case ACC.ROLE_COMBOBOX: return ATK.ATK_ROLE_COMBO_BOX; - case ACC.ROLE_DIALOG: return ATK.ATK_ROLE_DIALOG; - case ACC.ROLE_LABEL: return ATK.ATK_ROLE_LABEL; - case ACC.ROLE_LINK: return ATK.ATK_ROLE_TEXT; - case ACC.ROLE_LIST: return ATK.ATK_ROLE_LIST; - case ACC.ROLE_LISTITEM: return ATK.ATK_ROLE_LIST_ITEM; - case ACC.ROLE_MENU: return ATK.ATK_ROLE_MENU; - case ACC.ROLE_MENUBAR: return ATK.ATK_ROLE_MENU_BAR; - case ACC.ROLE_MENUITEM: return ATK.ATK_ROLE_MENU_ITEM; - case ACC.ROLE_PROGRESSBAR: return ATK.ATK_ROLE_PROGRESS_BAR; - case ACC.ROLE_PUSHBUTTON: return ATK.ATK_ROLE_PUSH_BUTTON; - case ACC.ROLE_SCROLLBAR: return ATK.ATK_ROLE_SCROLL_BAR; - case ACC.ROLE_SEPARATOR: return ATK.ATK_ROLE_SEPARATOR; - case ACC.ROLE_SLIDER: return ATK.ATK_ROLE_SLIDER; - case ACC.ROLE_TABLE: return ATK.ATK_ROLE_LIST; - case ACC.ROLE_TABLECELL: return ATK.ATK_ROLE_LIST_ITEM; - case ACC.ROLE_TABLECOLUMNHEADER: return ATK.ATK_ROLE_TABLE_COLUMN_HEADER; - case ACC.ROLE_TABLEROWHEADER: return ATK.ATK_ROLE_TABLE_ROW_HEADER; - case ACC.ROLE_TABFOLDER: return ATK.ATK_ROLE_PAGE_TAB_LIST; - case ACC.ROLE_TABITEM: return ATK.ATK_ROLE_PAGE_TAB; - case ACC.ROLE_TEXT: return ATK.ATK_ROLE_TEXT; - case ACC.ROLE_TOOLBAR: return ATK.ATK_ROLE_TOOL_BAR; - case ACC.ROLE_TOOLTIP: return ATK.ATK_ROLE_TOOL_TIP; - case ACC.ROLE_TREE: return ATK.ATK_ROLE_TREE; - case ACC.ROLE_TREEITEM: return ATK.ATK_ROLE_LIST_ITEM; - case ACC.ROLE_RADIOBUTTON: return ATK.ATK_ROLE_RADIO_BUTTON; - case ACC.ROLE_SPLITBUTTON: return ATK.ATK_ROLE_PUSH_BUTTON; - case ACC.ROLE_WINDOW: return ATK.ATK_ROLE_WINDOW; - } - } - } - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkObjectClass objectClass = new AtkObjectClass (); - ATK.memmove (objectClass, superType); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + event.detail = -1; + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getRole (event); + } + if (event.detail != -1) { + switch (event.detail) { + /* Convert from win32 role values to atk role values */ + case ACC.ROLE_CHECKBUTTON: return ATK.ATK_ROLE_CHECK_BOX; + case ACC.ROLE_CLIENT_AREA: return ATK.ATK_ROLE_DRAWING_AREA; + case ACC.ROLE_COMBOBOX: return ATK.ATK_ROLE_COMBO_BOX; + case ACC.ROLE_DIALOG: return ATK.ATK_ROLE_DIALOG; + case ACC.ROLE_LABEL: return ATK.ATK_ROLE_LABEL; + case ACC.ROLE_LINK: return ATK.ATK_ROLE_TEXT; + case ACC.ROLE_LIST: return ATK.ATK_ROLE_LIST; + case ACC.ROLE_LISTITEM: return ATK.ATK_ROLE_LIST_ITEM; + case ACC.ROLE_MENU: return ATK.ATK_ROLE_MENU; + case ACC.ROLE_MENUBAR: return ATK.ATK_ROLE_MENU_BAR; + case ACC.ROLE_MENUITEM: return ATK.ATK_ROLE_MENU_ITEM; + case ACC.ROLE_PROGRESSBAR: return ATK.ATK_ROLE_PROGRESS_BAR; + case ACC.ROLE_PUSHBUTTON: return ATK.ATK_ROLE_PUSH_BUTTON; + case ACC.ROLE_SCROLLBAR: return ATK.ATK_ROLE_SCROLL_BAR; + case ACC.ROLE_SEPARATOR: return ATK.ATK_ROLE_SEPARATOR; + case ACC.ROLE_SLIDER: return ATK.ATK_ROLE_SLIDER; + case ACC.ROLE_TABLE: return ATK.ATK_ROLE_LIST; + case ACC.ROLE_TABLECELL: return ATK.ATK_ROLE_LIST_ITEM; + case ACC.ROLE_TABLECOLUMNHEADER: return ATK.ATK_ROLE_TABLE_COLUMN_HEADER; + case ACC.ROLE_TABLEROWHEADER: return ATK.ATK_ROLE_TABLE_ROW_HEADER; + case ACC.ROLE_TABFOLDER: return ATK.ATK_ROLE_PAGE_TAB_LIST; + case ACC.ROLE_TABITEM: return ATK.ATK_ROLE_PAGE_TAB; + case ACC.ROLE_TEXT: return ATK.ATK_ROLE_TEXT; + case ACC.ROLE_TOOLBAR: return ATK.ATK_ROLE_TOOL_BAR; + case ACC.ROLE_TOOLTIP: return ATK.ATK_ROLE_TOOL_TIP; + case ACC.ROLE_TREE: return ATK.ATK_ROLE_TREE; + case ACC.ROLE_TREEITEM: return ATK.ATK_ROLE_LIST_ITEM; + case ACC.ROLE_RADIOBUTTON: return ATK.ATK_ROLE_RADIO_BUTTON; + case ACC.ROLE_SPLITBUTTON: return ATK.ATK_ROLE_PUSH_BUTTON; + case ACC.ROLE_WINDOW: return ATK.ATK_ROLE_WINDOW; + } + } + } + } + AtkObjectClass objectClass = getObjectClass (atkObject); if (objectClass.get_role == 0) return 0; - return ATK.call (objectClass.get_role, object.handle); + return ATK.call (objectClass.get_role, atkObject); } static int /*long*/ atkObject_ref_child (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) System.out.println ("-->atkObject_ref_child: " + index + " of: " + atkObject); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - object.updateChildren (); - AccessibleObject accObject = object.getChildByIndex ((int)/*64*/index); - if (accObject != null) { - OS.g_object_ref (accObject.handle); - return accObject.handle; + if (object != null) { + object.updateChildren (); + AccessibleObject accObject = object.getChildByIndex ((int)/*64*/index); + if (accObject != null) { + OS.g_object_ref (accObject.handle); + return accObject.handle; + } } - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkObjectClass objectClass = new AtkObjectClass (); - ATK.memmove (objectClass, superType); + AtkObjectClass objectClass = getObjectClass (atkObject); if (objectClass.ref_child == 0) return 0; - return ATK.call (objectClass.ref_child, object.handle, index); + return ATK.call (objectClass.ref_child, atkObject, index); } static int /*long*/ atkObject_ref_state_set (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkObject_ref_state_set"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkObjectClass objectClass = new AtkObjectClass (); - ATK.memmove (objectClass, superType); + AtkObjectClass objectClass = getObjectClass (atkObject); if (objectClass.ref_state_set != 0) { - parentResult = ATK.call (objectClass.ref_state_set, object.handle); - } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return parentResult; - - int /*long*/ set = parentResult; - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - event.detail = -1; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getState (event); - } - if (event.detail != -1) { - /* Convert from win32 state values to atk state values */ - int state = event.detail; - if ((state & ACC.STATE_BUSY) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_BUSY); - if ((state & ACC.STATE_CHECKED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_CHECKED); - if ((state & ACC.STATE_EXPANDED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_EXPANDED); - if ((state & ACC.STATE_FOCUSABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_FOCUSABLE); - if ((state & ACC.STATE_FOCUSED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_FOCUSED); - if ((state & ACC.STATE_HOTTRACKED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_ARMED); - if ((state & ACC.STATE_INVISIBLE) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_VISIBLE); - if ((state & ACC.STATE_MULTISELECTABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_MULTISELECTABLE); - if ((state & ACC.STATE_OFFSCREEN) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SHOWING); - if ((state & ACC.STATE_PRESSED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_PRESSED); - if ((state & ACC.STATE_READONLY) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_EDITABLE); - if ((state & ACC.STATE_SELECTABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SELECTABLE); - if ((state & ACC.STATE_SELECTED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SELECTED); - if ((state & ACC.STATE_SIZEABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_RESIZABLE); - /* Note: STATE_COLLAPSED, STATE_LINKED and STATE_NORMAL have no ATK equivalents */ - } - return set; + parentResult = ATK.call (objectClass.ref_state_set, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + int /*long*/ set = parentResult; + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + event.detail = -1; + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getState (event); + } + if (event.detail != -1) { + /* Convert from win32 state values to atk state values */ + int state = event.detail; + if ((state & ACC.STATE_BUSY) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_BUSY); + if ((state & ACC.STATE_CHECKED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_CHECKED); + if ((state & ACC.STATE_EXPANDED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_EXPANDED); + if ((state & ACC.STATE_FOCUSABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_FOCUSABLE); + if ((state & ACC.STATE_FOCUSED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_FOCUSED); + if ((state & ACC.STATE_HOTTRACKED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_ARMED); + if ((state & ACC.STATE_INVISIBLE) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_VISIBLE); + if ((state & ACC.STATE_MULTISELECTABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_MULTISELECTABLE); + if ((state & ACC.STATE_OFFSCREEN) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SHOWING); + if ((state & ACC.STATE_PRESSED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_PRESSED); + if ((state & ACC.STATE_READONLY) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_EDITABLE); + if ((state & ACC.STATE_SELECTABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SELECTABLE); + if ((state & ACC.STATE_SELECTED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SELECTED); + if ((state & ACC.STATE_SIZEABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_RESIZABLE); + /* Note: STATE_COLLAPSED, STATE_LINKED and STATE_NORMAL have no ATK equivalents */ + } + return set; + } + } + return parentResult; } - + + static AtkSelectionIface getSelectionIface (int /*long*/ atkObject) { + if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_SELECTION())) { + AtkSelectionIface iface = new AtkSelectionIface (); + ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_SELECTION_GET_IFACE (atkObject))); + return iface; + } + return null; + } + static int /*long*/ atkSelection_is_child_selected (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) System.out.println ("-->atkSelection_is_child_selected"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - if (ATK.g_type_is_a (object.parentType, ATK_SELECTION_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_SELECTION_GET_IFACE (object.handle)); - AtkSelectionIface selectionIface = new AtkSelectionIface (); - ATK.memmove (selectionIface, superType); - if (selectionIface.is_child_selected != 0) { - parentResult = ATK.call (selectionIface.is_child_selected, object.handle, index); - } - } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getSelection (event); - } - AccessibleObject accessibleObject = object.getChildByID (event.childID); - if (accessibleObject != null) { - return accessibleObject.index == index ? 1 : 0; + AtkSelectionIface iface = getSelectionIface (atkObject); + if (iface != null && iface.is_child_selected != 0) { + parentResult = ATK.call (iface.is_child_selected, atkObject, index); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getSelection (event); + } + AccessibleObject accessibleObject = object.getChildByID (event.childID); + if (accessibleObject != null) { + return accessibleObject.index == index ? 1 : 0; + } + } } return parentResult; } @@ -595,29 +788,974 @@ class AccessibleObject { static int /*long*/ atkSelection_ref_selection (int /*long*/ atkObject, int /*long*/ index) { if (DEBUG) System.out.println ("-->atkSelection_ref_selection"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - if (ATK.g_type_is_a (object.parentType, ATK_SELECTION_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_SELECTION_GET_IFACE (object.handle)); - AtkSelectionIface selectionIface = new AtkSelectionIface (); - ATK.memmove (selectionIface, superType); - if (selectionIface.ref_selection != 0) { - parentResult = ATK.call (selectionIface.ref_selection, object.handle, index); - } - } - AccessibleControlListener[] listeners = object.getControlListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); - event.childID = object.id; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getSelection (event); - } - AccessibleObject accObj = object.getChildByID (event.childID); - if (accObj != null) { - if (parentResult > 0) OS.g_object_unref (parentResult); - OS.g_object_ref (accObj.handle); - return accObj.handle; + AtkSelectionIface iface = getSelectionIface (atkObject); + if (iface != null && iface.ref_selection != 0) { + parentResult = ATK.call (iface.ref_selection, atkObject, index); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleControlEvent event = new AccessibleControlEvent (object.accessible); + event.childID = object.id; + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getSelection (event); + } + AccessibleObject accObj = object.getChildByID (event.childID); + if (accObj != null) { + if (parentResult > 0) OS.g_object_unref (parentResult); + OS.g_object_ref (accObj.handle); + return accObj.handle; + } + } + } + return parentResult; + } + + static AtkTableIface getTableIface (int /*long*/ atkObject) { + if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_TABLE())) { + AtkTableIface iface = new AtkTableIface (); + ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_TABLE_GET_IFACE (atkObject))); + return iface; + } + return null; + } + + static int /*long*/ atkTable_ref_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_ref_at"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.ref_at != 0) { + parentResult = ATK.call (iface.ref_at, atkObject, row, column); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.row = (int)/*64*/row; + event.column = (int)/*64*/column; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getCell(event); + } + Accessible result = event.accessible; + if (result != null) { + if (parentResult != 0) OS.g_object_unref(parentResult); + OS.g_object_ref(result.accessibleObject.handle); + return result.accessibleObject.handle; + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_index_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_get_index_at"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.row = (int)/*64*/row; + event.column = (int)/*64*/column; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getCell(event); + } + Accessible result = event.accessible; + if (result == null) return -1; + event = new AccessibleTableEvent(accessible); + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getColumnCount(event); + } + return row * event.count + column; + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_index_at != 0) { + parentResult = ATK.call (iface.get_index_at, atkObject, row, column); + } + return parentResult; + } + + static int /*long*/ atkTable_get_column_at_index (int /*long*/ atkObject, int /*long*/ index) { + if (DEBUG) System.out.println ("-->atkTable_get_column_at_index"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getColumnCount(event); + } + return index % event.count; + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_column_at_index != 0) { + parentResult = ATK.call (iface.get_column_at_index, atkObject, index); + } + return parentResult; + } + + static int /*long*/ atkTable_get_row_at_index (int /*long*/ atkObject, int /*long*/ index) { + if (DEBUG) System.out.println ("-->atkTable_get_row_at_index"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getColumnCount(event); + } + return index / event.count; + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_row_at_index != 0) { + parentResult = ATK.call (iface.get_row_at_index, atkObject, index); + } + return parentResult; + } + + static int /*long*/ atkTable_get_n_columns (int /*long*/ atkObject) { + if (DEBUG) System.out.println ("-->atkTable_get_n_columns"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_n_columns != 0) { + parentResult = ATK.call (iface.get_n_columns, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.count = (int)/*64*/parentResult; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getColumnCount(event); + parentResult = event.count; + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_n_rows (int /*long*/ atkObject) { + if (DEBUG) System.out.println ("-->atkTable_get_n_rows"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_n_rows != 0) { + parentResult = ATK.call (iface.get_n_rows, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.count = (int)/*64*/parentResult; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getRowCount(event); + parentResult = event.count; + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_column_extent_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_get_column_extent_at"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_column_extent_at != 0) { + parentResult = ATK.call (iface.get_column_extent_at, atkObject, row, column); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.row = (int)/*64*/row; + event.column = (int)/*64*/column; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getCell(event); + } + Accessible result = event.accessible; + if (result != null) { + listeners = result.accessibleTableCellListeners; + AccessibleTableCellEvent cellEvent = new AccessibleTableCellEvent(result); + cellEvent.count = (int)/*64*/parentResult; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) listeners.elementAt(i); + listener.getColumnSpan(cellEvent); + } + return cellEvent.count; + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_row_extent_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_get_row_extent_at"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_row_extent_at != 0) { + parentResult = ATK.call (iface.get_row_extent_at, atkObject, row, column); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.row = (int)/*64*/row; + event.column = (int)/*64*/column; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getCell(event); + } + Accessible result = event.accessible; + if (result != null) { + listeners = result.accessibleTableCellListeners; + AccessibleTableCellEvent cellEvent = new AccessibleTableCellEvent(result); + cellEvent.count = (int)/*64*/parentResult; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) listeners.elementAt(i); + listener.getRowSpan(cellEvent); + } + return cellEvent.count; + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_caption (int /*long*/ atkObject) { + if (DEBUG) System.out.println ("-->atkTable_get_caption"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_caption != 0) { + parentResult = ATK.call (iface.get_caption, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getCaption(event); + } + Accessible result = event.accessible; + if (result != null) return result.accessibleObject.handle; + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_summary (int /*long*/ atkObject) { + if (DEBUG) System.out.println ("-->atkTable_get_summary"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_summary != 0) { + parentResult = ATK.call (iface.get_summary, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getSummary(event); + } + Accessible result = event.accessible; + if (result != null) return result.accessibleObject.handle; + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_column_description (int /*long*/ atkObject, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_get_column_description"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_column_description != 0) { + parentResult = ATK.call (iface.get_column_description, atkObject, column); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.column = (int)/*64*/column; + if (parentResult != 0) event.result = getString (parentResult); + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getColumnDescription(event); + } + if (event.result == null) return parentResult; + if (descriptionPtr != -1) OS.g_free (descriptionPtr); + return descriptionPtr = getStringPtr (event.result); + } + return parentResult; + } + + static int /*long*/ atkTable_get_column_header (int /*long*/ atkObject, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_get_column_header"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_column_header != 0) { + parentResult = ATK.call (iface.get_column_header, atkObject, column); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getRowHeaders(event); + } + Accessible[] accessibles = event.accessibles; + if (accessibles != null) { + if (0 <= column && column < accessibles.length) { + return accessibles[(int)/*64*/column].accessibleObject.handle; + } + } + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_row_description (int /*long*/ atkObject, int /*long*/ row) { + if (DEBUG) System.out.println ("-->atkTable_get_row_description"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_row_description != 0) { + parentResult = ATK.call (iface.get_row_description, atkObject, row); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.row = (int)/*64*/row; + if (parentResult != 0) event.result = getString (parentResult); + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getRowDescription(event); + } + if (event.result == null) return parentResult; + if (descriptionPtr != -1) OS.g_free (descriptionPtr); + return descriptionPtr = getStringPtr (event.result); + } + return parentResult; + } + + static int /*long*/ atkTable_get_row_header (int /*long*/ atkObject, int /*long*/ row) { + if (DEBUG) System.out.println ("-->atkTable_get_row_header"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_row_header != 0) { + parentResult = ATK.call (iface.get_row_header, atkObject, row); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getRowHeaders(event); + } + Accessible[] accessibles = event.accessibles; + if (accessibles != null) { + if (0 <= row && row < accessibles.length) { + return accessibles[(int)/*64*/row].accessibleObject.handle; + } + } + } + } + return parentResult; + } + + static int /*long*/ atkTable_get_selected_columns (int /*long*/ atkObject, int /*long*/ selected) { + if (DEBUG) System.out.println ("-->atkTable_get_selected_columns"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getSelectedColumns(event); + } + int count = event.selected != null ? event.selected.length : 0; + int /*long*/ result = OS.g_malloc(count * 4); + if (event.selected != null) OS.memmove(result, event.selected, count * 4); + if (selected != 0) OS.memmove(selected, new int /*long*/[]{result}, C.PTR_SIZEOF); + return count; + } + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_selected_columns != 0) { + parentResult = ATK.call (iface.get_selected_columns, atkObject, selected); + } + return parentResult; + } + + static int /*long*/ atkTable_get_selected_rows (int /*long*/ atkObject, int /*long*/ selected) { + if (DEBUG) System.out.println ("-->atkTable_get_selected_rows"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getSelectedRows(event); + } + int count = event.selected != null ? event.selected.length : 0; + int /*long*/ result = OS.g_malloc(count * 4); + if (event.selected != null) OS.memmove(result, event.selected, count * 4); + if (selected != 0) OS.memmove(selected, new int /*long*/[]{result}, C.PTR_SIZEOF); + return count; + } + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.get_selected_rows != 0) { + parentResult = ATK.call (iface.get_selected_rows, atkObject, selected); + } + return parentResult; + } + + static int /*long*/ atkTable_is_column_selected (int /*long*/ atkObject, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_is_column_selected"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.is_column_selected != 0) { + parentResult = ATK.call (iface.is_column_selected, atkObject, column); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.isSelected = parentResult != 0; + event.column = (int)/*64*/column; + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.isColumnSelected(event); + } + return event.isSelected ? 1 : 0; + } + } + return parentResult; + } + + static int /*long*/ atkTable_is_row_selected (int /*long*/ atkObject, int /*long*/ row) { + if (DEBUG) System.out.println ("-->atkTable_is_row_selected"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.is_row_selected != 0) { + parentResult = ATK.call (iface.is_row_selected, atkObject, row); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.isSelected = parentResult != 0; + event.row = (int)/*64*/row; + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.isRowSelected(event); + } + return event.isSelected ? 1 : 0; + } + } + return parentResult; + } + + static int /*long*/ atkTable_is_selected (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_is_selected"); + AccessibleObject object = getAccessibleObject (atkObject); + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.is_selected != 0) { + parentResult = ATK.call (iface.is_selected, atkObject, row, column); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.row = (int)/*64*/row; + event.column = (int)/*64*/column; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.getCell(event); + } + Accessible result = event.accessible; + if (result != null) { + listeners = result.accessibleTableCellListeners; + AccessibleTableCellEvent cellEvent = new AccessibleTableCellEvent(result); + cellEvent.isSelected = parentResult != 0; + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) listeners.elementAt(i); + listener.isSelected(cellEvent); + } + return cellEvent.isSelected ? 1 : 0; + } + } + return parentResult; + } + + static int /*long*/ atkTable_add_row_selection (int /*long*/ atkObject, int /*long*/ row) { + if (DEBUG) System.out.println ("-->atkTable_add_row_selection"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.column = (int)/*64*/row; + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.selectRow(event); + } + //TODO should listener return if it did it or not + return 1; + } + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.add_row_selection != 0) { + parentResult = ATK.call (iface.add_row_selection, atkObject, row); + } + return parentResult; + } + + static int /*long*/ atkTable_remove_row_selection (int /*long*/ atkObject, int /*long*/ row) { + if (DEBUG) System.out.println ("-->atkTable_remove_row_selection"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.row = (int)/*64*/row; + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.deselectRow(event); + } + //TODO should listener return if it did it or not + return 1; + } + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.remove_row_selection != 0) { + parentResult = ATK.call (iface.remove_row_selection, atkObject, row); + } + return parentResult; + } + + static int /*long*/ atkTable_add_column_selection (int /*long*/ atkObject, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_add_column_selection"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.column = (int)/*64*/column; + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.selectColumn(event); + } + //TODO should listener return if it did it or not + return 1; + } + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.add_column_selection != 0) { + parentResult = ATK.call (iface.add_column_selection, atkObject, column); + } + return parentResult; + } + + static int /*long*/ atkTable_remove_column_selection (int /*long*/ atkObject, int /*long*/ column) { + if (DEBUG) System.out.println ("-->atkTable_remove_column_selection"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTableListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTableEvent event = new AccessibleTableEvent(accessible); + event.column = (int)/*64*/column; + for (int i = 0; i < length; i++) { + AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i); + listener.deselectColumn(event); + } + //TODO should listener return if it did it or not + return 1; + } + } + int /*long*/ parentResult = 0; + AtkTableIface iface = getTableIface (atkObject); + if (iface != null && iface.remove_column_selection != 0) { + parentResult = ATK.call (iface.remove_column_selection, atkObject, column); + } + return parentResult; + } + + static AtkTextIface getTextIface (int /*long*/ atkObject) { + if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_TEXT())) { + AtkTextIface iface = new AtkTextIface (); + ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_TEXT_GET_IFACE (atkObject))); + return iface; + } + return null; + } + + static int /*long*/ atkText_get_character_extents (int /*long*/ atkObject, int /*long*/ offset, int /*long*/ x, int /*long*/ y, int /*long*/ width, int /*long*/ height, int /*long*/ coords) { + if (DEBUG) System.out.println ("-->atkText_get_character_extents"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.start = (int)/*64*/offset; + event.end = (int)/*64*/offset; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getTextBounds(event); + } + if (coords == ATK.ATK_XY_WINDOW) { + /* translate display -> control, for answering to the OS */ + int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (atkObject); + GtkAccessible gtkAccessible = new GtkAccessible (); + ATK.memmove (gtkAccessible, gtkAccessibleHandle); + int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); + int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int[] topWindowX = new int [1], topWindowY = new int [1]; + OS.gdk_window_get_origin (window, topWindowX, topWindowY); + event.x -= topWindowX [0]; + event.y -= topWindowY [0]; + } + OS.memmove (x, new int[]{event.x}, 4); + OS.memmove (y, new int[]{event.y}, 4); + OS.memmove (width, new int[]{event.width}, 4); + OS.memmove (height, new int[]{event.height}, 4); + return 0; + } + } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_character_extents != 0) { + ATK.call (iface.get_character_extents, atkObject, offset, x, y, width, height, coords); + } + return 0; + } + + static String getString (int /*long*/ strPtr) { + int length = OS.strlen (strPtr); + byte [] buffer = new byte [length]; + OS.memmove (buffer, strPtr, length); + return new String (Converter.mbcsToWcs (null, buffer)); + } + + static int /*long*/ getStringPtr (String str) { + byte [] buffer = Converter.wcsToMbcs(null, str != null ? str : "", true); + int /*long*/ ptr = OS.g_malloc(buffer.length); + OS.memmove(ptr, buffer, buffer.length); + return ptr; + } + + static int /*long*/ atkText_get_run_attributes (int /*long*/ atkObject, int /*long*/ offset, int /*long*/ start_offset, int /*long*/ end_offset) { + if (DEBUG) System.out.println ("-->atkText_get_run_attributes"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleAttributeListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextAttributeEvent event = new AccessibleTextAttributeEvent(accessible); + event.offset = (int)/*64*/offset; + for (int i = 0; i < length; i++) { + AccessibleAttributeListener listener = (AccessibleAttributeListener) listeners.elementAt(i); + listener.getTextAttributes(event); + } + OS.memmove (start_offset, new int []{event.start}, 4); + OS.memmove (end_offset, new int []{event.end + 1}, 4); + TextStyle style = event.textStyle; + if (style == null) return 0; + int /*long*/ result = 0; + AtkAttribute attr = new AtkAttribute(); + if (style.rise != 0) { + int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_RISE)); + attr.value = getStringPtr (String.valueOf(style.rise)); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + } + if (style.underline) { + int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_UNDERLINE)); + String str = "none"; + switch (style.underlineStyle) { + case SWT.UNDERLINE_DOUBLE: str = "double"; break; + case SWT.UNDERLINE_SINGLE: str = "single"; break; + case SWT.UNDERLINE_ERROR: str = "error"; break; + case SWT.UNDERLINE_SQUIGGLE: str = "squiggle"; break; + } + attr.value = getStringPtr (str); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + } + if (style.strikeout) { + int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRIKETHROUGH)); + attr.value = getStringPtr ("1"); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + } + Font font = style.font; + if (font != null && !font.isDisposed()) { + //TODO language and direction + int /*long*/ attrPtr; + attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_FAMILY_NAME)); + attr.value = ATK.g_strdup (OS.pango_font_description_get_family (font.handle)); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + + attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_SIZE)); + attr.value = getStringPtr (String.valueOf (OS.pango_font_description_get_size(font.handle) / OS.PANGO_SCALE)); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + + attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STYLE)); + attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_STYLE, OS.pango_font_description_get_style(font.handle))); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + + attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_VARIANT)); + attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_VARIANT, OS.pango_font_description_get_variant(font.handle))); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + + attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRETCH)); + attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_STRETCH, OS.pango_font_description_get_stretch(font.handle))); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + + attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_WEIGHT)); + attr.value = getStringPtr (String.valueOf (OS.pango_font_description_get_weight(font.handle))); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + } + Color color = style.foreground; + if (color != null && !color.isDisposed()) { + int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_FG_COLOR)); + attr.value = getStringPtr ((color.handle.red & 0xFFFF) + "," + (color.handle.blue & 0xFFFF) + "," + (color.handle.blue & 0xFFFF)); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + } + color = style.background; + if (color != null && !color.isDisposed()) { + int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); + attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_BG_COLOR)); + attr.value = getStringPtr ((color.handle.red & 0xFFFF) + "," + (color.handle.blue & 0xFFFF) + "," + (color.handle.blue & 0xFFFF)); + ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); + result = OS.g_list_append(result, attrPtr); + } + return result; + } + } + int /*long*/ parentResult = 0; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_run_attributes != 0) { + parentResult = ATK.call (iface.get_run_attributes, atkObject, offset, start_offset, end_offset); + } + return parentResult; + } + + static int /*long*/ atkText_get_offset_at_point (int /*long*/ atkObject, int /*long*/ x, int /*long*/ y, int /*long*/ coords) { + if (DEBUG) System.out.println ("-->atkText_get_offset_at_point"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.x = (int)/*64*/x; + event.y = (int)/*64*/y; + if (coords == ATK.ATK_XY_WINDOW) { + /* translate control -> display, for filling in event to be dispatched */ + int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (atkObject); + GtkAccessible gtkAccessible = new GtkAccessible (); + ATK.memmove (gtkAccessible, gtkAccessibleHandle); + int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); + int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int[] topWindowX = new int [1], topWindowY = new int [1]; + OS.gdk_window_get_origin (window, topWindowX, topWindowY); + event.x += topWindowX [0]; + event.y += topWindowY [0]; + } + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getOffsetAtPoint(event); + } + return event.offset; + } + } + int /*long*/ parentResult = 0; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_offset_at_point != 0) { + parentResult = ATK.call (iface.get_offset_at_point, atkObject, x, y, coords); + } + return parentResult; + } + + static int /*long*/ atkText_add_selection (int /*long*/ atkObject, int /*long*/ start_offset, int /*long*/ end_offset) { + if (DEBUG) System.out.println ("-->atkText_add_selection"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.start = (int)/*64*/start_offset; + event.end = (int)/*64*/(end_offset - 1); + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.addSelection(event); + } + //TODO should listener say it did or not + return 1; + } + } + int /*long*/ parentResult = 0; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.add_selection != 0) { + parentResult = ATK.call (iface.add_selection, atkObject, start_offset, end_offset); + } + return parentResult; + } + + static int /*long*/ atkText_remove_selection (int /*long*/ atkObject, int /*long*/ selection_num) { + if (DEBUG) System.out.println ("-->atkText_remove_selection"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.index = (int)/*64*/selection_num; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.removeSelection(event); + } + //TODO should listener say it did or not + return 1; + } + } + int /*long*/ parentResult = 0; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.remove_selection != 0) { + parentResult = ATK.call (iface.remove_selection, atkObject, selection_num); + } + return parentResult; + } + + static int /*long*/ atkText_set_caret_offset (int /*long*/ atkObject, int /*long*/ offset) { + if (DEBUG) System.out.println ("-->atkText_gset_character_offset"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.offset = (int)/*64*/offset; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.setCaretOffset(event); + } + //TODO should listener say it did or not + return 1; + } + } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_character_at_offset != 0) { + return ATK.call (iface.get_character_at_offset, atkObject, offset); + } + return 0; + } + + static int /*long*/ atkText_set_selection (int /*long*/ atkObject, int /*long*/ selection_num, int /*long*/ start_offset, int /*long*/ end_offset) { + if (DEBUG) System.out.println ("-->atkText_set_selection"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.index = (int)/*64*/selection_num; + event.start = (int)/*64*/start_offset; + event.end = (int)/*64*/(end_offset - 1); + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.setSelection(event); + } + //TODO should listener say it did or not + return 1; + } + } + int /*long*/ parentResult = 0; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.set_selection != 0) { + parentResult = ATK.call (iface.set_selection, atkObject, selection_num, start_offset, end_offset); } return parentResult; } @@ -625,41 +1763,124 @@ class AccessibleObject { static int /*long*/ atkText_get_caret_offset (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkText_get_caret_offset"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; int /*long*/ parentResult = 0; - if (ATK.g_type_is_a (object.parentType, ATK_TEXT_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_TEXT_GET_IFACE (object.handle)); - AtkTextIface textIface = new AtkTextIface (); - ATK.memmove (textIface, superType); - if (textIface.get_caret_offset != 0) { - parentResult = ATK.call (textIface.get_caret_offset, object.handle); - } - } - AccessibleTextListener[] listeners = object.getTextListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleTextEvent event = new AccessibleTextEvent (object.accessible); - event.childID = object.id; - event.offset = (int)/*64*/parentResult; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getCaretOffset (event); - } - return event.offset; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_caret_offset != 0) { + parentResult = ATK.call (iface.get_caret_offset, atkObject); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getCaretOffset (event); + } + return event.offset; + } + listeners = accessible.accessibleTextListeners; + length = listeners.size(); + if (length > 0) { + AccessibleTextEvent event = new AccessibleTextEvent (object.accessible); + event.childID = object.id; + event.offset = (int)/*64*/parentResult; + for (int i = 0; i < length; i++) { + AccessibleTextListener listener = (AccessibleTextListener) listeners.elementAt(i); + listener.getCaretOffset (event); + } + return event.offset; + } + } + return parentResult; + } + + static int /*long*/ atkText_get_bounded_ranges (int /*long*/ atkObject, int /*long*/ rect, int /*long*/ coord_type, int /*long*/ x_clip_type, int /*long*/ y_clip_type) { + if (DEBUG) System.out.println ("-->atkText_get_bounded_ranges"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + AtkTextRectangle atkRect = new AtkTextRectangle(); + ATK.memmove (atkRect, rect, AtkTextRectangle.sizeof); + event.x = atkRect.x; + event.y = atkRect.y; + event.width = atkRect.width; + event.height = atkRect.height; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getRanges (event); + } + int [] ranges = event.ranges; + int size = ranges == null ? 1 : ranges.length / 2; + int /*long*/ result = OS.malloc(size * AtkTextRange.sizeof); + AtkTextRange range = new AtkTextRange(); + for (int j = 0, end = (ranges != null ? ranges.length / 2 : 1); j < end; j++) { + if (ranges != null) { + int index = j * 2; + event.start = ranges[index]; + event.end = ranges[index+1]; + } + event.count = 0; + event.type = ACC.TEXT_BOUNDARY_ALL; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getText(event); + } + range.start_offset = event.start; + range.end_offset = event.end + 1; + range.content = getStringPtr (event.result); + event.result = null; + event.count = event.type = event.x = event.y = event.width = event.height = 0; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getTextBounds(event); + } + range.bounds.x = event.x; + range.bounds.y = event.y; + range.bounds.width = event.width; + range.bounds.height = event.height; + ATK.memmove(result + j * AtkTextRange.sizeof, range, AtkTextRange.sizeof); + } + return result; + } + } + int /*long*/ parentResult = 0; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_bounded_ranges != 0) { + parentResult = ATK.call (iface.get_bounded_ranges, atkObject); + } + return parentResult; } static int /*long*/ atkText_get_character_at_offset (int /*long*/ atkObject, int /*long*/ offset) { if (DEBUG) System.out.println ("-->atkText_get_character_at_offset"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - String text = object.getText (); - if (text != null) return text.charAt ((int)/*64*/offset); // TODO - if (ATK.g_type_is_a (object.parentType, ATK_TEXT_TYPE)) { - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkTextIface textIface = new AtkTextIface (); - ATK.memmove (textIface, superType); - if (textIface.get_character_at_offset != 0) { - return ATK.call (textIface.get_character_at_offset, object.handle, offset); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.start = event.end = (int)/*64*/offset; + event.type = ACC.TEXT_BOUNDARY_CHAR; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getText(event); + } + String text = event.result; + if (text != null && text.length() > 0) return text.charAt(0); } + String text = object.getText (); + if (text != null) return text.charAt ((int)/*64*/offset); + } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_character_at_offset != 0) { + return ATK.call (iface.get_character_at_offset, atkObject, offset); } return 0; } @@ -667,16 +1888,24 @@ class AccessibleObject { static int /*long*/ atkText_get_character_count (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkText_get_character_count"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - String text = object.getText (); - if (text != null) return text.length (); - if (ATK.g_type_is_a (object.parentType, ATK_TEXT_TYPE)) { - int /*long*/ superType = ATK.g_type_class_peek (object.parentType); - AtkTextIface textIface = new AtkTextIface (); - ATK.memmove (textIface, superType); - if (textIface.get_character_count != 0) { - return ATK.call (textIface.get_character_count, object.handle); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getCharacterCount(event); + } + return event.count; } + String text = object.getText (); + if (text != null) return text.length (); + } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_character_count != 0) { + return ATK.call (iface.get_character_count, atkObject); } return 0; } @@ -684,77 +1913,130 @@ class AccessibleObject { static int /*long*/ atkText_get_n_selections (int /*long*/ atkObject) { if (DEBUG) System.out.println ("-->atkText_get_n_selections"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - int /*long*/ parentResult = 0; - if (ATK.g_type_is_a (object.parentType, ATK_TEXT_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_TEXT_GET_IFACE (object.handle)); - AtkTextIface textIface = new AtkTextIface (); - ATK.memmove (textIface, superType); - if (textIface.get_n_selections != 0) { - parentResult = ATK.call (textIface.get_n_selections, object.handle); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getSelectionCount (event); + } + return event.count; + } + listeners = accessible.accessibleTextListeners; + length = listeners.size(); + if (length > 0) { + AccessibleTextEvent event = new AccessibleTextEvent (object.accessible); + event.childID = object.id; + for (int i = 0; i < length; i++) { + AccessibleTextListener listener = (AccessibleTextListener) listeners.elementAt(i); + listener.getSelectionRange (event); + } + if (event.length > 0) return 1; } } - AccessibleTextListener[] listeners = object.getTextListeners (); - if (listeners.length == 0) return parentResult; - - AccessibleTextEvent event = new AccessibleTextEvent (object.accessible); - event.childID = object.id; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getSelectionRange (event); + int /*long*/ parentResult = 0; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_n_selections != 0) { + parentResult = ATK.call (iface.get_n_selections, atkObject); } - return event.length == 0 ? parentResult : 1; + return parentResult; } static int /*long*/ atkText_get_selection (int /*long*/ atkObject, int /*long*/ selection_num, int /*long*/ start_offset, int /*long*/ end_offset) { if (DEBUG) System.out.println ("-->atkText_get_selection"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; + int /*long*/ parentResult = 0; OS.memmove (start_offset, new int[] {0}, 4); OS.memmove (end_offset, new int[] {0}, 4); - if (ATK.g_type_is_a (object.parentType, ATK_TEXT_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_TEXT_GET_IFACE (object.handle)); - AtkTextIface textIface = new AtkTextIface (); - ATK.memmove (textIface, superType); - if (textIface.get_selection != 0) { - ATK.call (textIface.get_selection, object.handle, selection_num, start_offset, end_offset); - } - } - AccessibleTextListener[] listeners = object.getTextListeners (); - if (listeners.length == 0) return 0; - - AccessibleTextEvent event = new AccessibleTextEvent (object.accessible); - event.childID = object.id; - int[] parentStart = new int [1]; - int[] parentEnd = new int [1]; - OS.memmove (parentStart, start_offset, 4); - OS.memmove (parentEnd, end_offset, 4); - event.offset = parentStart [0]; - event.length = parentEnd [0] - parentStart [0]; - for (int i = 0; i < listeners.length; i++) { - listeners [i].getSelectionRange (event); - } - OS.memmove (start_offset, new int[] {event.offset}, 4); - OS.memmove (end_offset, new int[] {event.offset + event.length}, 4); - return 0; + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_selection != 0) { + parentResult = ATK.call (iface.get_selection, atkObject, selection_num, start_offset, end_offset); + } + if (object != null) { + int[] parentStart = new int [1]; + int[] parentEnd = new int [1]; + OS.memmove (parentStart, start_offset, 4); + OS.memmove (parentEnd, end_offset, 4); + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.index = (int)/*64*/selection_num; + event.start = parentStart[0]; + event.end = parentEnd[0] - 1; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getSelection (event); + } + parentStart [0] = event.start; + parentEnd [0] = event.end + 1; + OS.memmove (start_offset, parentStart, 4); + OS.memmove (end_offset, parentEnd, 4); + event.count = event.index = 0; + event.type = ACC.TEXT_BOUNDARY_ALL; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getText(event); + } + return getStringPtr (event.result); + } + if (selection_num == 0) { + listeners = accessible.accessibleTextListeners; + length = listeners.size(); + if (length > 0) { + AccessibleTextEvent event = new AccessibleTextEvent (accessible); + event.childID = object.id; + event.offset = parentStart [0]; + event.length = parentEnd [0] - parentStart [0]; + for (int i = 0; i < length; i++) { + AccessibleTextListener listener = (AccessibleTextListener) listeners.elementAt(i); + listener.getSelectionRange (event); + } + OS.memmove (start_offset, new int[] {event.offset}, 4); + OS.memmove (end_offset, new int[] {event.offset + event.length}, 4); + //TODO return the selected text, should we free parent result + return 0; + } + } + } + return parentResult; } static int /*long*/ atkText_get_text (int /*long*/ atkObject, int /*long*/ start_offset, int /*long*/ end_offset) { if (DEBUG) System.out.println ("-->atkText_get_text: " + start_offset + "," + end_offset); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - String text = object.getText (); - if (text.length () > 0) { - if (end_offset == -1) { - end_offset = text.length (); - } else { - end_offset = Math.min (end_offset, text.length ()); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + if (event.start != event.end) { + event.start = (int)/*64*/start_offset; + event.end = (int)/*64*/(end_offset - 1); + event.type = ACC.TEXT_BOUNDARY_ALL; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getText(event); + } + } + return getStringPtr (event.result); + } + String text = object.getText (); + if (text != null && text.length () > 0) { + if (end_offset == -1) { + end_offset = text.length (); + } else { + end_offset = Math.min (end_offset, text.length ()); + } + start_offset = Math.min (start_offset, end_offset); + text = text.substring ((int)/*64*/start_offset, (int)/*64*/end_offset); + return getStringPtr (text); } - start_offset = Math.min (start_offset, end_offset); - text = text.substring ((int)/*64*/start_offset, (int)/*64*/end_offset); - byte[] bytes = Converter.wcsToMbcs (null, text, true); - int /*long*/ result = OS.g_malloc (bytes.length); - OS.memmove (result, bytes, bytes.length); - return result; } return 0; } @@ -762,417 +2044,601 @@ class AccessibleObject { static int /*long*/ atkText_get_text_after_offset (int /*long*/ atkObject, int /*long*/ offset_value, int /*long*/ boundary_type, int /*long*/ start_offset, int /*long*/ end_offset) { if (DEBUG) System.out.println ("-->atkText_get_text_after_offset"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - int offset = (int)/*64*/offset_value; - String text = object.getText (); - if (text.length () > 0) { - int length = text.length (); - offset = Math.min (offset, length - 1); - int startBounds = offset; - int endBounds = offset; - switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_CHAR: { - if (length > offset) endBounds++; - break; - } - case ATK.ATK_TEXT_BOUNDARY_WORD_START: { - int wordStart1 = nextIndexOfChar (text, " !?.\n", offset - 1); - if (wordStart1 == -1) { - startBounds = endBounds = length; - break; - } - wordStart1 = nextIndexOfNotChar (text, " !?.\n", wordStart1); - if (wordStart1 == length) { - startBounds = endBounds = length; - break; - } - startBounds = wordStart1; - int wordStart2 = nextIndexOfChar (text, " !?.\n", wordStart1); - if (wordStart2 == -1) { - endBounds = length; - break; - } - endBounds = nextIndexOfNotChar (text, " !?.\n", wordStart2); - break; + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.start = event.end = (int)/*64*/offset_value; + event.count = 1; + switch ((int)/*64*/boundary_type) { + case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; } - case ATK.ATK_TEXT_BOUNDARY_WORD_END: { - int previousWordEnd = previousIndexOfNotChar (text, " \n", offset); - if (previousWordEnd == -1 || previousWordEnd != offset - 1) { - offset = nextIndexOfNotChar (text, " \n", offset); - } - if (offset == -1) { - startBounds = endBounds = length; - break; - } - int wordEnd1 = nextIndexOfChar (text, " !?.\n", (int)/*64*/offset); - if (wordEnd1 == -1) { - startBounds = endBounds = length; - break; - } - wordEnd1 = nextIndexOfNotChar (text, "!?.", wordEnd1); - if (wordEnd1 == length) { - startBounds = endBounds = length; - break; - } - startBounds = wordEnd1; - int wordEnd2 = nextIndexOfNotChar (text, " \n", wordEnd1); - if (wordEnd2 == length) { - startBounds = endBounds = length; - break; - } - wordEnd2 = nextIndexOfChar (text, " !?.\n", wordEnd2); - if (wordEnd2 == -1) { - endBounds = length; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getText(event); + } + OS.memmove (start_offset, new int[] {event.start}, 4); + OS.memmove (end_offset, new int[] {event.end}, 4); + return getStringPtr (event.result); + } + int offset = (int)/*64*/offset_value; + String text = object.getText (); + if (text != null && text.length () > 0) { + length = text.length (); + offset = Math.min (offset, length - 1); + int startBounds = offset; + int endBounds = offset; + switch ((int)/*64*/boundary_type) { + case ATK.ATK_TEXT_BOUNDARY_CHAR: { + if (length > offset) endBounds++; break; } - endBounds = nextIndexOfNotChar (text, "!?.", wordEnd2); - break; - } - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: { - int previousSentenceEnd = previousIndexOfChar (text, "!?.", offset); - int previousText = previousIndexOfNotChar (text, " !?.\n", offset); - int sentenceStart1 = 0; - if (previousSentenceEnd >= previousText) { - sentenceStart1 = nextIndexOfNotChar (text, " !?.\n", offset); - } else { - sentenceStart1 = nextIndexOfChar (text, "!?.", offset); - if (sentenceStart1 == -1) { + case ATK.ATK_TEXT_BOUNDARY_WORD_START: { + int wordStart1 = nextIndexOfChar (text, " !?.\n", offset - 1); + if (wordStart1 == -1) { startBounds = endBounds = length; break; } - sentenceStart1 = nextIndexOfNotChar (text, " !?.\n", sentenceStart1); - } - if (sentenceStart1 == length) { - startBounds = endBounds = length; + wordStart1 = nextIndexOfNotChar (text, " !?.\n", wordStart1); + if (wordStart1 == length) { + startBounds = endBounds = length; + break; + } + startBounds = wordStart1; + int wordStart2 = nextIndexOfChar (text, " !?.\n", wordStart1); + if (wordStart2 == -1) { + endBounds = length; + break; + } + endBounds = nextIndexOfNotChar (text, " !?.\n", wordStart2); break; } - startBounds = sentenceStart1; - int sentenceStart2 = nextIndexOfChar (text, "!?.", sentenceStart1); - if (sentenceStart2 == -1) { - endBounds = length; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: { + int previousWordEnd = previousIndexOfNotChar (text, " \n", offset); + if (previousWordEnd == -1 || previousWordEnd != offset - 1) { + offset = nextIndexOfNotChar (text, " \n", offset); + } + if (offset == -1) { + startBounds = endBounds = length; + break; + } + int wordEnd1 = nextIndexOfChar (text, " !?.\n", (int)/*64*/offset); + if (wordEnd1 == -1) { + startBounds = endBounds = length; + break; + } + wordEnd1 = nextIndexOfNotChar (text, "!?.", wordEnd1); + if (wordEnd1 == length) { + startBounds = endBounds = length; + break; + } + startBounds = wordEnd1; + int wordEnd2 = nextIndexOfNotChar (text, " \n", wordEnd1); + if (wordEnd2 == length) { + startBounds = endBounds = length; + break; + } + wordEnd2 = nextIndexOfChar (text, " !?.\n", wordEnd2); + if (wordEnd2 == -1) { + endBounds = length; + break; + } + endBounds = nextIndexOfNotChar (text, "!?.", wordEnd2); break; } - endBounds = nextIndexOfNotChar (text, " !?.\n", sentenceStart2); - break; - } - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: { - int sentenceEnd1 = nextIndexOfChar (text, "!?.", offset); - if (sentenceEnd1 == -1) { - startBounds = endBounds = length; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: { + int previousSentenceEnd = previousIndexOfChar (text, "!?.", offset); + int previousText = previousIndexOfNotChar (text, " !?.\n", offset); + int sentenceStart1 = 0; + if (previousSentenceEnd >= previousText) { + sentenceStart1 = nextIndexOfNotChar (text, " !?.\n", offset); + } else { + sentenceStart1 = nextIndexOfChar (text, "!?.", offset); + if (sentenceStart1 == -1) { + startBounds = endBounds = length; + break; + } + sentenceStart1 = nextIndexOfNotChar (text, " !?.\n", sentenceStart1); + } + if (sentenceStart1 == length) { + startBounds = endBounds = length; + break; + } + startBounds = sentenceStart1; + int sentenceStart2 = nextIndexOfChar (text, "!?.", sentenceStart1); + if (sentenceStart2 == -1) { + endBounds = length; + break; + } + endBounds = nextIndexOfNotChar (text, " !?.\n", sentenceStart2); break; } - sentenceEnd1 = nextIndexOfNotChar (text, "!?.", sentenceEnd1); - if (sentenceEnd1 == length) { - startBounds = endBounds = length; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: { + int sentenceEnd1 = nextIndexOfChar (text, "!?.", offset); + if (sentenceEnd1 == -1) { + startBounds = endBounds = length; + break; + } + sentenceEnd1 = nextIndexOfNotChar (text, "!?.", sentenceEnd1); + if (sentenceEnd1 == length) { + startBounds = endBounds = length; + break; + } + startBounds = sentenceEnd1; + int sentenceEnd2 = nextIndexOfNotChar (text, " \n", sentenceEnd1); + if (sentenceEnd2 == length) { + startBounds = endBounds = length; + break; + } + sentenceEnd2 = nextIndexOfChar (text, "!?.", sentenceEnd2); + if (sentenceEnd2 == -1) { + endBounds = length; + break; + } + endBounds = nextIndexOfNotChar (text, "!?.", sentenceEnd2); break; } - startBounds = sentenceEnd1; - int sentenceEnd2 = nextIndexOfNotChar (text, " \n", sentenceEnd1); - if (sentenceEnd2 == length) { - startBounds = endBounds = length; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: { + int lineStart1 = text.indexOf ('\n', offset - 1); + if (lineStart1 == -1) { + startBounds = endBounds = length; + break; + } + lineStart1 = nextIndexOfNotChar (text, "\n", lineStart1); + if (lineStart1 == length) { + startBounds = endBounds = length; + break; + } + startBounds = lineStart1; + int lineStart2 = text.indexOf ('\n', lineStart1); + if (lineStart2 == -1) { + endBounds = length; + break; + } + lineStart2 = nextIndexOfNotChar (text, "\n", lineStart2); + endBounds = lineStart2; break; } - sentenceEnd2 = nextIndexOfChar (text, "!?.", sentenceEnd2); - if (sentenceEnd2 == -1) { - endBounds = length; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: { + int lineEnd1 = nextIndexOfChar (text, "\n", offset); + if (lineEnd1 == -1) { + startBounds = endBounds = length; + break; + } + startBounds = lineEnd1; + if (startBounds == length) { + endBounds = length; + break; + } + int lineEnd2 = nextIndexOfChar (text, "\n", lineEnd1 + 1); + if (lineEnd2 == -1) { + endBounds = length; + break; + } + endBounds = lineEnd2; break; } - endBounds = nextIndexOfNotChar (text, "!?.", sentenceEnd2); - break; } - case ATK.ATK_TEXT_BOUNDARY_LINE_START: { - int lineStart1 = text.indexOf ('\n', offset - 1); - if (lineStart1 == -1) { - startBounds = endBounds = length; - break; - } - lineStart1 = nextIndexOfNotChar (text, "\n", lineStart1); - if (lineStart1 == length) { - startBounds = endBounds = length; - break; - } - startBounds = lineStart1; - int lineStart2 = text.indexOf ('\n', lineStart1); - if (lineStart2 == -1) { - endBounds = length; - break; - } - lineStart2 = nextIndexOfNotChar (text, "\n", lineStart2); - endBounds = lineStart2; - break; - } - case ATK.ATK_TEXT_BOUNDARY_LINE_END: { - int lineEnd1 = nextIndexOfChar (text, "\n", offset); - if (lineEnd1 == -1) { - startBounds = endBounds = length; - break; - } - startBounds = lineEnd1; - if (startBounds == length) { - endBounds = length; - break; - } - int lineEnd2 = nextIndexOfChar (text, "\n", lineEnd1 + 1); - if (lineEnd2 == -1) { - endBounds = length; - break; - } - endBounds = lineEnd2; - break; - } - } - OS.memmove (start_offset, new int[] {startBounds}, 4); - OS.memmove (end_offset, new int[] {endBounds}, 4); - text = text.substring (startBounds, endBounds); - byte[] bytes = Converter.wcsToMbcs (null, text, true); - int /*long*/ result = OS.g_malloc (bytes.length); - OS.memmove (result, bytes, bytes.length); - return result; - } + OS.memmove (start_offset, new int[] {startBounds}, 4); + OS.memmove (end_offset, new int[] {endBounds}, 4); + text = text.substring (startBounds, endBounds); + return getStringPtr (text); + } + } return 0; } static int /*long*/ atkText_get_text_at_offset (int /*long*/ atkObject, int /*long*/ offset_value, int /*long*/ boundary_type, int /*long*/ start_offset, int /*long*/ end_offset) { if (DEBUG) System.out.println ("-->atkText_get_text_at_offset: " + offset_value + " start: " + start_offset + " end: " + end_offset); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - int offset = (int)/*64*/offset_value; - String text = object.getText (); - if (text.length () > 0) { - int length = text.length (); - offset = Math.min (offset, length - 1); - int startBounds = offset; - int endBounds = offset; - switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_CHAR: { - if (length > offset) endBounds++; - break; - } - case ATK.ATK_TEXT_BOUNDARY_WORD_START: { - int wordStart1 = previousIndexOfNotChar (text, " !?.\n", offset); - if (wordStart1 == -1) { - startBounds = endBounds = 0; - break; - } - wordStart1 = previousIndexOfChar (text, " !?.\n", wordStart1) + 1; - if (wordStart1 == -1) { - startBounds = 0; - break; - } - startBounds = wordStart1; - int wordStart2 = nextIndexOfChar (text, " !?.\n", wordStart1); - endBounds = nextIndexOfNotChar (text, " !?.\n", wordStart2); - break; - } - case ATK.ATK_TEXT_BOUNDARY_WORD_END: { - int wordEnd1 = previousIndexOfNotChar (text, "!?.", offset + 1); - wordEnd1 = previousIndexOfChar (text, " !?.\n", wordEnd1); - wordEnd1 = previousIndexOfNotChar (text, " \n", wordEnd1 + 1); - if (wordEnd1 == -1) { - startBounds = endBounds = 0; - break; - } - startBounds = wordEnd1 + 1; - int wordEnd2 = nextIndexOfNotChar (text, " \n", startBounds); - if (wordEnd2 == length) { - endBounds = startBounds; + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.start = event.end = (int)/*64*/offset_value; + event.count = 0; + switch ((int)/*64*/boundary_type) { + case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; + } + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getText(event); + } + OS.memmove (start_offset, new int[] {event.start}, 4); + OS.memmove (end_offset, new int[] {event.end}, 4); + return getStringPtr (event.result); + } + int offset = (int)/*64*/offset_value; + String text = object.getText (); + if (text != null && text.length () > 0) { + length = text.length (); + offset = Math.min (offset, length - 1); + int startBounds = offset; + int endBounds = offset; + switch ((int)/*64*/boundary_type) { + case ATK.ATK_TEXT_BOUNDARY_CHAR: { + if (length > offset) endBounds++; break; } - wordEnd2 = nextIndexOfChar (text, " !?.\n", wordEnd2); - if (wordEnd2 == -1) { - endBounds = startBounds; + case ATK.ATK_TEXT_BOUNDARY_WORD_START: { + int wordStart1 = previousIndexOfNotChar (text, " !?.\n", offset); + if (wordStart1 == -1) { + startBounds = endBounds = 0; + break; + } + wordStart1 = previousIndexOfChar (text, " !?.\n", wordStart1) + 1; + if (wordStart1 == -1) { + startBounds = 0; + break; + } + startBounds = wordStart1; + int wordStart2 = nextIndexOfChar (text, " !?.\n", wordStart1); + endBounds = nextIndexOfNotChar (text, " !?.\n", wordStart2); break; } - endBounds = nextIndexOfNotChar (text, "!?.", wordEnd2); - break; - } - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: { - int sentenceStart1 = previousIndexOfNotChar (text, " !?.\n", offset + 1); - if (sentenceStart1 == -1) { - startBounds = endBounds = 0; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: { + int wordEnd1 = previousIndexOfNotChar (text, "!?.", offset + 1); + wordEnd1 = previousIndexOfChar (text, " !?.\n", wordEnd1); + wordEnd1 = previousIndexOfNotChar (text, " \n", wordEnd1 + 1); + if (wordEnd1 == -1) { + startBounds = endBounds = 0; + break; + } + startBounds = wordEnd1 + 1; + int wordEnd2 = nextIndexOfNotChar (text, " \n", startBounds); + if (wordEnd2 == length) { + endBounds = startBounds; + break; + } + wordEnd2 = nextIndexOfChar (text, " !?.\n", wordEnd2); + if (wordEnd2 == -1) { + endBounds = startBounds; + break; + } + endBounds = nextIndexOfNotChar (text, "!?.", wordEnd2); break; } - sentenceStart1 = previousIndexOfChar (text, "!?.", sentenceStart1) + 1; - startBounds = nextIndexOfNotChar (text, " \n", sentenceStart1); - int sentenceStart2 = nextIndexOfChar (text, "!?.", startBounds); - endBounds = nextIndexOfNotChar (text, " !?.\n", sentenceStart2); - break; - } - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: { - int sentenceEnd1 = previousIndexOfNotChar (text, "!?.", offset + 1); - sentenceEnd1 = previousIndexOfChar (text, "!?.", sentenceEnd1); - sentenceEnd1 = previousIndexOfNotChar (text, " \n", sentenceEnd1 + 1); - if (sentenceEnd1 == -1) { - startBounds = endBounds = 0; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: { + int sentenceStart1 = previousIndexOfNotChar (text, " !?.\n", offset + 1); + if (sentenceStart1 == -1) { + startBounds = endBounds = 0; + break; + } + sentenceStart1 = previousIndexOfChar (text, "!?.", sentenceStart1) + 1; + startBounds = nextIndexOfNotChar (text, " \n", sentenceStart1); + int sentenceStart2 = nextIndexOfChar (text, "!?.", startBounds); + endBounds = nextIndexOfNotChar (text, " !?.\n", sentenceStart2); break; } - startBounds = sentenceEnd1 + 1; - int sentenceEnd2 = nextIndexOfNotChar (text, " \n", startBounds); - if (sentenceEnd2 == length) { - endBounds = startBounds; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: { + int sentenceEnd1 = previousIndexOfNotChar (text, "!?.", offset + 1); + sentenceEnd1 = previousIndexOfChar (text, "!?.", sentenceEnd1); + sentenceEnd1 = previousIndexOfNotChar (text, " \n", sentenceEnd1 + 1); + if (sentenceEnd1 == -1) { + startBounds = endBounds = 0; + break; + } + startBounds = sentenceEnd1 + 1; + int sentenceEnd2 = nextIndexOfNotChar (text, " \n", startBounds); + if (sentenceEnd2 == length) { + endBounds = startBounds; + break; + } + sentenceEnd2 = nextIndexOfChar (text, "!?.", sentenceEnd2); + if (sentenceEnd2 == -1) { + endBounds = startBounds; + break; + } + endBounds = nextIndexOfNotChar (text, "!?.", sentenceEnd2); break; } - sentenceEnd2 = nextIndexOfChar (text, "!?.", sentenceEnd2); - if (sentenceEnd2 == -1) { - endBounds = startBounds; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: { + startBounds = previousIndexOfChar (text, "\n", offset) + 1; + int lineEnd2 = nextIndexOfChar (text, "\n", startBounds); + if (lineEnd2 < length) lineEnd2++; + endBounds = lineEnd2; break; } - endBounds = nextIndexOfNotChar (text, "!?.", sentenceEnd2); - break; - } - case ATK.ATK_TEXT_BOUNDARY_LINE_START: { - startBounds = previousIndexOfChar (text, "\n", offset) + 1; - int lineEnd2 = nextIndexOfChar (text, "\n", startBounds); - if (lineEnd2 < length) lineEnd2++; - endBounds = lineEnd2; - break; - } - case ATK.ATK_TEXT_BOUNDARY_LINE_END: { - int lineEnd1 = previousIndexOfChar (text, "\n", offset); - if (lineEnd1 == -1) { - startBounds = endBounds = 0; - break; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: { + int lineEnd1 = previousIndexOfChar (text, "\n", offset); + if (lineEnd1 == -1) { + startBounds = endBounds = 0; + break; + } + startBounds = lineEnd1; + endBounds = nextIndexOfChar (text, "\n", lineEnd1 + 1); } - startBounds = lineEnd1; - endBounds = nextIndexOfChar (text, "\n", lineEnd1 + 1); - } - } - OS.memmove (start_offset, new int[] {startBounds}, 4); - OS.memmove (end_offset, new int[] {endBounds}, 4); - text = text.substring (startBounds, endBounds); - byte[] bytes = Converter.wcsToMbcs (null, text, true); - int /*long*/ result = OS.g_malloc (bytes.length); - OS.memmove (result, bytes, bytes.length); - return result; - } + } + OS.memmove (start_offset, new int[] {startBounds}, 4); + OS.memmove (end_offset, new int[] {endBounds}, 4); + text = text.substring (startBounds, endBounds); + return getStringPtr (text); + } + } return 0; } static int /*long*/ atkText_get_text_before_offset (int /*long*/ atkObject, int /*long*/ offset_value, int /*long*/ boundary_type, int /*long*/ start_offset, int /*long*/ end_offset) { if (DEBUG) System.out.println ("-->atkText_get_text_before_offset"); AccessibleObject object = getAccessibleObject (atkObject); - if (object == null) return 0; - int offset = (int)/*64*/offset_value; - String text = object.getText (); - if (text.length () > 0) { - int length = text.length (); - offset = Math.min (offset, length - 1); - int startBounds = offset; - int endBounds = offset; - switch ((int)/*64*/boundary_type) { - case ATK.ATK_TEXT_BOUNDARY_CHAR: { - if (length >= offset && offset > 0) startBounds--; - break; - } - case ATK.ATK_TEXT_BOUNDARY_WORD_START: { - int wordStart1 = previousIndexOfChar (text, " !?.\n", offset - 1); - if (wordStart1 == -1) { - startBounds = endBounds = 0; - break; - } - int wordStart2 = previousIndexOfNotChar (text, " !?.\n", wordStart1); - if (wordStart2 == -1) { - startBounds = endBounds = 0; - break; - } - endBounds = wordStart1 + 1; - startBounds = previousIndexOfChar (text, " !?.\n", wordStart2) + 1; - break; - } - case ATK.ATK_TEXT_BOUNDARY_WORD_END: { - int wordEnd1 =previousIndexOfChar (text, " !?.\n", offset); - if (wordEnd1 == -1) { - startBounds = endBounds = 0; - break; - } - wordEnd1 = previousIndexOfNotChar (text, " \n", wordEnd1 + 1); - if (wordEnd1 == -1) { - startBounds = endBounds = 0; - break; - } - endBounds = wordEnd1 + 1; - int wordEnd2 = previousIndexOfNotChar (text, " !?.\n", endBounds); - wordEnd2 = previousIndexOfChar (text, " !?.\n", wordEnd2); - if (wordEnd2 == -1) { - startBounds = 0; - break; - } - startBounds = previousIndexOfNotChar (text, " \n", wordEnd2 + 1) + 1; - break; + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.start = event.end = (int)/*64*/offset_value; + event.count = -1; + switch ((int)/*64*/boundary_type) { + case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break; } - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: { - int sentenceStart1 = previousIndexOfChar (text, "!?.", offset); - if (sentenceStart1 == -1) { - startBounds = endBounds = 0; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getText(event); + } + OS.memmove (start_offset, new int[] {event.start}, 4); + OS.memmove (end_offset, new int[] {event.end}, 4); + return getStringPtr (event.result); + } + int offset = (int)/*64*/offset_value; + String text = object.getText (); + if (text != null && text.length () > 0) { + length = text.length (); + offset = Math.min (offset, length - 1); + int startBounds = offset; + int endBounds = offset; + switch ((int)/*64*/boundary_type) { + case ATK.ATK_TEXT_BOUNDARY_CHAR: { + if (length >= offset && offset > 0) startBounds--; break; } - int sentenceStart2 = previousIndexOfNotChar (text, "!?.", sentenceStart1); - if (sentenceStart2 == -1) { - startBounds = endBounds = 0; + case ATK.ATK_TEXT_BOUNDARY_WORD_START: { + int wordStart1 = previousIndexOfChar (text, " !?.\n", offset - 1); + if (wordStart1 == -1) { + startBounds = endBounds = 0; + break; + } + int wordStart2 = previousIndexOfNotChar (text, " !?.\n", wordStart1); + if (wordStart2 == -1) { + startBounds = endBounds = 0; + break; + } + endBounds = wordStart1 + 1; + startBounds = previousIndexOfChar (text, " !?.\n", wordStart2) + 1; break; } - endBounds = sentenceStart1 + 1; - startBounds = previousIndexOfChar (text, "!?.", sentenceStart2) + 1; - break; - } - case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: { - int sentenceEnd1 = previousIndexOfChar (text, "!?.", offset); - if (sentenceEnd1 == -1) { - startBounds = endBounds = 0; + case ATK.ATK_TEXT_BOUNDARY_WORD_END: { + int wordEnd1 =previousIndexOfChar (text, " !?.\n", offset); + if (wordEnd1 == -1) { + startBounds = endBounds = 0; + break; + } + wordEnd1 = previousIndexOfNotChar (text, " \n", wordEnd1 + 1); + if (wordEnd1 == -1) { + startBounds = endBounds = 0; + break; + } + endBounds = wordEnd1 + 1; + int wordEnd2 = previousIndexOfNotChar (text, " !?.\n", endBounds); + wordEnd2 = previousIndexOfChar (text, " !?.\n", wordEnd2); + if (wordEnd2 == -1) { + startBounds = 0; + break; + } + startBounds = previousIndexOfNotChar (text, " \n", wordEnd2 + 1) + 1; break; } - sentenceEnd1 = previousIndexOfNotChar (text, " \n", sentenceEnd1 + 1); - if (sentenceEnd1 == -1) { - startBounds = endBounds = 0; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: { + int sentenceStart1 = previousIndexOfChar (text, "!?.", offset); + if (sentenceStart1 == -1) { + startBounds = endBounds = 0; + break; + } + int sentenceStart2 = previousIndexOfNotChar (text, "!?.", sentenceStart1); + if (sentenceStart2 == -1) { + startBounds = endBounds = 0; + break; + } + endBounds = sentenceStart1 + 1; + startBounds = previousIndexOfChar (text, "!?.", sentenceStart2) + 1; break; } - endBounds = sentenceEnd1 + 1; - int sentenceEnd2 = previousIndexOfNotChar (text, "!?.", endBounds); - sentenceEnd2 = previousIndexOfChar (text, "!?.", sentenceEnd2); - if (sentenceEnd2 == -1) { - startBounds = 0; + case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: { + int sentenceEnd1 = previousIndexOfChar (text, "!?.", offset); + if (sentenceEnd1 == -1) { + startBounds = endBounds = 0; + break; + } + sentenceEnd1 = previousIndexOfNotChar (text, " \n", sentenceEnd1 + 1); + if (sentenceEnd1 == -1) { + startBounds = endBounds = 0; + break; + } + endBounds = sentenceEnd1 + 1; + int sentenceEnd2 = previousIndexOfNotChar (text, "!?.", endBounds); + sentenceEnd2 = previousIndexOfChar (text, "!?.", sentenceEnd2); + if (sentenceEnd2 == -1) { + startBounds = 0; + break; + } + startBounds = previousIndexOfNotChar (text, " \n", sentenceEnd2 + 1) + 1; break; } - startBounds = previousIndexOfNotChar (text, " \n", sentenceEnd2 + 1) + 1; - break; - } - case ATK.ATK_TEXT_BOUNDARY_LINE_START: { - int lineStart1 = previousIndexOfChar (text, "\n", offset); - if (lineStart1 == -1) { - startBounds = endBounds = 0; + case ATK.ATK_TEXT_BOUNDARY_LINE_START: { + int lineStart1 = previousIndexOfChar (text, "\n", offset); + if (lineStart1 == -1) { + startBounds = endBounds = 0; + break; + } + endBounds = lineStart1 + 1; + startBounds = previousIndexOfChar (text, "\n", lineStart1) + 1; break; } - endBounds = lineStart1 + 1; - startBounds = previousIndexOfChar (text, "\n", lineStart1) + 1; - break; - } - case ATK.ATK_TEXT_BOUNDARY_LINE_END: { - int lineEnd1 = previousIndexOfChar (text, "\n", offset); - if (lineEnd1 == -1) { - startBounds = endBounds = 0; + case ATK.ATK_TEXT_BOUNDARY_LINE_END: { + int lineEnd1 = previousIndexOfChar (text, "\n", offset); + if (lineEnd1 == -1) { + startBounds = endBounds = 0; + break; + } + endBounds = lineEnd1; + startBounds = previousIndexOfChar (text, "\n", lineEnd1); + if (startBounds == -1) startBounds = 0; break; } - endBounds = lineEnd1; - startBounds = previousIndexOfChar (text, "\n", lineEnd1); - if (startBounds == -1) startBounds = 0; - break; - } - } - OS.memmove (start_offset, new int[] {startBounds}, 4); - OS.memmove (end_offset, new int[] {endBounds}, 4); - text = text.substring (startBounds, endBounds); - byte[] bytes = Converter.wcsToMbcs (null, text, true); - int /*long*/ result = OS.g_malloc (bytes.length); - OS.memmove (result, bytes, bytes.length); - return result; - } + } + OS.memmove (start_offset, new int[] {startBounds}, 4); + OS.memmove (end_offset, new int[] {endBounds}, 4); + text = text.substring (startBounds, endBounds); + return getStringPtr (text); + } + } return 0; } + + static void setGValue (int /*long*/ value, Number number) { + if (number == null) return; + OS.g_value_unset(value); + if (number instanceof Double) { + OS.g_value_init(value, OS.G_TYPE_DOUBLE()); + OS.g_value_set_double(value, number.doubleValue()); + } else if (number instanceof Float) { + OS.g_value_init(value, OS.G_TYPE_FLOAT()); + OS.g_value_set_float(value, number.floatValue()); + } else if (number instanceof Long) { + OS.g_value_init(value, OS.G_TYPE_INT64()); + OS.g_value_set_int64(value, number.longValue()); + } else { + OS.g_value_init(value, OS.G_TYPE_INT()); + OS.g_value_set_int(value, number.intValue()); + } + } - AccessibleListener[] getAccessibleListeners () { - if (accessible == null) return new AccessibleListener [0]; - AccessibleListener[] result = accessible.getAccessibleListeners (); - return result != null ? result : new AccessibleListener [0]; + static Number getGValue (int /*long*/ value) { + int /*long*/ type = OS.G_VALUE_TYPE(value); + if (type == OS.G_TYPE_DOUBLE()) return new Double(OS.g_value_get_double(value)); + if (type == OS.G_TYPE_FLOAT()) return new Float(OS.g_value_get_float(value)); + if (type == OS.G_TYPE_INT64()) return new Long(OS.g_value_get_int64(value)); + return new Integer(OS.g_value_get_int(value)); + } + + static AtkValueIface getValueIface (int /*long*/ atkObject) { + if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_VALUE())) { + AtkValueIface iface = new AtkValueIface (); + ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_VALUE_GET_IFACE (atkObject))); + return iface; + } + return null; + } + static int /*long*/ atkValue_get_current_value (int /*long*/ atkObject, int /*long*/ value) { + if (DEBUG) System.out.println ("-->atkValue_get_current_value"); + AccessibleObject object = getAccessibleObject (atkObject); + AtkValueIface iface = getValueIface (atkObject); + if (iface != null && iface.get_current_value != 0) { + ATK.call (iface.get_current_value, atkObject, value); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleValueListeners; + AccessibleValueEvent event = new AccessibleValueEvent(accessible); + event.value = getGValue(value); + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleValueListener listener = (AccessibleValueListener) listeners.elementAt(i); + listener.getCurrentValue(event); + } + setGValue(value, event.value); + } + return 0; + } + + static int /*long*/ atkValue_get_maximum_value (int /*long*/ atkObject, int /*long*/ value) { + if (DEBUG) System.out.println ("-->atkValue_get_maximum_value"); + AccessibleObject object = getAccessibleObject (atkObject); + AtkValueIface iface = getValueIface (atkObject); + if (iface != null && iface.get_maximum_value != 0) { + ATK.call (iface.get_maximum_value, atkObject, value); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleValueListeners; + AccessibleValueEvent event = new AccessibleValueEvent(accessible); + event.value = getGValue(value); + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleValueListener listener = (AccessibleValueListener) listeners.elementAt(i); + listener.getMaximumValue(event); + } + setGValue(value, event.value); + } + return 0; + } + + static int /*long*/ atkValue_get_minimum_value (int /*long*/ atkObject, int /*long*/ value) { + if (DEBUG) System.out.println ("-->atkValue_get_minimum_value"); + AccessibleObject object = getAccessibleObject (atkObject); + AtkValueIface iface = getValueIface (atkObject); + if (iface != null && iface.get_minimum_value != 0) { + ATK.call (iface.get_minimum_value, atkObject, value); + } + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleValueListeners; + AccessibleValueEvent event = new AccessibleValueEvent(accessible); + event.value = getGValue(value); + for (int i = 0, length = listeners.size(); i < length; i++) { + AccessibleValueListener listener = (AccessibleValueListener) listeners.elementAt(i); + listener.getMinimumValue(event); + } + setGValue(value, event.value); + } + return 0; + } + + static int /*long*/ atkValue_set_current_value (int /*long*/ atkObject, int /*long*/ value) { + if (DEBUG) System.out.println ("-->atkValue_set_current_value"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + if (accessible != null) { + Vector listeners = accessible.accessibleValueListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleValueEvent event = new AccessibleValueEvent(accessible); + event.value = getGValue(value); + for (int i = 0; i < length; i++) { + AccessibleValueListener listener = (AccessibleValueListener) listeners.elementAt(i); + listener.setCurrentValue(event); + } + return 0; + } + } + } + int /*long*/ parentResult = 0; + AtkValueIface iface = getValueIface (atkObject); + if (iface != null && iface.set_current_value != 0) { + parentResult = ATK.call (iface.set_current_value, atkObject, value); + } + return parentResult; } static AccessibleObject getAccessibleObject (int /*long*/ atkObject) { @@ -1207,51 +2673,37 @@ class AccessibleObject { return null; } - AccessibleControlListener[] getControlListeners () { - if (accessible == null) return new AccessibleControlListener [0]; - AccessibleControlListener[] result = accessible.getControlListeners (); - return result != null ? result : new AccessibleControlListener [0]; - } - String getText () { int /*long*/ parentResult = 0; String parentText = ""; //$NON-NLS-1$ - if (ATK.g_type_is_a (parentType, ATK_TEXT_TYPE)) { - int /*long*/ superType = ATK.g_type_interface_peek_parent (ATK.ATK_TEXT_GET_IFACE (handle)); - AtkTextIface textIface = new AtkTextIface (); - ATK.memmove (textIface, superType); - int /*long*/ characterCount = 0; - if (textIface.get_character_count != 0) { - characterCount = ATK.call (textIface.get_character_count, handle); - } - if (characterCount > 0 && textIface.get_text != 0) { - parentResult = ATK.call (textIface.get_text, handle, 0, characterCount); + AtkTextIface iface = getTextIface (handle); + if (iface != null && iface.get_character_count != 0) { + int /*long*/ characterCount = ATK.call (iface.get_character_count, handle); + if (characterCount > 0 && iface.get_text != 0) { + parentResult = ATK.call (iface.get_text, handle, 0, characterCount); if (parentResult != 0) { - int length = OS.strlen (parentResult); - byte [] buffer = new byte [length]; - OS.memmove (buffer, parentResult, length); - parentText = new String (Converter.mbcsToWcs (null, buffer)); + parentText = getString (parentResult); + OS.g_free(parentResult); } } } - AccessibleControlListener[] controlListeners = getControlListeners (); - if (controlListeners.length == 0) return parentText; - AccessibleControlEvent event = new AccessibleControlEvent (accessible); - event.childID = id; - event.result = parentText; - for (int i = 0; i < controlListeners.length; i++) { - controlListeners [i].getValue (event); + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleControlEvent event = new AccessibleControlEvent (accessible); + event.childID = id; + event.result = parentText; + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getValue (event); + } + return event.result; } - return event.result; - } - - AccessibleTextListener[] getTextListeners () { - if (accessible == null) return new AccessibleTextListener [0]; - AccessibleTextListener[] result = accessible.getTextListeners (); - return result != null ? result : new AccessibleTextListener [0]; + return null; } static int /*long*/ gObjectClass_finalize (int /*long*/ atkObject) { + if (DEBUG) System.out.println ("-->gObjectClass_finalize: " + atkObject); int /*long*/ superType = ATK.g_type_class_peek_parent (ATK.G_OBJECT_GET_CLASS (atkObject)); int /*long*/ gObjectClass = ATK.G_OBJECT_CLASS (superType); GObjectClass objectClassStruct = new GObjectClass (); @@ -1325,6 +2777,10 @@ class AccessibleObject { if (unref && child.isLightweight) OS.g_object_unref (child.handle); } + void removeRelation (int type, Accessible target) { + OS.atk_object_remove_relationship (handle, toATKRelation(type), target.accessibleObject.handle); + } + void selectionChanged () { OS.g_signal_emit_by_name (handle, ATK.selection_changed); } @@ -1356,27 +2812,45 @@ class AccessibleObject { void textSelectionChanged() { OS.g_signal_emit_by_name (handle, ATK.text_selection_changed); } + + static int toATKRelation (int relation) { + switch (relation) { + case ACC.RELATION_CONTROLLED_BY: return ATK.ATK_RELATION_CONTROLLED_BY; + case ACC.RELATION_CONTROLLER_FOR: return ATK.ATK_RELATION_CONTROLLER_FOR; + case ACC.RELATION_DESCRIBED_BY: return ATK.ATK_RELATION_DESCRIBED_BY; + case ACC.RELATION_DESCRIPTION_FOR: return ATK.ATK_RELATION_DESCRIPTION_FOR; + case ACC.RELATION_EMBEDDED_BY: return ATK.ATK_RELATION_EMBEDDED_BY; + case ACC.RELATION_EMBEDS: return ATK.ATK_RELATION_EMBEDS; + case ACC.RELATION_FLOWS_FROM: return ATK.ATK_RELATION_FLOWS_FROM; + case ACC.RELATION_FLOWS_TO: return ATK.ATK_RELATION_FLOWS_TO; + case ACC.RELATION_LABEL_FOR: return ATK.ATK_RELATION_LABEL_FOR; + case ACC.RELATION_LABELLED_BY: return ATK.ATK_RELATION_LABELLED_BY; + case ACC.RELATION_MEMBER_OF: return ATK.ATK_RELATION_MEMBER_OF; + case ACC.RELATION_NODE_CHILD_OF: return ATK.ATK_RELATION_NODE_CHILD_OF; + case ACC.RELATION_PARENT_WINDOW_OF: return ATK.ATK_RELATION_PARENT_WINDOW_OF; + case ACC.RELATION_POPUP_FOR: return ATK.ATK_RELATION_POPUP_FOR; + case ACC.RELATION_SUBWINDOW_OF: return ATK.ATK_RELATION_SUBWINDOW_OF; + } + return 0; + } void updateChildren () { if (isLightweight) return; - AccessibleControlListener[] listeners = getControlListeners (); - if (listeners.length == 0) return; - + Vector listeners = accessible.accessibleControlListeners; + int length = listeners.size(); AccessibleControlEvent event = new AccessibleControlEvent (accessible); - for (int i = 0; i < listeners.length; i++) { - listeners [i].getChildren (event); + for (int i = 0; i < length; i++) { + AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i); + listener.getChildren (event); } if (event.children != null && event.children.length > 0) { Vector idsToKeep = new Vector (children.size ()); if (event.children [0] instanceof Integer) { /* an array of child id's (Integers) was answered */ - int /*long*/ parentType = AccessibleFactory.getDefaultParentType (); for (int i = 0; i < event.children.length; i++) { AccessibleObject object = getChildByIndex (i); if (object == null) { - int /*long*/ childType = AccessibleFactory.getChildType (accessible, i); - object = new AccessibleObject (childType, 0, accessible, parentType, true); - AccessibleObjects.put (new LONG (object.handle), object); + object = AccessibleFactory.createChildAccessible (accessible, i); addChild (object); object.index = i; } @@ -1414,4 +2888,47 @@ class AccessibleObject { } } } + + static int /*long*/ atkText_get_range_extents (int /*long*/ atkObject, int /*long*/ start_offset, int /*long*/ end_offset, int /*long*/ coord_type, int /*long*/ rect) { + if (DEBUG) System.out.println ("-->atkText_get_range_extents"); + AccessibleObject object = getAccessibleObject (atkObject); + if (object != null) { + Accessible accessible = object.accessible; + Vector listeners = accessible.accessibleTextExtendedListeners; + int length = listeners.size(); + if (length > 0) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible); + event.start = (int)/*64*/start_offset; + event.end = (int)/*64*/end_offset; + for (int i = 0; i < length; i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i); + listener.getTextBounds(event); + } + if (coord_type == ATK.ATK_XY_WINDOW) { + /* translate display -> control, for answering to the OS */ + int /*long*/ gtkAccessibleHandle = ATK.GTK_ACCESSIBLE (atkObject); + GtkAccessible gtkAccessible = new GtkAccessible (); + ATK.memmove (gtkAccessible, gtkAccessibleHandle); + int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget); + int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel); + int[] topWindowX = new int [1], topWindowY = new int [1]; + OS.gdk_window_get_origin (window, topWindowX, topWindowY); + event.x -= topWindowX [0]; + event.y -= topWindowY [0]; + } + AtkTextRectangle atkRect = new AtkTextRectangle(); + atkRect.x = event.x; + atkRect.y = event.y; + atkRect.width = event.width; + atkRect.height = event.height; + ATK.memmove (rect, atkRect, AtkTextRectangle.sizeof); + return 0; + } + } + AtkTextIface iface = getTextIface (atkObject); + if (iface != null && iface.get_range_extents != 0) { + ATK.call (iface.get_range_extents, atkObject, start_offset, end_offset, coord_type, rect); + } + return 0; + } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java index dc1c4137ab..dcae33ec5e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.swt.accessibility; - -import java.lang.reflect.Method; import java.util.Vector; import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; @@ -43,18 +41,56 @@ import org.eclipse.swt.internal.ole.win32.*; * @since 2.0 */ public class Accessible { + static final int MAX_RELATION_TYPES = 15; int refCount = 0, enumIndex = 0; - COMObject objIAccessible, objIEnumVARIANT; + COMObject objIAccessible, objIEnumVARIANT, objIServiceProvider, objIAccessible2, objIAccessibleAction, + objIAccessibleApplication, objIAccessibleComponent, objIAccessibleEditableText, objIAccessibleHyperlink, + objIAccessibleHypertext, objIAccessibleImage, objIAccessibleTable2, objIAccessibleTableCell, + objIAccessibleText, objIAccessibleValue; /* objIAccessibleRelation is defined in Relation class */ IAccessible iaccessible; Vector accessibleListeners = new Vector(); Vector accessibleControlListeners = new Vector(); - Vector textListeners = 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(); + Relation relations[] = new Relation[MAX_RELATION_TYPES]; Object[] variants; + Accessible parent; + Vector children = new Vector(); Control control; - static String ALTERNATE_ACCESSIBLE_CLASS_NAME = "org.eclipse.swt.accessibility2.Accessible2"; + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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; + parent.children.addElement(this); + // TODO: Should we use the proxy for lightweight children (for defaults only)? + this.iaccessible = parent.iaccessible; // use the same proxy for default values? + } /** * @since 3.5 + * @deprecated */ protected Accessible() { } @@ -72,9 +108,18 @@ public class Accessible { if (ppvObject[0] == 0) return; if (result != COM.S_OK) OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result); iaccessible = new IAccessible(ppvObject[0]); + createIAccessible(); + AddRef(); + } + + static Accessible checkNull (Accessible parent) { + if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + return parent; + } + void createIAccessible() { objIAccessible = new COMObject(new int[] {2,0,0,1,3,5,8,1,1,2,2,2,2,2,2,2,3,2,1,1,2,2,5,3,3,1,2,2}) { - public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);} + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessible, args[0], args[1]);} public int /*long*/ method1(int /*long*/[] args) {return AddRef();} public int /*long*/ method2(int /*long*/[] args) {return Release();} // method3 GetTypeInfoCount - not implemented @@ -103,8 +148,8 @@ public class Accessible { public int /*long*/ method26(int /*long*/[] args) {return put_accName(args[0], args[1]);} public int /*long*/ method27(int /*long*/[] args) {return put_accValue(args[0], args[1]);} }; - - /* If the callback takes a struct parameter (for example, a variant), + + /* If the callback takes a struct parameter (for example, a VARIANT), * then create a custom callback that dereferences the struct and * passes a pointer to the original callback. */ @@ -130,9 +175,246 @@ public class Accessible { funcs[26] = COM.put_accName_CALLBACK(funcs[26]); funcs[27] = COM.put_accValue_CALLBACK(funcs[27]); COM.MoveMemory(pVtable[0], funcs, OS.PTR_SIZEOF * funcs.length); + } + + void createIAccessible2() { + objIAccessible2 = new COMObject(new int[] {2,0,0,/*IA>>*/1,3,5,8,1,1,2,2,2,2,2,2,2,3,2,1,1,2,2,5,3,3,1,2,2,/*<<IA*/1,2,3,1,1,3,3,1,1,1,1,3,3,1,1,1,1,1}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessible2, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + // We will not add the IAccessible methods here because AT's should not rely on IA inheritance + public int /*long*/ method28(int /*long*/[] args) {return get_nRelations(args[0]);} + public int /*long*/ method29(int /*long*/[] args) {return get_relation((int)/*64*/args[0], args[1]);} + public int /*long*/ method30(int /*long*/[] args) {return get_relations((int)/*64*/args[0], args[1], args[2]);} + public int /*long*/ method31(int /*long*/[] args) {return get_role(args[0]);} + public int /*long*/ method32(int /*long*/[] args) {return scrollTo(args[0]);} + public int /*long*/ method33(int /*long*/[] args) {return scrollToPoint(args[0], (int)/*64*/args[1], (int)/*64*/args[2]);} + public int /*long*/ method34(int /*long*/[] args) {return get_groupPosition(args[0], args[1], args[2]);} + public int /*long*/ method35(int /*long*/[] args) {return get_states(args[0]);} + public int /*long*/ method36(int /*long*/[] args) {return get_extendedRole(args[0]);} + public int /*long*/ method37(int /*long*/[] args) {return get_localizedExtendedRole(args[0]);} + public int /*long*/ method38(int /*long*/[] args) {return get_nExtendedStates(args[0]);} + public int /*long*/ method39(int /*long*/[] args) {return get_extendedStates((int)/*64*/args[0], args[1], args[2]);} + public int /*long*/ method40(int /*long*/[] args) {return get_localizedExtendedStates((int)/*64*/args[0], args[1], args[2]);} + public int /*long*/ method41(int /*long*/[] args) {return get_uniqueID(args[0]);} + public int /*long*/ method42(int /*long*/[] args) {return get_windowHandle(args[0]);} + public int /*long*/ method43(int /*long*/[] args) {return get_indexInParent(args[0]);} + public int /*long*/ method44(int /*long*/[] args) {return get_locale(args[0]);} + public int /*long*/ method45(int /*long*/[] args) {return get_attributes(args[0]);} + }; + } + + void createIAccessibleAction() { + objIAccessibleAction = new COMObject(new int[] {2,0,0,1,1,2,4,2,2}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleAction, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return get_nActions((int)/*64*/args[0]);} + public int /*long*/ method4(int /*long*/[] args) {return doAction((int)/*64*/args[0]);} + public int /*long*/ method5(int /*long*/[] args) {return get_description((int)/*64*/args[0], args[1]);} + public int /*long*/ method6(int /*long*/[] args) {return get_keyBinding((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3]);} + public int /*long*/ method7(int /*long*/[] args) {return get_name((int)/*64*/args[0], args[1]);} + public int /*long*/ method8(int /*long*/[] args) {return get_localizedName((int)/*64*/args[0], args[1]);} + }; + } + + void createIAccessibleApplication() { + objIAccessibleApplication = new COMObject(new int[] {2,0,0,1,1,1,1}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleApplication, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return get_appName(args[0]);} + public int /*long*/ method4(int /*long*/[] args) {return get_appVersion(args[0]);} + public int /*long*/ method5(int /*long*/[] args) {return get_toolkitName(args[0]);} + public int /*long*/ method6(int /*long*/[] args) {return get_toolkitVersion(args[0]);} + }; + } + + void createIAccessibleComponent() { + objIAccessibleComponent = new COMObject(new int[] {2,0,0,2,1,1}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleComponent, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return get_locationInParent(args[0], args[1]);} + public int /*long*/ method4(int /*long*/[] args) {return get_foreground(args[0]);} + public int /*long*/ method5(int /*long*/[] args) {return get_background(args[0]);} + }; + } + + void createIAccessibleEditableText() { + objIAccessibleEditableText = new COMObject(new int[] {2,0,0,2,2,2,2,1,3,3}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleEditableText, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return copyText((int)/*64*/args[0], (int)/*64*/args[1]);} + public int /*long*/ method4(int /*long*/[] args) {return deleteText((int)/*64*/args[0], (int)/*64*/args[1]);} + public int /*long*/ method5(int /*long*/[] args) {return insertText((int)/*64*/args[0], args[1]);} + public int /*long*/ method6(int /*long*/[] args) {return cutText((int)/*64*/args[0], (int)/*64*/args[1]);} + public int /*long*/ method7(int /*long*/[] args) {return pasteText((int)/*64*/args[0]);} + public int /*long*/ method8(int /*long*/[] args) {return replaceText((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} + public int /*long*/ method9(int /*long*/[] args) {return setAttributes((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} + }; + } + + void createIAccessibleHyperlink() { + objIAccessibleHyperlink = new COMObject(new int[] {2,0,0,/*IAA>>*/2,0,0,1,1,2,4,2,2,/*<<IAA*/2,2,1,1,1}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleHyperlink, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + // IAccessibleAction + public int /*long*/ method3(int /*long*/[] args) {return get_nActions((int)/*64*/args[0]);} + public int /*long*/ method4(int /*long*/[] args) {return doAction((int)/*64*/args[0]);} + public int /*long*/ method5(int /*long*/[] args) {return get_description((int)/*64*/args[0], args[1]);} + public int /*long*/ method6(int /*long*/[] args) {return get_keyBinding((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3]);} + public int /*long*/ method7(int /*long*/[] args) {return get_name((int)/*64*/args[0], args[1]);} + public int /*long*/ method8(int /*long*/[] args) {return get_localizedName((int)/*64*/args[0], args[1]);} + // IAccessibleHyperlink + public int /*long*/ method9(int /*long*/[] args) {return get_anchor((int)/*64*/args[0], args[1]);} + public int /*long*/ method10(int /*long*/[] args) {return get_anchorTarget((int)/*64*/args[0], args[1]);} + public int /*long*/ method11(int /*long*/[] args) {return get_startIndex(args[0]);} + public int /*long*/ method12(int /*long*/[] args) {return get_endIndex(args[0]);} + public int /*long*/ method13(int /*long*/[] args) {return get_valid(args[0]);} + }; + } + + void createIAccessibleHypertext() { + objIAccessibleHypertext = new COMObject(new int[] {2,0,0,/*IAT>>*/2,4,1,6,1,4,3,3,5,5,5,1,1,3,1,3,5,1,1,/*<<IAT*/1,2,2}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleHypertext, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + // IAccessibleText + public int /*long*/ method3(int /*long*/[] args) {return addSelection((int)/*64*/args[0], (int)/*64*/args[1]);} + public int /*long*/ method4(int /*long*/[] args) {return get_attributes((int)/*64*/args[0], args[1], args[2], args[3]);} + public int /*long*/ method5(int /*long*/[] args) {return get_caretOffset(args[0]);} + public int /*long*/ method6(int /*long*/[] args) {return get_characterExtents((int)/*64*/args[0], args[1], args[2], args[3], args[4], args[5]);} + public int /*long*/ method7(int /*long*/[] args) {return get_nSelections(args[0]);} + public int /*long*/ method8(int /*long*/[] args) {return get_offsetAtPoint((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3]);} + public int /*long*/ method9(int /*long*/[] args) {return get_selection((int)/*64*/args[0], args[1], args[2]);} + public int /*long*/ method10(int /*long*/[] args) {return get_text((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} + public int /*long*/ method11(int /*long*/[] args) {return get_textBeforeOffset((int)/*64*/args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method12(int /*long*/[] args) {return get_textAfterOffset((int)/*64*/args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method13(int /*long*/[] args) {return get_textAtOffset((int)/*64*/args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method14(int /*long*/[] args) {return removeSelection((int)/*64*/args[0]);} + public int /*long*/ method15(int /*long*/[] args) {return setCaretOffset((int)/*64*/args[0]);} + public int /*long*/ method16(int /*long*/[] args) {return setSelection((int)/*64*/args[0], (int)/*64*/args[1], (int)/*64*/args[2]);} + public int /*long*/ method17(int /*long*/[] args) {return get_nCharacters(args[0]);} + public int /*long*/ method18(int /*long*/[] args) {return scrollSubstringTo((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} + public int /*long*/ method19(int /*long*/[] args) {return scrollSubstringToPoint((int)/*64*/args[0], (int)/*64*/args[1], args[2], (int)/*64*/args[3], (int)/*64*/args[4]);} + public int /*long*/ method20(int /*long*/[] args) {return get_newText(args[0]);} + public int /*long*/ method21(int /*long*/[] args) {return get_oldText(args[0]);} + // IAccessibleHypertext + public int /*long*/ method22(int /*long*/[] args) {return get_nHyperlinks(args[0]);} + public int /*long*/ method23(int /*long*/[] args) {return get_hyperlink((int)/*64*/args[0], args[1]);} + public int /*long*/ method24(int /*long*/[] args) {return get_hyperlinkIndex((int)/*64*/args[0], args[1]);} + }; + } + + void createIAccessibleImage() { + objIAccessibleImage = new COMObject(new int[] {2,0,0,1,3,2}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleImage, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return get_description(args[0]);} + public int /*long*/ method4(int /*long*/[] args) {return get_imagePosition(args[0], args[1], args[2]);} + public int /*long*/ method5(int /*long*/[] args) {return get_imageSize(args[0], args[1]);} + }; + } + + void createIAccessibleTable2() { + objIAccessibleTable2 = new COMObject(new int[] {2,0,0,3,1,2,1,1,1,1,1,2,2,2,2,1,2,2,1,1,1,1,1}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleTable2, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return get_cellAt((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} + public int /*long*/ method4(int /*long*/[] args) {return get_caption(args[0]);} + public int /*long*/ method5(int /*long*/[] args) {return get_columnDescription((int)/*64*/args[0], args[1]);} + public int /*long*/ method6(int /*long*/[] args) {return get_nColumns(args[0]);} + public int /*long*/ method7(int /*long*/[] args) {return get_nRows(args[0]);} + public int /*long*/ method8(int /*long*/[] args) {return get_nSelectedCells(args[0]);} + public int /*long*/ method9(int /*long*/[] args) {return get_nSelectedColumns(args[0]);} + public int /*long*/ method10(int /*long*/[] args) {return get_nSelectedRows(args[0]);} + public int /*long*/ method11(int /*long*/[] args) {return get_rowDescription((int)/*64*/args[0], args[1]);} + public int /*long*/ method12(int /*long*/[] args) {return get_selectedCells(args[0], args[1]);} + public int /*long*/ method13(int /*long*/[] args) {return get_selectedColumns(args[0], args[1]);} + public int /*long*/ method14(int /*long*/[] args) {return get_selectedRows(args[0], args[1]);} + public int /*long*/ method15(int /*long*/[] args) {return get_summary(args[0]);} + public int /*long*/ method16(int /*long*/[] args) {return get_isColumnSelected((int)/*64*/args[0], args[1]);} + public int /*long*/ method17(int /*long*/[] args) {return get_isRowSelected((int)/*64*/args[0], args[1]);} + public int /*long*/ method18(int /*long*/[] args) {return selectRow((int)/*64*/args[0]);} + public int /*long*/ method19(int /*long*/[] args) {return selectColumn((int)/*64*/args[0]);} + public int /*long*/ method20(int /*long*/[] args) {return unselectRow((int)/*64*/args[0]);} + public int /*long*/ method21(int /*long*/[] args) {return unselectColumn((int)/*64*/args[0]);} + public int /*long*/ method22(int /*long*/[] args) {return get_modelChange(args[0]);} + }; + } + void createIAccessibleTableCell() { + objIAccessibleTableCell = new COMObject(new int[] {2,0,0,1,2,1,1,2,1,1,5,1}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleTableCell, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return get_columnExtent(args[0]);} + public int /*long*/ method4(int /*long*/[] args) {return get_columnHeaderCells(args[0], args[1]);} + public int /*long*/ method5(int /*long*/[] args) {return get_columnIndex(args[0]);} + public int /*long*/ method6(int /*long*/[] args) {return get_rowExtent(args[0]);} + public int /*long*/ method7(int /*long*/[] args) {return get_rowHeaderCells(args[0], args[1]);} + public int /*long*/ method8(int /*long*/[] args) {return get_rowIndex(args[0]);} + public int /*long*/ method9(int /*long*/[] args) {return get_isSelected(args[0]);} + public int /*long*/ method10(int /*long*/[] args) {return get_rowColumnExtents(args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method11(int /*long*/[] args) {return get_table(args[0]);} + }; + } + + void createIAccessibleText() { + objIAccessibleText = new COMObject(new int[] {2,0,0,2,4,1,6,1,4,3,3,5,5,5,1,1,3,1,3,5,1,1}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleText, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return addSelection((int)/*64*/args[0], (int)/*64*/args[1]);} + public int /*long*/ method4(int /*long*/[] args) {return get_attributes((int)/*64*/args[0], args[1], args[2], args[3]);} + public int /*long*/ method5(int /*long*/[] args) {return get_caretOffset(args[0]);} + public int /*long*/ method6(int /*long*/[] args) {return get_characterExtents((int)/*64*/args[0], args[1], args[2], args[3], args[4], args[5]);} + public int /*long*/ method7(int /*long*/[] args) {return get_nSelections(args[0]);} + public int /*long*/ method8(int /*long*/[] args) {return get_offsetAtPoint((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3]);} + public int /*long*/ method9(int /*long*/[] args) {return get_selection((int)/*64*/args[0], args[1], args[2]);} + public int /*long*/ method10(int /*long*/[] args) {return get_text((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} + public int /*long*/ method11(int /*long*/[] args) {return get_textBeforeOffset((int)/*64*/args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method12(int /*long*/[] args) {return get_textAfterOffset((int)/*64*/args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method13(int /*long*/[] args) {return get_textAtOffset((int)/*64*/args[0], args[1], args[2], args[3], args[4]);} + public int /*long*/ method14(int /*long*/[] args) {return removeSelection((int)/*64*/args[0]);} + public int /*long*/ method15(int /*long*/[] args) {return setCaretOffset((int)/*64*/args[0]);} + public int /*long*/ method16(int /*long*/[] args) {return setSelection((int)/*64*/args[0], (int)/*64*/args[1], (int)/*64*/args[2]);} + public int /*long*/ method17(int /*long*/[] args) {return get_nCharacters(args[0]);} + public int /*long*/ method18(int /*long*/[] args) {return scrollSubstringTo((int)/*64*/args[0], (int)/*64*/args[1], args[2]);} + public int /*long*/ method19(int /*long*/[] args) {return scrollSubstringToPoint((int)/*64*/args[0], (int)/*64*/args[1], args[2], (int)/*64*/args[3], (int)/*64*/args[4]);} + public int /*long*/ method20(int /*long*/[] args) {return get_newText(args[0]);} + public int /*long*/ method21(int /*long*/[] args) {return get_oldText(args[0]);} + }; + } + + void createIAccessibleValue() { + objIAccessibleValue = new COMObject(new int[] {2,0,0,1,1,1,1}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleValue, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return get_currentValue(args[0]);} + public int /*long*/ method4(int /*long*/[] args) {return setCurrentValue(args[0]);} + public int /*long*/ method5(int /*long*/[] args) {return get_maximumValue(args[0]);} + public int /*long*/ method6(int /*long*/[] args) {return get_minimumValue(args[0]);} + }; + /* Dereference VARIANT struct parameters. */ + int /*long*/ ppVtable = objIAccessibleValue.ppVtable; + int /*long*/[] pVtable = new int /*long*/[1]; + COM.MoveMemory(pVtable, ppVtable, OS.PTR_SIZEOF); + int /*long*/[] funcs = new int /*long*/[7]; + COM.MoveMemory(funcs, pVtable[0], OS.PTR_SIZEOF * funcs.length); + funcs[4] = COM.CALLBACK_setCurrentValue(funcs[4]); + COM.MoveMemory(pVtable[0], funcs, OS.PTR_SIZEOF * funcs.length); + } + + void createIEnumVARIANT() { objIEnumVARIANT = new COMObject(new int[] {2,0,0,3,1,0,1}) { - public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);} + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIEnumVARIANT, args[0], args[1]);} public int /*long*/ method1(int /*long*/[] args) {return AddRef();} public int /*long*/ method2(int /*long*/[] args) {return Release();} public int /*long*/ method3(int /*long*/[] args) {return Next((int)/*64*/args[0], args[1], args[2]);} @@ -140,9 +422,17 @@ public class Accessible { public int /*long*/ method5(int /*long*/[] args) {return Reset();} public int /*long*/ method6(int /*long*/[] args) {return Clone(args[0]);} }; - AddRef(); } - + + void createIServiceProvider() { + objIServiceProvider = new COMObject(new int[] {2,0,0,3}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIServiceProvider, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return QueryService(args[0], args[1], args[2]);} + }; + } + /** * Invokes platform specific functionality to allocate a new accessible object. * <p> @@ -157,16 +447,6 @@ public class Accessible { * @return the platform specific accessible object */ public static Accessible internal_new_Accessible(Control control) { - if (ALTERNATE_ACCESSIBLE_CLASS_NAME != null) { - try { - Class clazz = Class.forName(ALTERNATE_ACCESSIBLE_CLASS_NAME); - Method method = clazz.getDeclaredMethod ("internal_new_Accessible", new Class [] {Control.class}); - Object value = method.invoke(clazz, new Object [] {control}); - return (Accessible)value; - } catch (Throwable e) { - ALTERNATE_ACCESSIBLE_CLASS_NAME = null; - } - } return new Accessible(control); } @@ -229,7 +509,7 @@ public class Accessible { * be notified when an accessible client asks for custom text control * specific information. The listener is notified by sending it * one of the messages defined in the <code>AccessibleTextListener</code> - * interface. + * and <code>AccessibleTextExtendedListener</code> interfaces. * * @param listener the listener that should be notified when the receiver * is asked for custom text control specific information @@ -243,6 +523,7 @@ public class Accessible { * </ul> * * @see AccessibleTextListener + * @see AccessibleTextExtendedListener * @see #removeAccessibleTextListener * * @since 3.0 @@ -250,10 +531,238 @@ public class Accessible { public void addAccessibleTextListener (AccessibleTextListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - textListeners.addElement (listener); + if (listener instanceof AccessibleTextExtendedListener) { + accessibleTextExtendedListeners.addElement (listener); + } else { + accessibleTextListeners.addElement (listener); + } } /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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(); + if (relations[type] == null) { + relations[type] = new Relation(this, type); + } + relations[type].addTarget(target); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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; + Release(); + parent.children.removeElement(this); + parent = null; + } + + int getAddress() { + /* The address of an Accessible is the address of its IAccessible COMObject. */ + if (objIAccessible == null) createIAccessible(); + return objIAccessible.getAddress(); + } + + /** * Returns the control for this Accessible object. * * @return the receiver's control @@ -262,7 +771,7 @@ public class Accessible { public Control getControl() { return control; } - + /** * Invokes platform specific functionality to dispose an accessible object. * <p> @@ -279,6 +788,10 @@ public class Accessible { } iaccessible = null; Release(); + for (int i = 0; i < children.size(); i++) { + Accessible child = (Accessible) children.elementAt(i); + child.dispose(); + } } /** @@ -370,6 +883,7 @@ public class Accessible { * </ul> * * @see AccessibleTextListener + * @see AccessibleTextExtendedListener * @see #addAccessibleTextListener * * @since 3.0 @@ -377,7 +891,251 @@ public class Accessible { public void removeAccessibleTextListener (AccessibleTextListener listener) { checkWidget (); if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - textListeners.removeElement (listener); + if (listener instanceof AccessibleTextExtendedListener) { + accessibleTextExtendedListeners.removeElement (listener); + } else { + accessibleTextListeners.removeElement (listener); + } + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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(); + Relation relation = (Relation)relations[type]; + if (relation != null) { + relation.removeTarget(target); + if (!relation.hasTargets()) { + relations[type].Release(); + relations[type] = null; + } + } + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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(); + COM.NotifyWinEvent (event, control.handle, COM.OBJID_CLIENT, childID); + } + + /** + * WARNING: API UNDER COSTRUCTION + * + * 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(); + COM.NotifyWinEvent (event, control.handle, COM.OBJID_CLIENT, childID); } /** @@ -474,40 +1232,52 @@ public class Accessible { * Ownership of ppvObject transfers from callee to caller so reference count on ppvObject * must be incremented before returning. Caller is responsible for releasing ppvObject. */ - int QueryInterface(int /*long*/ iid, int /*long*/ ppvObject) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; + int QueryInterface(COMObject comObject, int /*long*/ iid, int /*long*/ ppvObject) { GUID guid = new GUID(); COM.MoveMemory(guid, iid, GUID.sizeof); if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) { - COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessible.getAddress()}, OS.PTR_SIZEOF); + COM.MoveMemory(ppvObject, new int /*long*/[] { comObject.getAddress() }, OS.PTR_SIZEOF); AddRef(); return COM.S_OK; } - if (COM.IsEqualGUID(guid, COM.IIDIDispatch)) { - COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessible.getAddress()}, OS.PTR_SIZEOF); + if (COM.IsEqualGUID(guid, COM.IIDIDispatch) || COM.IsEqualGUID(guid, COM.IIDIAccessible)) { + if (objIAccessible == null) createIAccessible(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessible.getAddress() }, OS.PTR_SIZEOF); AddRef(); return COM.S_OK; } - if (COM.IsEqualGUID(guid, COM.IIDIAccessible)) { - COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessible.getAddress()}, OS.PTR_SIZEOF); + if (COM.IsEqualGUID(guid, COM.IIDIEnumVARIANT)) { + if (objIEnumVARIANT == null) createIEnumVARIANT(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIEnumVARIANT.getAddress() }, OS.PTR_SIZEOF); AddRef(); + enumIndex = 0; return COM.S_OK; } - - if (COM.IsEqualGUID(guid, COM.IIDIEnumVARIANT)) { - COM.MoveMemory(ppvObject, new int /*long*/[] { objIEnumVARIANT.getAddress()}, OS.PTR_SIZEOF); + + if (COM.IsEqualGUID(guid, COM.IIDIServiceProvider)) { + if (objIServiceProvider == null) createIServiceProvider(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIServiceProvider.getAddress() }, OS.PTR_SIZEOF); AddRef(); - enumIndex = 0; return COM.S_OK; } - int /*long*/[] ppv = new int /*long*/[1]; - int result = iaccessible.QueryInterface(guid, ppv); - COM.MoveMemory(ppvObject, ppv, OS.PTR_SIZEOF); - return result; + int code = queryAccessible2Interfaces(guid, ppvObject); + if (code == COM.S_OK) { + return COM.S_OK; + } + + if (iaccessible != null) { + /* Forward any other GUIDs to the OS proxy. */ + int /*long*/[] ppv = new int /*long*/[1]; + code = iaccessible.QueryInterface(guid, ppv); + COM.MoveMemory(ppvObject, ppv, OS.PTR_SIZEOF); + return code; + } + + return COM.E_NOINTERFACE; } int AddRef() { @@ -526,62 +1296,498 @@ public class Accessible { if (objIEnumVARIANT != null) objIEnumVARIANT.dispose(); objIEnumVARIANT = null; + + if (objIServiceProvider != null) + objIServiceProvider.dispose(); + objIServiceProvider = null; + + if (objIAccessible2 != null) + objIAccessible2.dispose(); + objIAccessible2 = null; + + if (objIAccessibleAction != null) + objIAccessibleAction.dispose(); + objIAccessibleAction = null; + + if (objIAccessibleApplication != null) + objIAccessibleApplication.dispose(); + objIAccessibleApplication = null; + + if (objIAccessibleComponent != null) + objIAccessibleComponent.dispose(); + objIAccessibleComponent = null; + + if (objIAccessibleEditableText != null) + objIAccessibleEditableText.dispose(); + objIAccessibleEditableText = null; + + if (objIAccessibleHyperlink != null) + objIAccessibleHyperlink.dispose(); + objIAccessibleHyperlink = null; + + if (objIAccessibleHypertext != null) + objIAccessibleHypertext.dispose(); + objIAccessibleHypertext = null; + + if (objIAccessibleImage != null) + objIAccessibleImage.dispose(); + objIAccessibleImage = null; + + if (objIAccessibleTable2 != null) + objIAccessibleTable2.dispose(); + objIAccessibleTable2 = null; + + if (objIAccessibleTableCell != null) + objIAccessibleTableCell.dispose(); + objIAccessibleTableCell = null; + + if (objIAccessibleText != null) + objIAccessibleText.dispose(); + objIAccessibleText = null; + + if (objIAccessibleValue != null) + objIAccessibleValue.dispose(); + objIAccessibleValue = null; + + for (int i = 0; i < relations.length; i++) { + if (relations[i] != null) relations[i].Release(); + } + // TODO: also remove all relations for which 'this' is a target?? + // (if so, need to make relations array static so all Accessibles can see it). } return refCount; } + /* QueryService([in] guidService, [in] riid, [out] ppvObject) */ + int QueryService(int /*long*/ guidService, int /*long*/ riid, int /*long*/ ppvObject) { + GUID service = new GUID(); + COM.MoveMemory(service, guidService, GUID.sizeof); + GUID guid = new GUID(); + COM.MoveMemory(guid, riid, GUID.sizeof); + + if (COM.IsEqualGUID(service, COM.IIDIAccessible)) { + if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDispatch) | COM.IsEqualGUID(guid, COM.IIDIAccessible)) { + if (objIAccessible == null) createIAccessible(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessible.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + /* NOTE: The following 2 lines shouldn't work, according to the IA2 specification, + * but this is what AccProbe and UnoInspect use, so we need to support it for testing. + */ + int code = queryAccessible2Interfaces(guid, ppvObject); + if (code == COM.S_OK) return code; + } + + if (COM.IsEqualGUID(service, COM.IIDIAccessible2)) { + int code = queryAccessible2Interfaces(guid, ppvObject); + if (code == COM.S_OK) return code; + } + + if (iaccessible != null) { + /* Forward any other GUIDs to the OS proxy. */ + int[] ppv = new int[1]; + int code = iaccessible.QueryInterface(COM.IIDIServiceProvider, ppv); + if (code == COM.S_OK) { + IServiceProvider iserviceProvider = new IServiceProvider(ppv[0]); + int[] ppvx = new int[1]; + code = iserviceProvider.QueryService(service, guid, ppvx); + COM.MoveMemory(ppvObject, new int /*long*/[] { ppvx[0] }, OS.PTR_SIZEOF); + return code; + } + } + + return COM.E_NOINTERFACE; + } + + int queryAccessible2Interfaces(GUID guid, int ppvObject) { + if (COM.IsEqualGUID(guid, COM.IIDIAccessible2) + && (accessibleControlListeners.size() > 0 || accessibleScrollListeners.size() > 0 || accessibleAttributeListeners.size() > 0)) { + if (objIAccessible2 == null) createIAccessible2(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessible2.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleAction) && accessibleActionListeners.size() > 0) { + if (objIAccessibleAction == null) createIAccessibleAction(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleAction.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleApplication)) { + if (objIAccessibleApplication == null) createIAccessibleApplication(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleApplication.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleComponent) && accessibleControlListeners.size() > 0) { + if (objIAccessibleComponent == null) createIAccessibleComponent(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleComponent.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + // TODO: We are not providing the EditableText interface at this time +// if (COM.IsEqualGUID(guid, COM.IIDIAccessibleEditableText)/*&& accessibleEditableTextListeners.size() > 0*/) { +// if (objIAccessibleEditableText == null) createIAccessibleEditableText(); +// COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleEditableText.getAddress() }, OS.PTR_SIZEOF); +// AddRef(); +// return COM.S_OK; +// } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleHyperlink) && accessibleHyperlinkListeners.size() > 0) { + if (objIAccessibleHyperlink == null) createIAccessibleHyperlink(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleHyperlink.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleHypertext) && accessibleTextExtendedListeners.size() > 0) { + if (objIAccessibleHypertext == null) createIAccessibleHypertext(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleHypertext.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleImage) + && (accessibleListeners.size() > 0 || accessibleControlListeners.size() > 0)) { + if (objIAccessibleImage == null) createIAccessibleImage(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleImage.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleTable2) && accessibleTableListeners.size() > 0) { + if (objIAccessibleTable2 == null) createIAccessibleTable2(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleTable2.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleTableCell) && accessibleTableCellListeners.size() > 0) { + if (objIAccessibleTableCell == null) createIAccessibleTableCell(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleTableCell.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleText) + && (accessibleTextListeners.size() > 0 || accessibleTextExtendedListeners.size() > 0 || accessibleAttributeListeners.size() > 0)) { + if (objIAccessibleText == null) createIAccessibleText(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleText.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleValue) && accessibleValueListeners.size() > 0) { + if (objIAccessibleValue == null) createIAccessibleValue(); + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleValue.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + return COM.E_NOINTERFACE; + } + + // ---------------------- START TEMPORARY DEBUG CODE + String guidString(GUID guid) { + final GUID IIDIAccessibleHandler = IIDFromString("{03022430-ABC4-11D0-BDE2-00AA001A1953}"); //$NON-NLS-1$ + final GUID IIDIAccessor = IIDFromString("{0C733A8C-2A1C-11CE-ADE5-00AA0044773D}"); //$NON-NLS-1$ + final GUID IIDIAdviseSink2 = IIDFromString("{00000125-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIBindCtx = IIDFromString("{0000000E-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDICreateErrorInfo = IIDFromString("{22F03340-547D-101B-8E65-08002B2BD119}"); //$NON-NLS-1$ + final GUID IIDICreateTypeInfo = IIDFromString("{00020405-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDICreateTypeLib = IIDFromString("{00020406-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIDataAdviseHolder = IIDFromString("{00000110-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIEnumConnectionPoints = IIDFromString("{B196B285-BAB4-101A-B69C-00AA00341D07}"); //$NON-NLS-1$ + final GUID IIDIEnumConnections = IIDFromString("{B196B287-BAB4-101A-B69C-00AA00341D07}"); //$NON-NLS-1$ + final GUID IIDIEnumMoniker = IIDFromString("{00000102-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIEnumOLEVERB = IIDFromString("{00000104-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIEnumSTATDATA = IIDFromString("{00000105-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIEnumSTATSTG = IIDFromString("{0000000D-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIEnumString = IIDFromString("{00000101-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIEnumUnknown = IIDFromString("{00000100-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIErrorInfo = IIDFromString("{1CF2B120-547D-101B-8E65-08002B2BD119}"); //$NON-NLS-1$ + final GUID IIDIErrorLog = IIDFromString("{3127CA40-446E-11CE-8135-00AA004BB851}"); //$NON-NLS-1$ + final GUID IIDIExternalConnection = IIDFromString("{00000019-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIFontDisp = IIDFromString("{BEF6E003-A874-101A-8BBA-00AA00300CAB}"); //$NON-NLS-1$ + final GUID IIDILockBytes = IIDFromString("{0000000A-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIMalloc = IIDFromString("{00000002-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIMallocSpy = IIDFromString("{0000001D-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIMarshal = IIDFromString("{00000003-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIMessageFilter = IIDFromString("{00000016-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIMoniker = IIDFromString("{0000000F-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIOleAdviseHolder = IIDFromString("{00000111-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIOleCache = IIDFromString("{0000011E-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIOleCache2 = IIDFromString("{00000128-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIOleCacheControl = IIDFromString("{00000129-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIOleItemContainer = IIDFromString("{0000011C-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIParseDisplayName = IIDFromString("{0000011A-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIPerPropertyBrowsing = IIDFromString("{376BD3AA-3845-101B-84ED-08002B2EC713}"); //$NON-NLS-1$ + final GUID IIDIPersistMemory = IIDFromString("{BD1AE5E0-A6AE-11CE-BD37-504200C10000}"); //$NON-NLS-1$ + final GUID IIDIPersistPropertyBag = IIDFromString("{37D84F60-42CB-11CE-8135-00AA004BB851}"); //$NON-NLS-1$ + final GUID IIDIPicture = IIDFromString("{7BF80980-BF32-101A-8BBB-00AA00300CAB}"); //$NON-NLS-1$ + final GUID IIDIPictureDisp = IIDFromString("{7BF80981-BF32-101A-8BBB-00AA00300CAB}"); //$NON-NLS-1$ + final GUID IIDIPropertyBag = IIDFromString("{55272A00-42CB-11CE-8135-00AA004BB851}"); //$NON-NLS-1$ + final GUID IIDIPropertyPage = IIDFromString("{B196B28D-BAB4-101A-B69C-00AA00341D07}"); //$NON-NLS-1$ + final GUID IIDIPropertyPage2 = IIDFromString("{01E44665-24AC-101B-84ED-08002B2EC713}"); //$NON-NLS-1$ + final GUID IIDIPropertyPageSite = IIDFromString("{B196B28C-BAB4-101A-B69C-00AA00341D07}"); //$NON-NLS-1$ + final GUID IIDIPSFactoryBuffer = IIDFromString("{D5F569D0-593B-101A-B569-08002B2DBF7A}"); //$NON-NLS-1$ + final GUID IIDIRootStorage = IIDFromString("{00000012-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIROTData = IIDFromString("{F29F6BC0-5021-11CE-AA15-00006901293F}"); //$NON-NLS-1$ + final GUID IIDIRpcChannelBuffer = IIDFromString("{D5F56B60-593B-101A-B569-08002B2DBF7A}"); //$NON-NLS-1$ + final GUID IIDIRpcProxyBuffer = IIDFromString("{D5F56A34-593B-101A-B569-08002B2DBF7A}"); //$NON-NLS-1$ + final GUID IIDIRpcStubBuffer = IIDFromString("{D5F56AFC-593B-101A-B569-08002B2DBF7A}"); //$NON-NLS-1$ + final GUID IIDIRunnableObject = IIDFromString("{00000126-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIRunningObjectTable = IIDFromString("{00000010-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDISimpleFrameSite = IIDFromString("{742B0E01-14E6-101B-914E-00AA00300CAB}"); //$NON-NLS-1$ + final GUID IIDIStdMarshalInfo = IIDFromString("{00000018-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDISupportErrorInfo = IIDFromString("{DF0B3D60-548F-101B-8E65-08002B2BD119}"); //$NON-NLS-1$ + final GUID IIDITypeComp = IIDFromString("{00020403-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDITypeLib = IIDFromString("{00020402-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + final GUID IIDIViewObject = IIDFromString("{0000010D-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + if (COM.IsEqualGUID(guid, COM.IID_IDropTargetHelper)) return "IID_IDropTargetHelper"; + if (COM.IsEqualGUID(guid, COM.IID_IDragSourceHelper)) return "IID_IDragSourceHelper"; + if (COM.IsEqualGUID(guid, COM.IID_IDragSourceHelper2)) return "IID_IDragSourceHelper2"; + if (COM.IsEqualGUID(guid, COM.IIDJavaBeansBridge)) return "IIDJavaBeansBridge"; + if (COM.IsEqualGUID(guid, COM.IIDShockwaveActiveXControl)) return "IIDShockwaveActiveXControl"; + if (COM.IsEqualGUID(guid, COM.IIDIEditorSiteTime)) return "IIDIEditorSiteTime"; + if (COM.IsEqualGUID(guid, COM.IIDIEditorSiteProperty)) return "IIDIEditorSiteProperty"; + if (COM.IsEqualGUID(guid, COM.IIDIEditorBaseProperty)) return "IIDIEditorBaseProperty"; + if (COM.IsEqualGUID(guid, COM.IIDIEditorSite)) return "IIDIEditorSite"; + if (COM.IsEqualGUID(guid, COM.IIDIEditorService)) return "IIDIEditorService"; + if (COM.IsEqualGUID(guid, COM.IIDIEditorManager)) return "IIDIEditorManager"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessible)) return "IIDIAccessible"; + if (COM.IsEqualGUID(guid, IIDIAccessibleHandler)) return "IIDIAccessibleHandler"; + if (COM.IsEqualGUID(guid, IIDIAccessor)) return "IIDIAccessor"; + if (COM.IsEqualGUID(guid, COM.IIDIAdviseSink)) return "IIDIAdviseSink"; + if (COM.IsEqualGUID(guid, IIDIAdviseSink2)) return "IIDIAdviseSink2"; + if (COM.IsEqualGUID(guid, IIDIBindCtx)) return "IIDIBindCtx"; + if (COM.IsEqualGUID(guid, COM.IIDIClassFactory)) return "IIDIClassFactory"; + if (COM.IsEqualGUID(guid, COM.IIDIClassFactory2)) return "IIDIClassFactory2"; + if (COM.IsEqualGUID(guid, COM.IIDIConnectionPoint)) return "IIDIConnectionPoint"; + if (COM.IsEqualGUID(guid, COM.IIDIConnectionPointContainer)) return "IIDIConnectionPointContainer"; + if (COM.IsEqualGUID(guid, IIDICreateErrorInfo)) return "IIDICreateErrorInfo"; + if (COM.IsEqualGUID(guid, IIDICreateTypeInfo)) return "IIDICreateTypeInfo"; + if (COM.IsEqualGUID(guid, IIDICreateTypeLib)) return "IIDICreateTypeLib"; + if (COM.IsEqualGUID(guid, IIDIDataAdviseHolder)) return "IIDIDataAdviseHolder"; + if (COM.IsEqualGUID(guid, COM.IIDIDataObject)) return "IIDIDataObject"; + if (COM.IsEqualGUID(guid, COM.IIDIDispatch)) return "IIDIDispatch"; + if (COM.IsEqualGUID(guid, COM.IIDIDispatchEx)) return "IIDIDispatchEx"; + if (COM.IsEqualGUID(guid, COM.IIDIDocHostUIHandler)) return "IIDIDocHostUIHandler"; + if (COM.IsEqualGUID(guid, COM.IIDIDocHostShowUI)) return "IIDIDocHostShowUI"; + if (COM.IsEqualGUID(guid, COM.IIDIDropSource)) return "IIDIDropSource"; + if (COM.IsEqualGUID(guid, COM.IIDIDropTarget)) return "IIDIDropTarget"; + if (COM.IsEqualGUID(guid, IIDIEnumConnectionPoints)) return "IIDIEnumConnectionPoints"; + if (COM.IsEqualGUID(guid, IIDIEnumConnections)) return "IIDIEnumConnections"; + if (COM.IsEqualGUID(guid, COM.IIDIEnumFORMATETC)) return "IIDIEnumFORMATETC"; + if (COM.IsEqualGUID(guid, IIDIEnumMoniker)) return "IIDIEnumMoniker"; + if (COM.IsEqualGUID(guid, IIDIEnumOLEVERB)) return "IIDIEnumOLEVERB"; + if (COM.IsEqualGUID(guid, IIDIEnumSTATDATA)) return "IIDIEnumSTATDATA"; + if (COM.IsEqualGUID(guid, IIDIEnumSTATSTG)) return "IIDIEnumSTATSTG"; + if (COM.IsEqualGUID(guid, IIDIEnumString)) return "IIDIEnumString"; + if (COM.IsEqualGUID(guid, IIDIEnumUnknown)) return "IIDIEnumUnknown"; + if (COM.IsEqualGUID(guid, COM.IIDIEnumVARIANT)) return "IIDIEnumVARIANT"; + if (COM.IsEqualGUID(guid, IIDIErrorInfo)) return "IIDIErrorInfo"; + if (COM.IsEqualGUID(guid, IIDIErrorLog)) return "IIDIErrorLog"; + if (COM.IsEqualGUID(guid, IIDIExternalConnection)) return "IIDIExternalConnection"; + if (COM.IsEqualGUID(guid, COM.IIDIFont)) return "IIDIFont"; + if (COM.IsEqualGUID(guid, IIDIFontDisp)) return "IIDIFontDisp"; + // if (COM.IsEqualGUID(guid, COM.IIDIHTMLDocumentEvents2)) return "IIDIHTMLDocumentEvents2"; + if (COM.IsEqualGUID(guid, COM.IIDIInternetSecurityManager)) return "IIDIInternetSecurityManager"; + if (COM.IsEqualGUID(guid, COM.IIDIAuthenticate)) return "IIDIAuthenticate"; + if (COM.IsEqualGUID(guid, COM.IIDIJScriptTypeInfo)) return "IIDIJScriptTypeInfo"; + if (COM.IsEqualGUID(guid, IIDILockBytes)) return "IIDILockBytes"; + if (COM.IsEqualGUID(guid, IIDIMalloc)) return "IIDIMalloc"; + if (COM.IsEqualGUID(guid, IIDIMallocSpy)) return "IIDIMallocSpy"; + if (COM.IsEqualGUID(guid, IIDIMarshal)) return "IIDIMarshal"; + if (COM.IsEqualGUID(guid, IIDIMessageFilter)) return "IIDIMessageFilter"; + if (COM.IsEqualGUID(guid, IIDIMoniker)) return "IIDIMoniker"; + if (COM.IsEqualGUID(guid, IIDIOleAdviseHolder)) return "IIDIOleAdviseHolder"; + if (COM.IsEqualGUID(guid, IIDIOleCache)) return "IIDIOleCache"; + if (COM.IsEqualGUID(guid, IIDIOleCache2)) return "IIDIOleCache2"; + if (COM.IsEqualGUID(guid, IIDIOleCacheControl)) return "IIDIOleCacheControl"; + if (COM.IsEqualGUID(guid, COM.IIDIOleClientSite)) return "IIDIOleClientSite"; + if (COM.IsEqualGUID(guid, COM.IIDIOleCommandTarget)) return "IIDIOleCommandTarget"; + if (COM.IsEqualGUID(guid, COM.IIDIOleContainer)) return "IIDIOleContainer"; + if (COM.IsEqualGUID(guid, COM.IIDIOleControl)) return "IIDIOleControl"; + if (COM.IsEqualGUID(guid, COM.IIDIOleControlSite)) return "IIDIOleControlSite"; + if (COM.IsEqualGUID(guid, COM.IIDIOleDocument)) return "IIDIOleDocument"; + if (COM.IsEqualGUID(guid, COM.IIDIOleDocumentSite)) return "IIDIOleDocumentSite"; + if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceActiveObject)) return "IIDIOleInPlaceActiveObject"; + if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceFrame)) return "IIDIOleInPlaceFrame"; + if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceObject)) return "IIDIOleInPlaceObject"; + if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceSite)) return "IIDIOleInPlaceSite"; + if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceUIWindow)) return "IIDIOleInPlaceUIWindow"; + if (COM.IsEqualGUID(guid, IIDIOleItemContainer)) return "IIDIOleItemContainer"; + if (COM.IsEqualGUID(guid, COM.IIDIOleLink)) return "IIDIOleLink"; + if (COM.IsEqualGUID(guid, COM.IIDIOleObject)) return "IIDIOleObject"; + if (COM.IsEqualGUID(guid, COM.IIDIOleWindow)) return "IIDIOleWindow"; + if (COM.IsEqualGUID(guid, IIDIParseDisplayName)) return "IIDIParseDisplayName"; + if (COM.IsEqualGUID(guid, IIDIPerPropertyBrowsing)) return "IIDIPerPropertyBrowsing"; + if (COM.IsEqualGUID(guid, COM.IIDIPersist)) return "IIDIPersist"; + if (COM.IsEqualGUID(guid, COM.IIDIPersistFile)) return "IIDIPersistFile"; + if (COM.IsEqualGUID(guid, IIDIPersistMemory)) return "IIDIPersistMemory"; + if (COM.IsEqualGUID(guid, IIDIPersistPropertyBag)) return "IIDIPersistPropertyBag"; + if (COM.IsEqualGUID(guid, COM.IIDIPersistStorage)) return "IIDIPersistStorage"; + if (COM.IsEqualGUID(guid, COM.IIDIPersistStream)) return "IIDIPersistStream"; + if (COM.IsEqualGUID(guid, COM.IIDIPersistStreamInit)) return "IIDIPersistStreamInit"; + if (COM.IsEqualGUID(guid, IIDIPicture)) return "IIDIPicture"; + if (COM.IsEqualGUID(guid, IIDIPictureDisp)) return "IIDIPictureDisp"; + if (COM.IsEqualGUID(guid, IIDIPropertyBag)) return "IIDIPropertyBag"; + if (COM.IsEqualGUID(guid, COM.IIDIPropertyNotifySink)) return "IIDIPropertyNotifySink"; + if (COM.IsEqualGUID(guid, IIDIPropertyPage)) return "IIDIPropertyPage"; + if (COM.IsEqualGUID(guid, IIDIPropertyPage2)) return "IIDIPropertyPage2"; + if (COM.IsEqualGUID(guid, IIDIPropertyPageSite)) return "IIDIPropertyPageSite"; + if (COM.IsEqualGUID(guid, COM.IIDIProvideClassInfo)) return "IIDIProvideClassInfo"; + if (COM.IsEqualGUID(guid, COM.IIDIProvideClassInfo2)) return "IIDIProvideClassInfo2"; + if (COM.IsEqualGUID(guid, IIDIPSFactoryBuffer)) return "IIDIPSFactoryBuffer"; + if (COM.IsEqualGUID(guid, IIDIRootStorage)) return "IIDIRootStorage"; + if (COM.IsEqualGUID(guid, IIDIROTData)) return "IIDIROTData"; + if (COM.IsEqualGUID(guid, IIDIRpcChannelBuffer)) return "IIDIRpcChannelBuffer"; + if (COM.IsEqualGUID(guid, IIDIRpcProxyBuffer)) return "IIDIRpcProxyBuffer"; + if (COM.IsEqualGUID(guid, IIDIRpcStubBuffer)) return "IIDIRpcStubBuffer"; + if (COM.IsEqualGUID(guid, IIDIRunnableObject)) return "IIDIRunnableObject"; + if (COM.IsEqualGUID(guid, IIDIRunningObjectTable)) return "IIDIRunningObjectTable"; + if (COM.IsEqualGUID(guid, IIDISimpleFrameSite)) return "IIDISimpleFrameSite"; + if (COM.IsEqualGUID(guid, COM.IIDIServiceProvider)) return "IIDIServiceProvider"; + if (COM.IsEqualGUID(guid, COM.IIDISpecifyPropertyPages)) return "IIDISpecifyPropertyPages"; + if (COM.IsEqualGUID(guid, IIDIStdMarshalInfo)) return "IIDIStdMarshalInfo"; + if (COM.IsEqualGUID(guid, COM.IIDIStorage)) return "IIDIStorage"; + if (COM.IsEqualGUID(guid, COM.IIDIStream)) return "IIDIStream"; + if (COM.IsEqualGUID(guid, IIDISupportErrorInfo)) return "IIDISupportErrorInfo"; + if (COM.IsEqualGUID(guid, IIDITypeComp)) return "IIDITypeComp"; + if (COM.IsEqualGUID(guid, IIDITypeLib)) return "IIDITypeLib"; + if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) return "IIDIUnknown"; + if (COM.IsEqualGUID(guid, IIDIViewObject)) return "IIDIViewObject"; + if (COM.IsEqualGUID(guid, COM.IIDIViewObject2)) return "IIDIViewObject2"; + if (COM.IsEqualGUID(guid, COM.CGID_DocHostCommandHandler)) return "CGID_DocHostCommandHandler"; + if (COM.IsEqualGUID(guid, COM.CGID_Explorer)) return "CGID_Explorer"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessible2)) return "IIDIAccessible2"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleRelation)) return "IIDIAccessibleRelation"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleAction)) return "IIDIAccessibleAction"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleComponent)) return "IIDIAccessibleComponent"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleValue)) return "IIDIAccessibleValue"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleText)) return "IIDIAccessibleText"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleEditableText)) return "IIDIAccessibleEditableText"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleHyperlink)) return "IIDIAccessibleHyperlink"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleHypertext)) return "IIDIAccessibleHypertext"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleTable)) return "IIDIAccessibleTable"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleTable2)) return "IIDIAccessibleTable2"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleTableCell)) return "IIDIAccessibleTableCell"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleImage)) return "IIDIAccessibleImage"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleApplication)) return "IIDIAccessibleApplication"; + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleContext)) return "IIDIAccessibleContext"; + return StringFromIID(guid); + } + static GUID IIDFromString(String lpsz) { + int length = lpsz.length(); + char[] buffer = new char[length + 1]; + lpsz.getChars(0, length, buffer, 0); + GUID lpiid = new GUID(); + if (COM.IIDFromString(buffer, lpiid) == COM.S_OK) return lpiid; + return null; + } + static String StringFromIID(GUID guid) { + return '{' + toHex(guid.Data1, 8) + "-" + + toHex(guid.Data2, 4) + "-" + + toHex(guid.Data3, 4) + "-" + + toHex(guid.Data4[0], 2) + toHex(guid.Data4[1], 2) + "-" + + toHex(guid.Data4[2], 2) + toHex(guid.Data4[3], 2) + toHex(guid.Data4[4], 2) + toHex(guid.Data4[5], 2) + toHex(guid.Data4[6], 2) + toHex(guid.Data4[7], 2) + '}'; + } + static final String zeros = "00000000"; + static String toHex(int v, int length) { + String t = Integer.toHexString(v).toUpperCase(); + int tlen = t.length(); + if (tlen > length) { + t = t.substring(tlen - length); + } + return zeros.substring(0, Math.max(0, length - tlen)) + t; + } +// ------------- END TEMPORARY DEBUG CODE + + /* accDoDefaultAction([in] varChild) */ int accDoDefaultAction(int /*long*/ varChild) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; - // Currently, we don't let the application override this. Forward to the proxy. - int code = iaccessible.accDoDefaultAction(varChild); - if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + if (accessibleActionListeners.size() > 0) { + VARIANT v = getVARIANT(varChild); + if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; + if (v.lVal == COM.CHILDID_SELF) return doAction(0); + } + int code = COM.DISP_E_MEMBERNOTFOUND; + if (iaccessible != null) { + /* If there were no action listeners, forward to the proxy. */ + code = iaccessible.accDoDefaultAction(varChild); + if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + } return code; } + /* accHitTest([in] xLeft, [in] yTop, [out] pvarChild) */ int accHitTest(int xLeft, int yTop, int /*long*/ pvarChild) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; - - /* Get the default (left, top) child from the OS. */ int osChild = ACC.CHILDID_NONE; - int code = iaccessible.accHitTest(xLeft, yTop, pvarChild); - if (accessibleControlListeners.size() == 0) return code; - if (code == COM.S_OK) { - VARIANT v = getVARIANT(pvarChild); - if (v.vt == COM.VT_I4) osChild = osToChildID(v.lVal); - /* Should also handle v.vt == COM.VT_DISPATCH */ + int /*long*/ osChildObject = 0; + if (iaccessible != null) { + /* Get the default child at point (left, top) from the OS. */ + int code = iaccessible.accHitTest(xLeft, yTop, pvarChild); + if (accessibleControlListeners.size() == 0) return code; + if (code == COM.S_OK) { + VARIANT v = getVARIANT(pvarChild); + if (v.vt == COM.VT_I4) osChild = osToChildID(v.lVal); + else if (v.vt == COM.VT_DISPATCH) { + osChildObject = v.lVal; + System.out.println("accHitTest: proxy returned an object with this address: " + osChildObject); + } + } } AccessibleControlEvent event = new AccessibleControlEvent(this); + // TODO: Should also look up Accessible for osChildObject event.childID = osChild; + //event.accessible = Accessible for osChildObject; event.x = xLeft; event.y = yTop; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getChildAtPoint(event); } + Accessible accessible = event.accessible; + if (accessible != null) { + accessible.AddRef(); + setPtrVARIANT(pvarChild, COM.VT_DISPATCH, accessible.getAddress()); + return COM.S_OK; + } int childID = event.childID; - if (childID == ACC.CHILDID_NONE) return COM.S_FALSE; - setVARIANT(pvarChild, COM.VT_I4, childIDToOs(childID)); + if (childID == ACC.CHILDID_NONE) { + if (osChildObject != 0) return COM.S_OK; + setIntVARIANT(pvarChild, COM.VT_EMPTY, 0); + return COM.S_FALSE; + } + setIntVARIANT(pvarChild, COM.VT_I4, childIDToOs(childID)); return COM.S_OK; } + /* accLocation([out] pxLeft, [out] pyTop, [out] pcxWidth, [out] pcyHeight, [in] varChild) */ int accLocation(int /*long*/ pxLeft, int /*long*/ pyTop, int /*long*/ pcxWidth, int /*long*/ pcyHeight, int /*long*/ varChild) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default location from the OS. */ int osLeft = 0, osTop = 0, osWidth = 0, osHeight = 0; - int code = iaccessible.accLocation(pxLeft, pyTop, pcxWidth, pcyHeight, varChild); - if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID - if (accessibleControlListeners.size() == 0) return code; - if (code == COM.S_OK) { - int[] pLeft = new int[1], pTop = new int[1], pWidth = new int[1], pHeight = new int[1]; - COM.MoveMemory(pLeft, pxLeft, 4); - COM.MoveMemory(pTop, pyTop, 4); - COM.MoveMemory(pWidth, pcxWidth, 4); - COM.MoveMemory(pHeight, pcyHeight, 4); - osLeft = pLeft[0]; osTop = pTop[0]; osWidth = pWidth[0]; osHeight = pHeight[0]; + if (iaccessible != null) { + /* Get the default location from the OS. */ + int code = iaccessible.accLocation(pxLeft, pyTop, pcxWidth, pcyHeight, varChild); + if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + if (accessibleControlListeners.size() == 0) return code; + if (code == COM.S_OK) { + int[] pLeft = new int[1], pTop = new int[1], pWidth = new int[1], pHeight = new int[1]; + COM.MoveMemory(pLeft, pxLeft, 4); + COM.MoveMemory(pTop, pyTop, 4); + COM.MoveMemory(pWidth, pcxWidth, 4); + COM.MoveMemory(pHeight, pcyHeight, 4); + osLeft = pLeft[0]; osTop = pTop[0]; osWidth = pWidth[0]; osHeight = pHeight[0]; + } } AccessibleControlEvent event = new AccessibleControlEvent(this); @@ -601,22 +1807,28 @@ public class Accessible { return COM.S_OK; } + /* accNavigate([in] navDir, [in] varStart, [out] pvarEndUpAt) */ int accNavigate(int navDir, int /*long*/ varStart, int /*long*/ pvarEndUpAt) { - /* MSAA: "The accNavigate method is deprecated and should not be used." - * - * NOTE: Since many of the native controls still handle accNavigate, - * we will continue to send this through to the proxy. - */ - int code = iaccessible.accNavigate(navDir, varStart, pvarEndUpAt); - if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + /* MSAA: "The accNavigate method is deprecated and should not be used." */ + int code = COM.DISP_E_MEMBERNOTFOUND; + if (iaccessible != null) { + /* Since many of the native controls still handle accNavigate, + * we will continue to send this through to the proxy. */ + code = iaccessible.accNavigate(navDir, varStart, pvarEndUpAt); + if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + } return code; } + /* accSelect([in] flagsSelect, [in] varChild) */ int accSelect(int flagsSelect, int /*long*/ varChild) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; - // Currently, we don't let the application override this. Forward to the proxy. - int code = iaccessible.accSelect(flagsSelect, varChild); - if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + // TODO: Probably need to support this? + int code = COM.DISP_E_MEMBERNOTFOUND; + if (iaccessible != null) { + /* Currently, we don't expose this as API. Forward to the proxy. */ + code = iaccessible.accSelect(flagsSelect, varChild); + if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + } return code; } @@ -625,13 +1837,13 @@ public class Accessible { * must be incremented before returning. The caller is responsible for releasing ppdispChild. */ int get_accChild(int /*long*/ varChild, int /*long*/ ppdispChild) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - if (accessibleControlListeners.size() == 0) { - int code = iaccessible.get_accChild(varChild, ppdispChild); + int code = COM.S_FALSE; + if (iaccessible != null) { + /* Get the default child from the OS. */ + code = iaccessible.get_accChild(varChild, ppdispChild); if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID - return code; } AccessibleControlEvent event = new AccessibleControlEvent(this); @@ -643,23 +1855,24 @@ public class Accessible { Accessible accessible = event.accessible; if (accessible != null) { accessible.AddRef(); - COM.MoveMemory(ppdispChild, new int /*long*/[] { accessible.objIAccessible.getAddress() }, OS.PTR_SIZEOF); + COM.MoveMemory(ppdispChild, new int /*long*/[] { accessible.getAddress() }, OS.PTR_SIZEOF); return COM.S_OK; } - return COM.S_FALSE; + return code; } + /* get_accChildCount([out] pcountChildren) */ int get_accChildCount(int /*long*/ pcountChildren) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; - - /* Get the default child count from the OS. */ int osChildCount = 0; - int code = iaccessible.get_accChildCount(pcountChildren); - if (accessibleControlListeners.size() == 0) return code; - if (code == COM.S_OK) { - int[] pChildCount = new int[1]; - COM.MoveMemory(pChildCount, pcountChildren, 4); - osChildCount = pChildCount[0]; + if (iaccessible != null) { + /* Get the default child count from the OS. */ + int code = iaccessible.get_accChildCount(pcountChildren); + if (accessibleControlListeners.size() == 0) return code; + if (code == COM.S_OK) { + int[] pChildCount = new int[1]; + COM.MoveMemory(pChildCount, pcountChildren, 4); + osChildCount = pChildCount[0]; + } } AccessibleControlEvent event = new AccessibleControlEvent(this); @@ -674,24 +1887,26 @@ public class Accessible { return COM.S_OK; } + /* get_accDefaultAction([in] varChild, [out] pszDefaultAction) */ int get_accDefaultAction(int /*long*/ varChild, int /*long*/ pszDefaultAction) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default defaultAction from the OS. */ + int code = COM.DISP_E_MEMBERNOTFOUND; String osDefaultAction = null; - int code = iaccessible.get_accDefaultAction(varChild, pszDefaultAction); - if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID - if (accessibleControlListeners.size() == 0) return code; - if (code == COM.S_OK) { - int /*long*/[] pDefaultAction = new int /*long*/[1]; - COM.MoveMemory(pDefaultAction, pszDefaultAction, OS.PTR_SIZEOF); - int size = COM.SysStringByteLen(pDefaultAction[0]); - if (size > 0) { - char[] buffer = new char[(size + 1) /2]; - COM.MoveMemory(buffer, pDefaultAction[0], size); - osDefaultAction = new String(buffer); + if (iaccessible != null) { + /* Get the default defaultAction from the OS. */ + code = iaccessible.get_accDefaultAction(varChild, pszDefaultAction); + if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID + if (accessibleControlListeners.size() == 0) return code; + if (code == COM.S_OK) { + int /*long*/[] pDefaultAction = new int /*long*/[1]; + COM.MoveMemory(pDefaultAction, pszDefaultAction, OS.PTR_SIZEOF); + int size = COM.SysStringByteLen(pDefaultAction[0]); + if (size > 0) { + char[] buffer = new char[(size + 1) /2]; + COM.MoveMemory(buffer, pDefaultAction[0], size); + osDefaultAction = new String(buffer); + } } } @@ -702,40 +1917,45 @@ public class Accessible { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getDefaultAction(event); } + if ((event.result == null || event.result.length() == 0) && v.lVal == COM.CHILDID_SELF) { + code = get_name(0, pszDefaultAction); + } if (event.result == null) return code; - char[] data = (event.result + "\0").toCharArray(); - int /*long*/ ptr = COM.SysAllocString(data); - COM.MoveMemory(pszDefaultAction, new int /*long*/[] { ptr }, OS.PTR_SIZEOF); + if (event.result.length() == 0) return COM.S_FALSE; + setString(pszDefaultAction, event.result); return COM.S_OK; } + /* get_accDescription([in] varChild, [out] pszDescription) */ int get_accDescription(int /*long*/ varChild, int /*long*/ pszDescription) { /* * MSAA: "The accDescription property is not supported in the transition to * UI Automation. MSAA servers and applications should not use it." * - * NOTE: Description was exposed as SWT API. We will need to either deprecate this, - * or find a suitable replacement. Note that the trick to expose tree columns - * was not supported by screen readers, so it should be replaced. + * TODO: Description was exposed as SWT API. We will need to either deprecate this (?), + * or find a suitable replacement. Also, check description property on other platforms. + * Note that the trick to expose tree columns (below) was not supported by screen readers, + * so it should be replaced. */ - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default description from the OS. */ + int code = COM.DISP_E_MEMBERNOTFOUND; String osDescription = null; - int code = iaccessible.get_accDescription(varChild, pszDescription); - if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID - // TEMPORARY CODE - process tree even if there are no apps listening - if (accessibleListeners.size() == 0 && !(control instanceof Tree)) return code; - if (code == COM.S_OK) { - int /*long*/[] pDescription = new int /*long*/[1]; - COM.MoveMemory(pDescription, pszDescription, OS.PTR_SIZEOF); - int size = COM.SysStringByteLen(pDescription[0]); - if (size > 0) { - char[] buffer = new char[(size + 1) /2]; - COM.MoveMemory(buffer, pDescription[0], size); - osDescription = new String(buffer); + if (iaccessible != null) { + /* Get the default description from the OS. */ + code = iaccessible.get_accDescription(varChild, pszDescription); + if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID + // TEMPORARY CODE - process tree even if there are no apps listening + if (accessibleListeners.size() == 0 && !(control instanceof Tree)) return code; + if (code == COM.S_OK) { + int /*long*/[] pDescription = new int /*long*/[1]; + COM.MoveMemory(pDescription, pszDescription, OS.PTR_SIZEOF); + int size = COM.SysStringByteLen(pDescription[0]); + if (size > 0) { + char[] buffer = new char[(size + 1) /2]; + COM.MoveMemory(buffer, pDescription[0], size); + osDescription = new String(buffer); + } } } @@ -775,26 +1995,25 @@ public class Accessible { listener.getDescription(event); } if (event.result == null) return code; - char[] data = (event.result + "\0").toCharArray(); - int /*long*/ ptr = COM.SysAllocString(data); - COM.MoveMemory(pszDescription, new int /*long*/[] { ptr }, OS.PTR_SIZEOF); + if (event.result.length() == 0) return COM.S_FALSE; + setString(pszDescription, event.result); return COM.S_OK; } - /* get_accFocus([out] int pvarChild) + /* get_accFocus([out] pvarChild) * Ownership of pvarChild transfers from callee to caller so reference count on pvarChild * must be incremented before returning. The caller is responsible for releasing pvarChild. */ int get_accFocus(int /*long*/ pvarChild) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; - - /* Get the default focus child from the OS. */ int osChild = ACC.CHILDID_NONE; - int code = iaccessible.get_accFocus(pvarChild); - if (accessibleControlListeners.size() == 0) return code; - if (code == COM.S_OK) { - VARIANT v = getVARIANT(pvarChild); - if (v.vt == COM.VT_I4) osChild = osToChildID(v.lVal); + if (iaccessible != null) { + /* Get the default focus child from the OS. */ + int code = iaccessible.get_accFocus(pvarChild); + if (accessibleControlListeners.size() == 0) return code; + if (code == COM.S_OK) { + VARIANT v = getVARIANT(pvarChild); + if (v.vt == COM.VT_I4) osChild = osToChildID(v.lVal); + } } AccessibleControlEvent event = new AccessibleControlEvent(this); @@ -806,41 +2025,43 @@ public class Accessible { Accessible accessible = event.accessible; if (accessible != null) { accessible.AddRef(); - setPtrVARIANT(pvarChild, COM.VT_DISPATCH, accessible.objIAccessible.getAddress()); + setPtrVARIANT(pvarChild, COM.VT_DISPATCH, accessible.getAddress()); return COM.S_OK; } int childID = event.childID; if (childID == ACC.CHILDID_NONE) { - setVARIANT(pvarChild, COM.VT_EMPTY, 0); + setIntVARIANT(pvarChild, COM.VT_EMPTY, 0); return COM.S_FALSE; } if (childID == ACC.CHILDID_SELF) { AddRef(); - setPtrVARIANT(pvarChild, COM.VT_DISPATCH, objIAccessible.getAddress()); + setPtrVARIANT(pvarChild, COM.VT_DISPATCH, getAddress()); return COM.S_OK; } - setVARIANT(pvarChild, COM.VT_I4, childIDToOs(childID)); + setIntVARIANT(pvarChild, COM.VT_I4, childIDToOs(childID)); return COM.S_OK; } + /* get_accHelp([in] varChild, [out] pszHelp) */ int get_accHelp(int /*long*/ varChild, int /*long*/ pszHelp) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default help string from the OS. */ + int code = COM.DISP_E_MEMBERNOTFOUND; String osHelp = null; - int code = iaccessible.get_accHelp(varChild, pszHelp); - if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID - if (accessibleListeners.size() == 0) return code; - if (code == COM.S_OK) { - int /*long*/[] pHelp = new int /*long*/[1]; - COM.MoveMemory(pHelp, pszHelp, OS.PTR_SIZEOF); - int size = COM.SysStringByteLen(pHelp[0]); - if (size > 0) { - char[] buffer = new char[(size + 1) /2]; - COM.MoveMemory(buffer, pHelp[0], size); - osHelp = new String(buffer); + if (iaccessible != null) { + /* Get the default help string from the OS. */ + code = iaccessible.get_accHelp(varChild, pszHelp); + if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID + if (accessibleListeners.size() == 0) return code; + if (code == COM.S_OK) { + int /*long*/[] pHelp = new int /*long*/[1]; + COM.MoveMemory(pHelp, pszHelp, OS.PTR_SIZEOF); + int size = COM.SysStringByteLen(pHelp[0]); + if (size > 0) { + char[] buffer = new char[(size + 1) /2]; + COM.MoveMemory(buffer, pHelp[0], size); + osHelp = new String(buffer); + } } } @@ -853,41 +2074,43 @@ public class Accessible { } if (event.result == null) return code; if (event.result.length() == 0) return COM.S_FALSE; - char[] data = (event.result + "\0").toCharArray(); - int /*long*/ ptr = COM.SysAllocString(data); - COM.MoveMemory(pszHelp, new int /*long*/[] { ptr }, OS.PTR_SIZEOF); + setString(pszHelp, event.result); return COM.S_OK; } + /* get_accHelpTopic([out] pszHelpFile, [in] varChild, [out] pidTopic) */ int get_accHelpTopic(int /*long*/ pszHelpFile, int /*long*/ varChild, int /*long*/ pidTopic) { - /* MSAA: "The accHelpTopic property is deprecated and should not be used." - * - * NOTE: Since it is possible that a native control might still handle get_accHelpTopic, - * we will continue to send this through to the proxy. - */ - int code = iaccessible.get_accHelpTopic(pszHelpFile, varChild, pidTopic); - if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + /* MSAA: "The accHelpTopic property is deprecated and should not be used." */ + int code = COM.DISP_E_MEMBERNOTFOUND; + if (iaccessible != null) { + /* Since it is possible that a native control might still handle get_accHelpTopic, + * we will continue to send this through to the proxy. */ + code = iaccessible.get_accHelpTopic(pszHelpFile, varChild, pidTopic); + if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + } return code; } + /* get_accKeyboardShortcut([in] varChild, [out] pszKeyboardShortcut) */ int get_accKeyboardShortcut(int /*long*/ varChild, int /*long*/ pszKeyboardShortcut) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default keyboard shortcut from the OS. */ + int code = COM.DISP_E_MEMBERNOTFOUND; String osKeyboardShortcut = null; - int code = iaccessible.get_accKeyboardShortcut(varChild, pszKeyboardShortcut); - if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID - if (accessibleListeners.size() == 0) return code; - if (code == COM.S_OK) { - int /*long*/[] pKeyboardShortcut = new int /*long*/[1]; - COM.MoveMemory(pKeyboardShortcut, pszKeyboardShortcut, OS.PTR_SIZEOF); - int size = COM.SysStringByteLen(pKeyboardShortcut[0]); - if (size > 0) { - char[] buffer = new char[(size + 1) /2]; - COM.MoveMemory(buffer, pKeyboardShortcut[0], size); - osKeyboardShortcut = new String(buffer); + if (iaccessible != null) { + /* Get the default keyboard shortcut from the OS. */ + code = iaccessible.get_accKeyboardShortcut(varChild, pszKeyboardShortcut); + if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID + if (accessibleListeners.size() == 0) return code; + if (code == COM.S_OK) { + int /*long*/[] pKeyboardShortcut = new int /*long*/[1]; + COM.MoveMemory(pKeyboardShortcut, pszKeyboardShortcut, OS.PTR_SIZEOF); + int size = COM.SysStringByteLen(pKeyboardShortcut[0]); + if (size > 0) { + char[] buffer = new char[(size + 1) /2]; + COM.MoveMemory(buffer, pKeyboardShortcut[0], size); + osKeyboardShortcut = new String(buffer); + } } } @@ -899,30 +2122,31 @@ public class Accessible { listener.getKeyboardShortcut(event); } if (event.result == null) return code; - char[] data = (event.result + "\0").toCharArray(); - int /*long*/ ptr = COM.SysAllocString(data); - COM.MoveMemory(pszKeyboardShortcut, new int /*long*/[] { ptr }, OS.PTR_SIZEOF); + if (event.result.length() == 0) return COM.S_FALSE; + setString(pszKeyboardShortcut, event.result); return COM.S_OK; } + /* get_accName([in] varChild, [out] pszName) */ int get_accName(int /*long*/ varChild, int /*long*/ pszName) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default name from the OS. */ + int code = COM.S_FALSE; String osName = null; - int code = iaccessible.get_accName(varChild, pszName); - if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID - if (accessibleListeners.size() == 0) return code; - if (code == COM.S_OK) { - int /*long*/[] pName = new int /*long*/[1]; - COM.MoveMemory(pName, pszName, OS.PTR_SIZEOF); - int size = COM.SysStringByteLen(pName[0]); - if (size > 0) { - char[] buffer = new char[(size + 1) /2]; - COM.MoveMemory(buffer, pName[0], size); - osName = new String(buffer); + if (iaccessible != null) { + /* Get the default name from the OS. */ + code = iaccessible.get_accName(varChild, pszName); + if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID + if (accessibleListeners.size() == 0) return code; + if (code == COM.S_OK) { + int /*long*/[] pName = new int /*long*/[1]; + COM.MoveMemory(pName, pszName, OS.PTR_SIZEOF); + int size = COM.SysStringByteLen(pName[0]); + if (size > 0) { + char[] buffer = new char[(size + 1) /2]; + COM.MoveMemory(buffer, pName[0], size); + osName = new String(buffer); + } } } @@ -935,9 +2159,7 @@ public class Accessible { } if (event.result == null) return code; if (event.result.length() == 0) return COM.S_FALSE; - char[] data = (event.result + "\0").toCharArray(); - int /*long*/ ptr = COM.SysAllocString(data); - COM.MoveMemory(pszName, new int /*long*/[] { ptr }, OS.PTR_SIZEOF); + setString(pszName, event.result); return COM.S_OK; } @@ -946,22 +2168,32 @@ public class Accessible { * must be incremented before returning. The caller is responsible for releasing ppdispParent. */ int get_accParent(int /*long*/ ppdispParent) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; - // Currently, we don't let the application override this. Forward to the proxy. - return iaccessible.get_accParent(ppdispParent); + // TODO: Do we need getParent API? Returning 'parent', or proxy's parent should be ok? + int code = COM.DISP_E_MEMBERNOTFOUND; + if (iaccessible != null) { + /* Currently, we don't expose this as API. Forward to the proxy. */ + code = iaccessible.get_accParent(ppdispParent); + } else if (parent != null) { + /* For lightweight accessibles, return the accessible's parent. */ + parent.AddRef(); + setPtrVARIANT(ppdispParent, COM.VT_DISPATCH, parent.getAddress()); + code = COM.S_OK; + } + return code; } + /* get_accRole([in] varChild, [out] pvarRole) */ int get_accRole(int /*long*/ varChild, int /*long*/ pvarRole) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default role from the OS. */ int osRole = COM.ROLE_SYSTEM_CLIENT; - int code = iaccessible.get_accRole(varChild, pvarRole); - if (code == COM.S_OK) { - VARIANT v2 = getVARIANT(pvarRole); - if (v2.vt == COM.VT_I4) osRole = v2.lVal; + if (iaccessible != null) { + /* Get the default role from the OS. */ + int code = iaccessible.get_accRole(varChild, pvarRole); + if (code == COM.S_OK) { + VARIANT v2 = getVARIANT(pvarRole); + if (v2.vt == COM.VT_I4) osRole = v2.lVal; + } } AccessibleControlEvent event = new AccessibleControlEvent(this); @@ -977,7 +2209,7 @@ public class Accessible { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); listener.getRole(event); } - setVARIANT(pvarRole, COM.VT_I4, roleToOs(event.detail)); + setIntVARIANT(pvarRole, COM.VT_I4, roleToOs(event.detail)); return COM.S_OK; } @@ -986,21 +2218,23 @@ public class Accessible { * must be incremented before returning. The caller is responsible for releasing pvarChildren. */ int get_accSelection(int /*long*/ pvarChildren) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; - - /* Get the default selection from the OS. */ int osChild = ACC.CHILDID_NONE; - int code = iaccessible.get_accSelection(pvarChildren); - if (accessibleControlListeners.size() == 0) return code; - if (code == COM.S_OK) { - VARIANT v = getVARIANT(pvarChildren); - if (v.vt == COM.VT_I4) { - osChild = osToChildID(v.lVal); - } else if (v.vt == COM.VT_UNKNOWN) { - osChild = ACC.CHILDID_MULTIPLE; - /* Should get IEnumVARIANT from punkVal field, and enumerate children... */ + int /*long*/ osChildObject = 0; + if (iaccessible != null) { + /* Get the default selection from the OS. */ + int code = iaccessible.get_accSelection(pvarChildren); + if (accessibleControlListeners.size() == 0) return code; + if (code == COM.S_OK) { + VARIANT v = getVARIANT(pvarChildren); + if (v.vt == COM.VT_I4) { + osChild = osToChildID(v.lVal); + } else if (v.vt == COM.VT_DISPATCH) { + osChildObject = v.lVal; + } else if (v.vt == COM.VT_UNKNOWN) { + osChild = ACC.CHILDID_MULTIPLE; + // TODO: Should get IEnumVARIANT from punkVal field, and enumerate children... + } } - /* Should also handle (v.vt == COM.VT_DISPATCH) */ } AccessibleControlEvent event = new AccessibleControlEvent(this); @@ -1012,40 +2246,44 @@ public class Accessible { Accessible accessible = event.accessible; if (accessible != null) { accessible.AddRef(); - setPtrVARIANT(pvarChildren, COM.VT_DISPATCH, accessible.objIAccessible.getAddress()); + setPtrVARIANT(pvarChildren, COM.VT_DISPATCH, accessible.getAddress()); return COM.S_OK; } int childID = event.childID; if (childID == ACC.CHILDID_NONE) { - setVARIANT(pvarChildren, COM.VT_EMPTY, 0); + if (osChildObject != 0) return COM.S_OK; + setIntVARIANT(pvarChildren, COM.VT_EMPTY, 0); return COM.S_FALSE; } if (childID == ACC.CHILDID_MULTIPLE) { - AddRef(); - setPtrVARIANT(pvarChildren, COM.VT_UNKNOWN, objIAccessible.getAddress()); + // TODO: return an enumeration for event.children (currently just returns enumeration from proxy) + //AddRef(); + //setPtrVARIANT(pvarChildren, COM.VT_UNKNOWN, getAddress()); return COM.S_OK; } if (childID == ACC.CHILDID_SELF) { AddRef(); - setPtrVARIANT(pvarChildren, COM.VT_DISPATCH, objIAccessible.getAddress()); + setPtrVARIANT(pvarChildren, COM.VT_DISPATCH, getAddress()); return COM.S_OK; } - setVARIANT(pvarChildren, COM.VT_I4, childIDToOs(childID)); + setIntVARIANT(pvarChildren, COM.VT_I4, childIDToOs(childID)); return COM.S_OK; } + /* get_accState([in] varChild, [out] pvarState) */ int get_accState(int /*long*/ varChild, int /*long*/ pvarState) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default state from the OS. */ int osState = 0; - int code = iaccessible.get_accState(varChild, pvarState); - if (code == COM.S_OK) { - VARIANT v2 = getVARIANT(pvarState); - if (v2.vt == COM.VT_I4) osState = v2.lVal; + if (iaccessible != null) { + /* Get the default state from the OS. */ + int code = iaccessible.get_accState(varChild, pvarState); + if (code == COM.S_OK) { + VARIANT v2 = getVARIANT(pvarState); + if (v2.vt == COM.VT_I4) osState = v2.lVal; + } } + boolean grayed = false; AccessibleControlEvent event = new AccessibleControlEvent(this); event.childID = osToChildID(v.lVal); @@ -1087,28 +2325,30 @@ public class Accessible { state &= ~ COM.STATE_SYSTEM_CHECKED; state |= COM.STATE_SYSTEM_MIXED; } - setVARIANT(pvarState, COM.VT_I4, state); + setIntVARIANT(pvarState, COM.VT_I4, state); return COM.S_OK; } + /* get_accValue([in] varChild, [out] pszValue) */ int get_accValue(int /*long*/ varChild, int /*long*/ pszValue) { - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; VARIANT v = getVARIANT(varChild); if (v.vt != COM.VT_I4) return COM.E_INVALIDARG; - - /* Get the default value string from the OS. */ + int code = COM.DISP_E_MEMBERNOTFOUND; String osValue = null; - int code = iaccessible.get_accValue(varChild, pszValue); - if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID - if (accessibleControlListeners.size() == 0) return code; - if (code == COM.S_OK) { - int /*long*/[] pValue = new int /*long*/[1]; - COM.MoveMemory(pValue, pszValue, OS.PTR_SIZEOF); - int size = COM.SysStringByteLen(pValue[0]); - if (size > 0) { - char[] buffer = new char[(size + 1) /2]; - COM.MoveMemory(buffer, pValue[0], size); - osValue = new String(buffer); + if (iaccessible != null) { + /* Get the default value string from the OS. */ + code = iaccessible.get_accValue(varChild, pszValue); + if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + if (accessibleControlListeners.size() == 0) return code; + if (code == COM.S_OK) { + int /*long*/[] pValue = new int /*long*/[1]; + COM.MoveMemory(pValue, pszValue, OS.PTR_SIZEOF); + int size = COM.SysStringByteLen(pValue[0]); + if (size > 0) { + char[] buffer = new char[(size + 1) /2]; + COM.MoveMemory(buffer, pValue[0], size); + osValue = new String(buffer); + } } } @@ -1120,23 +2360,27 @@ public class Accessible { listener.getValue(event); } if (event.result == null) return code; - char[] data = (event.result + "\0").toCharArray(); - int /*long*/ ptr = COM.SysAllocString(data); - COM.MoveMemory(pszValue, new int /*long*/[] { ptr }, OS.PTR_SIZEOF); + // empty string is a valid value, so do not test for it + setString(pszValue, event.result); return COM.S_OK; } + /* put_accName([in] varChild, [in] szName) */ int put_accName(int /*long*/ varChild, int /*long*/ szName) { /* MSAA: "The IAccessible::put_accName method is no longer supported. Servers should return E_NOTIMPL." */ return COM.E_NOTIMPL; } + /* put_accValue([in] varChild, [in] szValue) */ int put_accValue(int /*long*/ varChild, int /*long*/ szValue) { - // MSAA: this method is typically only used for edit controls - if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED; - // We don't implement this. Forward to the proxy. - int code = iaccessible.put_accValue(varChild, szValue); - if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + // TODO: Are we going to support this (in EditableText)? + /* MSAA: this method is typically only used for edit controls. */ + int code = COM.DISP_E_MEMBERNOTFOUND; + if (iaccessible != null) { + /* Currently, we don't expose this as API. Forward to the proxy. */ + code = iaccessible.put_accValue(varChild, szValue); + if (code == COM.E_INVALIDARG) code = COM.DISP_E_MEMBERNOTFOUND; // proxy doesn't know about app childID + } return code; } @@ -1148,7 +2392,7 @@ public class Accessible { * (unless the caller passed in NULL for that parameter). */ - /* Next([in] celt, [out] rgvar, [in, out] pceltFetched) + /* IEnumVARIANT::Next([in] celt, [out] rgvar, [in, out] pceltFetched) * Ownership of rgvar transfers from callee to caller so reference count on rgvar * must be incremented before returning. The caller is responsible for releasing rgvar. */ @@ -1156,7 +2400,7 @@ public class Accessible { /* If there are no listeners, query the proxy for * its IEnumVariant, and get the Next items from it. */ - if (accessibleControlListeners.size() == 0) { + if (iaccessible != null && accessibleControlListeners.size() == 0) { int /*long*/[] ppvObject = new int /*long*/[1]; int code = iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject); if (code != COM.S_OK) return code; @@ -1201,11 +2445,11 @@ public class Accessible { Object nextItem = nextItems[i]; if (nextItem instanceof Integer) { int item = ((Integer) nextItem).intValue(); - setVARIANT(rgvar + i * VARIANT.sizeof, COM.VT_I4, item); + setIntVARIANT(rgvar + i * VARIANT.sizeof, COM.VT_I4, item); } else { Accessible accessible = (Accessible) nextItem; accessible.AddRef(); - setPtrVARIANT(rgvar + i * VARIANT.sizeof, COM.VT_DISPATCH, accessible.objIAccessible.getAddress()); + setPtrVARIANT(rgvar + i * VARIANT.sizeof, COM.VT_DISPATCH, accessible.getAddress()); } } if (pceltFetched != 0) @@ -1218,12 +2462,12 @@ public class Accessible { return COM.S_FALSE; } - /* Skip over the specified number of elements in the enumeration sequence. */ + /* IEnumVARIANT::Skip([in] celt) over the specified number of elements in the enumeration sequence. */ int Skip(int celt) { /* If there are no listeners, query the proxy * for its IEnumVariant, and tell it to Skip. */ - if (accessibleControlListeners.size() == 0) { + if (iaccessible != null && accessibleControlListeners.size() == 0) { int /*long*/[] ppvObject = new int /*long*/[1]; int code = iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject); if (code != COM.S_OK) return code; @@ -1242,12 +2486,12 @@ public class Accessible { return COM.S_OK; } - /* Reset the enumeration sequence to the beginning. */ + /* IEnumVARIANT::Reset() the enumeration sequence to the beginning. */ int Reset() { /* If there are no listeners, query the proxy * for its IEnumVariant, and tell it to Reset. */ - if (accessibleControlListeners.size() == 0) { + if (iaccessible != null && accessibleControlListeners.size() == 0) { int /*long*/[] ppvObject = new int /*long*/[1]; int code = (int)/*64*/iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject); if (code != COM.S_OK) return code; @@ -1261,7 +2505,7 @@ public class Accessible { return COM.S_OK; } - /* Clone([out] ppEnum) + /* IEnumVARIANT::Clone([out] ppEnum) * Ownership of ppEnum transfers from callee to caller so reference count on ppEnum * must be incremented before returning. The caller is responsible for releasing ppEnum. */ @@ -1269,7 +2513,7 @@ public class Accessible { /* If there are no listeners, query the proxy for * its IEnumVariant, and get the Clone from it. */ - if (accessibleControlListeners.size() == 0) { + if (iaccessible != null && accessibleControlListeners.size() == 0) { int /*long*/[] ppvObject = new int /*long*/[1]; int code = iaccessible.QueryInterface(COM.IIDIEnumVARIANT, ppvObject); if (code != COM.S_OK) return code; @@ -1282,11 +2526,1298 @@ public class Accessible { } if (ppEnum == 0) return COM.E_INVALIDARG; - COM.MoveMemory(ppEnum, new int /*long*/[] { objIEnumVARIANT.getAddress()}, OS.PTR_SIZEOF); + COM.MoveMemory(ppEnum, new int /*long*/[] { objIEnumVARIANT.getAddress() }, OS.PTR_SIZEOF); AddRef(); return COM.S_OK; } + /* IAccessible2::get_nRelations([out] pNRelations) */ + int get_nRelations(int /*long*/ pNRelations) { + int count = 0; + for (int type = 0; type < MAX_RELATION_TYPES; type++) { + if (relations[type] != null) count++; + } + COM.MoveMemory(pNRelations, new int [] { count }, 4); + return COM.S_OK; + } + + /* IAccessible2::get_relation([in] relationIndex, [out] ppRelation) */ + int get_relation(int relationIndex, int /*long*/ ppRelation) { + int i = -1; + for (int type = 0; type < MAX_RELATION_TYPES; type++) { + Relation relation = (Relation)relations[type]; + if (relation != null) i++; + if (i == relationIndex) { + relation.AddRef(); + COM.MoveMemory(ppRelation, new int /*long*/[] { relation.objIAccessibleRelation.getAddress() }, OS.PTR_SIZEOF); + return COM.S_OK; + } + } + return COM.E_INVALIDARG; + } + + /* IAccessible2::get_relations([in] maxRelations, [out] ppRelations, [out] pNRelations) */ + int get_relations(int maxRelations, int /*long*/ ppRelations, int /*long*/ pNRelations) { + int count = 0; + for (int type = 0; type < MAX_RELATION_TYPES; type++) { + if (count == maxRelations) break; + Relation relation = (Relation)relations[type]; + if (relation != null) { + relation.AddRef(); + COM.MoveMemory(ppRelations + count * OS.PTR_SIZEOF, new int /*long*/[] { relation.objIAccessibleRelation.getAddress() }, OS.PTR_SIZEOF); + count++; + } + } + COM.MoveMemory(pNRelations, new int [] { count }, 4); + return COM.S_OK; + } + + /* IAccessible2::get_role([out] pRole) */ + int get_role(int /*long*/ pRole) { + AccessibleControlEvent event = new AccessibleControlEvent(this); + event.childID = ACC.CHILDID_SELF; + for (int i = 0; i < accessibleControlListeners.size(); i++) { + AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); + listener.getRole(event); + } + COM.MoveMemory(pRole, new int [] { event.detail }, 4); + return COM.S_OK; + } + + /* IAccessible2::scrollTo([in] scrollType) */ + int scrollTo(int scrollType) { + if (scrollType < ACC.SCROLL_TYPE_LEFT_EDGE || scrollType > ACC.SCROLL_TYPE_ANYWHERE) return COM.E_INVALIDARG; + return COM.E_NOTIMPL; + } + + /* IAccessible2::scrollToPoint([in] coordinateType, [in] x, [in] y) */ + int scrollToPoint(int coordinateType, int x, int y) { + if (coordinateType != COM.IA2_COORDTYPE_SCREEN_RELATIVE) return COM.E_INVALIDARG; + return COM.E_NOTIMPL; + } + + /* IAccessible2::get_groupPosition([out] pGroupLevel, [out] pSimilarItemsInGroup, [out] pPositionInGroup) */ + int get_groupPosition(int /*long*/ pGroupLevel, int /*long*/ pSimilarItemsInGroup, int /*long*/ pPositionInGroup) { + // TODO: handle where possible - maybe add AccessibleGroup later +// COM.MoveMemory(pGroupLevel, new int [] { groupLevel }, 4); +// COM.MoveMemory(pSimilarItemsInGroup, new int [] { similarItemsInGroup }, 4); +// COM.MoveMemory(pPositionInGroup, new int [] { positionInGroup }, 4); + return COM.S_OK; + // TODO: @retval S_OK if at least one value is valid@retval S_FALSE if no values are valid + } + + /* IAccessible2::get_states([out] pStates) */ + int get_states(int /*long*/ pStates) { + AccessibleControlEvent event = new AccessibleControlEvent(this); + event.childID = ACC.CHILDID_SELF; + for (int i = 0; i < accessibleControlListeners.size(); i++) { + AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); + listener.getState(event); + } + COM.MoveMemory(pStates, new int [] { event.detail }, 4); + return COM.S_OK; + } + + /* IAccessible2::get_extendedRole([out] pbstrExtendedRole) */ + int get_extendedRole(int /*long*/ pbstrExtendedRole) { + // TODO: this feature is not supported. + setString(pbstrExtendedRole, null); + return COM.DISP_E_MEMBERNOTFOUND; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessible2::get_localizedExtendedRole([out] pbstrLocalizedExtendedRole) */ + int get_localizedExtendedRole(int /*long*/ pbstrLocalizedExtendedRole) { + // TODO: this feature is not supported. + setString(pbstrLocalizedExtendedRole, null); + return COM.DISP_E_MEMBERNOTFOUND; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessible2::get_nExtendedStates([out] pNExtendedStates) */ + int get_nExtendedStates(int /*long*/ pNExtendedStates) { + // TODO: this feature is not supported. + COM.MoveMemory(pNExtendedStates, new int [] { 0 }, 4); + return COM.DISP_E_MEMBERNOTFOUND; + } + + /* IAccessible2::get_extendedStates([in] maxExtendedStates, [out] ppbstrExtendedStates, [out] pNExtendedStates) */ + int get_extendedStates(int maxExtendedStates, int /*long*/ ppbstrExtendedStates, int /*long*/ pNExtendedStates) { + // TODO: this feature is not supported. + setString(ppbstrExtendedStates, null); + COM.MoveMemory(pNExtendedStates, new int [] { 0 }, 4); + return COM.DISP_E_MEMBERNOTFOUND; + // TODO: @retval S_FALSE if there are no states, [out] values are NULL and 0 respectively + } + + /* IAccessible2::get_localizedExtendedStates([in] maxLocalizedExtendedStates, [out] ppbstrLocalizedExtendedStates, [out] pNLocalizedExtendedStates) */ + int get_localizedExtendedStates(int maxLocalizedExtendedStates, int /*long*/ ppbstrLocalizedExtendedStates, int /*long*/ pNLocalizedExtendedStates) { + // TODO: this feature is not supported. + setString(ppbstrLocalizedExtendedStates, null); + COM.MoveMemory(pNLocalizedExtendedStates, new int [] { 0 }, 4); + return COM.DISP_E_MEMBERNOTFOUND; + // TODO: @retval S_FALSE if there are no states, [out] values are NULL and 0 respectively + } + + /* IAccessible2::get_uniqueID([out] pUniqueID) */ + int get_uniqueID(int /*long*/ pUniqueID) { + // TODO: just return a hash on the Accessible or something + //COM.MoveMemory(pUniqueID, new int [] { uniqueID }, 4); + return COM.S_OK; + } + + /* IAccessible2::get_windowHandle([out] pWindowHandle) */ + int get_windowHandle(int /*long*/ pWindowHandle) { + // TODO: platform-specific - return HWND on Windows + //COM.MoveMemory(pWindowHandle, new int /*long*/ [] { windowHandle }, OS.PTR_SIZEOF); + return COM.S_OK; + } + + /* IAccessible2::get_indexInParent([out] pIndexInParent) */ + int get_indexInParent(int /*long*/ pIndexInParent) { + // TODO: look up index in *parent's* AccessibleControl.getChildren + AccessibleControlEvent event = new AccessibleControlEvent(this); + event.childID = ACC.CHILDID_SELF; + for (int i = 0; i < accessibleControlListeners.size(); i++) { + AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); + listener.getChildren(event); + } + Object [] siblings = event.children; + int indexInParent = 0; + COM.MoveMemory(pIndexInParent, new int [] { indexInParent }, 4); + return COM.S_OK; + // TODO: @retval S_FALSE if no parent, [out] value is -1 + } + + /* IAccessible2::get_locale([out] pLocale) */ + int get_locale(int /*long*/ pLocale) { + // TODO: just return current locale - maybe add later in AccessibleLocale + // Note: need to return an IA2Locale struct: String language, String country, String variant + //COM.MoveMemory(pLocale, new int [] { locale }, 4); + return COM.S_OK; + } + + /* IAccessible2::get_attributes([out] pbstrAttributes) */ + int get_attributes(int /*long*/ pbstrAttributes) { + AccessibleAttributeEvent event = new AccessibleAttributeEvent(this); + for (int i = 0; i < accessibleAttributeListeners.size(); i++) { + AccessibleAttributeListener listener = (AccessibleAttributeListener) accessibleAttributeListeners.elementAt(i); + listener.getAttributes(event); + } + String attributes = ""; + // TODO: Create an attributes string from the event data + if (attributes.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrAttributes, attributes); + return COM.S_OK; + // TODO: @retval S_FALSE returned if there is nothing to return, [out] value is NULL + } + + /* IAccessibleAction::get_nActions([out] pNActions) */ + int get_nActions(int /*long*/ pNActions) { + AccessibleActionEvent event = new AccessibleActionEvent(this); + for (int i = 0; i < accessibleActionListeners.size(); i++) { + AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i); + listener.getActionCount(event); + } + COM.MoveMemory(pNActions, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleAction::doAction([in] actionIndex) */ + int doAction(int actionIndex) { + AccessibleActionEvent event = new AccessibleActionEvent(this); + event.index = actionIndex; + for (int i = 0; i < accessibleActionListeners.size(); i++) { + AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i); + listener.doAction(event); + } + return COM.S_OK; + } + + /* IAccessibleAction::get_description([in] actionIndex, [out] pbstrDescription) */ + int get_description(int actionIndex, int /*long*/ pbstrDescription) { + AccessibleActionEvent event = new AccessibleActionEvent(this); + event.index = actionIndex; + for (int i = 0; i < accessibleActionListeners.size(); i++) { + AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i); + listener.getDescription(event); + } + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; + setString(pbstrDescription, event.result); + return COM.S_OK; + } + + /* IAccessibleAction::get_keyBinding([in] actionIndex, [in] nMaxBindings, [out] ppbstrKeyBindings, [out] pNBindings) */ + int get_keyBinding(int actionIndex, int nMaxBindings, int /*long*/ ppbstrKeyBindings, int /*long*/ pNBindings) { + AccessibleActionEvent event = new AccessibleActionEvent(this); + event.index = actionIndex; + for (int i = 0; i < accessibleActionListeners.size(); i++) { + AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i); + listener.getKeyBinding(event); + } + String keyBindings = event.result; + if (keyBindings == null) return COM.S_FALSE; + int length = keyBindings.length(); + if (length == 0) return COM.S_FALSE; + int i = 0, count = 0; + while (i < length) { + if (count == nMaxBindings) break; + int j = keyBindings.indexOf(';', i); + if (j == -1) j = length; + String keyBinding = keyBindings.substring(i, j); + if (keyBinding.length() > 0) { + setString(ppbstrKeyBindings + count * OS.PTR_SIZEOF, keyBinding); + count++; + } + i = j + 1; + } + COM.MoveMemory(pNBindings, new int [] { count }, 4); + return COM.S_OK; + } + + /* IAccessibleAction::get_name([in] actionIndex, [out] pbstrName) */ + int get_name(int actionIndex, int /*long*/ pbstrName) { + AccessibleActionEvent event = new AccessibleActionEvent(this); + event.index = actionIndex; + for (int i = 0; i < accessibleActionListeners.size(); i++) { + AccessibleActionListener listener = (AccessibleActionListener) accessibleActionListeners.elementAt(i); + listener.getName(event); + } + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrName, event.result); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL@retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleAction::get_localizedName([in] actionIndex, [out] pbstrLocalizedName) */ + int get_localizedName(int actionIndex, int /*long*/ pbstrLocalizedName) { + return COM.S_FALSE; + } + + /* IAccessibleApplication::get_appName([out] pbstrName) */ + int get_appName(int /*long*/ pbstrName) { + // TODO: use Display.getAppName (version?) new API in Display + String appName = ""; + if (appName.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrName, appName); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessibleApplication::get_appVersion([out] pbstrVersion) */ + int get_appVersion(int /*long*/ pbstrVersion) { + // TODO: use Display.getAppName (version?) new API in Display + String appVersion = ""; + if (appVersion.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrVersion, appVersion); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessibleApplication::get_toolkitName([out] pbstrName) */ + int get_toolkitName(int /*long*/ pbstrName) { + // TODO: use SWT for toolkit name and version + String toolkitName = "SWT"; + if (toolkitName.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrName, toolkitName); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessibleApplication::get_toolkitVersion([out] pbstrVersion) */ + int get_toolkitVersion(int /*long*/ pbstrVersion) { + // TODO: use SWT for toolkit name and version + String toolkitVersion = "" + SWT.getVersion(); + if (toolkitVersion.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrVersion, toolkitVersion); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessibleComponent::get_locationInParent([out] pX, [out] pY) */ + int get_locationInParent(int /*long*/ pX, int /*long*/ pY) { + // TODO: support transparently (hard for fake parents - screen vs. parent coords) + AccessibleControlEvent event = new AccessibleControlEvent(this); + for (int i = 0; i < accessibleControlListeners.size(); i++) { + AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); + listener.getLocation (event); + } + COM.MoveMemory(pX, new int [] { event.x }, 4); + COM.MoveMemory(pY, new int [] { event.y }, 4); + return COM.S_OK; + } + + /* IAccessibleComponent::get_foreground([out] pForeground) */ + int get_foreground(int /*long*/ pForeground) { + // TODO: Do not support foreground for children (support transparently for controls) + //COM.MoveMemory(pForeground, new int [] { control.getForegroundPixel() }, 4); + return COM.S_OK; + } + + /* IAccessibleComponent::get_background([out] pBackground) */ + int get_background(int /*long*/ pBackground) { + // TODO: Do not support background for children (support transparently for controls) + //COM.MoveMemory(pBackground, new int [] { control.getBackgroundPixel() }, 4); + return COM.S_OK; + } + + /* IAccessibleEditableText::copyText([in] startOffset, [in] endOffset) */ + int copyText(int startOffset, int endOffset) { + // TODO: Do not provide at this time + return COM.DISP_E_MEMBERNOTFOUND; +// AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this); +// event.start = startOffset; +// event.end = endOffset; +// for (int i = 0; i < accessibleEditableTextListeners.size(); i++) { +// AccessibleEditableTextListener listener = (AccessibleEditableTextListener) accessibleEditableTextListeners.elementAt(i); +// listener.copyText(event); +// } +// return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleEditableText::deleteText([in] startOffset, [in] endOffset) */ + int deleteText(int startOffset, int endOffset) { + // TODO: Do not provide at this time + return COM.DISP_E_MEMBERNOTFOUND; +// AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this); +// event.start = startOffset; +// event.end = endOffset; +// for (int i = 0; i < accessibleEditableTextListeners.size(); i++) { +// AccessibleEditableTextListener listener = (AccessibleEditableTextListener) accessibleEditableTextListeners.elementAt(i); +// listener.deleteText(event); +// } +// return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleEditableText::insertText([in] offset, [in] pbstrText) */ + int insertText(int offset, int /*long*/ pbstrText) { + // TODO: Do not provide at this time + return COM.DISP_E_MEMBERNOTFOUND; +// AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this); +// event.index = offset; +// event.string = pbstrText; +// for (int i = 0; i < accessibleEditableTextListeners.size(); i++) { +// AccessibleEditableTextListener listener = (AccessibleEditableTextListener) accessibleEditableTextListeners.elementAt(i); +// listener.insertText(event); +// } +// return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleEditableText::cutText([in] startOffset, [in] endOffset) */ + int cutText(int startOffset, int endOffset) { + // TODO: Do not provide at this time + return COM.DISP_E_MEMBERNOTFOUND; +// AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this); +// event.start = startOffset; +// event.end = endOffset; +// for (int i = 0; i < accessibleEditableTextListeners.size(); i++) { +// AccessibleEditableTextListener listener = (AccessibleEditableTextListener) accessibleEditableTextListeners.elementAt(i); +// listener.cutText(event); +// } +// return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleEditableText::pasteText([in] offset) */ + int pasteText(int offset) { + // TODO: Do not provide at this time + return COM.DISP_E_MEMBERNOTFOUND; +// AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this); +// event.index = offset; +// for (int i = 0; i < accessibleEditableTextListeners.size(); i++) { +// AccessibleEditableTextListener listener = (AccessibleEditableTextListener) accessibleEditableTextListeners.elementAt(i); +// listener.pasteText(event); +// } +// return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleEditableText::replaceText([in] startOffset, [in] endOffset, [in] pbstrText) */ + int replaceText(int startOffset, int endOffset, int /*long*/ pbstrText) { + // TODO: Do not provide at this time + return COM.DISP_E_MEMBERNOTFOUND; +// AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this); +// event.start = startOffset; +// event.end = endOffset; +// event.string = pbstrText; +// for (int i = 0; i < accessibleEditableTextListeners.size(); i++) { +// AccessibleEditableTextListener listener = (AccessibleEditableTextListener) accessibleEditableTextListeners.elementAt(i); +// listener.replaceText(event); +// } +// return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleEditableText::setAttributes([in] startOffset, [in] endOffset, [in] pbstrAttributes) */ + int setAttributes(int startOffset, int endOffset, int /*long*/ pbstrAttributes) { + // TODO: Do not provide at this time + return COM.DISP_E_MEMBERNOTFOUND; +// AccessibleEditableTextEvent event = new AccessibleEditableTextEvent(this); +// event.start = startOffset; +// event.end = endOffset; +// event.attributes = pbstrAttributes; +// for (int i = 0; i < accessibleEditableTextListeners.size(); i++) { +// AccessibleEditableTextListener listener = (AccessibleEditableTextListener) accessibleEditableTextListeners.elementAt(i); +// listener.setAttributes(event); +// } +// return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleHyperlink::get_anchor([in] index, [out] pAnchor) */ + int get_anchor(int index, int /*long*/ pAnchor) { + AccessibleHyperlinkEvent event = new AccessibleHyperlinkEvent(this); + event.index = index; + for (int i = 0; i < accessibleHyperlinkListeners.size(); i++) { + AccessibleHyperlinkListener listener = (AccessibleHyperlinkListener) accessibleHyperlinkListeners.elementAt(i); + listener.getAnchor(event); + } + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + // TODO: pAnchor is a VARIANT that can be either a bstr (event.string) or a dispatch (event.accessible) + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL@retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleHyperlink::get_anchorTarget([in] index, [out] pAnchorTarget) */ + int get_anchorTarget(int index, int /*long*/ pAnchorTarget) { + AccessibleHyperlinkEvent event = new AccessibleHyperlinkEvent(this); + event.index = index; + for (int i = 0; i < accessibleHyperlinkListeners.size(); i++) { + AccessibleHyperlinkListener listener = (AccessibleHyperlinkListener) accessibleHyperlinkListeners.elementAt(i); + listener.getAnchorTarget(event); + } + // TODO: pAnchorTarget is a VARIANT that can be either a bstr (event.string) or a dispatch (event.accessible) + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL@retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleHyperlink::get_startIndex([out] pIndex) */ + int get_startIndex(int /*long*/ pIndex) { + AccessibleHyperlinkEvent event = new AccessibleHyperlinkEvent(this); + for (int i = 0; i < accessibleHyperlinkListeners.size(); i++) { + AccessibleHyperlinkListener listener = (AccessibleHyperlinkListener) accessibleHyperlinkListeners.elementAt(i); + listener.getStartIndex(event); + } + COM.MoveMemory(pIndex, new int [] { event.index }, 4); + return COM.S_OK; + } + + /* IAccessibleHyperlink::get_endIndex([out] pIndex) */ + int get_endIndex(int /*long*/ pIndex) { + AccessibleHyperlinkEvent event = new AccessibleHyperlinkEvent(this); + for (int i = 0; i < accessibleHyperlinkListeners.size(); i++) { + AccessibleHyperlinkListener listener = (AccessibleHyperlinkListener) accessibleHyperlinkListeners.elementAt(i); + listener.getEndIndex(event); + } + COM.MoveMemory(pIndex, new int [] { event.index }, 4); + return COM.S_OK; + } + + /* IAccessibleHyperlink::get_valid([out] pValid) */ + int get_valid(int /*long*/ pValid) { + // TODO: deprecated - should we return S_FALSE or E_NOTIMPL? + return COM.E_NOTIMPL; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is FALSE + } + + /* IAccessibleHypertext::get_nHyperlinks([out] pHyperlinkCount) */ + int get_nHyperlinks(int /*long*/ pHyperlinkCount) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getHyperlinkCount(event); + } + COM.MoveMemory(pHyperlinkCount, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleHypertext::get_hyperlink([in] index, [out] ppHyperlink) */ + int get_hyperlink(int index, int /*long*/ ppHyperlink) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.index = index; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getHyperlink(event); + } + Accessible accessible = event.accessible; + if (accessible != null) { + accessible.AddRef(); + setPtrVARIANT(ppHyperlink, COM.VT_DISPATCH, accessible.getAddress()); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleHypertext::get_hyperlinkIndex([in] charIndex, [out] pHyperlinkIndex) */ + int get_hyperlinkIndex(int charIndex, int /*long*/ pHyperlinkIndex) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.offset = charIndex; + event.index = -1; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getHyperlinkIndex(event); + } + if (event.index == -1) return COM.S_FALSE; + COM.MoveMemory(pHyperlinkIndex, new int [] { event.index }, 4); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is -1@retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleImage::get_description([out] pbstrDescription) */ + int get_description(int /*long*/ pbstrDescription) { + // TODO: Does it make sense to just reuse description? + AccessibleEvent event = new AccessibleEvent(this); + for (int i = 0; i < accessibleListeners.size(); i++) { + AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i); + listener.getDescription(event); + } + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrDescription, event.result); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessibleImage::get_imagePosition([in] coordinateType, [out] pX, [out] pY) */ + int get_imagePosition(int coordinateType, int /*long*/ pX, int /*long*/ pY) { + // TODO: does it make sense to just reuse getLocation? + AccessibleControlEvent event = new AccessibleControlEvent(this); + for (int i = 0; i < accessibleControlListeners.size(); i++) { + AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); + listener.getLocation(event); + } + // TODO: make sure to return the correct coordinateType + COM.MoveMemory(pX, new int [] { event.x }, 4); + COM.MoveMemory(pY, new int [] { event.y }, 4); + return COM.S_OK; + } + + /* IAccessibleImage::get_imageSize([out] pHeight, [out] pWidth) */ + int get_imageSize(int /*long*/ pHeight, int /*long*/ pWidth) { + AccessibleControlEvent event = new AccessibleControlEvent(this); + for (int i = 0; i < accessibleControlListeners.size(); i++) { + AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); + listener.getLocation(event); + } + COM.MoveMemory(pHeight, new int [] { event.height }, 4); + COM.MoveMemory(pWidth, new int [] { event.width }, 4); + return COM.S_OK; + } + + /* IAccessibleTable2::get_cellAt([in] row, [in] column, [out] ppCell) */ + int get_cellAt(int row, int column, int /*long*/ ppCell) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.row = row; + event.column = column; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getCell(event); + } + Accessible accessible = event.accessible; + if (accessible != null) { + accessible.AddRef(); + setPtrVARIANT(ppCell, COM.VT_DISPATCH, accessible.getAddress()); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleTable2::get_caption([out] ppAccessible) */ + int get_caption(int /*long*/ ppAccessible) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getCaption(event); + } + Accessible accessible = event.accessible; + if (accessible != null) { + accessible.AddRef(); + setPtrVARIANT(ppAccessible, COM.VT_DISPATCH, accessible.getAddress()); + } + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessibleTable2::get_columnDescription([in] column, [out] pbstrDescription) */ + int get_columnDescription(int column, int /*long*/ pbstrDescription) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.column = column; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getColumnDescription(event); + } + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrDescription, event.result); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL@retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleTable2::get_nColumns([out] pColumnCount) */ + int get_nColumns(int /*long*/ pColumnCount) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getColumnCount(event); + } + COM.MoveMemory(pColumnCount, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleTable2::get_nRows([out] pRowCount) */ + int get_nRows(int /*long*/ pRowCount) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getRowCount(event); + } + COM.MoveMemory(pRowCount, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleTable2::get_nSelectedCells([out] pCellCount) */ + int get_nSelectedCells(int /*long*/ pCellCount) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getSelectedCellCount(event); + } + COM.MoveMemory(pCellCount, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleTable2::get_nSelectedColumns([out] pColumnCount) */ + int get_nSelectedColumns(int /*long*/ pColumnCount) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getSelectedColumnCount(event); + } + COM.MoveMemory(pColumnCount, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleTable2::get_nSelectedRows([out] pRowCount) */ + int get_nSelectedRows(int /*long*/ pRowCount) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getSelectedRowCount(event); + } + COM.MoveMemory(pRowCount, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleTable2::get_rowDescription([in] row, [out] pbstrDescription) */ + int get_rowDescription(int row, int /*long*/ pbstrDescription) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.row = row; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getRowDescription(event); + } + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrDescription, event.result); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL@retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleTable2::get_selectedCells([out] ppCells, [out] pNSelectedCells) */ + int get_selectedCells(int /*long*/ ppCells, int /*long*/ pNSelectedCells) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getSelectedCells(event); + } + // TODO: Handle array, not just first element + if (event.accessibles == null || event.accessibles.length == 0) return COM.S_FALSE; + Accessible accessible = event.accessibles[0]; + if (accessible != null) { + accessible.AddRef(); + setPtrVARIANT(ppCells, COM.VT_DISPATCH, accessible.getAddress()); + } + COM.MoveMemory(pNSelectedCells, new int [] { event.count }, 4); + return COM.S_OK; + // TODO: @retval S_FALSE if there are none, [out] values are NULL and 0 respectively + } + + /* IAccessibleTable2::get_selectedColumns([out] ppSelectedColumns, [out] pNColumns) */ + int get_selectedColumns(int /*long*/ ppSelectedColumns, int /*long*/ pNColumns) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getSelectedColumns(event); + } + if (event.selected == null || event.selected.length == 0) return COM.S_FALSE; + // TODO: return whole array of selected items, not just first + COM.MoveMemory(ppSelectedColumns, new int [] { event.selected[0] }, 4); + COM.MoveMemory(pNColumns, new int [] { event.count }, 4); + return COM.S_OK; + // TODO: @retval S_FALSE if there are none, [out] values are NULL and 0 respectively + } + + /* IAccessibleTable2::get_selectedRows([out] ppSelectedRows, [out] pNRows) */ + int get_selectedRows(int /*long*/ ppSelectedRows, int /*long*/ pNRows) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getSelectedRows(event); + } + if (event.selected == null || event.selected.length == 0) return COM.S_FALSE; + // TODO: return whole array of selected items, not just first + COM.MoveMemory(ppSelectedRows, new int [] { event.selected[0] }, 4); + COM.MoveMemory(pNRows, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleTable2::get_summary([out] ppAccessible) */ + int get_summary(int /*long*/ ppAccessible) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.getSummary(event); + } + Accessible accessible = event.accessible; + if (accessible == null) return COM.S_FALSE; + accessible.AddRef(); + setPtrVARIANT(ppAccessible, COM.VT_DISPATCH, accessible.getAddress()); + return COM.S_OK; + } + + /* IAccessibleTable2::get_isColumnSelected([in] column, [out] pIsSelected) */ + int get_isColumnSelected(int column, int /*long*/ pIsSelected) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.column = column; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.isColumnSelected(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed, [out] value is FALSE + } + + /* IAccessibleTable2::get_isRowSelected([in] row, [out] pIsSelected) */ + int get_isRowSelected(int row, int /*long*/ pIsSelected) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.row = row; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.isRowSelected(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed, [out] value is FALSE + } + + /* IAccessibleTable2::selectRow([in] row) */ + int selectRow(int row) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.row = row; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.setSelectedRow(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleTable2::selectColumn([in] column) */ + int selectColumn(int column) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.column = column; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.setSelectedColumn(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleTable2::unselectRow([in] row) */ + int unselectRow(int row) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.row = row; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.deselectRow(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleTable2::unselectColumn([in] column) */ + int unselectColumn(int column) { + AccessibleTableEvent event = new AccessibleTableEvent(this); + event.column = column; + for (int i = 0; i < accessibleTableListeners.size(); i++) { + AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); + listener.deselectColumn(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleTable2::get_modelChange([out] pModelChange) */ + int get_modelChange(int /*long*/ pModelChange) { + // TODO: implement this... return the most recent row and column values associated with the change +// AccessibleTableEvent event = new AccessibleTableEvent(this); +// for (int i = 0; i < accessibleTableListeners.size(); i++) { +// AccessibleTableListener listener = (AccessibleTableListener) accessibleTableListeners.elementAt(i); +// listener.getModelChange(event); +// } +// // TODO: create modelChange struct to return from event data +// //COM.MoveMemory(pModelChange, new int [] { event.modelChange }, 4); +// return COM.S_OK; +// // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + return COM.S_FALSE; + } + + /* IAccessibleTableCell::get_columnExtent([out] pNColumnsSpanned) */ + int get_columnExtent(int /*long*/ pNColumnsSpanned) { + AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); + for (int i = 0; i < accessibleTableCellListeners.size(); i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); + listener.getColumnSpan(event); + } + COM.MoveMemory(pNColumnsSpanned, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleTableCell::get_columnHeaderCells([out] ppCellAccessibles, [out] pNColumnHeaderCells) */ + int get_columnHeaderCells(int /*long*/ ppCellAccessibles, int /*long*/ pNColumnHeaderCells) { + AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); + for (int i = 0; i < accessibleTableCellListeners.size(); i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); + listener.getColumnHeaders(event); + } + // TODO: Handle array, not just first element + Accessible accessible = event.accessibles[0]; + if (accessible != null) { + accessible.AddRef(); + setPtrVARIANT(ppCellAccessibles, COM.VT_DISPATCH, accessible.getAddress()); + } + COM.MoveMemory(pNColumnHeaderCells, new int [] { event.count }, 4); + return COM.S_OK; + // TODO: @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively + } + + /* IAccessibleTableCell::get_columnIndex([out] pColumnIndex) */ + int get_columnIndex(int /*long*/ pColumnIndex) { + AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); + for (int i = 0; i < accessibleTableCellListeners.size(); i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); + listener.getColumnIndex(event); + } + COM.MoveMemory(pColumnIndex, new int [] { event.index }, 4); + return COM.S_OK; + } + + /* IAccessibleTableCell::get_rowExtent([out] pNRowsSpanned) */ + int get_rowExtent(int /*long*/ pNRowsSpanned) { + AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); + for (int i = 0; i < accessibleTableCellListeners.size(); i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); + listener.getRowSpan(event); + } + COM.MoveMemory(pNRowsSpanned, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleTableCell::get_rowHeaderCells([out] ppCellAccessibles, [out] pNRowHeaderCells) */ + int get_rowHeaderCells(int /*long*/ ppCellAccessibles, int /*long*/ pNRowHeaderCells) { + AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); + for (int i = 0; i < accessibleTableCellListeners.size(); i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); + listener.getRowHeaders(event); + } + // TODO: Handle array, not just first element + Accessible accessible = event.accessibles[0]; + if (accessible != null) { + accessible.AddRef(); + setPtrVARIANT(ppCellAccessibles, COM.VT_DISPATCH, accessible.getAddress()); + } + COM.MoveMemory(pNRowHeaderCells, new int [] { event.count }, 4); + return COM.S_OK; + // TODO: @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively + } + + /* IAccessibleTableCell::get_rowIndex([out] pRowIndex) */ + int get_rowIndex(int /*long*/ pRowIndex) { + AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); + for (int i = 0; i < accessibleTableCellListeners.size(); i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); + listener.getRowIndex(event); + } + COM.MoveMemory(pRowIndex, new int [] { event.index }, 4); + return COM.S_OK; + } + + /* IAccessibleTableCell::get_isSelected([out] pIsSelected) */ + int get_isSelected(int /*long*/ pIsSelected) { + AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); + for (int i = 0; i < accessibleTableCellListeners.size(); i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); + listener.isSelected(event); + } + return COM.S_OK; + } + + /* IAccessibleTableCell::get_rowColumnExtents([out] pRow, [out] pColumn, [out] pRowExtents, [out] pColumnExtents, [out] pIsSelected) */ + int get_rowColumnExtents(int /*long*/ pRow, int /*long*/ pColumn, int /*long*/ pRowExtents, int /*long*/ pColumnExtents, int /*long*/ pIsSelected) { + // TODO: should we implement this? It is just a convenience function. + return COM.DISP_E_MEMBERNOTFOUND; +// AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); +// for (int i = 0; i < accessibleTableCellListeners.size(); i++) { +// AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); +// listener.getRowColumnExtents(event); +// } +// COM.MoveMemory(pRow, new int [] { event.row }, 4); +// COM.MoveMemory(pColumn, new int [] { event.column }, 4); +// COM.MoveMemory(pRowExtents, new int [] { event.rowExtents }, 4); +// COM.MoveMemory(pColumnExtents, new int [] { event.columnExtents }, 4); +// return COM.S_OK; + } + + /* IAccessibleTableCell::get_table([out] ppTable) */ + int get_table(int /*long*/ ppTable) { + AccessibleTableCellEvent event = new AccessibleTableCellEvent(this); + for (int i = 0; i < accessibleTableCellListeners.size(); i++) { + AccessibleTableCellListener listener = (AccessibleTableCellListener) accessibleTableCellListeners.elementAt(i); + listener.getTable(event); + } + Accessible accessible = event.accessible; + if (accessible != null) { + accessible.AddRef(); + setPtrVARIANT(ppTable, COM.VT_DISPATCH, accessible.getAddress()); + } + return COM.S_OK; + } + + /* IAccessibleText::addSelection([in] startOffset, [in] endOffset) */ + int addSelection(int startOffset, int endOffset) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.start = startOffset; + event.end = endOffset; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.addSelection(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleText::get_attributes([in] offset, [out] pStartOffset, [out] pEndOffset, [out] pbstrTextAttributes) */ + int get_attributes(int offset, int /*long*/ pStartOffset, int /*long*/ pEndOffset, int /*long*/ pbstrTextAttributes) { + AccessibleTextAttributeEvent event = new AccessibleTextAttributeEvent(this); + event.offset = offset; + for (int i = 0; i < accessibleAttributeListeners.size(); i++) { + AccessibleAttributeListener listener = (AccessibleAttributeListener) accessibleAttributeListeners.elementAt(i); + listener.getTextAttributes(event); + } + COM.MoveMemory(pStartOffset, new int [] { event.start }, 4); + COM.MoveMemory(pEndOffset, new int [] { event.end }, 4); + String textAttributes = ""; + // TODO: Construct text attributes string from event data + if (textAttributes.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrTextAttributes, textAttributes); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] values are 0s and NULL respectively@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and NULL respectively + } + + /* IAccessibleText::get_caretOffset([out] pOffset) */ + int get_caretOffset(int /*long*/ pOffset) { + // TODO: already in old API (in super interface) + AccessibleTextEvent event = new AccessibleTextEvent(this); + for (int i = 0; i < accessibleTextListeners.size(); i++) { + AccessibleTextListener listener = (AccessibleTextListener) accessibleTextListeners.elementAt(i); + listener.getCaretOffset (event); + } + COM.MoveMemory(pOffset, new int [] { event.offset }, 4); + return COM.S_OK; + // TODO: @retval S_FALSE if the caret is not currently active on this object, i.e. the + } + + /* IAccessibleText::get_characterExtents([in] offset, [in] coordType, [out] pX, [out] pY, [out] pWidth, [out] pHeight) */ + int get_characterExtents(int offset, int coordType, int /*long*/ pX, int /*long*/ pY, int /*long*/ pWidth, int /*long*/ pHeight) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.start = offset; + event.end = offset; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getTextBounds(event); + } + COM.MoveMemory(pX, new int [] { event.x }, 4); + COM.MoveMemory(pY, new int [] { event.y }, 4); + COM.MoveMemory(pWidth, new int [] { event.width }, 4); + COM.MoveMemory(pHeight, new int [] { event.height }, 4); + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed, [out] values are 0s + } + + /* IAccessibleText::get_nSelections([out] pNSelections) */ + int get_nSelections(int /*long*/ pNSelections) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getSelectionCount(event); + } + COM.MoveMemory(pNSelections, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleText::get_offsetAtPoint([in] x, [in] y, [in] coordType, [out] pOffset) */ + int get_offsetAtPoint(int x, int y, int coordType, int /*long*/ pOffset) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.x = x; + event.y = y; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getOffsetAtPoint(event); + } + COM.MoveMemory(pOffset, new int [] { event.index }, 4); + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed, [out] value is 0 + } + + /* IAccessibleText::get_selection([in] selectionIndex, [out] pStartOffset, [out] pEndOffset) */ + int get_selection(int selectionIndex, int /*long*/ pStartOffset, int /*long*/ pEndOffset) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.index = selectionIndex; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getSelection(event); + } + COM.MoveMemory(pStartOffset, new int [] { event.start }, 4); + COM.MoveMemory(pEndOffset, new int [] { event.end }, 4); + return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] values are 0s@retval E_INVALIDARG if bad [in] passed, [out] values are 0s + } + + /* IAccessibleText::get_text([in] startOffset, [in] endOffset, [out] pbstrText) */ + int get_text(int startOffset, int endOffset, int /*long*/ pbstrText) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.start = startOffset; + event.end = endOffset; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getText(event); + } + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrText, event.result); + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed, [out] value is NULL + } + + /* IAccessibleText::get_textBeforeOffset([in] offset, [in] boundaryType, [out] pStartOffset, [out] pEndOffset, [out] pbstrText) */ + int get_textBeforeOffset(int offset, int boundaryType, int /*long*/ pStartOffset, int /*long*/ pEndOffset, int /*long*/ pbstrText) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.offset = offset; + event.type = boundaryType; + // TODO: need to implement - use getTextRange +// for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { +// AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); +// listener.getTextBeforeOffset(event); +// } + COM.MoveMemory(pStartOffset, new int [] { event.start }, 4); + COM.MoveMemory(pEndOffset, new int [] { event.end }, 4); + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrText, event.result); + return COM.S_OK; + // TODO: @retval S_FALSE if the requested boundary type is not implemented, such as@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and NULL respectively + } + + /* IAccessibleText::get_textAfterOffset([in] offset, [in] boundaryType, [out] pStartOffset, [out] pEndOffset, [out] pbstrText) */ + int get_textAfterOffset(int offset, int boundaryType, int /*long*/ pStartOffset, int /*long*/ pEndOffset, int /*long*/ pbstrText) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.offset = offset; + event.type = boundaryType; + // TODO: need to implement - use getTextRange +// for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { +// AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); +// listener.getTextAfterOffset(event); +// } + COM.MoveMemory(pStartOffset, new int [] { event.start }, 4); + COM.MoveMemory(pEndOffset, new int [] { event.end }, 4); + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrText, event.result); + return COM.S_OK; + // TODO: @retval S_FALSE if the requested boundary type is not implemented, such as@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and NULL respectively + } + + /* IAccessibleText::get_textAtOffset([in] offset, [in] boundaryType, [out] pStartOffset, [out] pEndOffset, [out] pbstrText) */ + int get_textAtOffset(int offset, int boundaryType, int /*long*/ pStartOffset, int /*long*/ pEndOffset, int /*long*/ pbstrText) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.offset = offset; + event.type = boundaryType; + // TODO: need to implement - use getTextRange +// for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { +// AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); +// listener.getTextAtOffset(event); +// } + COM.MoveMemory(pStartOffset, new int [] { event.start }, 4); + COM.MoveMemory(pEndOffset, new int [] { event.end }, 4); + if (event.result == null || event.result.length() == 0) return COM.S_FALSE; // TODO: is S_FALSE ok here? + setString(pbstrText, event.result); + return COM.S_OK; + // TODO: @retval S_FALSE if the requested boundary type is not implemented, such as@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and NULL respectively + } + + /* IAccessibleText::removeSelection([in] selectionIndex) */ + int removeSelection(int selectionIndex) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.index = selectionIndex; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.removeSelection(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleText::setCaretOffset([in] offset) */ + int setCaretOffset(int offset) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.index = offset; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.setCaretOffset(event); + } + return COM.S_OK; + // TODO: @retval E_FAIL if the caret cannot be set@retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleText::setSelection([in] selectionIndex, [in] startOffset, [in] endOffset) */ + int setSelection(int selectionIndex, int startOffset, int endOffset) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.index = selectionIndex; + event.start = startOffset; + event.end = endOffset; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.setSelection(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleText::get_nCharacters([out] pNCharacters) */ + int get_nCharacters(int /*long*/ pNCharacters) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.getCharacterCount(event); + } + COM.MoveMemory(pNCharacters, new int [] { event.count }, 4); + return COM.S_OK; + } + + /* IAccessibleText::scrollSubstringTo([in] startIndex, [in] endIndex, [in] scrollType) */ + int scrollSubstringTo(int startIndex, int endIndex, int scrollType) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.start = startIndex; + event.end = endIndex; + event.type = scrollType; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.scrollText(event); + } + return COM.S_OK; + // TODO: @retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleText::scrollSubstringToPoint([in] startIndex, [in] endIndex, [in] coordinateType, [in] x, [in] y) */ + int scrollSubstringToPoint(int startIndex, int endIndex, int coordinateType, int x, int y) { + AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); + event.type = ACC.SCROLL_TYPE_POINT; + event.start = startIndex; + event.end = endIndex; + event.x = x; + event.y = y; + for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { + AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); + listener.scrollText(event); + } + return COM.S_OK; + // TODO: @retval S_FALSE if the object is already at the specified location.@retval E_INVALIDARG if bad [in] passed + } + + /* IAccessibleText::get_newText([out] pNewText) */ + int get_newText(int /*long*/ pNewText) { + // TODO: Try to implement this without providing API + return COM.S_FALSE; +// AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); +// for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { +// AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); +// listener.getNewText(event); +// } +// // TODO: create a text segment struct using the data in the event +// //COM.MoveMemory(pNewText, new int [] { event.string }, 4); +// return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessibleText::get_oldText([out] pOldText) */ + int get_oldText(int /*long*/ pOldText) { + // TODO: Try to implement this without providing API + return COM.S_FALSE; +// AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(this); +// for (int i = 0; i < accessibleTextExtendedListeners.size(); i++) { +// AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) accessibleTextExtendedListeners.elementAt(i); +// listener.getOldText(event); +// } +// // TODO: create a text segment struct using the data in the event +// //COM.MoveMemory(pOldText, new int [] { event.string }, 4); +// return COM.S_OK; + // TODO: @retval S_FALSE if there is nothing to return, [out] value is NULL + } + + /* IAccessibleValue::get_currentValue([out] pCurrentValue) */ + int get_currentValue(int /*long*/ pCurrentValue) { + AccessibleValueEvent event = new AccessibleValueEvent(this); + for (int i = 0; i < accessibleValueListeners.size(); i++) { + AccessibleValueListener listener = (AccessibleValueListener) accessibleValueListeners.elementAt(i); + listener.getCurrentValue(event); + } + if (event.value == null) return COM.S_FALSE; + setNumberVARIANT(pCurrentValue, event.value); + return COM.S_OK; + } + + /* IAccessibleValue::setCurrentValue([in] value) */ + int setCurrentValue(int /*long*/ value) { + AccessibleValueEvent event = new AccessibleValueEvent(this); + event.value = getNumberVARIANT(value); + for (int i = 0; i < accessibleValueListeners.size(); i++) { + AccessibleValueListener listener = (AccessibleValueListener) accessibleValueListeners.elementAt(i); + listener.setCurrentValue(event); + } + return COM.S_OK; + } + + /* IAccessibleValue::get_maximumValue([out] pMaximumValue) */ + int get_maximumValue(int /*long*/ pMaximumValue) { + AccessibleValueEvent event = new AccessibleValueEvent(this); + for (int i = 0; i < accessibleValueListeners.size(); i++) { + AccessibleValueListener listener = (AccessibleValueListener) accessibleValueListeners.elementAt(i); + listener.getMaximumValue(event); + } + if (event.value == null) return COM.S_FALSE; + setNumberVARIANT(pMaximumValue, event.value); + return COM.S_OK; + } + + /* IAccessibleValue::get_minimumValue([out] pMinimumValue) */ + int get_minimumValue(int /*long*/ pMinimumValue) { + AccessibleValueEvent event = new AccessibleValueEvent(this); + for (int i = 0; i < accessibleValueListeners.size(); i++) { + AccessibleValueListener listener = (AccessibleValueListener) accessibleValueListeners.elementAt(i); + listener.getMinimumValue(event); + } + if (event.value == null) return COM.S_FALSE; + setNumberVARIANT(pMinimumValue, event.value); + return COM.S_OK; + } + int childIDToOs(int childID) { if (childID == ACC.CHILDID_SELF) return COM.CHILDID_SELF; /* @@ -1434,8 +3965,15 @@ public class Accessible { COM.MoveMemory(v, variant, VARIANT.sizeof); return v; } + + Number getNumberVARIANT(int /*long*/ variant) { + VARIANT v = new VARIANT(); + COM.MoveMemory(v, variant, VARIANT.sizeof); + if (v.vt == COM.VT_I8) return new Long(v.lVal); // TODO: Fix this - v.lVal is an int - don't use struct + return new Integer(v.lVal); + } - void setVARIANT(int /*long*/ variant, short vt, int lVal) { + void setIntVARIANT(int /*long*/ variant, short vt, int lVal) { if (vt == COM.VT_I4 || vt == COM.VT_EMPTY) { COM.MoveMemory(variant, new short[] { vt }, 2); COM.MoveMemory(variant + 8, new int[] { lVal }, 4); @@ -1448,7 +3986,29 @@ public class Accessible { COM.MoveMemory(variant + 8, new int /*long*/[] { lVal }, OS.PTR_SIZEOF); } } + + void setNumberVARIANT(int /*long*/ variant, Number number) { + if (number instanceof Double) { + COM.MoveMemory(variant, new short[] { COM.VT_R8 }, 2); + COM.MoveMemory(variant + 8, new double[] { number.doubleValue() }, 8); + } else if (number instanceof Float) { + COM.MoveMemory(variant, new short[] { COM.VT_R4 }, 2); + COM.MoveMemory(variant + 8, new float[] { number.floatValue() }, 4); + } else if (number instanceof Long) { + COM.MoveMemory(variant, new short[] { COM.VT_I8 }, 2); + COM.MoveMemory(variant + 8, new long[] { number.longValue() }, 8); + } else { + COM.MoveMemory(variant, new short[] { COM.VT_I4 }, 2); + COM.MoveMemory(variant + 8, new int[] { number.intValue() }, 4); + } + } + void setString(int psz, String string) { + char[] data = (string + "\0").toCharArray(); + int /*long*/ ptr = COM.SysAllocString(data); + COM.MoveMemory(psz, new int /*long*/ [] { ptr }, OS.PTR_SIZEOF); + } + /* checkWidget was copied from Widget, and rewritten to work in this package */ void checkWidget () { if (!isValidThread ()) SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Relation.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Relation.java new file mode 100644 index 0000000000..1a4fda51c6 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Relation.java @@ -0,0 +1,182 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.accessibility; + +import org.eclipse.swt.internal.win32.*; +import org.eclipse.swt.internal.ole.win32.*; + +class Relation { + Accessible accessible; + COMObject objIAccessibleRelation = null; + int refCount; + int type; + Accessible[] targets; + static final String[] relationTypeString = { + "controlledBy", //$NON-NLS-1$ + "controllerFor", //$NON-NLS-1$ + "describedBy", //$NON-NLS-1$ + "descriptionFor", //$NON-NLS-1$ + "embeddedBy", //$NON-NLS-1$ + "embeds", //$NON-NLS-1$ + "flowsFrom", //$NON-NLS-1$ + "flowsTo", //$NON-NLS-1$ + "labelFor", //$NON-NLS-1$ + "labelledBy", //$NON-NLS-1$ + "memberOf", //$NON-NLS-1$ + "nodeChildOf", //$NON-NLS-1$ + "parentWindowOf", //$NON-NLS-1$ + "popupFor", //$NON-NLS-1$ + "subwindowOf", //$NON-NLS-1$ + }; + static final String[] localizedRelationTypeString = { + "controlled by", + "controller for", + "described by", + "description for", + "embedded by", + "embeds", + "flows from", + "flows to", + "label for", + "labelled by", + "member of", + "node child of", + "parent window of", + "popup for", + "subwindow of", + }; + + Relation(Accessible accessible, int type) { + this.accessible = accessible; + this.type = type; + this.targets = new Accessible[0]; + } + + /* QueryInterface([in] iid, [out] ppvObject) + * Ownership of ppvObject transfers from callee to caller so reference count on ppvObject + * must be incremented before returning. Caller is responsible for releasing ppvObject. + */ + int QueryInterface(COMObject comObject, int /*long*/ iid, int /*long*/ ppvObject) { + GUID guid = new GUID(); + COM.MoveMemory(guid, iid, GUID.sizeof); + + if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) { + COM.MoveMemory(ppvObject, new int /*long*/[] { comObject.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + if (COM.IsEqualGUID(guid, COM.IIDIAccessibleRelation)) { + COM.MoveMemory(ppvObject, new int /*long*/[] { objIAccessibleRelation.getAddress() }, OS.PTR_SIZEOF); + AddRef(); + return COM.S_OK; + } + + return COM.E_NOINTERFACE; + } + + int AddRef() { + if (refCount == 0) { + /* Create the COMObject on the first AddRef. */ + objIAccessibleRelation = new COMObject(new int[] {2,0,0,1,1,1,2,3}) { + public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(objIAccessibleRelation, args[0], args[1]);} + public int /*long*/ method1(int /*long*/[] args) {return AddRef();} + public int /*long*/ method2(int /*long*/[] args) {return Release();} + public int /*long*/ method3(int /*long*/[] args) {return get_relationType(args[0]);} + public int /*long*/ method4(int /*long*/[] args) {return get_localizedRelationType(args[0]);} + public int /*long*/ method5(int /*long*/[] args) {return get_nTargets(args[0]);} + public int /*long*/ method6(int /*long*/[] args) {return get_target((int)/*64*/args[0], args[1]);} + public int /*long*/ method7(int /*long*/[] args) {return get_targets((int)/*64*/args[0], args[1], args[2]);} + }; + } + refCount++; + return refCount; + } + + int Release() { + refCount--; + + if (refCount == 0) { + if (objIAccessibleRelation != null) + objIAccessibleRelation.dispose(); + objIAccessibleRelation = null; + } + return refCount; + } + + /* get_relationType([out] pbstrRelationType) */ + int get_relationType(int /*long*/ pbstrRelationType) { + setString(pbstrRelationType, relationTypeString[type]); + return COM.S_OK; + } + + /* get_localizedRelationType([out] pbstrLocalizedRelationType) */ + int get_localizedRelationType(int /*long*/ pbstrLocalizedRelationType) { + setString(pbstrLocalizedRelationType, localizedRelationTypeString[type]); + return COM.S_OK; + } + + /* get_nTargets([out] pNTargets) */ + int get_nTargets(int /*long*/ pNTargets) { + COM.MoveMemory(pNTargets, new int [] { targets.length }, 4); + return COM.S_OK; + } + + /* get_target([in] targetIndex, [out] ppTarget) */ + int get_target(int targetIndex, int /*long*/ ppTarget) { + if (targetIndex < 0 || targetIndex >= targets.length) return COM.E_INVALIDARG; + Accessible target = targets[targetIndex]; + target.AddRef(); + COM.MoveMemory(ppTarget, new int /*long*/[] { target.objIAccessible.getAddress() }, OS.PTR_SIZEOF); + return COM.S_OK; + } + + /* get_targets([in] maxTargets, [out] ppTargets, [out] pNTargets) */ + int get_targets(int maxTargets, int /*long*/ ppTargets, int /*long*/ pNTargets) { + int count = Math.min(targets.length, maxTargets); + for (int i = 0; i < count; i++) { + Accessible target = targets[i]; + target.AddRef(); + COM.MoveMemory(ppTargets + i * OS.PTR_SIZEOF, new int /*long*/[] { target.objIAccessible.getAddress() }, OS.PTR_SIZEOF); + } + COM.MoveMemory(pNTargets, new int [] { count }, 4); + return COM.S_OK; + } + + void addTarget(Accessible target) { + Accessible[] newTargets = new Accessible[targets.length + 1]; + System.arraycopy(targets, 0, newTargets, 0, targets.length); + newTargets[targets.length] = target; + targets = newTargets; + } + + void removeTarget(Accessible target) { + Accessible[] newTargets = new Accessible[targets.length - 1]; + int j = 0; + for (int i = 0; i < targets.length; i++) { + if (targets[i] != target) { + newTargets[j++] = targets[i]; + } + } + targets = newTargets; + } + + boolean hasTargets() { + return targets.length > 0; + } + + // setString copied from Accessible class + void setString(int psz, String string) { + char[] data = (string + "\0").toCharArray(); + int /*long*/ ptr = COM.SysAllocString(data); + COM.MoveMemory(psz, new int /*long*/ [] { ptr }, OS.PTR_SIZEOF); + } +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk.c index b663012f2d..ab1f3e5f07 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -19,6 +19,126 @@ #define ATK_NATIVE(func) Java_org_eclipse_swt_internal_accessibility_gtk_ATK_##func +#ifndef NO_ATK_1IS_1NO_1OP_1OBJECT_1FACTORY +JNIEXPORT jboolean JNICALL ATK_NATIVE(ATK_1IS_1NO_1OP_1OBJECT_1FACTORY) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1IS_1NO_1OP_1OBJECT_1FACTORY_FUNC); + rc = (jboolean)ATK_IS_NO_OP_OBJECT_FACTORY(arg0); + ATK_NATIVE_EXIT(env, that, ATK_1IS_1NO_1OP_1OBJECT_1FACTORY_FUNC); + return rc; +} +#endif + +#ifndef NO_ATK_1TYPE_1ACTION +JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1ACTION) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1ACTION_FUNC); + rc = (jintLong)ATK_TYPE_ACTION; + ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1ACTION_FUNC); + return rc; +} +#endif + +#ifndef NO_ATK_1TYPE_1COMPONENT +JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1COMPONENT) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1COMPONENT_FUNC); + rc = (jintLong)ATK_TYPE_COMPONENT; + ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1COMPONENT_FUNC); + return rc; +} +#endif + +#ifndef NO_ATK_1TYPE_1HYPERTEXT +JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1HYPERTEXT) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1HYPERTEXT_FUNC); + rc = (jintLong)ATK_TYPE_HYPERTEXT; + ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1HYPERTEXT_FUNC); + return rc; +} +#endif + +#ifndef NO_ATK_1TYPE_1OBJECT_1FACTORY +JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1OBJECT_1FACTORY) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1OBJECT_1FACTORY_FUNC); + rc = (jintLong)ATK_TYPE_OBJECT_FACTORY; + ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1OBJECT_1FACTORY_FUNC); + return rc; +} +#endif + +#ifndef NO_ATK_1TYPE_1SELECTION +JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1SELECTION) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1SELECTION_FUNC); + rc = (jintLong)ATK_TYPE_SELECTION; + ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1SELECTION_FUNC); + return rc; +} +#endif + +#ifndef NO_ATK_1TYPE_1TABLE +JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1TABLE) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1TABLE_FUNC); + rc = (jintLong)ATK_TYPE_TABLE; + ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1TABLE_FUNC); + return rc; +} +#endif + +#ifndef NO_ATK_1TYPE_1TEXT +JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1TEXT) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1TEXT_FUNC); + rc = (jintLong)ATK_TYPE_TEXT; + ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1TEXT_FUNC); + return rc; +} +#endif + +#ifndef NO_ATK_1TYPE_1VALUE +JNIEXPORT jintLong JNICALL ATK_NATIVE(ATK_1TYPE_1VALUE) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, ATK_1TYPE_1VALUE_FUNC); + rc = (jintLong)ATK_TYPE_VALUE; + ATK_NATIVE_EXIT(env, that, ATK_1TYPE_1VALUE_FUNC); + return rc; +} +#endif + +#ifndef NO_AtkAttribute_1sizeof +JNIEXPORT jint JNICALL ATK_NATIVE(AtkAttribute_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + ATK_NATIVE_ENTER(env, that, AtkAttribute_1sizeof_FUNC); + rc = (jint)AtkAttribute_sizeof(); + ATK_NATIVE_EXIT(env, that, AtkAttribute_1sizeof_FUNC); + return rc; +} +#endif + #ifndef NO_AtkObjectFactoryClass_1sizeof JNIEXPORT jint JNICALL ATK_NATIVE(AtkObjectFactoryClass_1sizeof) (JNIEnv *env, jclass that) @@ -43,6 +163,42 @@ JNIEXPORT jint JNICALL ATK_NATIVE(AtkObjectFactory_1sizeof) } #endif +#ifndef NO_AtkTextRange_1sizeof +JNIEXPORT jint JNICALL ATK_NATIVE(AtkTextRange_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + ATK_NATIVE_ENTER(env, that, AtkTextRange_1sizeof_FUNC); + rc = (jint)AtkTextRange_sizeof(); + ATK_NATIVE_EXIT(env, that, AtkTextRange_1sizeof_FUNC); + return rc; +} +#endif + +#ifndef NO_AtkTextRectangle_1sizeof +JNIEXPORT jint JNICALL ATK_NATIVE(AtkTextRectangle_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + ATK_NATIVE_ENTER(env, that, AtkTextRectangle_1sizeof_FUNC); + rc = (jint)AtkTextRectangle_sizeof(); + ATK_NATIVE_EXIT(env, that, AtkTextRectangle_1sizeof_FUNC); + return rc; +} +#endif + +#ifndef NO_GTK_1TYPE_1ACCESSIBLE +JNIEXPORT jintLong JNICALL ATK_NATIVE(GTK_1TYPE_1ACCESSIBLE) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, GTK_1TYPE_1ACCESSIBLE_FUNC); + rc = (jintLong)GTK_TYPE_ACCESSIBLE; + ATK_NATIVE_EXIT(env, that, GTK_1TYPE_1ACCESSIBLE_FUNC); + return rc; +} +#endif + #ifndef NO__1ATK_1ACTION_1GET_1IFACE JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1ACTION_1GET_1IFACE) (JNIEnv *env, jclass that, jintLong arg0) @@ -67,6 +223,18 @@ JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1COMPONENT_1GET_1IFACE) } #endif +#ifndef NO__1ATK_1HYPERTEXT_1GET_1IFACE +JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1HYPERTEXT_1GET_1IFACE) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, _1ATK_1HYPERTEXT_1GET_1IFACE_FUNC); + rc = (jintLong)ATK_HYPERTEXT_GET_IFACE(arg0); + ATK_NATIVE_EXIT(env, that, _1ATK_1HYPERTEXT_1GET_1IFACE_FUNC); + return rc; +} +#endif + #ifndef NO__1ATK_1OBJECT_1FACTORY_1CLASS JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1OBJECT_1FACTORY_1CLASS) (JNIEnv *env, jclass that, jintLong arg0) @@ -91,6 +259,18 @@ JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1SELECTION_1GET_1IFACE) } #endif +#ifndef NO__1ATK_1TABLE_1GET_1IFACE +JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1TABLE_1GET_1IFACE) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, _1ATK_1TABLE_1GET_1IFACE_FUNC); + rc = (jintLong)ATK_TABLE_GET_IFACE(arg0); + ATK_NATIVE_EXIT(env, that, _1ATK_1TABLE_1GET_1IFACE_FUNC); + return rc; +} +#endif + #ifndef NO__1ATK_1TEXT_1GET_1IFACE JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1TEXT_1GET_1IFACE) (JNIEnv *env, jclass that, jintLong arg0) @@ -103,6 +283,18 @@ JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1TEXT_1GET_1IFACE) } #endif +#ifndef NO__1ATK_1VALUE_1GET_1IFACE +JNIEXPORT jintLong JNICALL ATK_NATIVE(_1ATK_1VALUE_1GET_1IFACE) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, _1ATK_1VALUE_1GET_1IFACE_FUNC); + rc = (jintLong)ATK_VALUE_GET_IFACE(arg0); + ATK_NATIVE_EXIT(env, that, _1ATK_1VALUE_1GET_1IFACE_FUNC); + return rc; +} +#endif + #ifndef NO__1GTK_1ACCESSIBLE JNIEXPORT jintLong JNICALL ATK_NATIVE(_1GTK_1ACCESSIBLE) (JNIEnv *env, jclass that, jintLong arg0) @@ -263,6 +455,30 @@ JNIEXPORT jintLong JNICALL ATK_NATIVE(_1atk_1state_1set_1new) } #endif +#ifndef NO__1atk_1text_1attribute_1get_1name +JNIEXPORT jintLong JNICALL ATK_NATIVE(_1atk_1text_1attribute_1get_1name) + (JNIEnv *env, jclass that, jint arg0) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, _1atk_1text_1attribute_1get_1name_FUNC); + rc = (jintLong)atk_text_attribute_get_name(arg0); + ATK_NATIVE_EXIT(env, that, _1atk_1text_1attribute_1get_1name_FUNC); + return rc; +} +#endif + +#ifndef NO__1atk_1text_1attribute_1get_1value +JNIEXPORT jintLong JNICALL ATK_NATIVE(_1atk_1text_1attribute_1get_1value) + (JNIEnv *env, jclass that, jint arg0, jint arg1) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, _1atk_1text_1attribute_1get_1value_FUNC); + rc = (jintLong)atk_text_attribute_get_value(arg0, arg1); + ATK_NATIVE_EXIT(env, that, _1atk_1text_1attribute_1get_1value_FUNC); + return rc; +} +#endif + #if (!defined(NO__1call__II) && !defined(JNI64)) || (!defined(NO__1call__JJ) && defined(JNI64)) #ifndef JNI64 JNIEXPORT jintLong JNICALL ATK_NATIVE(_1call__II)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) @@ -401,6 +617,18 @@ JNIEXPORT jintLong JNICALL ATK_NATIVE(_1call__JJJJJJJ)(JNIEnv *env, jclass that, } #endif +#ifndef NO_g_1strdup +JNIEXPORT jintLong JNICALL ATK_NATIVE(g_1strdup) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + ATK_NATIVE_ENTER(env, that, g_1strdup_FUNC); + rc = (jintLong)g_strdup((char *)arg0); + ATK_NATIVE_EXIT(env, that, g_1strdup_FUNC); + return rc; +} +#endif + #if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1) @@ -422,6 +650,30 @@ JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibil } #endif +#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2) +#endif +{ + AtkAttribute _arg1, *lparg1=NULL; +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I_FUNC); +#endif + if (arg1) if ((lparg1 = getAtkAttributeFields(env, arg1, &_arg1)) == NULL) goto fail; + memmove((void *)arg0, (const void *)lparg1, (size_t)arg2); +fail: +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I_FUNC); +#endif +} +#endif + #if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1) @@ -527,6 +779,27 @@ JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibil } #endif +#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1) +#endif +{ +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2_FUNC); +#endif + if (arg1) getAtkTableIfaceFields(env, arg1, (AtkTableIface *)arg0); +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2_FUNC); +#endif +} +#endif + #if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1) @@ -548,6 +821,75 @@ JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibil } #endif +#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2) +#endif +{ + AtkTextRange _arg1, *lparg1=NULL; +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I_FUNC); +#endif + if (arg1) if ((lparg1 = getAtkTextRangeFields(env, arg1, &_arg1)) == NULL) goto fail; + memmove((void *)arg0, (const void *)lparg1, (size_t)arg2); +fail: +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I_FUNC); +#endif +} +#endif + +#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2) +#endif +{ + AtkTextRectangle _arg1, *lparg1=NULL; +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I_FUNC); +#endif + if (arg1) if ((lparg1 = getAtkTextRectangleFields(env, arg1, &_arg1)) == NULL) goto fail; + memmove((void *)arg0, (const void *)lparg1, (size_t)arg2); +fail: +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I_FUNC); +#endif +} +#endif + +#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1) +#endif +{ +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2_FUNC); +#endif + if (arg1) getAtkValueIfaceFields(env, arg1, (AtkValueIface *)arg0); +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2_FUNC); +#endif +} +#endif + #if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2J) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1) @@ -569,6 +911,31 @@ JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibili } #endif +#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2JI) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2JI)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) +#endif +{ + AtkAttribute _arg0, *lparg0=NULL; +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2II_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2JI_FUNC); +#endif + if (arg0) if ((lparg0 = getAtkAttributeFields(env, arg0, &_arg0)) == NULL) goto fail; + memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); +fail: + if (arg0 && lparg0) setAtkAttributeFields(env, arg0, lparg0); +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2II_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2JI_FUNC); +#endif +} +#endif + #if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2J) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1) @@ -674,6 +1041,27 @@ JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibili } #endif +#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2J) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2J)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1) +#endif +{ +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2I_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2J_FUNC); +#endif + if (arg0) setAtkTableIfaceFields(env, arg0, (AtkTableIface *)arg1); +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2I_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2J_FUNC); +#endif +} +#endif + #if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2J) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1) @@ -695,6 +1083,77 @@ JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibili } #endif +#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2JI) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2JI)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) +#endif +{ + AtkTextRange _arg0, *lparg0=NULL; +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2II_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2JI_FUNC); +#endif + if (arg0) if ((lparg0 = getAtkTextRangeFields(env, arg0, &_arg0)) == NULL) goto fail; + memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); +fail: + if (arg0 && lparg0) setAtkTextRangeFields(env, arg0, lparg0); +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2II_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2JI_FUNC); +#endif +} +#endif + +#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2JI) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2JI)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) +#endif +{ + AtkTextRectangle _arg0, *lparg0=NULL; +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2II_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2JI_FUNC); +#endif + if (arg0) if ((lparg0 = getAtkTextRectangleFields(env, arg0, &_arg0)) == NULL) goto fail; + memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); +fail: + if (arg0 && lparg0) setAtkTextRectangleFields(env, arg0, lparg0); +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2II_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2JI_FUNC); +#endif +} +#endif + +#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2J) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1) +#else +JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2J)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1) +#endif +{ +#ifndef JNI64 + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2I_FUNC); +#else + ATK_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2J_FUNC); +#endif + if (arg0) setAtkValueIfaceFields(env, arg0, (AtkValueIface *)arg1); +#ifndef JNI64 + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2I_FUNC); +#else + ATK_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2J_FUNC); +#endif +} +#endif + #if (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_GtkAccessible_2I) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_accessibility_gtk_GtkAccessible_2J) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL ATK_NATIVE(memmove__Lorg_eclipse_swt_internal_accessibility_gtk_GtkAccessible_2I)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_stats.c index 0527eda396..dfce31cb91 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_stats.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -18,16 +18,32 @@ #ifdef NATIVE_STATS -int ATK_nativeFunctionCount = 42; -int ATK_nativeFunctionCallCount[42]; +int ATK_nativeFunctionCount = 71; +int ATK_nativeFunctionCallCount[71]; char * ATK_nativeFunctionNames[] = { + "ATK_1IS_1NO_1OP_1OBJECT_1FACTORY", + "ATK_1TYPE_1ACTION", + "ATK_1TYPE_1COMPONENT", + "ATK_1TYPE_1HYPERTEXT", + "ATK_1TYPE_1OBJECT_1FACTORY", + "ATK_1TYPE_1SELECTION", + "ATK_1TYPE_1TABLE", + "ATK_1TYPE_1TEXT", + "ATK_1TYPE_1VALUE", + "AtkAttribute_1sizeof", "AtkObjectFactoryClass_1sizeof", "AtkObjectFactory_1sizeof", + "AtkTextRange_1sizeof", + "AtkTextRectangle_1sizeof", + "GTK_1TYPE_1ACCESSIBLE", "_1ATK_1ACTION_1GET_1IFACE", "_1ATK_1COMPONENT_1GET_1IFACE", + "_1ATK_1HYPERTEXT_1GET_1IFACE", "_1ATK_1OBJECT_1FACTORY_1CLASS", "_1ATK_1SELECTION_1GET_1IFACE", + "_1ATK_1TABLE_1GET_1IFACE", "_1ATK_1TEXT_1GET_1IFACE", + "_1ATK_1VALUE_1GET_1IFACE", "_1GTK_1ACCESSIBLE", "_1atk_1focus_1tracker_1notify", "_1atk_1get_1default_1registry", @@ -42,6 +58,8 @@ char * ATK_nativeFunctionNames[] = { "_1atk_1relation_1set_1remove", "_1atk_1state_1set_1add_1state", "_1atk_1state_1set_1new", + "_1atk_1text_1attribute_1get_1name", + "_1atk_1text_1attribute_1get_1value", #ifndef JNI64 "_1call__II", #else @@ -72,12 +90,18 @@ char * ATK_nativeFunctionNames[] = { #else "_1call__JJJJJJJ", #endif + "g_1strdup", #ifndef JNI64 "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2", #else "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2", #endif #ifndef JNI64 + "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I", +#else + "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I", +#endif +#ifndef JNI64 "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2", #else "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2", @@ -103,16 +127,41 @@ char * ATK_nativeFunctionNames[] = { "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkSelectionIface_2", #endif #ifndef JNI64 + "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2", +#else + "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2", +#endif +#ifndef JNI64 "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2", #else "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2", #endif #ifndef JNI64 + "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I", +#else + "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I", +#endif +#ifndef JNI64 + "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I", +#else + "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I", +#endif +#ifndef JNI64 + "memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2", +#else + "memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2", +#endif +#ifndef JNI64 "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2I", #else "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2J", #endif #ifndef JNI64 + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2II", +#else + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2JI", +#endif +#ifndef JNI64 "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2I", #else "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2J", @@ -138,11 +187,31 @@ char * ATK_nativeFunctionNames[] = { "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkSelectionIface_2J", #endif #ifndef JNI64 + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2I", +#else + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2J", +#endif +#ifndef JNI64 "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2I", #else "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2J", #endif #ifndef JNI64 + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2II", +#else + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2JI", +#endif +#ifndef JNI64 + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2II", +#else + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2JI", +#endif +#ifndef JNI64 + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2I", +#else + "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2J", +#endif +#ifndef JNI64 "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_GtkAccessible_2I", #else "memmove__Lorg_eclipse_swt_internal_accessibility_gtk_GtkAccessible_2J", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_stats.h index d4680abfb0..5f4debeabe 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_stats.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -29,13 +29,29 @@ extern char* ATK_nativeFunctionNames[]; #endif typedef enum { + ATK_1IS_1NO_1OP_1OBJECT_1FACTORY_FUNC, + ATK_1TYPE_1ACTION_FUNC, + ATK_1TYPE_1COMPONENT_FUNC, + ATK_1TYPE_1HYPERTEXT_FUNC, + ATK_1TYPE_1OBJECT_1FACTORY_FUNC, + ATK_1TYPE_1SELECTION_FUNC, + ATK_1TYPE_1TABLE_FUNC, + ATK_1TYPE_1TEXT_FUNC, + ATK_1TYPE_1VALUE_FUNC, + AtkAttribute_1sizeof_FUNC, AtkObjectFactoryClass_1sizeof_FUNC, AtkObjectFactory_1sizeof_FUNC, + AtkTextRange_1sizeof_FUNC, + AtkTextRectangle_1sizeof_FUNC, + GTK_1TYPE_1ACCESSIBLE_FUNC, _1ATK_1ACTION_1GET_1IFACE_FUNC, _1ATK_1COMPONENT_1GET_1IFACE_FUNC, + _1ATK_1HYPERTEXT_1GET_1IFACE_FUNC, _1ATK_1OBJECT_1FACTORY_1CLASS_FUNC, _1ATK_1SELECTION_1GET_1IFACE_FUNC, + _1ATK_1TABLE_1GET_1IFACE_FUNC, _1ATK_1TEXT_1GET_1IFACE_FUNC, + _1ATK_1VALUE_1GET_1IFACE_FUNC, _1GTK_1ACCESSIBLE_FUNC, _1atk_1focus_1tracker_1notify_FUNC, _1atk_1get_1default_1registry_FUNC, @@ -50,6 +66,8 @@ typedef enum { _1atk_1relation_1set_1remove_FUNC, _1atk_1state_1set_1add_1state_FUNC, _1atk_1state_1set_1new_FUNC, + _1atk_1text_1attribute_1get_1name_FUNC, + _1atk_1text_1attribute_1get_1value_FUNC, #ifndef JNI64 _1call__II_FUNC, #else @@ -80,12 +98,18 @@ typedef enum { #else _1call__JJJJJJJ_FUNC, #endif + g_1strdup_FUNC, #ifndef JNI64 memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2_FUNC, #else memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2_FUNC, #endif #ifndef JNI64 + memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I_FUNC, +#else + memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2I_FUNC, +#endif +#ifndef JNI64 memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2_FUNC, #else memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2_FUNC, @@ -111,16 +135,41 @@ typedef enum { memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkSelectionIface_2_FUNC, #endif #ifndef JNI64 + memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2_FUNC, +#else + memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2_FUNC, +#endif +#ifndef JNI64 memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2_FUNC, #else memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2_FUNC, #endif #ifndef JNI64 + memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I_FUNC, +#else + memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2I_FUNC, +#endif +#ifndef JNI64 + memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I_FUNC, +#else + memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2I_FUNC, +#endif +#ifndef JNI64 + memmove__ILorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2_FUNC, +#else + memmove__JLorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2_FUNC, +#endif +#ifndef JNI64 memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2I_FUNC, #else memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkActionIface_2J_FUNC, #endif #ifndef JNI64 + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2II_FUNC, +#else + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkAttribute_2JI_FUNC, +#endif +#ifndef JNI64 memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2I_FUNC, #else memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkComponentIface_2J_FUNC, @@ -146,11 +195,31 @@ typedef enum { memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkSelectionIface_2J_FUNC, #endif #ifndef JNI64 + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2I_FUNC, +#else + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTableIface_2J_FUNC, +#endif +#ifndef JNI64 memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2I_FUNC, #else memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextIface_2J_FUNC, #endif #ifndef JNI64 + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2II_FUNC, +#else + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRange_2JI_FUNC, +#endif +#ifndef JNI64 + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2II_FUNC, +#else + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkTextRectangle_2JI_FUNC, +#endif +#ifndef JNI64 + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2I_FUNC, +#else + memmove__Lorg_eclipse_swt_internal_accessibility_gtk_AtkValueIface_2J_FUNC, +#endif +#ifndef JNI64 memmove__Lorg_eclipse_swt_internal_accessibility_gtk_GtkAccessible_2I_FUNC, #else memmove__Lorg_eclipse_swt_internal_accessibility_gtk_GtkAccessible_2J_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_structs.c index cd9a5ed7db..73d1d8efce 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_structs.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_structs.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -62,6 +62,40 @@ void setAtkActionIfaceFields(JNIEnv *env, jobject lpObject, AtkActionIface *lpSt } #endif +#ifndef NO_AtkAttribute +typedef struct AtkAttribute_FID_CACHE { + int cached; + jclass clazz; + jfieldID name, value; +} AtkAttribute_FID_CACHE; + +AtkAttribute_FID_CACHE AtkAttributeFc; + +void cacheAtkAttributeFields(JNIEnv *env, jobject lpObject) +{ + if (AtkAttributeFc.cached) return; + AtkAttributeFc.clazz = (*env)->GetObjectClass(env, lpObject); + AtkAttributeFc.name = (*env)->GetFieldID(env, AtkAttributeFc.clazz, "name", I_J); + AtkAttributeFc.value = (*env)->GetFieldID(env, AtkAttributeFc.clazz, "value", I_J); + AtkAttributeFc.cached = 1; +} + +AtkAttribute *getAtkAttributeFields(JNIEnv *env, jobject lpObject, AtkAttribute *lpStruct) +{ + if (!AtkAttributeFc.cached) cacheAtkAttributeFields(env, lpObject); + lpStruct->name = (char *)(*env)->GetIntLongField(env, lpObject, AtkAttributeFc.name); + lpStruct->value = (char *)(*env)->GetIntLongField(env, lpObject, AtkAttributeFc.value); + return lpStruct; +} + +void setAtkAttributeFields(JNIEnv *env, jobject lpObject, AtkAttribute *lpStruct) +{ + if (!AtkAttributeFc.cached) cacheAtkAttributeFields(env, lpObject); + (*env)->SetIntLongField(env, lpObject, AtkAttributeFc.name, (jintLong)lpStruct->name); + (*env)->SetIntLongField(env, lpObject, AtkAttributeFc.value, (jintLong)lpStruct->value); +} +#endif + #ifndef NO_AtkComponentIface typedef struct AtkComponentIface_FID_CACHE { int cached; @@ -352,11 +386,147 @@ void setAtkSelectionIfaceFields(JNIEnv *env, jobject lpObject, AtkSelectionIface } #endif +#ifndef NO_AtkTableIface +typedef struct AtkTableIface_FID_CACHE { + int cached; + jclass clazz; + jfieldID ref_at, get_index_at, get_column_at_index, get_row_at_index, get_n_columns, get_n_rows, get_column_extent_at, get_row_extent_at, get_caption, get_column_description, get_column_header, get_row_description, get_row_header, get_summary, set_caption, set_column_description, set_column_header, set_row_description, set_row_header, set_summary, get_selected_columns, get_selected_rows, is_column_selected, is_row_selected, is_selected, add_row_selection, remove_row_selection, add_column_selection, remove_column_selection, row_inserted, column_inserted, row_deleted, column_deleted, row_reordered, column_reordered, model_changed; +} AtkTableIface_FID_CACHE; + +AtkTableIface_FID_CACHE AtkTableIfaceFc; + +void cacheAtkTableIfaceFields(JNIEnv *env, jobject lpObject) +{ + if (AtkTableIfaceFc.cached) return; + AtkTableIfaceFc.clazz = (*env)->GetObjectClass(env, lpObject); + AtkTableIfaceFc.ref_at = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "ref_at", I_J); + AtkTableIfaceFc.get_index_at = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_index_at", I_J); + AtkTableIfaceFc.get_column_at_index = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_column_at_index", I_J); + AtkTableIfaceFc.get_row_at_index = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_row_at_index", I_J); + AtkTableIfaceFc.get_n_columns = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_n_columns", I_J); + AtkTableIfaceFc.get_n_rows = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_n_rows", I_J); + AtkTableIfaceFc.get_column_extent_at = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_column_extent_at", I_J); + AtkTableIfaceFc.get_row_extent_at = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_row_extent_at", I_J); + AtkTableIfaceFc.get_caption = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_caption", I_J); + AtkTableIfaceFc.get_column_description = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_column_description", I_J); + AtkTableIfaceFc.get_column_header = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_column_header", I_J); + AtkTableIfaceFc.get_row_description = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_row_description", I_J); + AtkTableIfaceFc.get_row_header = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_row_header", I_J); + AtkTableIfaceFc.get_summary = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_summary", I_J); + AtkTableIfaceFc.set_caption = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "set_caption", I_J); + AtkTableIfaceFc.set_column_description = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "set_column_description", I_J); + AtkTableIfaceFc.set_column_header = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "set_column_header", I_J); + AtkTableIfaceFc.set_row_description = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "set_row_description", I_J); + AtkTableIfaceFc.set_row_header = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "set_row_header", I_J); + AtkTableIfaceFc.set_summary = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "set_summary", I_J); + AtkTableIfaceFc.get_selected_columns = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_selected_columns", I_J); + AtkTableIfaceFc.get_selected_rows = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "get_selected_rows", I_J); + AtkTableIfaceFc.is_column_selected = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "is_column_selected", I_J); + AtkTableIfaceFc.is_row_selected = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "is_row_selected", I_J); + AtkTableIfaceFc.is_selected = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "is_selected", I_J); + AtkTableIfaceFc.add_row_selection = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "add_row_selection", I_J); + AtkTableIfaceFc.remove_row_selection = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "remove_row_selection", I_J); + AtkTableIfaceFc.add_column_selection = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "add_column_selection", I_J); + AtkTableIfaceFc.remove_column_selection = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "remove_column_selection", I_J); + AtkTableIfaceFc.row_inserted = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "row_inserted", I_J); + AtkTableIfaceFc.column_inserted = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "column_inserted", I_J); + AtkTableIfaceFc.row_deleted = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "row_deleted", I_J); + AtkTableIfaceFc.column_deleted = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "column_deleted", I_J); + AtkTableIfaceFc.row_reordered = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "row_reordered", I_J); + AtkTableIfaceFc.column_reordered = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "column_reordered", I_J); + AtkTableIfaceFc.model_changed = (*env)->GetFieldID(env, AtkTableIfaceFc.clazz, "model_changed", I_J); + AtkTableIfaceFc.cached = 1; +} + +AtkTableIface *getAtkTableIfaceFields(JNIEnv *env, jobject lpObject, AtkTableIface *lpStruct) +{ + if (!AtkTableIfaceFc.cached) cacheAtkTableIfaceFields(env, lpObject); + lpStruct->ref_at = (AtkObject* (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.ref_at); + lpStruct->get_index_at = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_index_at); + lpStruct->get_column_at_index = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_column_at_index); + lpStruct->get_row_at_index = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_row_at_index); + lpStruct->get_n_columns = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_n_columns); + lpStruct->get_n_rows = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_n_rows); + lpStruct->get_column_extent_at = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_column_extent_at); + lpStruct->get_row_extent_at = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_row_extent_at); + lpStruct->get_caption = (AtkObject* (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_caption); + lpStruct->get_column_description = (G_CONST_RETURN gchar* (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_column_description); + lpStruct->get_column_header = (AtkObject* (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_column_header); + lpStruct->get_row_description = (G_CONST_RETURN gchar* (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_row_description); + lpStruct->get_row_header = (AtkObject* (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_row_header); + lpStruct->get_summary = (AtkObject* (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_summary); + lpStruct->set_caption = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.set_caption); + lpStruct->set_column_description = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.set_column_description); + lpStruct->set_column_header = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.set_column_header); + lpStruct->set_row_description = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.set_row_description); + lpStruct->set_row_header = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.set_row_header); + lpStruct->set_summary = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.set_summary); + lpStruct->get_selected_columns = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_selected_columns); + lpStruct->get_selected_rows = (gint (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.get_selected_rows); + lpStruct->is_column_selected = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.is_column_selected); + lpStruct->is_row_selected = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.is_row_selected); + lpStruct->is_selected = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.is_selected); + lpStruct->add_row_selection = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.add_row_selection); + lpStruct->remove_row_selection = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.remove_row_selection); + lpStruct->add_column_selection = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.add_column_selection); + lpStruct->remove_column_selection = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.remove_column_selection); + lpStruct->row_inserted = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.row_inserted); + lpStruct->column_inserted = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.column_inserted); + lpStruct->row_deleted = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.row_deleted); + lpStruct->column_deleted = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.column_deleted); + lpStruct->row_reordered = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.row_reordered); + lpStruct->column_reordered = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.column_reordered); + lpStruct->model_changed = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTableIfaceFc.model_changed); + return lpStruct; +} + +void setAtkTableIfaceFields(JNIEnv *env, jobject lpObject, AtkTableIface *lpStruct) +{ + if (!AtkTableIfaceFc.cached) cacheAtkTableIfaceFields(env, lpObject); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.ref_at, (jintLong)lpStruct->ref_at); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_index_at, (jintLong)lpStruct->get_index_at); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_column_at_index, (jintLong)lpStruct->get_column_at_index); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_row_at_index, (jintLong)lpStruct->get_row_at_index); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_n_columns, (jintLong)lpStruct->get_n_columns); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_n_rows, (jintLong)lpStruct->get_n_rows); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_column_extent_at, (jintLong)lpStruct->get_column_extent_at); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_row_extent_at, (jintLong)lpStruct->get_row_extent_at); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_caption, (jintLong)lpStruct->get_caption); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_column_description, (jintLong)lpStruct->get_column_description); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_column_header, (jintLong)lpStruct->get_column_header); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_row_description, (jintLong)lpStruct->get_row_description); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_row_header, (jintLong)lpStruct->get_row_header); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_summary, (jintLong)lpStruct->get_summary); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.set_caption, (jintLong)lpStruct->set_caption); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.set_column_description, (jintLong)lpStruct->set_column_description); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.set_column_header, (jintLong)lpStruct->set_column_header); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.set_row_description, (jintLong)lpStruct->set_row_description); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.set_row_header, (jintLong)lpStruct->set_row_header); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.set_summary, (jintLong)lpStruct->set_summary); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_selected_columns, (jintLong)lpStruct->get_selected_columns); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.get_selected_rows, (jintLong)lpStruct->get_selected_rows); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.is_column_selected, (jintLong)lpStruct->is_column_selected); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.is_row_selected, (jintLong)lpStruct->is_row_selected); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.is_selected, (jintLong)lpStruct->is_selected); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.add_row_selection, (jintLong)lpStruct->add_row_selection); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.remove_row_selection, (jintLong)lpStruct->remove_row_selection); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.add_column_selection, (jintLong)lpStruct->add_column_selection); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.remove_column_selection, (jintLong)lpStruct->remove_column_selection); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.row_inserted, (jintLong)lpStruct->row_inserted); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.column_inserted, (jintLong)lpStruct->column_inserted); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.row_deleted, (jintLong)lpStruct->row_deleted); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.column_deleted, (jintLong)lpStruct->column_deleted); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.row_reordered, (jintLong)lpStruct->row_reordered); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.column_reordered, (jintLong)lpStruct->column_reordered); + (*env)->SetIntLongField(env, lpObject, AtkTableIfaceFc.model_changed, (jintLong)lpStruct->model_changed); +} +#endif + #ifndef NO_AtkTextIface typedef struct AtkTextIface_FID_CACHE { int cached; jclass clazz; - jfieldID get_text, get_text_after_offset, get_text_at_offset, get_character_at_offset, get_text_before_offset, get_caret_offset, get_run_attributes, get_default_attributes, get_character_extents, get_character_count, get_offset_at_point, get_n_selections, get_selection, add_selection, remove_selection, set_selection, set_caret_offset, text_changed, text_caret_moved, text_selection_changed; + jfieldID get_text, get_text_after_offset, get_text_at_offset, get_character_at_offset, get_text_before_offset, get_caret_offset, get_run_attributes, get_default_attributes, get_character_extents, get_character_count, get_offset_at_point, get_n_selections, get_selection, add_selection, remove_selection, set_selection, set_caret_offset, text_changed, text_caret_moved, text_selection_changed, get_range_extents, get_bounded_ranges; } AtkTextIface_FID_CACHE; AtkTextIface_FID_CACHE AtkTextIfaceFc; @@ -385,6 +555,8 @@ void cacheAtkTextIfaceFields(JNIEnv *env, jobject lpObject) AtkTextIfaceFc.text_changed = (*env)->GetFieldID(env, AtkTextIfaceFc.clazz, "text_changed", I_J); AtkTextIfaceFc.text_caret_moved = (*env)->GetFieldID(env, AtkTextIfaceFc.clazz, "text_caret_moved", I_J); AtkTextIfaceFc.text_selection_changed = (*env)->GetFieldID(env, AtkTextIfaceFc.clazz, "text_selection_changed", I_J); + AtkTextIfaceFc.get_range_extents = (*env)->GetFieldID(env, AtkTextIfaceFc.clazz, "get_range_extents", I_J); + AtkTextIfaceFc.get_bounded_ranges = (*env)->GetFieldID(env, AtkTextIfaceFc.clazz, "get_bounded_ranges", I_J); AtkTextIfaceFc.cached = 1; } @@ -411,6 +583,8 @@ AtkTextIface *getAtkTextIfaceFields(JNIEnv *env, jobject lpObject, AtkTextIface lpStruct->text_changed = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTextIfaceFc.text_changed); lpStruct->text_caret_moved = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTextIfaceFc.text_caret_moved); lpStruct->text_selection_changed = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTextIfaceFc.text_selection_changed); + lpStruct->get_range_extents = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkTextIfaceFc.get_range_extents); + lpStruct->get_bounded_ranges = (AtkTextRange** (*)())(*env)->GetIntLongField(env, lpObject, AtkTextIfaceFc.get_bounded_ranges); return lpStruct; } @@ -437,6 +611,134 @@ void setAtkTextIfaceFields(JNIEnv *env, jobject lpObject, AtkTextIface *lpStruct (*env)->SetIntLongField(env, lpObject, AtkTextIfaceFc.text_changed, (jintLong)lpStruct->text_changed); (*env)->SetIntLongField(env, lpObject, AtkTextIfaceFc.text_caret_moved, (jintLong)lpStruct->text_caret_moved); (*env)->SetIntLongField(env, lpObject, AtkTextIfaceFc.text_selection_changed, (jintLong)lpStruct->text_selection_changed); + (*env)->SetIntLongField(env, lpObject, AtkTextIfaceFc.get_range_extents, (jintLong)lpStruct->get_range_extents); + (*env)->SetIntLongField(env, lpObject, AtkTextIfaceFc.get_bounded_ranges, (jintLong)lpStruct->get_bounded_ranges); +} +#endif + +#ifndef NO_AtkTextRange +typedef struct AtkTextRange_FID_CACHE { + int cached; + jclass clazz; + jfieldID bounds, start_offset, end_offset, content; +} AtkTextRange_FID_CACHE; + +AtkTextRange_FID_CACHE AtkTextRangeFc; + +void cacheAtkTextRangeFields(JNIEnv *env, jobject lpObject) +{ + if (AtkTextRangeFc.cached) return; + AtkTextRangeFc.clazz = (*env)->GetObjectClass(env, lpObject); + AtkTextRangeFc.bounds = (*env)->GetFieldID(env, AtkTextRangeFc.clazz, "bounds", "Lorg/eclipse/swt/internal/accessibility/gtk/AtkTextRectangle;"); + AtkTextRangeFc.start_offset = (*env)->GetFieldID(env, AtkTextRangeFc.clazz, "start_offset", "I"); + AtkTextRangeFc.end_offset = (*env)->GetFieldID(env, AtkTextRangeFc.clazz, "end_offset", "I"); + AtkTextRangeFc.content = (*env)->GetFieldID(env, AtkTextRangeFc.clazz, "content", I_J); + AtkTextRangeFc.cached = 1; +} + +AtkTextRange *getAtkTextRangeFields(JNIEnv *env, jobject lpObject, AtkTextRange *lpStruct) +{ + if (!AtkTextRangeFc.cached) cacheAtkTextRangeFields(env, lpObject); + { + jobject lpObject1 = (*env)->GetObjectField(env, lpObject, AtkTextRangeFc.bounds); + if (lpObject1 != NULL) getAtkTextRectangleFields(env, lpObject1, &lpStruct->bounds); + } + lpStruct->start_offset = (*env)->GetIntField(env, lpObject, AtkTextRangeFc.start_offset); + lpStruct->end_offset = (*env)->GetIntField(env, lpObject, AtkTextRangeFc.end_offset); + lpStruct->content = (gchar *)(*env)->GetIntLongField(env, lpObject, AtkTextRangeFc.content); + return lpStruct; +} + +void setAtkTextRangeFields(JNIEnv *env, jobject lpObject, AtkTextRange *lpStruct) +{ + if (!AtkTextRangeFc.cached) cacheAtkTextRangeFields(env, lpObject); + { + jobject lpObject1 = (*env)->GetObjectField(env, lpObject, AtkTextRangeFc.bounds); + if (lpObject1 != NULL) setAtkTextRectangleFields(env, lpObject1, &lpStruct->bounds); + } + (*env)->SetIntField(env, lpObject, AtkTextRangeFc.start_offset, (jint)lpStruct->start_offset); + (*env)->SetIntField(env, lpObject, AtkTextRangeFc.end_offset, (jint)lpStruct->end_offset); + (*env)->SetIntLongField(env, lpObject, AtkTextRangeFc.content, (jintLong)lpStruct->content); +} +#endif + +#ifndef NO_AtkTextRectangle +typedef struct AtkTextRectangle_FID_CACHE { + int cached; + jclass clazz; + jfieldID x, y, width, height; +} AtkTextRectangle_FID_CACHE; + +AtkTextRectangle_FID_CACHE AtkTextRectangleFc; + +void cacheAtkTextRectangleFields(JNIEnv *env, jobject lpObject) +{ + if (AtkTextRectangleFc.cached) return; + AtkTextRectangleFc.clazz = (*env)->GetObjectClass(env, lpObject); + AtkTextRectangleFc.x = (*env)->GetFieldID(env, AtkTextRectangleFc.clazz, "x", "I"); + AtkTextRectangleFc.y = (*env)->GetFieldID(env, AtkTextRectangleFc.clazz, "y", "I"); + AtkTextRectangleFc.width = (*env)->GetFieldID(env, AtkTextRectangleFc.clazz, "width", "I"); + AtkTextRectangleFc.height = (*env)->GetFieldID(env, AtkTextRectangleFc.clazz, "height", "I"); + AtkTextRectangleFc.cached = 1; +} + +AtkTextRectangle *getAtkTextRectangleFields(JNIEnv *env, jobject lpObject, AtkTextRectangle *lpStruct) +{ + if (!AtkTextRectangleFc.cached) cacheAtkTextRectangleFields(env, lpObject); + lpStruct->x = (*env)->GetIntField(env, lpObject, AtkTextRectangleFc.x); + lpStruct->y = (*env)->GetIntField(env, lpObject, AtkTextRectangleFc.y); + lpStruct->width = (*env)->GetIntField(env, lpObject, AtkTextRectangleFc.width); + lpStruct->height = (*env)->GetIntField(env, lpObject, AtkTextRectangleFc.height); + return lpStruct; +} + +void setAtkTextRectangleFields(JNIEnv *env, jobject lpObject, AtkTextRectangle *lpStruct) +{ + if (!AtkTextRectangleFc.cached) cacheAtkTextRectangleFields(env, lpObject); + (*env)->SetIntField(env, lpObject, AtkTextRectangleFc.x, (jint)lpStruct->x); + (*env)->SetIntField(env, lpObject, AtkTextRectangleFc.y, (jint)lpStruct->y); + (*env)->SetIntField(env, lpObject, AtkTextRectangleFc.width, (jint)lpStruct->width); + (*env)->SetIntField(env, lpObject, AtkTextRectangleFc.height, (jint)lpStruct->height); +} +#endif + +#ifndef NO_AtkValueIface +typedef struct AtkValueIface_FID_CACHE { + int cached; + jclass clazz; + jfieldID get_current_value, get_maximum_value, get_minimum_value, set_current_value; +} AtkValueIface_FID_CACHE; + +AtkValueIface_FID_CACHE AtkValueIfaceFc; + +void cacheAtkValueIfaceFields(JNIEnv *env, jobject lpObject) +{ + if (AtkValueIfaceFc.cached) return; + AtkValueIfaceFc.clazz = (*env)->GetObjectClass(env, lpObject); + AtkValueIfaceFc.get_current_value = (*env)->GetFieldID(env, AtkValueIfaceFc.clazz, "get_current_value", I_J); + AtkValueIfaceFc.get_maximum_value = (*env)->GetFieldID(env, AtkValueIfaceFc.clazz, "get_maximum_value", I_J); + AtkValueIfaceFc.get_minimum_value = (*env)->GetFieldID(env, AtkValueIfaceFc.clazz, "get_minimum_value", I_J); + AtkValueIfaceFc.set_current_value = (*env)->GetFieldID(env, AtkValueIfaceFc.clazz, "set_current_value", I_J); + AtkValueIfaceFc.cached = 1; +} + +AtkValueIface *getAtkValueIfaceFields(JNIEnv *env, jobject lpObject, AtkValueIface *lpStruct) +{ + if (!AtkValueIfaceFc.cached) cacheAtkValueIfaceFields(env, lpObject); + lpStruct->get_current_value = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkValueIfaceFc.get_current_value); + lpStruct->get_maximum_value = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkValueIfaceFc.get_maximum_value); + lpStruct->get_minimum_value = (void (*)())(*env)->GetIntLongField(env, lpObject, AtkValueIfaceFc.get_minimum_value); + lpStruct->set_current_value = (gboolean (*)())(*env)->GetIntLongField(env, lpObject, AtkValueIfaceFc.set_current_value); + return lpStruct; +} + +void setAtkValueIfaceFields(JNIEnv *env, jobject lpObject, AtkValueIface *lpStruct) +{ + if (!AtkValueIfaceFc.cached) cacheAtkValueIfaceFields(env, lpObject); + (*env)->SetIntLongField(env, lpObject, AtkValueIfaceFc.get_current_value, (jintLong)lpStruct->get_current_value); + (*env)->SetIntLongField(env, lpObject, AtkValueIfaceFc.get_maximum_value, (jintLong)lpStruct->get_maximum_value); + (*env)->SetIntLongField(env, lpObject, AtkValueIfaceFc.get_minimum_value, (jintLong)lpStruct->get_minimum_value); + (*env)->SetIntLongField(env, lpObject, AtkValueIfaceFc.set_current_value, (jintLong)lpStruct->set_current_value); } #endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_structs.h index 85e11a8810..b74dda3ba3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_structs.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/atk_structs.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -27,6 +27,18 @@ void setAtkActionIfaceFields(JNIEnv *env, jobject lpObject, AtkActionIface *lpSt #define AtkActionIface_sizeof() 0 #endif +#ifndef NO_AtkAttribute +void cacheAtkAttributeFields(JNIEnv *env, jobject lpObject); +AtkAttribute *getAtkAttributeFields(JNIEnv *env, jobject lpObject, AtkAttribute *lpStruct); +void setAtkAttributeFields(JNIEnv *env, jobject lpObject, AtkAttribute *lpStruct); +#define AtkAttribute_sizeof() sizeof(AtkAttribute) +#else +#define cacheAtkAttributeFields(a,b) +#define getAtkAttributeFields(a,b,c) NULL +#define setAtkAttributeFields(a,b,c) +#define AtkAttribute_sizeof() 0 +#endif + #ifndef NO_AtkComponentIface void cacheAtkComponentIfaceFields(JNIEnv *env, jobject lpObject); AtkComponentIface *getAtkComponentIfaceFields(JNIEnv *env, jobject lpObject, AtkComponentIface *lpStruct); @@ -87,6 +99,18 @@ void setAtkSelectionIfaceFields(JNIEnv *env, jobject lpObject, AtkSelectionIface #define AtkSelectionIface_sizeof() 0 #endif +#ifndef NO_AtkTableIface +void cacheAtkTableIfaceFields(JNIEnv *env, jobject lpObject); +AtkTableIface *getAtkTableIfaceFields(JNIEnv *env, jobject lpObject, AtkTableIface *lpStruct); +void setAtkTableIfaceFields(JNIEnv *env, jobject lpObject, AtkTableIface *lpStruct); +#define AtkTableIface_sizeof() sizeof(AtkTableIface) +#else +#define cacheAtkTableIfaceFields(a,b) +#define getAtkTableIfaceFields(a,b,c) NULL +#define setAtkTableIfaceFields(a,b,c) +#define AtkTableIface_sizeof() 0 +#endif + #ifndef NO_AtkTextIface void cacheAtkTextIfaceFields(JNIEnv *env, jobject lpObject); AtkTextIface *getAtkTextIfaceFields(JNIEnv *env, jobject lpObject, AtkTextIface *lpStruct); @@ -99,6 +123,42 @@ void setAtkTextIfaceFields(JNIEnv *env, jobject lpObject, AtkTextIface *lpStruct #define AtkTextIface_sizeof() 0 #endif +#ifndef NO_AtkTextRange +void cacheAtkTextRangeFields(JNIEnv *env, jobject lpObject); +AtkTextRange *getAtkTextRangeFields(JNIEnv *env, jobject lpObject, AtkTextRange *lpStruct); +void setAtkTextRangeFields(JNIEnv *env, jobject lpObject, AtkTextRange *lpStruct); +#define AtkTextRange_sizeof() sizeof(AtkTextRange) +#else +#define cacheAtkTextRangeFields(a,b) +#define getAtkTextRangeFields(a,b,c) NULL +#define setAtkTextRangeFields(a,b,c) +#define AtkTextRange_sizeof() 0 +#endif + +#ifndef NO_AtkTextRectangle +void cacheAtkTextRectangleFields(JNIEnv *env, jobject lpObject); +AtkTextRectangle *getAtkTextRectangleFields(JNIEnv *env, jobject lpObject, AtkTextRectangle *lpStruct); +void setAtkTextRectangleFields(JNIEnv *env, jobject lpObject, AtkTextRectangle *lpStruct); +#define AtkTextRectangle_sizeof() sizeof(AtkTextRectangle) +#else +#define cacheAtkTextRectangleFields(a,b) +#define getAtkTextRectangleFields(a,b,c) NULL +#define setAtkTextRectangleFields(a,b,c) +#define AtkTextRectangle_sizeof() 0 +#endif + +#ifndef NO_AtkValueIface +void cacheAtkValueIfaceFields(JNIEnv *env, jobject lpObject); +AtkValueIface *getAtkValueIfaceFields(JNIEnv *env, jobject lpObject, AtkValueIface *lpStruct); +void setAtkValueIfaceFields(JNIEnv *env, jobject lpObject, AtkValueIface *lpStruct); +#define AtkValueIface_sizeof() sizeof(AtkValueIface) +#else +#define cacheAtkValueIfaceFields(a,b) +#define getAtkValueIfaceFields(a,b,c) NULL +#define setAtkValueIfaceFields(a,b,c) +#define AtkValueIface_sizeof() 0 +#endif + #ifndef NO_GtkAccessible void cacheGtkAccessibleFields(JNIEnv *env, jobject lpObject); GtkAccessible *getGtkAccessibleFields(JNIEnv *env, jobject lpObject, GtkAccessible *lpStruct); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index f4a463a787..105c22db25 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -459,6 +459,78 @@ JNIEXPORT void JNICALL OS_NATIVE(G_1OBJECT_1CLASS_1SET_1CONSTRUCTOR) } #endif +#ifndef NO_G_1TYPE_1BOOLEAN +JNIEXPORT jintLong JNICALL OS_NATIVE(G_1TYPE_1BOOLEAN) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, G_1TYPE_1BOOLEAN_FUNC); + rc = (jintLong)G_TYPE_BOOLEAN; + OS_NATIVE_EXIT(env, that, G_1TYPE_1BOOLEAN_FUNC); + return rc; +} +#endif + +#ifndef NO_G_1TYPE_1DOUBLE +JNIEXPORT jintLong JNICALL OS_NATIVE(G_1TYPE_1DOUBLE) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, G_1TYPE_1DOUBLE_FUNC); + rc = (jintLong)G_TYPE_DOUBLE; + OS_NATIVE_EXIT(env, that, G_1TYPE_1DOUBLE_FUNC); + return rc; +} +#endif + +#ifndef NO_G_1TYPE_1FLOAT +JNIEXPORT jintLong JNICALL OS_NATIVE(G_1TYPE_1FLOAT) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, G_1TYPE_1FLOAT_FUNC); + rc = (jintLong)G_TYPE_FLOAT; + OS_NATIVE_EXIT(env, that, G_1TYPE_1FLOAT_FUNC); + return rc; +} +#endif + +#ifndef NO_G_1TYPE_1INT +JNIEXPORT jintLong JNICALL OS_NATIVE(G_1TYPE_1INT) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, G_1TYPE_1INT_FUNC); + rc = (jintLong)G_TYPE_INT; + OS_NATIVE_EXIT(env, that, G_1TYPE_1INT_FUNC); + return rc; +} +#endif + +#ifndef NO_G_1TYPE_1INT64 +JNIEXPORT jintLong JNICALL OS_NATIVE(G_1TYPE_1INT64) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, G_1TYPE_1INT64_FUNC); + rc = (jintLong)G_TYPE_INT64; + OS_NATIVE_EXIT(env, that, G_1TYPE_1INT64_FUNC); + return rc; +} +#endif + +#ifndef NO_G_1VALUE_1TYPE +JNIEXPORT jintLong JNICALL OS_NATIVE(G_1VALUE_1TYPE) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, G_1VALUE_1TYPE_FUNC); + rc = (jintLong)G_VALUE_TYPE(arg0); + OS_NATIVE_EXIT(env, that, G_1VALUE_1TYPE_FUNC); + return rc; +} +#endif + #ifndef NO_GdkColor_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(GdkColor_1sizeof) (JNIEnv *env, jclass that) @@ -1643,30 +1715,6 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1G_1OBJECT_1TYPE_1NAME) } #endif -#ifndef NO__1G_1TYPE_1BOOLEAN -JNIEXPORT jintLong JNICALL OS_NATIVE(_1G_1TYPE_1BOOLEAN) - (JNIEnv *env, jclass that) -{ - jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1G_1TYPE_1BOOLEAN_FUNC); - rc = (jintLong)G_TYPE_BOOLEAN; - OS_NATIVE_EXIT(env, that, _1G_1TYPE_1BOOLEAN_FUNC); - return rc; -} -#endif - -#ifndef NO__1G_1TYPE_1INT -JNIEXPORT jintLong JNICALL OS_NATIVE(_1G_1TYPE_1INT) - (JNIEnv *env, jclass that) -{ - jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1G_1TYPE_1INT_FUNC); - rc = (jintLong)G_TYPE_INT; - OS_NATIVE_EXIT(env, that, _1G_1TYPE_1INT_FUNC); - return rc; -} -#endif - #ifndef NO__1G_1TYPE_1STRING JNIEXPORT jintLong JNICALL OS_NATIVE(_1G_1TYPE_1STRING) (JNIEnv *env, jclass that) @@ -2312,6 +2360,26 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1atk_1object_1add_1relationship) } #endif +#ifndef NO__1atk_1object_1remove_1relationship +JNIEXPORT jboolean JNICALL OS_NATIVE(_1atk_1object_1remove_1relationship) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintLong arg2) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1atk_1object_1remove_1relationship_FUNC); +/* + rc = (jboolean)atk_object_remove_relationship((AtkObject *)arg0, (AtkRelationType)arg1, (AtkObject *)arg2); +*/ + { + LOAD_FUNCTION(fp, atk_object_remove_relationship) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(AtkObject *, AtkRelationType, AtkObject *))fp)((AtkObject *)arg0, (AtkRelationType)arg1, (AtkObject *)arg2); + } + } + OS_NATIVE_EXIT(env, that, _1atk_1object_1remove_1relationship_FUNC); + return rc; +} +#endif + #ifndef NO__1call JNIEXPORT jintLong JNICALL OS_NATIVE(_1call) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLong arg5, jintLong arg6, jintLong arg7) @@ -17061,6 +17129,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1pango_1font_1description_1get_1size) } #endif +#ifndef NO__1pango_1font_1description_1get_1stretch +JNIEXPORT jint JNICALL OS_NATIVE(_1pango_1font_1description_1get_1stretch) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1pango_1font_1description_1get_1stretch_FUNC); + rc = (jint)pango_font_description_get_stretch((PangoFontDescription *)arg0); + OS_NATIVE_EXIT(env, that, _1pango_1font_1description_1get_1stretch_FUNC); + return rc; +} +#endif + #ifndef NO__1pango_1font_1description_1get_1style JNIEXPORT jint JNICALL OS_NATIVE(_1pango_1font_1description_1get_1style) (JNIEnv *env, jclass that, jintLong arg0) @@ -17073,6 +17153,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1pango_1font_1description_1get_1style) } #endif +#ifndef NO__1pango_1font_1description_1get_1variant +JNIEXPORT jint JNICALL OS_NATIVE(_1pango_1font_1description_1get_1variant) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1pango_1font_1description_1get_1variant_FUNC); + rc = (jint)pango_font_description_get_variant((PangoFontDescription *)arg0); + OS_NATIVE_EXIT(env, that, _1pango_1font_1description_1get_1variant_FUNC); + return rc; +} +#endif + #ifndef NO__1pango_1font_1description_1get_1weight JNIEXPORT jint JNICALL OS_NATIVE(_1pango_1font_1description_1get_1weight) (JNIEnv *env, jclass that, jintLong arg0) @@ -17933,6 +18025,116 @@ JNIEXPORT void JNICALL OS_NATIVE(g_1main_1context_1wakeup) } #endif +#ifndef NO_g_1value_1get_1double +JNIEXPORT jdouble JNICALL OS_NATIVE(g_1value_1get_1double) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jdouble rc = 0; + OS_NATIVE_ENTER(env, that, g_1value_1get_1double_FUNC); + rc = (jdouble)g_value_get_double((GValue *)arg0); + OS_NATIVE_EXIT(env, that, g_1value_1get_1double_FUNC); + return rc; +} +#endif + +#ifndef NO_g_1value_1get_1float +JNIEXPORT jfloat JNICALL OS_NATIVE(g_1value_1get_1float) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jfloat rc = 0; + OS_NATIVE_ENTER(env, that, g_1value_1get_1float_FUNC); + rc = (jfloat)g_value_get_float((GValue *)arg0); + OS_NATIVE_EXIT(env, that, g_1value_1get_1float_FUNC); + return rc; +} +#endif + +#ifndef NO_g_1value_1get_1int +JNIEXPORT jint JNICALL OS_NATIVE(g_1value_1get_1int) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, g_1value_1get_1int_FUNC); + rc = (jint)g_value_get_int((GValue *)arg0); + OS_NATIVE_EXIT(env, that, g_1value_1get_1int_FUNC); + return rc; +} +#endif + +#ifndef NO_g_1value_1get_1int64 +JNIEXPORT jlong JNICALL OS_NATIVE(g_1value_1get_1int64) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jlong rc = 0; + OS_NATIVE_ENTER(env, that, g_1value_1get_1int64_FUNC); + rc = (jlong)g_value_get_int64((GValue *)arg0); + OS_NATIVE_EXIT(env, that, g_1value_1get_1int64_FUNC); + return rc; +} +#endif + +#ifndef NO_g_1value_1init +JNIEXPORT jintLong JNICALL OS_NATIVE(g_1value_1init) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, g_1value_1init_FUNC); + rc = (jintLong)g_value_init((GValue *)arg0, (GType)arg1); + OS_NATIVE_EXIT(env, that, g_1value_1init_FUNC); + return rc; +} +#endif + +#ifndef NO_g_1value_1set_1double +JNIEXPORT void JNICALL OS_NATIVE(g_1value_1set_1double) + (JNIEnv *env, jclass that, jintLong arg0, jdouble arg1) +{ + OS_NATIVE_ENTER(env, that, g_1value_1set_1double_FUNC); + g_value_set_double((GValue *)arg0, arg1); + OS_NATIVE_EXIT(env, that, g_1value_1set_1double_FUNC); +} +#endif + +#ifndef NO_g_1value_1set_1float +JNIEXPORT void JNICALL OS_NATIVE(g_1value_1set_1float) + (JNIEnv *env, jclass that, jintLong arg0, jfloat arg1) +{ + OS_NATIVE_ENTER(env, that, g_1value_1set_1float_FUNC); + g_value_set_float((GValue *)arg0, arg1); + OS_NATIVE_EXIT(env, that, g_1value_1set_1float_FUNC); +} +#endif + +#ifndef NO_g_1value_1set_1int +JNIEXPORT void JNICALL OS_NATIVE(g_1value_1set_1int) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + OS_NATIVE_ENTER(env, that, g_1value_1set_1int_FUNC); + g_value_set_int((GValue *)arg0, arg1); + OS_NATIVE_EXIT(env, that, g_1value_1set_1int_FUNC); +} +#endif + +#ifndef NO_g_1value_1set_1int64 +JNIEXPORT void JNICALL OS_NATIVE(g_1value_1set_1int64) + (JNIEnv *env, jclass that, jintLong arg0, jlong arg1) +{ + OS_NATIVE_ENTER(env, that, g_1value_1set_1int64_FUNC); + g_value_set_int64((GValue *)arg0, arg1); + OS_NATIVE_EXIT(env, that, g_1value_1set_1int64_FUNC); +} +#endif + +#ifndef NO_g_1value_1unset +JNIEXPORT void JNICALL OS_NATIVE(g_1value_1unset) + (JNIEnv *env, jclass that, jintLong arg0) +{ + OS_NATIVE_ENTER(env, that, g_1value_1unset_FUNC); + g_value_unset((GValue *)arg0); + OS_NATIVE_EXIT(env, that, g_1value_1unset_FUNC); +} +#endif + #ifndef NO_localeconv_1decimal_1point JNIEXPORT jintLong JNICALL OS_NATIVE(localeconv_1decimal_1point) (JNIEnv *env, jclass that) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 4099c5869a..5536099fff 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -129,6 +129,7 @@ #define gdk_x11_screen_lookup_visual_LIB "libgdk-x11-2.0.so.0" #define atk_object_add_relationship_LIB "libatk-1.0.so.0" +#define atk_object_remove_relationship_LIB "libatk-1.0.so.0" #define pango_attr_underline_color_new_LIB "libpango-1.0.so.0" #define pango_attr_strikethrough_color_new_LIB "libpango-1.0.so.0" #define pango_font_metrics_get_underline_thickness_LIB "libpango-1.0.so.0" diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c index cf185a4ab5..4697d1b507 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1334; -int OS_nativeFunctionCallCount[1334]; +int OS_nativeFunctionCount = 1353; +int OS_nativeFunctionCallCount[1353]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -66,6 +66,12 @@ char * OS_nativeFunctionNames[] = { "GTypeQuery_1sizeof", "G_1OBJECT_1CLASS_1CONSTRUCTOR", "G_1OBJECT_1CLASS_1SET_1CONSTRUCTOR", + "G_1TYPE_1BOOLEAN", + "G_1TYPE_1DOUBLE", + "G_1TYPE_1FLOAT", + "G_1TYPE_1INT", + "G_1TYPE_1INT64", + "G_1VALUE_1TYPE", "GdkColor_1sizeof", "GdkDragContext_1sizeof", "GdkEventAny_1sizeof", @@ -164,8 +170,6 @@ char * OS_nativeFunctionNames[] = { "_1G_1OBJECT_1GET_1CLASS", "_1G_1OBJECT_1TYPE", "_1G_1OBJECT_1TYPE_1NAME", - "_1G_1TYPE_1BOOLEAN", - "_1G_1TYPE_1INT", "_1G_1TYPE_1STRING", "_1PANGO_1PIXELS", "_1PANGO_1TYPE_1FONT_1DESCRIPTION", @@ -205,7 +209,9 @@ char * OS_nativeFunctionNames[] = { "_1XTestFakeKeyEvent", "_1XTestFakeMotionEvent", "_1XWarpPointer", + "_1access", "_1atk_1object_1add_1relationship", + "_1atk_1object_1remove_1relationship", "_1call", "_1dlclose", "_1dlopen", @@ -236,6 +242,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1file_1new_1for_1path", "_1g_1file_1query_1info", "_1g_1file_1read", + "_1g_1file_1test", "_1g_1filename_1from_1uri", "_1g_1filename_1from_1utf8", "_1g_1filename_1to_1uri", @@ -1367,7 +1374,9 @@ char * OS_nativeFunctionNames[] = { "_1pango_1font_1description_1from_1string", "_1pango_1font_1description_1get_1family", "_1pango_1font_1description_1get_1size", + "_1pango_1font_1description_1get_1stretch", "_1pango_1font_1description_1get_1style", + "_1pango_1font_1description_1get_1variant", "_1pango_1font_1description_1get_1weight", "_1pango_1font_1description_1new", "_1pango_1font_1description_1set_1family", @@ -1433,6 +1442,16 @@ char * OS_nativeFunctionNames[] = { "_1pango_1tab_1array_1new", "_1pango_1tab_1array_1set_1tab", "g_1main_1context_1wakeup", + "g_1value_1get_1double", + "g_1value_1get_1float", + "g_1value_1get_1int", + "g_1value_1get_1int64", + "g_1value_1init", + "g_1value_1set_1double", + "g_1value_1set_1float", + "g_1value_1set_1int", + "g_1value_1set_1int64", + "g_1value_1unset", "localeconv_1decimal_1point", #ifndef JNI64 "memmove__ILorg_eclipse_swt_internal_gtk_GInterfaceInfo_2I", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h index aed702c964..176327d877 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h @@ -74,6 +74,12 @@ typedef enum { GTypeQuery_1sizeof_FUNC, G_1OBJECT_1CLASS_1CONSTRUCTOR_FUNC, G_1OBJECT_1CLASS_1SET_1CONSTRUCTOR_FUNC, + G_1TYPE_1BOOLEAN_FUNC, + G_1TYPE_1DOUBLE_FUNC, + G_1TYPE_1FLOAT_FUNC, + G_1TYPE_1INT_FUNC, + G_1TYPE_1INT64_FUNC, + G_1VALUE_1TYPE_FUNC, GdkColor_1sizeof_FUNC, GdkDragContext_1sizeof_FUNC, GdkEventAny_1sizeof_FUNC, @@ -172,8 +178,6 @@ typedef enum { _1G_1OBJECT_1GET_1CLASS_FUNC, _1G_1OBJECT_1TYPE_FUNC, _1G_1OBJECT_1TYPE_1NAME_FUNC, - _1G_1TYPE_1BOOLEAN_FUNC, - _1G_1TYPE_1INT_FUNC, _1G_1TYPE_1STRING_FUNC, _1PANGO_1PIXELS_FUNC, _1PANGO_1TYPE_1FONT_1DESCRIPTION_FUNC, @@ -215,6 +219,7 @@ typedef enum { _1XWarpPointer_FUNC, _1access_FUNC, _1atk_1object_1add_1relationship_FUNC, + _1atk_1object_1remove_1relationship_FUNC, _1call_FUNC, _1dlclose_FUNC, _1dlopen_FUNC, @@ -1377,7 +1382,9 @@ typedef enum { _1pango_1font_1description_1from_1string_FUNC, _1pango_1font_1description_1get_1family_FUNC, _1pango_1font_1description_1get_1size_FUNC, + _1pango_1font_1description_1get_1stretch_FUNC, _1pango_1font_1description_1get_1style_FUNC, + _1pango_1font_1description_1get_1variant_FUNC, _1pango_1font_1description_1get_1weight_FUNC, _1pango_1font_1description_1new_FUNC, _1pango_1font_1description_1set_1family_FUNC, @@ -1443,6 +1450,16 @@ typedef enum { _1pango_1tab_1array_1new_FUNC, _1pango_1tab_1array_1set_1tab_FUNC, g_1main_1context_1wakeup_FUNC, + g_1value_1get_1double_FUNC, + g_1value_1get_1float_FUNC, + g_1value_1get_1int_FUNC, + g_1value_1get_1int64_FUNC, + g_1value_1init_FUNC, + g_1value_1set_1double_FUNC, + g_1value_1set_1float_FUNC, + g_1value_1set_1int_FUNC, + g_1value_1set_1int64_FUNC, + g_1value_1unset_FUNC, localeconv_1decimal_1point_FUNC, #ifndef JNI64 memmove__ILorg_eclipse_swt_internal_gtk_GInterfaceInfo_2I_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/ATK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/ATK.java index 77201aabc1..e3a01c5fb0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/ATK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/ATK.java @@ -24,7 +24,22 @@ public class ATK extends OS { } /** Constants */ + public static final int ATK_RELATION_NULL = 0; + public static final int ATK_RELATION_CONTROLLED_BY = 1; + public static final int ATK_RELATION_CONTROLLER_FOR = 2; + public static final int ATK_RELATION_LABEL_FOR = 3; public static final int ATK_RELATION_LABELLED_BY = 4; + public static final int ATK_RELATION_MEMBER_OF = 5; + public static final int ATK_RELATION_NODE_CHILD_OF = 6; + public static final int ATK_RELATION_FLOWS_TO = 7; + public static final int ATK_RELATION_FLOWS_FROM = 8; + public static final int ATK_RELATION_SUBWINDOW_OF = 9; + public static final int ATK_RELATION_EMBEDS = 10; + public static final int ATK_RELATION_EMBEDDED_BY = 11; + public static final int ATK_RELATION_POPUP_FOR = 12; + public static final int ATK_RELATION_PARENT_WINDOW_OF = 13; + public static final int ATK_RELATION_DESCRIBED_BY = 14; + public static final int ATK_RELATION_DESCRIPTION_FOR = 15; public static final int ATK_ROLE_CHECK_BOX = 7; public static final int ATK_ROLE_COMBO_BOX = 11; public static final int ATK_ROLE_DIALOG = 16; @@ -76,6 +91,37 @@ public class ATK extends OS { public static final int ATK_TEXT_BOUNDARY_SENTENCE_END = 4; public static final int ATK_TEXT_BOUNDARY_LINE_START = 5; public static final int ATK_TEXT_BOUNDARY_LINE_END = 6; + public static final int ATK_TEXT_CLIP_NONE = 0; + public static final int ATK_TEXT_CLIP_MIN = 1; + public static final int ATK_TEXT_CLIP_MAX = 2; + public static final int ATK_TEXT_CLIP_BOTH = 3; + public static final int ATK_TEXT_ATTR_LEFT_MARGIN = 1; + public static final int ATK_TEXT_ATTR_RIGHT_MARGIN = 2; + public static final int ATK_TEXT_ATTR_INDENT = 3; + public static final int ATK_TEXT_ATTR_INVISIBLE = 4; + public static final int ATK_TEXT_ATTR_EDITABLE = 5; + public static final int ATK_TEXT_ATTR_PIXELS_ABOVE_LINES = 6; + public static final int ATK_TEXT_ATTR_PIXELS_BELOW_LINES = 7; + public static final int ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP = 8; + public static final int ATK_TEXT_ATTR_BG_FULL_HEIGHT = 9; + public static final int ATK_TEXT_ATTR_RISE = 10; + public static final int ATK_TEXT_ATTR_UNDERLINE = 11; + public static final int ATK_TEXT_ATTR_STRIKETHROUGH = 12; + public static final int ATK_TEXT_ATTR_SIZE = 13; + public static final int ATK_TEXT_ATTR_SCALE = 14; + public static final int ATK_TEXT_ATTR_WEIGHT = 15; + public static final int ATK_TEXT_ATTR_LANGUAGE = 16; + public static final int ATK_TEXT_ATTR_FAMILY_NAME = 17; + public static final int ATK_TEXT_ATTR_BG_COLOR = 18; + public static final int ATK_TEXT_ATTR_FG_COLOR = 19; + public static final int ATK_TEXT_ATTR_BG_STIPPLE = 20; + public static final int ATK_TEXT_ATTR_FG_STIPPLE = 21; + public static final int ATK_TEXT_ATTR_WRAP_MODE = 22; + public static final int ATK__TEXT_ATTR_DIRECTION = 23; + public static final int ATK_TEXT_ATTR_JUSTIFICATION = 24; + public static final int ATK_TEXT_ATTR_STRETCH = 25; + public static final int ATK_TEXT_ATTR_VARIANT = 26; + public static final int ATK_TEXT_ATTR_STYLE = 27; public static final int ATK_XY_WINDOW = 1; /** Signals */ @@ -88,8 +134,31 @@ public class ATK extends OS { /** 64 bit */ public static final native int AtkObjectFactory_sizeof (); public static final native int AtkObjectFactoryClass_sizeof (); +public static final native int AtkAttribute_sizeof (); +public static final native int AtkTextRange_sizeof (); +public static final native int AtkTextRectangle_sizeof (); /** Natives */ + +/** @method flags=const */ +public static final native int /*long*/ GTK_TYPE_ACCESSIBLE (); +/** @method flags=const */ +public static final native int /*long*/ ATK_TYPE_ACTION (); +/** @method flags=const */ +public static final native int /*long*/ ATK_TYPE_COMPONENT (); +/** @method flags=const */ +public static final native int /*long*/ ATK_TYPE_HYPERTEXT (); +/** @method flags=const */ +public static final native int /*long*/ ATK_TYPE_SELECTION (); +/** @method flags=const */ +public static final native int /*long*/ ATK_TYPE_TABLE (); +/** @method flags=const */ +public static final native int /*long*/ ATK_TYPE_TEXT (); +/** @method flags=const */ +public static final native int /*long*/ ATK_TYPE_VALUE (); +/** @method flags=const */ +public static final native int /*long*/ ATK_TYPE_OBJECT_FACTORY (); +public static final native boolean ATK_IS_NO_OP_OBJECT_FACTORY (int /*long*/ obj); public static final native int /*long*/ _ATK_ACTION_GET_IFACE (int /*long*/ obj); public static final int /*long*/ ATK_ACTION_GET_IFACE (int /*long*/ obj) { lock.lock(); @@ -109,19 +178,29 @@ public static final int /*long*/ ATK_COMPONENT_GET_IFACE(int /*long*/ atkHandle) } } public static final native int /*long*/ _ATK_OBJECT_FACTORY_CLASS (int /*long*/ klass); -public static final int /*long*/ ATK_OBJECT_FACTORY_CLASS (int /*long*/ klass) { +public static final native int /*long*/ _ATK_SELECTION_GET_IFACE (int /*long*/ obj); +public static final int /*long*/ ATK_SELECTION_GET_IFACE (int /*long*/ obj) { lock.lock(); try { - return _ATK_OBJECT_FACTORY_CLASS(klass); + return _ATK_SELECTION_GET_IFACE(obj); } finally { lock.unlock(); } } -public static final native int /*long*/ _ATK_SELECTION_GET_IFACE (int /*long*/ obj); -public static final int /*long*/ ATK_SELECTION_GET_IFACE (int /*long*/ obj) { +public static final native int /*long*/ _ATK_HYPERTEXT_GET_IFACE (int /*long*/ handle); +public static final int /*long*/ ATK_HYPERTEXT_GET_IFACE (int /*long*/ handle) { lock.lock(); try { - return _ATK_SELECTION_GET_IFACE(obj); + return _ATK_HYPERTEXT_GET_IFACE(handle); + } finally { + lock.unlock(); + } +} +public static final native int /*long*/ _ATK_TABLE_GET_IFACE (int /*long*/ handle); +public static final int /*long*/ ATK_TABLE_GET_IFACE (int /*long*/ handle) { + lock.lock(); + try { + return _ATK_TABLE_GET_IFACE(handle); } finally { lock.unlock(); } @@ -135,6 +214,15 @@ public static final int /*long*/ ATK_TEXT_GET_IFACE (int /*long*/ handle) { lock.unlock(); } } +public static final native int /*long*/ _ATK_VALUE_GET_IFACE (int /*long*/ handle); +public static final int /*long*/ ATK_VALUE_GET_IFACE (int /*long*/ handle) { + lock.lock(); + try { + return _ATK_VALUE_GET_IFACE(handle); + } finally { + lock.unlock(); + } +} public static final native int /*long*/ _GTK_ACCESSIBLE (int /*long*/ handle); public static final int /*long*/ GTK_ACCESSIBLE (int /*long*/ handle) { lock.lock(); @@ -291,6 +379,24 @@ public static final int /*long*/ atk_state_set_new () { lock.unlock(); } } +public static final native int /*long*/ _atk_text_attribute_get_name (int attr); +public static final int /*long*/ atk_text_attribute_get_name (int attr) { + lock.lock(); + try { + return _atk_text_attribute_get_name(attr); + } finally { + lock.unlock(); + } +} +public static final native int /*long*/ _atk_text_attribute_get_value (int attr, int index); +public static final int /*long*/ atk_text_attribute_get_value (int attr, int index) { + lock.lock(); + try { + return _atk_text_attribute_get_value(attr, index); + } finally { + lock.unlock(); + } +} public static final native int /*long*/ _call (int /*long*/ function, int /*long*/ arg0); public static final int /*long*/ call (int /*long*/ function, int /*long*/ arg0) { lock.lock(); @@ -345,13 +451,17 @@ public static final int /*long*/ call (int /*long*/ function, int /*long*/ arg0, lock.unlock(); } } +/** @param str cast=(char *) */ +public static final native int /*long*/ g_strdup (int /*long*/ str); public static final native void memmove (AtkActionIface dest, int /*long*/ src); public static final native void memmove (AtkComponentIface dest, int /*long*/ src); public static final native void memmove (AtkHypertextIface dest, int /*long*/ src); public static final native void memmove (AtkObjectClass dest, int /*long*/ src); public static final native void memmove (AtkObjectFactoryClass dest, int /*long*/ src); public static final native void memmove (AtkSelectionIface dest, int /*long*/ src); +public static final native void memmove (AtkTableIface dest, int /*long*/ src); public static final native void memmove (AtkTextIface dest, int /*long*/ src); +public static final native void memmove (AtkValueIface dest, int /*long*/ src); public static final native void memmove (GtkAccessible dest, int /*long*/ src); public static final native void memmove (int /*long*/ dest, AtkActionIface src); public static final native void memmove (int /*long*/ dest, AtkComponentIface src); @@ -359,5 +469,43 @@ public static final native void memmove (int /*long*/ dest, AtkHypertextIface sr public static final native void memmove (int /*long*/ dest, AtkObjectClass src); public static final native void memmove (int /*long*/ dest, AtkObjectFactoryClass src); public static final native void memmove (int /*long*/ dest, AtkSelectionIface src); +public static final native void memmove (int /*long*/ dest, AtkTableIface src); public static final native void memmove (int /*long*/ dest, AtkTextIface src); +public static final native void memmove (int /*long*/ dest, AtkValueIface src); +/** + * @param dest cast=(void *) + * @param src cast=(const void *),flags=no_out + * @param size cast=(size_t) + */ +public static final native void memmove (int /*long*/ dest, AtkTextRectangle src, int size); +/** + * @param dest cast=(void *) + * @param src cast=(const void *),flags=no_out + * @param size cast=(size_t) + */ +public static final native void memmove (AtkTextRectangle dest, int /*long*/ src, int size); +/** + * @param dest cast=(void *) + * @param src cast=(const void *),flags=no_out + * @param size cast=(size_t) + */ +public static final native void memmove (int /*long*/ dest, AtkTextRange src, int size); +/** + * @param dest cast=(void *) + * @param src cast=(const void *),flags=no_out + * @param size cast=(size_t) + */ +public static final native void memmove (AtkTextRange dest, int /*long*/ src, int size); +/** + * @param dest cast=(void *) + * @param src cast=(const void *),flags=no_out + * @param size cast=(size_t) + */ +public static final native void memmove (int /*long*/ dest, AtkAttribute src, int size); +/** + * @param dest cast=(void *) + * @param src cast=(const void *),flags=no_out + * @param size cast=(size_t) + */ +public static final native void memmove (AtkAttribute dest, int /*long*/ src, int size); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkAttribute.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkAttribute.java new file mode 100644 index 0000000000..b48b7b8aab --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkAttribute.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.accessibility.gtk; + + +public class AtkAttribute { + /** @field cast=(char *) */ + public int /*long*/ name; + /** @field cast=(char *) */ + public int /*long*/ value; + public static final int sizeof = ATK.AtkAttribute_sizeof (); +} + diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTableIface.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTableIface.java new file mode 100644 index 0000000000..c54b38c575 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTableIface.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.accessibility.gtk; + + +public class AtkTableIface { + /** @field cast=(AtkObject* (*)()) */ + public int /*long*/ ref_at; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_index_at; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_column_at_index; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_row_at_index; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_n_columns; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_n_rows; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_column_extent_at; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_row_extent_at; + /** @field cast=(AtkObject* (*)()) */ + public int /*long*/ get_caption; + /** @field cast=(G_CONST_RETURN gchar* (*)()) */ + public int /*long*/ get_column_description; + /** @field cast=(AtkObject* (*)()) */ + public int /*long*/ get_column_header; + /** @field cast=(G_CONST_RETURN gchar* (*)()) */ + public int /*long*/ get_row_description; + /** @field cast=(AtkObject* (*)()) */ + public int /*long*/ get_row_header; + /** @field cast=(AtkObject* (*)()) */ + public int /*long*/ get_summary; + /** @field cast=(void (*)()) */ + public int /*long*/ set_caption; + /** @field cast=(void (*)()) */ + public int /*long*/ set_column_description; + /** @field cast=(void (*)()) */ + public int /*long*/ set_column_header; + /** @field cast=(void (*)()) */ + public int /*long*/ set_row_description; + /** @field cast=(void (*)()) */ + public int /*long*/ set_row_header; + /** @field cast=(void (*)()) */ + public int /*long*/ set_summary; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_selected_columns; + /** @field cast=(gint (*)()) */ + public int /*long*/ get_selected_rows; + /** @field cast=(gboolean (*)()) */ + public int /*long*/ is_column_selected; + /** @field cast=(gboolean (*)()) */ + public int /*long*/ is_row_selected; + /** @field cast=(gboolean (*)()) */ + public int /*long*/ is_selected; + /** @field cast=(gboolean (*)()) */ + public int /*long*/ add_row_selection; + /** @field cast=(gboolean (*)()) */ + public int /*long*/ remove_row_selection; + /** @field cast=(gboolean (*)()) */ + public int /*long*/ add_column_selection; + /** @field cast=(gboolean (*)()) */ + public int /*long*/ remove_column_selection; + /** @field cast=(void (*)()) */ + public int /*long*/ row_inserted; + /** @field cast=(void (*)()) */ + public int /*long*/ column_inserted; + /** @field cast=(void (*)()) */ + public int /*long*/ row_deleted; + /** @field cast=(void (*)()) */ + public int /*long*/ column_deleted; + /** @field cast=(void (*)()) */ + public int /*long*/ row_reordered; + /** @field cast=(void (*)()) */ + public int /*long*/ column_reordered; + /** @field cast=(void (*)()) */ + public int /*long*/ model_changed; +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextIface.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextIface.java index 5e74aa7fcb..a9999d1a9c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextIface.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextIface.java @@ -56,4 +56,8 @@ public class AtkTextIface { public int /*long*/ text_caret_moved; /** @field cast=(void (*)()) */ public int /*long*/ text_selection_changed; + /** @field cast=(void (*)()) */ + public int /*long*/ get_range_extents; + /** @field cast=(AtkTextRange** (*)()) */ + public int /*long*/ get_bounded_ranges; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextRange.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextRange.java new file mode 100644 index 0000000000..f5a12eaeb3 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextRange.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.accessibility.gtk; + + +public class AtkTextRange { + public AtkTextRectangle bounds = new AtkTextRectangle(); + public int start_offset; + public int end_offset; + /** @field cast=(gchar *) */ + public int /*long*/ content; + public static final int sizeof = ATK.AtkTextRange_sizeof (); + +} + diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextRectangle.java new file mode 100644 index 0000000000..9d95e4563b --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkTextRectangle.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.accessibility.gtk; + + +public class AtkTextRectangle { + public int x; + public int y; + public int width; + public int height; + public static final int sizeof = ATK.AtkTextRectangle_sizeof (); +} + diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkValueIface.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkValueIface.java new file mode 100644 index 0000000000..817bd40660 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/accessibility/gtk/AtkValueIface.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.internal.accessibility.gtk; + + +public class AtkValueIface { + /** @field cast=(void (*)()) */ + public int /*long*/ get_current_value; + /** @field cast=(void (*)()) */ + public int /*long*/ get_maximum_value; + /** @field cast=(void (*)()) */ + public int /*long*/ get_minimum_value; + /** @field cast=(gboolean (*)()) */ + public int /*long*/ set_current_value; +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index c061d25f7b..550f406fd6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -1719,25 +1719,16 @@ public static final int /*long*/ G_OBJECT_TYPE_NAME (int /*long*/ object) { } } /** @method flags=const */ -public static final native int /*long*/ _G_TYPE_BOOLEAN(); -public static final int /*long*/ G_TYPE_BOOLEAN() { - lock.lock(); - try { - return _G_TYPE_BOOLEAN(); - } finally { - lock.unlock(); - } -} +public static final native int /*long*/ G_TYPE_BOOLEAN(); /** @method flags=const */ -public static final native int /*long*/ _G_TYPE_INT(); -public static final int /*long*/ G_TYPE_INT() { - lock.lock(); - try { - return _G_TYPE_INT(); - } finally { - lock.unlock(); - } -} +public static final native int /*long*/ G_TYPE_DOUBLE(); +/** @method flags=const */ +public static final native int /*long*/ G_TYPE_FLOAT(); +/** @method flags=const */ +public static final native int /*long*/ G_TYPE_INT(); +/** @method flags=const */ +public static final native int /*long*/ G_TYPE_INT64(); +public static final native int /*long*/ G_VALUE_TYPE(int /*long*/ value); public static final native int /*long*/ _G_OBJECT_TYPE (int /*long*/ instance); public static final int /*long*/ G_OBJECT_TYPE (int /*long*/ instance) { lock.lock(); @@ -3262,6 +3253,29 @@ public static final int /*long*/ g_utf8_to_utf16(int /*long*/ str, int /*long*/ lock.unlock(); } } +/** + * @param value cast=(GValue *) + * @param type cast=(GType) + */ +public static final native int /*long*/ g_value_init (int /*long*/ value, int /*long*/ type); +/** @param value cast=(GValue *) */ +public static final native int g_value_get_int (int /*long*/ value); +/** @param value cast=(GValue *) */ +public static final native void g_value_set_int (int /*long*/ value, int v); +/** @param value cast=(GValue *) */ +public static final native double g_value_get_double (int /*long*/ value); +/** @param value cast=(GValue *) */ +public static final native void g_value_set_double (int /*long*/ value, double v); +/** @param value cast=(GValue *) */ +public static final native float g_value_get_float (int /*long*/ value); +/** @param value cast=(GValue *) */ +public static final native void g_value_set_float (int /*long*/ value, float v); +/** @param value cast=(GValue *) */ +public static final native long g_value_get_int64 (int /*long*/ value); +/** @param value cast=(GValue *) */ +public static final native void g_value_set_int64 (int /*long*/ value, long v); +/** @param value cast=(GValue *) */ +public static final native void g_value_unset (int /*long*/ value); /** @param value cast=(const GValue *) */ public static final native int /*long*/ _g_value_peek_pointer (int /*long*/ value); public static final int /*long*/ g_value_peek_pointer (int /*long*/ value) { @@ -14113,6 +14127,26 @@ public static final int pango_font_description_get_size(int /*long*/ desc) { } } /** @param desc cast=(PangoFontDescription *) */ +public static final native int _pango_font_description_get_stretch(int /*long*/ desc); +public static final int pango_font_description_get_stretch(int /*long*/ desc) { + lock.lock(); + try { + return _pango_font_description_get_stretch(desc); + } finally { + lock.unlock(); + } +} +/** @param desc cast=(PangoFontDescription *) */ +public static final native int _pango_font_description_get_variant(int /*long*/ desc); +public static final int pango_font_description_get_variant(int /*long*/ desc) { + lock.lock(); + try { + return _pango_font_description_get_variant(desc); + } finally { + lock.unlock(); + } +} +/** @param desc cast=(PangoFontDescription *) */ public static final native int _pango_font_description_get_style(int /*long*/ desc); public static final int pango_font_description_get_style(int /*long*/ desc) { lock.lock(); @@ -14854,6 +14888,21 @@ public static final boolean atk_object_add_relationship (int /*long*/ object, in } } /** + * @method flags=dynamic + * @param object cast=(AtkObject *) + * @param relationship cast=(AtkRelationType) + * @param target cast=(AtkObject *) + */ +public static final native boolean _atk_object_remove_relationship (int /*long*/ object, int relationship, int /*long*/ target); +public static final boolean atk_object_remove_relationship (int /*long*/ object, int relationship, int /*long*/ target) { + lock.lock(); + try { + return _atk_object_remove_relationship(object, relationship, target); + } finally { + lock.unlock(); + } +} +/** * @param path cast=(const char*) */ public static final native int _access (byte [] path, int amode); @@ -14865,5 +14914,4 @@ public static final int access (byte [] path, int amode) { lock.unlock(); } } - } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_custom.c index 59e822833b..5f0b789c20 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_custom.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_custom.c @@ -239,6 +239,19 @@ JNIEXPORT jintLong JNICALL COM_NATIVE(put_1accValue_1CALLBACK) } #endif +#ifndef NO_CALLBACK_1setCurrentValue +static jintLong CALLBACK_setCurrentValue; +static HRESULT CALLBACK setCurrentValue(void* ppVTable, VARIANT arg0) { + return ((HRESULT (CALLBACK *)(void*, VARIANT*))CALLBACK_setCurrentValue)(ppVTable, &arg0); +} +JNIEXPORT jintLong JNICALL COM_NATIVE(CALLBACK_1setCurrentValue) + (JNIEnv *env, jclass that, jintLong func) +{ + CALLBACK_setCurrentValue = func; + return (jintLong)setCurrentValue; +} +#endif + #ifndef NO_VtblCall_1PPPPVARIANT JNIEXPORT jint JNICALL COM_NATIVE(VtblCall_1PPPPVARIANT) (JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLong arg5, jintLong arg6) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c index 6660b5b12c..ee1e83178d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,10 +14,11 @@ #ifdef NATIVE_STATS -int COM_nativeFunctionCount = 184; -int COM_nativeFunctionCallCount[184]; +int COM_nativeFunctionCount = 185; +int COM_nativeFunctionCallCount[185]; char * COM_nativeFunctionNames[] = { "AccessibleObjectFromWindow", + "CALLBACK_1setCurrentValue", "CAUUID_1sizeof", "CLSIDFromProgID", "CLSIDFromString", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h index 614b321940..33d4378306 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/com_stats.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,6 +26,7 @@ extern char* COM_nativeFunctionNames[]; typedef enum { AccessibleObjectFromWindow_FUNC, + CALLBACK_1setCurrentValue_FUNC, CAUUID_1sizeof_FUNC, CLSIDFromProgID_FUNC, CLSIDFromString_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java index 216a29dcf2..ec3c6a26c7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java @@ -133,6 +133,22 @@ public class COM extends OS { public static final GUID CGID_DocHostCommandHandler = IIDFromString("{f38bc242-b950-11d1-8918-00c04fc2c836}"); //$NON-NLS-1$ public static final GUID CGID_Explorer = IIDFromString("{000214D0-0000-0000-C000-000000000046}"); //$NON-NLS-1$ + // IA2 related GUIDS + public static final GUID IIDIAccessible2 = IIDFromString("{E89F726E-C4F4-4c19-BB19-B647D7FA8478}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleRelation = IIDFromString("{7CDF86EE-C3DA-496a-BDA4-281B336E1FDC}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleAction = IIDFromString("{B70D9F59-3B5A-4dba-AB9E-22012F607DF5}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleComponent = IIDFromString("{1546D4B0-4C98-4bda-89AE-9A64748BDDE4}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleValue = IIDFromString("{35855B5B-C566-4fd0-A7B1-E65465600394}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleText = IIDFromString("{24FD2FFB-3AAD-4a08-8335-A3AD89C0FB4B}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleEditableText = IIDFromString("{A59AA09A-7011-4b65-939D-32B1FB5547E3}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleHyperlink = IIDFromString("{01C20F2B-3DD2-400f-949F-AD00BDAB1D41}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleHypertext = IIDFromString("{6B4F8BBF-F1F2-418a-B35E-A195BC4103B9}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleTable = IIDFromString("{35AD8070-C20C-4fb4-B094-F4F7275DD469}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleTable2 = IIDFromString("{6167f295-06f0-4cdd-a1fa-02e25153d869}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleTableCell = IIDFromString("{594116B1-C99F-4847-AD06-0A7A86ECE645}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleImage = IIDFromString("{FE5ABB3D-615E-4f7b-909F-5F0EDA9E8DDE}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleApplication = IIDFromString("{D49DED83-5B25-43F4-9B95-93B44595979E}"); //$NON-NLS-1$ + public static final GUID IIDIAccessibleContext = IIDFromString("{77A123E4-5794-44e0-B8BF-DE600C9D29BD}"); //$NON-NLS-1$ /** Constants */ //public static final int ADVF_DATAONSTOP = 64; @@ -822,6 +838,8 @@ public static final int ROLE_SYSTEM_SLIDER = 0x33; public static final int ROLE_SYSTEM_PAGETABLIST = 0x3c; //public static final int ROLE_SYSTEM_CLOCK = 0x3d; public static final int ROLE_SYSTEM_SPLITBUTTON = 0x3e; +//public static final int ROLE_SYSTEM_IPADDRESS = 0x3f; +//public static final int ROLE_SYSTEM_OUTLINEBUTTON = 0x40; public static final int STATE_SYSTEM_NORMAL = 0; //public static final int STATE_SYSTEM_UNAVAILABLE = 0x1; public static final int STATE_SYSTEM_SELECTED = 0x2; @@ -829,7 +847,6 @@ public static final int STATE_SYSTEM_FOCUSED = 0x4; public static final int STATE_SYSTEM_PRESSED = 0x8; public static final int STATE_SYSTEM_CHECKED = 0x10; public static final int STATE_SYSTEM_MIXED = 0x20; -//public static final int STATE_SYSTEM_INDETERMINATE = STATE_SYSTEM_MIXED; public static final int STATE_SYSTEM_READONLY = 0x40; public static final int STATE_SYSTEM_HOTTRACKED = 0x80; //public static final int STATE_SYSTEM_DEFAULT = 0x100; @@ -856,6 +873,10 @@ public static final int STATE_SYSTEM_MULTISELECTABLE = 0x1000000; //public static final int STATE_SYSTEM_PROTECTED = 0x20000000; //public static final int STATE_SYSTEM_VALID = 0x3fffffff; +/* IA2 additional constants */ +public static final int IA2_COORDTYPE_SCREEN_RELATIVE = 0; +public static final int IA2_COORDTYPE_PARENT_RELATIVE = 1; + /** Accessibility natives */ /** @@ -929,6 +950,8 @@ public static final native int /*long*/ accDoDefaultAction_CALLBACK(int /*long*/ public static final native int /*long*/ put_accName_CALLBACK(int /*long*/ func); /** @method flags=no_gen */ public static final native int /*long*/ put_accValue_CALLBACK(int /*long*/ func); +/** @method flags=no_gen,callback_types=HRESULT;VARIANT;,callback_flags=none;struct; */ +public static final native int /*long*/ CALLBACK_setCurrentValue(int /*long*/ func); /* sizeof's */ public static final native int CAUUID_sizeof(); |