Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod2002-02-28 16:40:42 +0000
committerCarolyn MacLeod2002-02-28 16:40:42 +0000
commitfb1e2071d35034cab2aa0ee2da4593b8398a9282 (patch)
treee97c9dc8912ce665773fe552a17687454f5538ec /bundles
parentdf2b18d6c3d453a1cbf6420cefbca622fb8ff1da (diff)
downloadeclipse.platform.swt-fb1e2071d35034cab2aa0ee2da4593b8398a9282.tar.gz
eclipse.platform.swt-fb1e2071d35034cab2aa0ee2da4593b8398a9282.tar.xz
eclipse.platform.swt-fb1e2071d35034cab2aa0ee2da4593b8398a9282.zip
Added accessibility
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java37
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAdapter.java74
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlAdapter.java78
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlEvent.java49
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlListener.java62
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleEvent.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleListener.java72
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java699
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/OSACC.java41
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java47
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java153
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c155
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IAccessible.java80
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java56
19 files changed, 1662 insertions, 4 deletions
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
new file mode 100644
index 0000000000..4fdacfcc2c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java
@@ -0,0 +1,37 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * Class ACC contains all the constants used in defining an
+ * Accessible object.
+ */
+public class ACC {
+ public static final int STATE_SYSTEM_NORMAL = 0x00000000;
+ public static final int STATE_SYSTEM_SELECTED = 0x00000002;
+ public static final int STATE_SYSTEM_SELECTABLE = 0x00200000;
+ public static final int STATE_SYSTEM_FOCUSED = 0x00000004;
+ public static final int STATE_SYSTEM_FOCUSABLE = 0x00100000;
+
+ public static final int ROLE_SYSTEM_CLIENT = 0xa;
+ public static final int ROLE_SYSTEM_PUSHBUTTON = 0x2b;
+ public static final int ROLE_SYSTEM_PAGETAB = 0x25;
+ public static final int ROLE_SYSTEM_PAGETABLIST = 0x3c;
+ public static final int ROLE_SYSTEM_STATICTEXT = 0x29;
+
+ public static final int NAVDIR_UP = 0x1;
+ public static final int NAVDIR_DOWN = 0x2;
+ public static final int NAVDIR_LEFT = 0x3;
+ public static final int NAVDIR_RIGHT = 0x4;
+ public static final int NAVDIR_NEXT = 0x5;
+ public static final int NAVDIR_PREVIOUS = 0x6;
+ public static final int NAVDIR_FIRSTCHILD = 0x7;
+ public static final int NAVDIR_LASTCHILD = 0x8;
+
+ public static final int CHILDID_SELF = 0;
+ public static final int CHILDID_NONE = -1;
+ public static final int CHILDID_MULTIPLE = -2; // look for a better solution...
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAdapter.java
new file mode 100644
index 0000000000..4207d0389d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAdapter.java
@@ -0,0 +1,74 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * This adapter class provides default implementations for the
+ * methods described by the <code>AccessibleListener</code> interface.
+ * <p>
+ * Classes that wish to deal with <code>AccessibleEvent</code>s can
+ * extend this class and override only the methods that they are
+ * interested in.
+ * </p><p>
+ * Note: Accessibility clients use child identifiers to specify
+ * whether they want information about a control or one of its children.
+ * Child identifiers are positive integers > 0.
+ * The identifier CHILDID_SELF (0) represents the control.
+ * </p>
+ *
+ * @see AccessibleListener
+ * @see AccessibleEvent
+ */
+public abstract class AccessibleAdapter implements AccessibleListener {
+
+ /**
+ * Sent when an accessibility client requests the name
+ * of the control, or the name of a child of the control.
+ * The default behavior is to do nothing.
+ *
+ * @param e an event object containing the following fields:
+ * childID [IN] - an identifier specifying the control or one of its children
+ * result [OUT] - the requested name string
+ */
+ public void getName(AccessibleEvent e) {
+ }
+
+ /**
+ * Sent when an accessibility client requests the help string
+ * of the control, or the help string of a child of the control.
+ * The default behavior is to do nothing.
+ *
+ * @param e an event object containing the following fields:
+ * childID [IN] - an identifier specifying the control or one of its children
+ * result [OUT] - the requested help string
+ */
+ public void getHelp(AccessibleEvent e) {
+ }
+
+ /**
+ * Sent when an accessibility client requests the keyboard shortcut
+ * of the control, or the keyboard shortcut of a child of the control.
+ * The default behavior is to do nothing.
+ *
+ * @param e an event object containing the following fields:
+ * childID [IN] - an identifier specifying the control or one of its children
+ * result [OUT] - the requested keyboard shortcut string (example: "CTRL+C")
+ */
+ public void getKeyboardShortcut(AccessibleEvent e) {
+ }
+
+ /**
+ * Sent when an accessibility client requests a description
+ * of the control, or a description of a child of the control.
+ * The default behavior is to do nothing.
+ *
+ * @param e an event object containing the following fields:
+ * childID [IN] - an identifier specifying the control or one of its children
+ * result [OUT] - the requested description string
+ */
+ public void getDescription(AccessibleEvent 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
new file mode 100644
index 0000000000..a09da7ce14
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlAdapter.java
@@ -0,0 +1,78 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * This adapter class provides default implementations for the
+ * methods described by the <code>AccessibleControlListener</code> interface.
+ * <p>
+ * Classes that wish to deal with <code>AccessibleControlEvent</code>s can
+ * extend this class and override only the methods that they are
+ * interested in.
+ * </p><p>
+ * Accessibility clients use child identifiers to specify
+ * whether they want information about a control or one of its children.
+ * Child identifiers are positive integers > 0.
+ * The identifier CHILDID_SELF (0) represents the control.
+ * When returning a child identifier to a client, you may use CHILDID_NONE
+ * to indicate that no child or control has the required information.
+ * </p><p>
+ * Note: This adapter is typically used by implementors of
+ * a custom control to provide very detailed information about
+ * the control instance to accessibility clients.
+ * </p>
+ *
+ * @see AccessibleControlListener
+ * @see AccessibleControlEvent
+ */
+public abstract class AccessibleControlAdapter implements AccessibleControlListener {
+
+ /**
+ * Sent when an accessibility client requests the identifier
+ * of the control child at the specified display coordinates.
+ * The default behavior is to do nothing.
+ *
+ * @param e an event object containing the following fields:
+ * x, y [IN] - the specified point in display coordinates
+ * childID [OUT] - the ID of the child at point, or CHILDID_SELF, or CHILDID_NONE
+ */
+ public void accHitTest(AccessibleControlEvent e) {
+ }
+
+ public void accLocation(AccessibleControlEvent e) {
+ }
+
+ public void accNavigate(AccessibleControlEvent e) {
+ }
+
+ public void getChild(AccessibleControlEvent e) {
+ }
+
+ public void getChildCount(AccessibleControlEvent e) {
+ }
+
+ public void getDefaultAction(AccessibleControlEvent e) {
+ }
+
+ public void getFocus(AccessibleControlEvent e) {
+ }
+
+ public void getRole(AccessibleControlEvent e) {
+ }
+
+ public void getSelection(AccessibleControlEvent e) {
+ }
+
+ public void getState(AccessibleControlEvent e) {
+ }
+
+ public void getValue(AccessibleControlEvent e) {
+ }
+
+ // May need to implement for IEnumVARIANT
+ public void getChildren(AccessibleControlEvent e) {
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlEvent.java
new file mode 100644
index 0000000000..545e4b6401
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlEvent.java
@@ -0,0 +1,49 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.SWTEventObject;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class are sent as a result of
+ * accessibility clients sending messages to controls
+ * asking for detailed information about the implementation
+ * of the control instance. Typically, only implementors
+ * of custom controls need to listen for this event.
+ * <p>
+ * Note: The meaning of each field depends on the
+ * message that was sent.
+ * </p>
+ *
+ * @see AccessibleControlListener
+ */
+public class AccessibleControlEvent extends SWTEventObject {
+ public int childID; // IN/OUT
+ public Accessible accessible; // OUT
+ public int x, y; // IN/OUT
+ public int width, height; // OUT
+ public int code; // IN/OUT
+ public String result; // OUT
+ public Object children[]; // [OUT] - may need this for IEnumVARIANT
+
+public AccessibleControlEvent(Object source) {
+ super(source);
+}
+
+public String toString () {
+ return "AccessibleControlEvent {" +
+ " childID=" + childID +
+ " accessible=" + accessible +
+ " x=" + x +
+ " y=" + y +
+ " width=" + width +
+ " height=" + height +
+ " code=" + code +
+ " result=" + result +
+ "}";
+}
+}
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
new file mode 100644
index 0000000000..30496c6ca0
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleControlListener.java
@@ -0,0 +1,62 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.SWTEventListener;
+
+/**
+ * Classes that implement this interface provide methods
+ * that deal with the events that are generated when an
+ * accessibility client sends a message to a control.
+ * <p>
+ * After creating an instance of a class that implements
+ * this interface it can be added to a control using the
+ * <code>addAccessibleControlListener</code> method and removed
+ * using the <code>removeAccessibleControlListener</code> method.
+ * When a client requests information the appropriate method
+ * will be invoked.
+ * </p><p>
+ * Accessibility clients use child identifiers to specify
+ * whether they want information about a control or one of its children.
+ * Child identifiers are positive integers > 0.
+ * The identifier CHILDID_SELF (0) represents the control.
+ * </p><p>
+ * Note: This interface is typically used by implementors of
+ * a custom control to provide very detailed information about
+ * the control instance to accessibility clients.
+ * </p>
+ *
+ * @see AccessibleControlAdapter
+ * @see AccessibleControlEvent
+ */
+public interface AccessibleControlListener extends SWTEventListener {
+
+ public void accHitTest(AccessibleControlEvent e);
+ public void accLocation(AccessibleControlEvent e);
+ public void getChild(AccessibleControlEvent e);
+ public void getChildCount(AccessibleControlEvent e);
+ public void getDefaultAction(AccessibleControlEvent e);
+ public void getFocus(AccessibleControlEvent e);
+ public void getRole(AccessibleControlEvent e);
+ public void getSelection(AccessibleControlEvent e);
+ public void getState(AccessibleControlEvent e);
+ public void getValue(AccessibleControlEvent e);
+
+ // May need to implement for IEnumVARIANT
+ public void getChildren(AccessibleControlEvent e);
+
+ // May not implement - not sure what clients use these - likely testing clients, not accesibility (but not sure)
+ public void accNavigate(AccessibleControlEvent e);
+ //public void accDoDefaultAction(AccessibleControlEvent e);
+ //public void accSelect(AccessibleControlEvent e);
+
+ // Probably won't implement - the usual parent is probably good enough
+ //public void getParent(AccessibleControlEvent e);
+
+ // Will not implement
+ //public void putName(AccessibleControlEvent e);
+ //public void putValue(AccessibleControlEvent e);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleEvent.java
new file mode 100644
index 0000000000..8450cc977a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleEvent.java
@@ -0,0 +1,32 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.SWTEventObject;
+
+/**
+ * Instances of this class are sent as a result of
+ * accessibility clients sending messages to controls
+ * asking for information about the control instance.
+ * <p>
+ * Note: The meaning of the result field depends
+ * on the message that was sent.
+ * </p>
+ *
+ * @see AccessibleListener
+ */
+public class AccessibleEvent extends SWTEventObject {
+ public int childID; // IN - can be CHILDID_SELF or a positive integer
+ public String result; // OUT - result depends on the listener method called
+
+public AccessibleEvent(Object source) {
+ super(source);
+}
+
+public String toString () {
+ return "AccessibleEvent {childID=" + childID + " result=" + result + "}";
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleListener.java
new file mode 100644
index 0000000000..dd02c0b0c5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleListener.java
@@ -0,0 +1,72 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.SWTEventListener;
+
+/**
+ * Classes that implement this interface provide methods
+ * that deal with the events that are generated when an
+ * accessibility client sends a message to a control.
+ * <p>
+ * After creating an instance of a class that implements
+ * this interface it can be added to a control using the
+ * <code>addAccessibleListener</code> method and removed
+ * using the <code>removeAccessibleListener</code> method.
+ * When a client requests information the appropriate method
+ * will be invoked.
+ * </p><p>
+ * Note: Accessibility clients use child identifiers to specify
+ * whether they want information about a control or one of its children.
+ * Child identifiers are positive integers > 0.
+ * The identifier CHILDID_SELF (0) represents the control.
+ * </p>
+ *
+ * @see AccessibleAdapter
+ * @see AccessibleEvent
+ */
+public interface AccessibleListener extends SWTEventListener {
+
+ /**
+ * Sent when an accessibility client requests the name
+ * of the control, or the name of a child of the control.
+ *
+ * @param e an event object containing the following fields:
+ * childID [IN] - an identifier specifying the control or one of its children
+ * result [OUT] - the requested name string
+ */
+ public void getName(AccessibleEvent e);
+
+ /**
+ * Sent when an accessibility client requests the help string
+ * of the control, or the help string of a child of the control.
+ *
+ * @param e an event object containing the following fields:
+ * childID [IN] - an identifier specifying the control or one of its children
+ * result [OUT] - the requested help string
+ */
+ public void getHelp(AccessibleEvent e);
+
+ /**
+ * Sent when an accessibility client requests the keyboard shortcut
+ * of the control, or the keyboard shortcut of a child of the control.
+ *
+ * @param e an event object containing the following fields:
+ * childID [IN] - an identifier specifying the control or one of its children
+ * result [OUT] - the requested keyboard shortcut string (example: "CTRL+C")
+ */
+ public void getKeyboardShortcut(AccessibleEvent e);
+
+ /**
+ * Sent when an accessibility client requests a description
+ * of the control, or a description of a child of the control.
+ *
+ * @param e an event object containing the following fields:
+ * childID [IN] - an identifier specifying the control or one of its children
+ * result [OUT] - the requested description string
+ */
+ public void getDescription(AccessibleEvent e);
+}
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
new file mode 100644
index 0000000000..7d89e3a53d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
@@ -0,0 +1,699 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import java.util.Vector;
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.internal.win32.*;
+import org.eclipse.swt.ole.win32.*;
+import org.eclipse.swt.internal.ole.win32.*;
+
+/**
+ * NOTE: The API in the accessibility package is NOT finalized.
+ * Use at your own risk, because it will most certainly change.
+ * The methods in AccessibleListener are more stable than those
+ * in AccessibleControlListener, however please take nothing for
+ * granted. The only reason this API is being released at this
+ * time is so that other teams can try it out.
+ */
+public class Accessible {
+ static final boolean debug = false;
+ int refCount = 0, enumIndex = 0;
+ COMObject objIAccessible, objIEnumVARIANT;
+ IAccessible iaccessible;
+ Vector accessibleListeners = new Vector(), accessibleControlListeners = new Vector();
+ Object[] variants;
+
+ Accessible(Control control) {
+ int[] ppvObject = new int[1];
+ int result = OSACC.CreateStdAccessibleObject(control.handle, COM.OBJID_CLIENT, COM.IIDIAccessible, ppvObject);
+ if (result == COM.E_NOTIMPL) return;
+ if (result != COM.S_OK)
+ OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
+ iaccessible = new IAccessible(ppvObject[0]);
+ iaccessible.AddRef();
+
+ objIAccessible = new COMObject(new int[] {2,0,0,1,3,5,8,1,1,5,5,5,5,5,5,5,6,5,1,1,5,5,8,6,3,4,5,5}) {
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ public int method3(int[] args) {return GetTypeInfoCount(args[0]);}
+ public int method4(int[] args) {return GetTypeInfo(args[0], args[1], args[2]);}
+ public int method5(int[] args) {return GetIDsOfNames(args[0], args[1], args[2], args[3], args[4]);}
+ public int method6(int[] args) {return Invoke(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
+ public int method7(int[] args) {return get_accParent(args[0]);}
+ public int method8(int[] args) {return get_accChildCount(args[0]);}
+ public int method9(int[] args) {return get_accChild(args[0], args[1], args[2], args[3], args[4]);}
+ public int method10(int[] args) {return get_accName(args[0], args[1], args[2], args[3], args[4]);}
+ public int method11(int[] args) {return get_accValue(args[0], args[1], args[2], args[3], args[4]);}
+ public int method12(int[] args) {return get_accDescription(args[0], args[1], args[2], args[3], args[4]);}
+ public int method13(int[] args) {return get_accRole(args[0], args[1], args[2], args[3], args[4]);}
+ public int method14(int[] args) {return get_accState(args[0], args[1], args[2], args[3], args[4]);}
+ public int method15(int[] args) {return get_accHelp(args[0], args[1], args[2], args[3], args[4]);}
+ public int method16(int[] args) {return get_accHelpTopic(args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int method17(int[] args) {return get_accKeyboardShortcut(args[0], args[1], args[2], args[3], args[4]);}
+ public int method18(int[] args) {return get_accFocus(args[0]);}
+ public int method19(int[] args) {return get_accSelection(args[0]);}
+ public int method20(int[] args) {return get_accDefaultAction(args[0], args[1], args[2], args[3], args[4]);}
+ public int method21(int[] args) {return accSelect(args[0], args[1], args[2], args[3], args[4]);}
+ public int method22(int[] args) {return accLocation(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
+ public int method23(int[] args) {return accNavigate(args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int method24(int[] args) {return accHitTest(args[0], args[1], args[2]);}
+ public int method25(int[] args) {return accDoDefaultAction(args[0], args[1], args[2], args[3]);}
+ public int method26(int[] args) {return put_accName(args[0], args[1], args[2], args[3], args[4]);}
+ public int method27(int[] args) {return put_accValue(args[0], args[1], args[2], args[3], args[4]);}
+ };
+
+ objIEnumVARIANT = new COMObject(new int[] {2,0,0,3,1,0,1}) {
+ public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
+ public int method1(int[] args) {return AddRef();}
+ public int method2(int[] args) {return Release();}
+ public int method3(int[] args) {return Next(args[0], args[1], args[2]);}
+ public int method4(int[] args) {return Skip(args[0]);}
+ public int method5(int[] args) {return Reset();}
+ // method6 Clone - not implemented
+ };
+ }
+
+ public static Accessible internal_new_accessible(Control control) {
+ return new Accessible(control);
+ }
+
+ public void addAccessibleListener(AccessibleListener listener) {
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleListeners.addElement(listener);
+ }
+
+ public void removeAccessibleListener(AccessibleListener listener) {
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleListeners.removeElement(listener);
+ }
+
+ public void addAccessibleControlListener(AccessibleControlListener listener) {
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleControlListeners.addElement(listener);
+ }
+
+ public void removeAccessibleControlListener(AccessibleControlListener listener) {
+ if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ accessibleControlListeners.removeElement(listener);
+ }
+
+ public int internal_WM_GETOBJECT (int wParam, int lParam) {
+ if (objIAccessible == null) return 0;
+ if (lParam == COM.OBJID_CLIENT) {
+ return OSACC.LresultFromObject(COM.IIDIAccessible, wParam, objIAccessible.getAddress());
+ }
+ return 0;
+ }
+
+ int QueryInterface(int arg1, int arg2) {
+ if (debug)
+ System.out.print("QueryInterface: ");
+
+ GUID guid = new GUID();
+ COM.MoveMemory(guid, arg1, GUID.sizeof);
+
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
+ if (debug)
+ System.out.println("IUnknown");
+ COM.MoveMemory(arg2, new int[] { objIAccessible.getAddress()}, 4);
+ return COM.S_OK;
+ }
+
+ if (COM.IsEqualGUID(guid, COM.IIDIDispatch)) {
+ if (debug)
+ System.out.println("IDispatch");
+ COM.MoveMemory(arg2, new int[] { objIAccessible.getAddress()}, 4);
+ return COM.S_OK;
+ }
+
+ if (COM.IsEqualGUID(guid, COM.IIDIAccessible)) {
+ if (debug)
+ System.out.println("IAccessible");
+ COM.MoveMemory(arg2, new int[] { objIAccessible.getAddress()}, 4);
+ return COM.S_OK;
+ }
+
+ if (COM.IsEqualGUID(guid, COM.IIDIEnumVARIANT)) {
+ if (debug)
+ System.out.println("IEnumVARIANT");
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getChildren(event);
+ }
+ variants = event.children;
+ enumIndex = 0;
+ COM.MoveMemory(arg2, new int[] { objIEnumVARIANT.getAddress()}, 4);
+ return COM.S_OK;
+ }
+
+ int[] ppvObject = new int[1];
+ int result = iaccessible.QueryInterface(guid, ppvObject);
+ COM.MoveMemory(arg2, ppvObject, 4);
+ if (debug)
+ System.out.println("other (" + result + ")");
+ return result;
+ }
+
+ int AddRef() {
+ if (debug)
+ System.out.println("AddRef");
+ refCount++;
+ return refCount;
+ }
+
+ int Release() {
+ if (debug)
+ System.out.println("Release");
+ refCount--;
+
+ if (refCount == 0) {
+ //disposeCOMInterfaces();
+ }
+ return refCount;
+ }
+
+ int GetTypeInfoCount(int pctinfo) {
+ if (debug)
+ System.out.println("GetTypeInfoCount");
+ return COM.E_NOTIMPL;
+ }
+
+ int GetTypeInfo(int iTInfo, int lcid, int ppTInfo) {
+ if (debug)
+ System.out.println("GetTypeInfo");
+ return COM.E_NOTIMPL;
+ }
+
+ int GetIDsOfNames(int riid, int rgszNames, int cNames, int lcid, int rgDispId) {
+ if (debug)
+ System.out.println("GetIDsOfNames");
+ return COM.E_NOTIMPL;
+ }
+
+ int Invoke(int dispIdMember, int riid, int lcid, int dwFlags, int pDispParams, int pVarResult, int pExcepInfo, int pArgErr) {
+ if (debug)
+ System.out.println("Invoke");
+ return COM.E_NOTIMPL;
+ }
+
+ int accDoDefaultAction(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) {
+ if (debug)
+ System.out.println("accDoDefaultAction " + varChild_vt + " " + varChild_lVal);
+ // must implement this for the items because they have a default action
+ return iaccessible.accDoDefaultAction(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2);
+ }
+
+ int accHitTest(int xLeft, int yTop, int pvarChild) {
+ if (debug)
+ System.out.println("accHitTest " + xLeft + " " + yTop + " " + pvarChild);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.accHitTest(xLeft, yTop, pvarChild);
+ }
+
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.x = xLeft;
+ event.y = yTop;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.accHitTest(event);
+ }
+ int childID = event.childID;
+ if (childID == ACC.CHILDID_NONE) {
+ COM.MoveMemory(pvarChild, new short[] { COM.VT_EMPTY }, 2);
+ return COM.S_FALSE;
+ }
+ COM.MoveMemory(pvarChild, new short[] { COM.VT_I4 }, 2);
+ COM.MoveMemory(pvarChild + 8, new int[] { childID }, 4);
+ return COM.S_OK;
+ }
+
+ int accLocation(int pxLeft, int pyTop, int pcxWidth, int pcyHeight, int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) {
+ if (debug)
+ System.out.println("accLocation " + pxLeft + " " + pyTop + " " + pcxWidth + " " + pcyHeight + " " + varChild_vt + " " + varChild_lVal);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.accLocation(pxLeft, pyTop, pcxWidth, pcyHeight, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.accLocation(event);
+ }
+ OS.MoveMemory(pxLeft, new int[] { event.x }, 4);
+ OS.MoveMemory(pyTop, new int[] { event.y }, 4);
+ OS.MoveMemory(pcxWidth, new int[] { event.width }, 4);
+ OS.MoveMemory(pcyHeight, new int[] { event.height }, 4);
+ return COM.S_OK;
+ }
+
+ int accNavigate(int navDir, int varStart_vt, int varStart_reserved1, int varStart_lVal, int varStart_reserved2, int pvarEndUpAt) {
+ if (debug)
+ System.out.println("accNavigate " + navDir + " " + varStart_vt + " " + varStart_lVal + " " + pvarEndUpAt);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.accNavigate(navDir, varStart_vt, varStart_reserved1, varStart_lVal, varStart_reserved2, pvarEndUpAt);
+ }
+
+ if (varStart_vt != COM.VT_I4) return COM.E_INVALIDARG;
+ switch (navDir) {
+ case ACC.NAVDIR_FIRSTCHILD:
+ case ACC.NAVDIR_LASTCHILD:
+ if (varStart_lVal != ACC.CHILDID_SELF) return COM.E_INVALIDARG;
+ case ACC.NAVDIR_UP:
+ case ACC.NAVDIR_DOWN:
+ case ACC.NAVDIR_LEFT:
+ case ACC.NAVDIR_PREVIOUS:
+ case ACC.NAVDIR_RIGHT:
+ case ACC.NAVDIR_NEXT:
+ break;
+ default: return COM.E_INVALIDARG;
+ }
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.code = navDir;
+ event.childID = varStart_lVal;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.accNavigate(event);
+ }
+ Accessible accessible = event.accessible;
+ if (accessible != null) {
+ COM.MoveMemory(pvarEndUpAt, new short[] { COM.VT_DISPATCH }, 2);
+ COM.MoveMemory(pvarEndUpAt + 8, new int[] { accessible.objIAccessible.getAddress() }, 4);
+ return COM.S_OK;
+ }
+ int childID = event.childID;
+ if (childID == ACC.CHILDID_NONE) {
+ COM.MoveMemory(pvarEndUpAt, new short[] { COM.VT_EMPTY }, 2);
+ return COM.S_FALSE;
+ }
+ if (childID == ACC.CHILDID_SELF) {
+ COM.MoveMemory(pvarEndUpAt, new short[] { COM.VT_DISPATCH }, 2);
+ COM.MoveMemory(pvarEndUpAt + 8, new int[] { objIAccessible.getAddress() }, 4);
+ return COM.S_OK;
+ }
+ COM.MoveMemory(pvarEndUpAt, new short[] { COM.VT_I4 }, 2);
+ COM.MoveMemory(pvarEndUpAt + 8, new int[] { childID }, 4);
+ return COM.S_OK;
+ }
+
+ int accSelect(int flagsSelect, int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) {
+ if (debug)
+ System.out.println("accSelect " + flagsSelect + " " + varChild_vt + " " + varChild_lVal);
+ // must implement for the items because they support selection
+ return iaccessible.accSelect(flagsSelect, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2);
+ }
+
+ int get_accChild(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int ppdispChild) {
+ if (debug)
+ System.out.println("get_accChild " + varChild_vt + " " + varChild_lVal + " " + ppdispChild);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accChild(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, ppdispChild);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getChild(event);
+ }
+ if (debug)
+ System.out.println("get_accChild returned: " + event);
+ Accessible accessible = event.accessible;
+ if (accessible != null) {
+ COM.MoveMemory(ppdispChild, new int[] { accessible.objIAccessible.getAddress() }, 4);
+ return COM.S_OK;
+ }
+ return COM.S_FALSE;
+ }
+
+ int get_accChildCount(int pcountChildren) {
+ if (debug)
+ System.out.println("get_accChildCount " + pcountChildren);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accChildCount(pcountChildren);
+ }
+
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getChildCount(event);
+ }
+
+ COM.MoveMemory(pcountChildren, new int[] { event.code }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accDefaultAction(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszDefaultAction) {
+ if (debug)
+ System.out.println("get_accDefaultAction " + varChild_vt + " " + varChild_lVal + " " + pszDefaultAction);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accDefaultAction(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszDefaultAction);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getDefaultAction(event);
+ }
+ if (event.result == null) return COM.S_FALSE;
+ char[] data = (event.result + "\0").toCharArray();
+ int ptr = COM.SysAllocString(data);
+ COM.MoveMemory(pszDefaultAction, new int[] { ptr }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accDescription(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszDescription) {
+ if (debug)
+ System.out.println("get_accDescription " + varChild_vt + " " + varChild_lVal + " " + pszDescription);
+ if (accessibleListeners.size() == 0) {
+ return iaccessible.get_accDescription(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszDescription);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleEvent event = new AccessibleEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getDescription(event);
+ }
+ if (event.result == null) return COM.S_FALSE;
+ char[] data = (event.result + "\0").toCharArray();
+ int ptr = COM.SysAllocString(data);
+ COM.MoveMemory(pszDescription, new int[] { ptr }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accFocus(int pvarChild) {
+ if (debug)
+ System.out.println("get_accFocus " + pvarChild);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accFocus(pvarChild);
+ }
+
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getFocus(event);
+ }
+ Accessible accessible = event.accessible;
+ if (accessible != null) {
+ COM.MoveMemory(pvarChild, new short[] { COM.VT_DISPATCH }, 2);
+ COM.MoveMemory(pvarChild + 8, new int[] { accessible.objIAccessible.getAddress() }, 4);
+ return COM.S_OK;
+ }
+ int childID = event.childID;
+ if (childID == ACC.CHILDID_NONE) {
+ COM.MoveMemory(pvarChild, new short[] { COM.VT_EMPTY }, 2);
+ return COM.S_FALSE;
+ }
+ if (childID == ACC.CHILDID_SELF) {
+ COM.MoveMemory(pvarChild, new short[] { COM.VT_DISPATCH }, 2);
+ COM.MoveMemory(pvarChild + 8, new int[] { objIAccessible.getAddress() }, 4);
+ return COM.S_OK;
+ }
+ COM.MoveMemory(pvarChild, new short[] { COM.VT_I4 }, 2);
+ COM.MoveMemory(pvarChild + 8, new int[] { childID }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accHelp(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszHelp) {
+ if (debug)
+ System.out.println("get_accHelp " + varChild_vt + " " + varChild_lVal + " " + pszHelp);
+ if (accessibleListeners.size() == 0) {
+ return iaccessible.get_accHelp(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszHelp);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleEvent event = new AccessibleEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getHelp(event);
+ }
+ if (event.result == null) return COM.S_FALSE;
+ char[] data = (event.result + "\0").toCharArray();
+ int ptr = COM.SysAllocString(data);
+ COM.MoveMemory(pszHelp, new int[] { ptr }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accHelpTopic(int pszHelpFile, int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pidTopic) {
+ if (debug)
+ System.out.println("get_accHelpTopic " + pszHelpFile + " " + varChild_vt + " " + varChild_lVal + " " + pidTopic);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accHelpTopic(pszHelpFile, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pidTopic);
+ }
+ return COM.S_FALSE;
+ }
+
+ int get_accKeyboardShortcut(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszKeyboardShortcut) {
+ if (debug)
+ System.out.println("get_accKeyboardShortcut " + pszKeyboardShortcut);
+ if (accessibleListeners.size() == 0) {
+ return iaccessible.get_accKeyboardShortcut(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszKeyboardShortcut);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleEvent event = new AccessibleEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getKeyboardShortcut(event);
+ }
+ if (event.result == null) return COM.S_FALSE;
+ char[] data = (event.result + "\0").toCharArray();
+ int ptr = COM.SysAllocString(data);
+ COM.MoveMemory(pszKeyboardShortcut, new int[] { ptr }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accName(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszName) {
+ if (debug)
+ System.out.println("get_accName " + varChild_vt + " " + varChild_lVal + " " + pszName);
+ if (accessibleListeners.size() == 0) {
+ return iaccessible.get_accName(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszName);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleEvent event = new AccessibleEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleListeners.size(); i++) {
+ AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
+ listener.getName(event);
+ }
+ if (debug)
+ System.out.println("get_accName returned: " + event);
+ if (event.result == null) return COM.S_FALSE;
+ char[] data = (event.result + "\0").toCharArray();
+ int ptr = COM.SysAllocString(data);
+ COM.MoveMemory(pszName, new int[] { ptr }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accParent(int ppdispParent) {
+ return iaccessible.get_accParent(ppdispParent);
+ }
+
+ int get_accRole(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pvarRole) {
+ if (debug)
+ System.out.println("get_accRole " + varChild_vt + " " + varChild_lVal + " " + pvarRole);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accRole(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pvarRole);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getRole(event);
+ }
+ if (debug)
+ System.out.println("get_accRole returned: " + event);
+ int role = event.code;
+ COM.MoveMemory(pvarRole, new short[] { COM.VT_I4 }, 2);
+ COM.MoveMemory(pvarRole + 8, new int[] { role }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accSelection(int pvarChildren) {
+ if (debug)
+ System.out.println("get_accSelection " + pvarChildren);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accSelection(pvarChildren);
+ }
+
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = ACC.CHILDID_NONE;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getSelection(event);
+ }
+ if (debug)
+ System.out.println("get_accSelection returned: " + event);
+ Accessible accessible = event.accessible;
+ if (accessible != null) {
+ COM.MoveMemory(pvarChildren, new short[] { COM.VT_DISPATCH }, 2);
+ COM.MoveMemory(pvarChildren + 8, new int[] { accessible.objIAccessible.getAddress() }, 4);
+ return COM.S_OK;
+ }
+ int childID = event.childID;
+ if (childID == ACC.CHILDID_NONE) {
+ COM.MoveMemory(pvarChildren, new short[] { COM.VT_EMPTY }, 2);
+ return COM.S_FALSE;
+ }
+ if (childID == ACC.CHILDID_MULTIPLE) {
+ COM.MoveMemory(pvarChildren, new short[] { COM.VT_UNKNOWN }, 2);
+ /* Supposed to return an IEnumVARIANT for this... so the next line is wrong... need a better API here... */
+ COM.MoveMemory(pvarChildren + 8, new int[] { objIAccessible.getAddress() }, 4);
+ return COM.S_OK;
+ }
+ if (childID == ACC.CHILDID_SELF) {
+ COM.MoveMemory(pvarChildren, new short[] { COM.VT_DISPATCH }, 2);
+ COM.MoveMemory(pvarChildren + 8, new int[] { objIAccessible.getAddress() }, 4);
+ return COM.S_OK;
+ }
+ COM.MoveMemory(pvarChildren, new short[] { COM.VT_I4 }, 2);
+ COM.MoveMemory(pvarChildren + 8, new int[] { childID }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accState(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pvarState) {
+ if (debug)
+ System.out.println("get_accState " + varChild_vt + " " + varChild_lVal + " " + pvarState);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accState(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pvarState);
+ }
+
+ if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getState(event);
+ }
+ if (debug)
+ System.out.println("get_accState returned: " + event);
+ int state = event.code;
+ COM.MoveMemory(pvarState, new short[] { COM.VT_I4 }, 2);
+ COM.MoveMemory(pvarState + 8, new int[] { state }, 4);
+ return COM.S_OK;
+ }
+
+ int get_accValue(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszValue) {
+ if (debug)
+ System.out.println("get_accValue " + varChild_vt + " " + varChild_lVal + " " + pszValue);
+ if (accessibleControlListeners.size() == 0) {
+ return iaccessible.get_accValue(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszValue);
+ }
+
+ AccessibleControlEvent event = new AccessibleControlEvent(this);
+ event.childID = varChild_lVal;
+ for (int i = 0; i < accessibleControlListeners.size(); i++) {
+ AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);
+ listener.getValue(event);
+ }
+ if (event.result == null) return COM.S_FALSE;
+ char[] data = (event.result + "\0").toCharArray();
+ int ptr = COM.SysAllocString(data);
+ COM.MoveMemory(pszValue, new int[] { ptr }, 4);
+ return COM.S_OK;
+ }
+
+ int put_accName(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int szName) {
+ // this method is no longer supported
+ if (debug)
+ System.out.println("put_accName " + varChild_vt + " " + varChild_lVal + " " + szName);
+ return iaccessible.put_accName(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, szName);
+ }
+
+ int put_accValue(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int szValue) {
+ // this method is typically only used for edit controls
+ if (debug)
+ System.out.println("put_accValue " + varChild_vt + " " + varChild_lVal + " " + szValue);
+ return iaccessible.put_accValue(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, szValue);
+ }
+
+ /* IEnumVARIANT methods: Next, Skip, Reset */
+ int Next(int celt, int rgvar, int pceltFetched) {
+ /* Retrieve the next celt items in the enumeration sequence.
+ * If there are fewer than the requested number of elements left
+ * in the sequence, retrieve the remaining elements.
+ * The number of elements actually retrieved is returned in pceltFetched
+ * (unless the caller passed in NULL for that parameter).
+ */
+ if (debug)
+ System.out.println("Next " + celt + " " + rgvar + " " + pceltFetched);
+
+ if (rgvar == 0) return COM.E_INVALIDARG;
+ if (pceltFetched == 0 && celt != 1) return COM.E_INVALIDARG;
+
+ Object[] nextItems = null;
+ if (variants != null && celt >= 1) {
+ int endIndex = enumIndex + celt - 1;
+ if (endIndex > (variants.length - 1)) endIndex = variants.length - 1;
+ if (enumIndex <= endIndex) {
+ nextItems = new Object[endIndex - enumIndex + 1];
+ for (int i = 0; i < nextItems.length; i++) {
+ nextItems[i] = variants[enumIndex];
+ enumIndex++;
+ }
+ }
+ }
+ if (nextItems != null) {
+ for (int i = 0; i < nextItems.length; i++) {
+ Object nextItem = nextItems[i];
+ if (nextItem instanceof Integer) {
+ int item = ((Integer) nextItem).intValue();
+ COM.MoveMemory(rgvar + i * 16, new short[] { COM.VT_I4 }, 2);
+ COM.MoveMemory(rgvar + i * 16 + 8, new int[] { item }, 4);
+ } else {
+ int address = ((Accessible) nextItem).objIAccessible.getAddress();
+ COM.MoveMemory(rgvar + i * 16, new short[] { COM.VT_DISPATCH }, 2);
+ COM.MoveMemory(rgvar + i * 16 + 8, new int[] { address }, 4);
+ }
+ }
+ if (pceltFetched != 0)
+ COM.MoveMemory(pceltFetched, new int[] {nextItems.length}, 4);
+ if (nextItems.length == celt) return COM.S_OK;
+ } else {
+ if (pceltFetched != 0)
+ COM.MoveMemory(pceltFetched, new int[] {0}, 4);
+ }
+ return COM.S_FALSE;
+ }
+
+ int Skip(int celt) {
+ /* Skip over the specified number of elements in the enumeration sequence. */
+ if (debug)
+ System.out.println("Skip " + celt);
+
+ if (celt < 1 ) return COM.E_INVALIDARG;
+ enumIndex += celt;
+ if (enumIndex > (variants.length - 1)) {
+ enumIndex = variants.length - 1;
+ return COM.S_FALSE;
+ }
+ return COM.S_OK;
+ }
+
+ int Reset() {
+ /* Reset the enumeration sequence to the beginning. */
+ if (debug)
+ System.out.println("Reset");
+
+ enumIndex = 0;
+ return COM.S_OK;
+ }
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/OSACC.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/OSACC.java
new file mode 100644
index 0000000000..6c846f2825
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/OSACC.java
@@ -0,0 +1,41 @@
+package org.eclipse.swt.accessibility;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.ole.win32.COM;
+
+/**
+ * Class OSACC contains all of the OS constants needed for accessibility.
+ */
+public class OSACC extends COM {
+ public static final int OBJID_CLIENT = 0xfffffffc;
+ public static final int WM_GETOBJECT = 0x3d;
+ public static final int CO_E_OBJNOTCONNECTED = 0x800401FD;
+
+ /* Need these constants - but first should make up nice names/values for the public constants in ACC... */
+// public static final int STATE_SYSTEM_NORMAL = 0x00000000;
+// public static final int STATE_SYSTEM_SELECTED = 0x00000002;
+// public static final int STATE_SYSTEM_SELECTABLE = 0x00200000;
+// public static final int STATE_SYSTEM_FOCUSED = 0x00000004;
+// public static final int STATE_SYSTEM_FOCUSABLE = 0x00100000;
+// public static final int ROLE_SYSTEM_CLIENT = 0xa;
+// public static final int ROLE_SYSTEM_PUSHBUTTON = 0x2b;
+// public static final int ROLE_SYSTEM_PAGETAB = 0x25;
+// public static final int ROLE_SYSTEM_PAGETABLIST = 0x3c;
+// public static final int ROLE_SYSTEM_STATICTEXT = 0x29;
+// public static final int NAVDIR_UP = 0x1;
+// public static final int NAVDIR_DOWN = 0x2;
+// public static final int NAVDIR_LEFT = 0x3;
+// public static final int NAVDIR_RIGHT = 0x4;
+// public static final int NAVDIR_NEXT = 0x5;
+// public static final int NAVDIR_PREVIOUS = 0x6;
+// public static final int NAVDIR_FIRSTCHILD = 0x7;
+// public static final int NAVDIR_LASTCHILD = 0x8;
+
+ // not sure why these don't work in this class? These natives are defined in COM for the moment...
+ //public static final native int CreateStdAccessibleObject (int hwnd, int idObject, GUID riidInterface, int[] ppvObject);
+ //public static final native int LresultFromObject (GUID riid, int wParam, int pAcc);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java
index 6889189fba..68d970450a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CLabel.java
@@ -10,6 +10,10 @@ import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.events.*;
+/* Start ACCESSIBILITY */
+import org.eclipse.swt.accessibility.*;
+/* End ACCESSIBILITY */
+
/**
* A Label which supports aligned text and/or an image and different border styles.
* <p>
@@ -56,7 +60,6 @@ public class CLabel extends Canvas {
private Color[] gradientColors;
private int[] gradientPercents;
-
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
@@ -102,6 +105,48 @@ public CLabel(Composite parent, int style) {
}
});
+/* Start ACCESSIBILITY */
+ getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ public void getName(AccessibleEvent e) {
+ e.result = getText();
+ }
+
+ public void getHelp(AccessibleEvent e) {
+ e.result = getToolTipText();
+ }
+ });
+
+ getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
+ public void accHitTest(AccessibleControlEvent e) {
+ Point testPoint = toControl(new Point(e.x, e.y));
+ if (getBounds().contains(testPoint)) {
+ e.childID = ACC.CHILDID_SELF;
+ }
+ }
+
+ public void accLocation(AccessibleControlEvent e) {
+ Rectangle location = getBounds();
+ Point pt = toDisplay(new Point(location.x, location.y));
+ e.x = pt.x;
+ e.y = pt.y;
+ e.width = location.width;
+ e.height = location.height;
+ }
+
+ public void getChildCount(AccessibleControlEvent e) {
+ e.code = 0;
+ }
+
+ public void getRole(AccessibleControlEvent e) {
+ e.code = ACC.ROLE_SYSTEM_STATICTEXT;
+ }
+
+ public void getState(AccessibleControlEvent e) {
+ e.code = ACC.STATE_SYSTEM_NORMAL;
+ }
+ });
+/* End ACCESSIBILITY */
+
}
/**
* Check the style bits to ensure that no invalid styles are applied.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
index 9767601dc8..9034f036db 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
@@ -11,6 +11,11 @@ import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
+/* Start ACCESSIBILITY */
+import org.eclipse.swt.accessibility.*;
+/* End ACCESSIBILITY */
+
+
/**
* Instances of this class implement the notebook user interface
* metaphor. It allows the user to select a notebook page from
@@ -224,6 +229,154 @@ public CTabFolder(Composite parent, int style) {
createCloseBar();
setBorderVisible((style & SWT.BORDER) != 0);
+
+
+/* Start ACCESSIBILITY */
+ getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ public void getName(AccessibleEvent e) {
+ int childID = e.childID;
+ if (childID > items.length) return;
+ if (childID != ACC.CHILDID_SELF) {
+ CTabItem childItem = items[childID - 1];
+ e.result = childItem.getText();
+ }
+ }
+
+ public void getHelp(AccessibleEvent e) {
+ int childID = e.childID;
+ if (childID > items.length) return;
+ if (childID == ACC.CHILDID_SELF) {
+ e.result = getToolTipText();
+ } else {
+ CTabItem childItem = items[childID - 1];
+ e.result = childItem.getToolTipText();
+ }
+ }
+
+ public void getKeyboardShortcut(AccessibleEvent e) {
+ int childID = e.childID;
+ if (childID > items.length) return;
+ if (childID != ACC.CHILDID_SELF) {
+ e.result = "Ctrl+TAB";
+ }
+ }
+ });
+
+ getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
+ public void accHitTest(AccessibleControlEvent e) {
+ Point testPoint = toControl(new Point(e.x, e.y));
+ int childID = ACC.CHILDID_SELF;
+ for (int i = 0; i < items.length; i++) {
+ Rectangle bounds = items[i].getBounds();
+ if (bounds.contains(testPoint)) {
+ childID = i + 1;
+ break;
+ }
+ }
+ if (childID == ACC.CHILDID_SELF && !getBounds().contains(testPoint)) {
+ e.childID = ACC.CHILDID_NONE;
+ }
+ e.childID = childID;
+ }
+
+ public void accLocation(AccessibleControlEvent e) {
+ int childID = e.childID;
+ if (childID > items.length) return;
+ Rectangle location;
+ if (childID == ACC.CHILDID_SELF) {
+ location = getBounds();
+ } else {
+ CTabItem childItem = items[childID - 1];
+ location = childItem.getBounds();
+ }
+ Point pt = toDisplay(new Point(location.x, location.y));
+ e.x = pt.x;
+ e.y = pt.y;
+ e.width = location.width;
+ e.height = location.height;
+ }
+
+ public void accNavigate(AccessibleControlEvent e) {
+ int childID = ACC.CHILDID_NONE;
+ switch (e.code) {
+ case ACC.NAVDIR_UP:
+ case ACC.NAVDIR_DOWN:
+ if (childID == ACC.CHILDID_SELF) childID = ACC.CHILDID_SELF;
+ break;
+ case ACC.NAVDIR_FIRSTCHILD:
+ if (items.length > 0) childID = 1;
+ break;
+ case ACC.NAVDIR_LASTCHILD:
+ if (items.length > 0) childID = items.length;
+ break;
+ case ACC.NAVDIR_LEFT:
+ case ACC.NAVDIR_PREVIOUS:
+ if (childID == ACC.CHILDID_SELF) childID = ACC.CHILDID_SELF;
+ if (items.length > 0 && childID > 1) childID = childID - 1;
+ break;
+ case ACC.NAVDIR_RIGHT:
+ case ACC.NAVDIR_NEXT:
+ if (childID == ACC.CHILDID_SELF) childID = ACC.CHILDID_SELF;
+ if (items.length > 0 && childID < items.length) childID = childID + 1;
+ break;
+ }
+ e.childID = childID;
+ }
+
+ public void getChildCount(AccessibleControlEvent e) {
+ e.code = items.length;
+ }
+
+ public void getDefaultAction(AccessibleControlEvent e) {
+ int childID = e.childID;
+ if (childID > items.length) return;
+ if (childID != ACC.CHILDID_SELF) {
+ e.result = "Switch";
+ }
+ }
+
+ public void getRole(AccessibleControlEvent e) {
+ int childID = e.childID;
+ if (childID > items.length) return;
+ if (childID == ACC.CHILDID_SELF) {
+ e.code = ACC.ROLE_SYSTEM_PAGETABLIST;
+ } else {
+ e.code = ACC.ROLE_SYSTEM_PAGETAB;
+ }
+ }
+
+ public void getSelection(AccessibleControlEvent e) {
+ if (selectedIndex == -1) {
+ e.childID = ACC.CHILDID_NONE;
+ } else {
+ e.childID = selectedIndex + 1;
+ }
+ }
+
+ public void getState(AccessibleControlEvent e) {
+ int childID = e.childID;
+ if (childID > items.length) return;
+ int state;
+ if (childID == ACC.CHILDID_SELF) {
+ state = ACC.STATE_SYSTEM_NORMAL;
+ } else {
+ state = ACC.STATE_SYSTEM_SELECTABLE;
+ if (selectedIndex + 1 == childID) {
+ state |= ACC.STATE_SYSTEM_SELECTED;
+ }
+ }
+ e.code = state;
+ }
+
+ public void getChildren(AccessibleControlEvent e) {
+ Object[] children = new Object[items.length];
+ for (int i = 0; i < items.length; i++) {
+ children[i] = new Integer(i + 1);
+ }
+ e.children = children;
+ }
+ });
+/* End ACCESSIBILITY */
}
private static int checkStyle (int style) {
int mask = SWT.TOP | SWT.BOTTOM | SWT.FLAT;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
index 66da6d475c..52bcb045da 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak
@@ -18,7 +18,7 @@ WS_PREFIX=win32
SWT_VERSION = $(maj_ver)$(min_ver)
SWT_LIB = $(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).dll
-LINK_LIBS = ole32.lib comctl32.lib user32.lib gdi32.lib comdlg32.lib kernel32.lib shell32.lib oleaut32.lib advapi32.lib imm32.lib winspool.lib
+LINK_LIBS = ole32.lib comctl32.lib user32.lib gdi32.lib comdlg32.lib kernel32.lib shell32.lib oleaut32.lib advapi32.lib imm32.lib winspool.lib oleacc.lib
# note: thoroughly test all examples after changing any optimization flags
CFLAGS = -c -W3 -G6 -GD -O1 -DSWT_VERSION=$(SWT_VERSION) -DSWT_BUILD_NUM=$(bld_num) -nologo -D_X86_=1 -D_WIN32 -D_WIN95 -D_WIN32_WINDOWS=0x0400 -D_MT -MT -DWIN32 -D_WIN32_DCOM /I$(JAVA_HOME)\include /I.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h
index ea39a16ab8..14523f6f8b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/structs.h
@@ -30,6 +30,8 @@
#include <objbase.h>
#include <shlwapi.h>
#include <shellapi.h>
+#include <initguid.h>
+#include <oleacc.h>
#ifdef WIN32_PLATFORM_PSPC
#include <aygshell.h>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c
index 32081cc98a..b630b34ced 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swtole.c
@@ -3254,3 +3254,158 @@ JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CoGetInstance
}
*/
+/****************** ACCESSIBILITY ****************/
+/*
+ * Class: org_eclipse_swt_internal_ole_win32_COM
+ * Method: CreateStdAccessibleObject
+ * Signature: (IILorg/eclipse/swt/internal/ole/win32/GUID;[I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_CreateStdAccessibleObject
+ (JNIEnv *env, jclass that, jint hwnd, jint idObject, jobject riidInterface, jintArray ppvObject)
+{
+ DECL_GLOB(pGlob)
+ LPVOID *ppvObject1=NULL;
+ GUID guid, *riidInterface1=NULL;
+ jint rc = E_NOTIMPL;
+ HMODULE hm;
+ FARPROC fp;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "CreateStdAccessibleObject\n");
+#endif
+
+ if (riidInterface) {
+ riidInterface1=&guid;
+ cacheGuidFids(env, riidInterface, &PGLOB(GuidFc));
+ getGuidFields(env, riidInterface, riidInterface1, &PGLOB(GuidFc));
+ }
+
+ if (ppvObject)
+ ppvObject1 = (LPVOID *)(*env)->GetIntArrayElements(env, ppvObject, NULL);
+
+ /*
+ * CreateStdAccessibleObject is an oleacc specific call.
+ * If you link it into swt.dll, a system modal entry point not found dialog will
+ * appear as soon as swt.dll is loaded. Here we check for the entry point and
+ * only do the call if it exists.
+ */
+ if (!(hm = GetModuleHandle("oleacc.dll"))) hm = LoadLibrary("oleacc.dll");
+ if (hm && (fp = GetProcAddress(hm, "CreateStdAccessibleObject"))) {
+ rc = (jint)fp((HWND)hwnd, idObject, riidInterface1, ppvObject1);
+ }
+
+ if (riidInterface) {
+ setGuidFields(env, riidInterface, riidInterface1, &PGLOB(GuidFc));
+ }
+
+ if (ppvObject)
+ (*env)->ReleaseIntArrayElements(env, ppvObject, (jint *)ppvObject1, 0);
+
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_ole_win32_COM
+ * Method: LresultFromObject
+ * Signature: (Lorg/eclipse/swt/internal/ole/win32/GUID;II)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_LresultFromObject
+ (JNIEnv *env, jclass that, jobject riid, jint wParam, jint pAcc)
+{
+ GUID guid, *riid1=NULL;
+ jint rc = E_NOTIMPL;
+ HMODULE hm;
+ FARPROC fp;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "LresultFromObject\n");
+#endif
+
+ if (riid) {
+ riid1=&guid;
+ cacheGuidFids(env, riid, &PGLOB(GuidFc));
+ getGuidFields(env, riid, riid1, &PGLOB(GuidFc));
+ }
+ /*
+ * LresultFromObject is an oleacc specific call.
+ * If you link it into swt.dll, a system modal entry point not found dialog will
+ * appear as soon as swt.dll is loaded. Here we check for the entry point and
+ * only do the call if it exists.
+ */
+ if (!(hm = GetModuleHandle("oleacc.dll"))) hm = LoadLibrary("oleacc.dll");
+ if (hm && (fp = GetProcAddress(hm, "LresultFromObject"))) {
+ rc = (jint)fp(riid1, wParam, (LPUNKNOWN)pAcc);
+ }
+ if (riid) {
+ setGuidFields(env, riid, riid1, &PGLOB(GuidFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_ole_win32_COM
+ * Method: VtblCall
+ * Signature: (IIIIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIIII
+ (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jint arg2, jint arg3)
+{
+ P_OLE_FN_5 fn; /* this is a function that returns int */
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "COM_VtblCall__IIIIII\n");
+#endif
+ fn = (P_OLE_FN_5)(*(int **)ppVtbl)[fnNumber];
+ return fn(ppVtbl, arg0, arg1, arg2, arg3); /* cast it to an OLE function returning int */
+}
+
+/*
+ * Class: org_eclipse_swt_internal_ole_win32_COM
+ * Method: VtblCall
+ * Signature: (IIIIIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIIIII
+ (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4)
+{
+ P_OLE_FN_6 fn; /* this is a function that returns int */
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "COM_VtblCall__IIIIIII\n");
+#endif
+ fn = (P_OLE_FN_6)(*(int **)ppVtbl)[fnNumber];
+ return fn(ppVtbl, arg0, arg1, arg2, arg3, arg4); /* cast it to an OLE function returning int */
+}
+
+/*
+ * Class: org_eclipse_swt_internal_ole_win32_COM
+ * Method: VtblCall
+ * Signature: (IIIIIIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIIIIII
+ (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5)
+{
+ P_OLE_FN_7 fn; /* this is a function that returns int */
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "COM_VtblCall__IIIIIIII\n");
+#endif
+ fn = (P_OLE_FN_7)(*(int **)ppVtbl)[fnNumber];
+ return fn(ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); /* cast it to an OLE function returning int */
+}
+
+/*
+ * Class: org_eclipse_swt_internal_ole_win32_COM
+ * Method: VtblCall
+ * Signature: (IIIIIIIIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_ole_win32_COM_VtblCall__IIIIIIIIII
+ (JNIEnv *env, jclass that, jint fnNumber, jint ppVtbl, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jint arg5, jint arg6, jint arg7)
+{
+ P_OLE_FN_9 fn; /* this is a function that returns int */
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "COM_VtblCall__IIIIIIIIII\n");
+#endif
+ fn = (P_OLE_FN_9)(*(int **)ppVtbl)[fnNumber];
+ return fn(ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); /* cast it to an OLE function returning int */
+}
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 c6a2e06213..42242708b5 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
@@ -26,7 +26,10 @@ public class COM extends OS {
public static final GUID IIDIEditorService = IIDFromString("{BEE283FE-7B42-4FF3-8232-0F07D43ABCF1}");
public static final GUID IIDIEditorManager = IIDFromString("{EFDE08C4-BE87-4B1A-BF84-15FC30207180}");
-
+ public static final GUID IIDIAccessible = IIDFromString("{618736E0-3C3D-11CF-810C-00AA00389B71}");
+ //public static final GUID IIDIAccessibleHandler = IIDFromString("{03022430-ABC4-11D0-BDE2-00AA001A1953}");
+ //public static final GUID IIDIAccessor = IIDFromString("{0C733A8C-2A1C-11CE-ADE5-00AA0044773D}");
+
public static final GUID IIDIAdviseSink = IIDFromString("{0000010F-0000-0000-C000-000000000046}");
//public static final GUID IIDIAdviseSink2 = IIDFromString("{00000125-0000-0000-C000-000000000046}");
//public static final GUID IIDIBindCtx = IIDFromString("{0000000E-0000-0000-C000-000000000046}");
@@ -51,7 +54,7 @@ public class COM extends OS {
//public static final GUID IIDIEnumSTATSTG = IIDFromString("{0000000D-0000-0000-C000-000000000046}");
//public static final GUID IIDIEnumString = IIDFromString("{00000101-0000-0000-C000-000000000046}");
//public static final GUID IIDIEnumUnknown = IIDFromString("{00000100-0000-0000-C000-000000000046}");
- //public static final GUID IIDIEnumVARIANT = IIDFromString("{00020404-0000-0000-C000-000000000046}");
+ public static final GUID IIDIEnumVARIANT = IIDFromString("{00020404-0000-0000-C000-000000000046}");
//public static final GUID IIDIErrorInfo = IIDFromString("{1CF2B120-547D-101B-8E65-08002B2BD119}");
//public static final GUID IIDIErrorLog = IIDFromString("{3127CA40-446E-11CE-8135-00AA004BB851}");
//public static final GUID IIDIExternalConnection = IIDFromString("{00000019-0000-0000-C000-000000000046}");
@@ -538,4 +541,16 @@ public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int[
public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int[] arg1, int arg2, int[] arg3);
public static final native int WriteClassStg(int pStg, GUID rclsid);
+
+/* VtblCalls added for accessibility (definitions belong here in COM, not in ACC) */
+public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, int arg2, int arg3);
+public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4);
+public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5);
+public static final native int VtblCall(int fnNumber, int ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7);
+/* End of VtblCalls added for accessibility */
+
+/* these are only here temporarily until I figure out how to move them into ACC */
+ public static final native int CreateStdAccessibleObject (int hwnd, int idObject, GUID riidInterface, int[] ppvObject);
+ public static final native int LresultFromObject (GUID riid, int wParam, int pAcc);
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IAccessible.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IAccessible.java
new file mode 100644
index 0000000000..329ad25852
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/IAccessible.java
@@ -0,0 +1,80 @@
+package org.eclipse.swt.internal.ole.win32;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.ole.win32.*;
+
+public class IAccessible extends IDispatch {
+
+public IAccessible(int address) {
+ super(address);
+}
+
+public int get_accParent(int ppdispParent) {
+ return COM.VtblCall(7, address, ppdispParent);
+}
+public int get_accChildCount(int pcountChildren) {
+ return COM.VtblCall(8, address, pcountChildren);
+}
+public int get_accChild(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int ppdispChild) {
+ return COM.VtblCall(9, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, ppdispChild);
+}
+public int get_accName(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszName) {
+ return COM.VtblCall(10, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszName);
+}
+public int get_accValue(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszValue) {
+ return COM.VtblCall(11, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszValue);
+}
+public int get_accDescription(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszDescription) {
+ return COM.VtblCall(12, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszDescription);
+}
+public int get_accRole(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pvarRole) {
+ return COM.VtblCall(13, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pvarRole);
+}
+public int get_accState(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pvarState) {
+ return COM.VtblCall(14, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pvarState);
+}
+public int get_accHelp(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszHelp) {
+ return COM.VtblCall(15, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszHelp);
+}
+public int get_accHelpTopic(int pszHelpFile, int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pidTopic) {
+ return COM.VtblCall(16, address, pszHelpFile, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pidTopic);
+}
+public int get_accKeyboardShortcut(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszKeyboardShortcut) {
+ return COM.VtblCall(17, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszKeyboardShortcut);
+}
+public int get_accFocus(int pvarChild) {
+ return COM.VtblCall(18, address, pvarChild);
+}
+public int get_accSelection(int pvarChildren) {
+ return COM.VtblCall(19, address, pvarChildren);
+}
+public int get_accDefaultAction(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pszDefaultAction) {
+ return COM.VtblCall(20, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pszDefaultAction);
+}
+public int accSelect(int flagsSelect, int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) {
+ return COM.VtblCall(21, address, flagsSelect, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2);
+}
+public int accLocation(int pxLeft, int pyTop, int pcxWidth, int pcyHeight,
+ int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) {
+ return COM.VtblCall(22, address, pxLeft, pyTop, pcxWidth, pcyHeight, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2);
+}
+public int accNavigate(int navDir, int varStart_vt, int varStart_reserved1, int varStart_lVal, int varStart_reserved2, int pvarEndUpAt) {
+ return COM.VtblCall(23, address, navDir, varStart_vt, varStart_reserved1, varStart_lVal, varStart_reserved2, pvarEndUpAt);
+}
+public int accHitTest(int xLeft, int yTop, int pvarChild) {
+ return COM.VtblCall(24, address, xLeft, yTop, pvarChild);
+}
+public int accDoDefaultAction(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2) {
+ return COM.VtblCall(25, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2);
+}
+public int put_accName(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int szName) {
+ return COM.VtblCall(26, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, szName);
+}
+public int put_accValue(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int szValue) {
+ return COM.VtblCall(27, address, varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, szValue);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index f4249c49aa..dc67aa0636 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -598,6 +598,7 @@ public class OS {
public static final int NULLREGION = 0x1;
public static final int NULL_BRUSH = 0x5;
public static final int NULL_PEN = 0x8;
+ public static final int OBJID_CLIENT = 0xFFFFFFFC;
public static final int OBJ_FONT = 0x6;
public static final int OBJ_PEN = 0x1;
public static final int OBM_CHECKBOXES = 0x7ff7;
@@ -1036,6 +1037,7 @@ public class OS {
public static final int WM_GETDLGCODE = 0x87;
public static final int WM_GETFONT = 0x31;
// public static final int WM_GETICON = 0x7f;
+ public static final int WM_GETOBJECT = 0x003D;
public static final int WM_HELP = 0x53;
public static final int WM_HSCROLL = 0x114;
public static final int WM_IME_CHAR = 0x286;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
index 9ab2adeddf..054313871b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java
@@ -208,6 +208,12 @@ public class SWT {
* hardware key up event type (value is 34)
*/
public static final int HardKeyUp = 34;
+
+ /**
+ * access accessibility event type (value is 35)
+ */
+ public static final int AccessAccessibility = 35;
+
/* Event Details */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index dd524ccace..6e522ffcb2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -9,6 +9,9 @@ import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
+/* Start ACCESSIBILITY */
+import org.eclipse.swt.accessibility.*;
+/* End ACCESSIBILITY */
/**
* Control is the abstract superclass of all windowed user interface classes.
@@ -40,6 +43,11 @@ public abstract class Control extends Widget implements Drawable {
String toolTipText;
Object layoutData;
+/* Start ACCESSIBILITY */
+ Accessible accessible;
+/* End ACCESSIBILITY */
+
+
/**
* Prevents uninitialized instances from being created outside the package.
*/
@@ -567,6 +575,39 @@ public boolean forceFocus () {
return true;
}
+/* Start ACCESSIBILITY */
+/**
+ * NOTE: The API in the accessibility package is NOT finalized.
+ * Use at your own risk, because it will most certainly change.
+ * The methods in AccessibleListener are more stable than those
+ * in AccessibleControlListener, however please take nothing for
+ * granted. The only reason this API is being released at this
+ * time is so that other teams can try it out.
+ */
+/**
+ * Returns the accessible object for the receiver.
+ * If this is the first time this object is requested,
+ * then the object is created and returned.
+ *
+ * @return the accessible object
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see addAccessibleListener
+ * @see addAccessibleControlListener
+ */
+public Accessible getAccessible () {
+ checkWidget ();
+ if (accessible == null) {
+ accessible = Accessible.internal_new_accessible (this);
+ }
+ return accessible;
+}
+/* End ACCESSIBILITY */
+
/**
* Returns the receiver's background color.
*
@@ -2632,6 +2673,9 @@ int windowProc (int msg, int wParam, int lParam) {
case OS.WM_IME_COMPOSITION: result = WM_IME_COMPOSITION (wParam, lParam); break;
case OS.WM_INITMENUPOPUP: result = WM_INITMENUPOPUP (wParam, lParam); break;
case OS.WM_GETFONT: result = WM_GETFONT (wParam, lParam); break;
+/* Start ACCESSIBILITY */
+ case OS.WM_GETOBJECT: result = WM_GETOBJECT (wParam, lParam); break;
+/* End ACCESSIBILITY */
case OS.WM_KEYDOWN: result = WM_KEYDOWN (wParam, lParam); break;
case OS.WM_KEYUP: result = WM_KEYUP (wParam, lParam); break;
case OS.WM_KILLFOCUS: result = WM_KILLFOCUS (wParam, lParam); break;
@@ -2813,6 +2857,18 @@ LRESULT WM_GETFONT (int wParam, int lParam) {
return null;
}
+/* Start ACCESSIBILITY */
+LRESULT WM_GETOBJECT (int wParam, int lParam) {
+ if (accessible != null) {
+ int result = accessible.internal_WM_GETOBJECT (wParam, lParam);
+ if (result != 0) {
+ return new LRESULT(result);
+ }
+ }
+ return null;
+}
+/* End ACCESSIBILITY */
+
LRESULT WM_HELP (int wParam, int lParam) {
if (OS.IsWinCE) return null;
HELPINFO lphi = new HELPINFO ();

Back to the top