*** empty log message ***
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 index fb3330d..4207d03 100644 --- 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
@@ -12,6 +12,11 @@ * 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 @@ -21,22 +26,49 @@ /** * Sent when an accessibility client requests the name - * of a control, or the specified child of a control. + * 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] - the specified child identifier, or CHILDID_SELF - * result [OUT] - the string representing the requested name + * childID [IN] - an identifier specifying the control or one of its children + * result [OUT] - the requested name string */ - public void get_accName(AccessibleEvent e) { + public void getName(AccessibleEvent e) { } - public void get_accHelp(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) { } - public void get_accKeyboardShortcut(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) { } - public void get_accDescription(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 index db07c89..a09da7c 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
@@ -12,6 +12,17 @@ * 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 @@ -37,35 +48,31 @@ public void accNavigate(AccessibleControlEvent e) { } - public void get_accChild(AccessibleControlEvent e) { + public void getChild(AccessibleControlEvent e) { } - public void get_accChildCount(AccessibleControlEvent e) { + public void getChildCount(AccessibleControlEvent e) { } - public void get_accDefaultAction(AccessibleControlEvent e) { + public void getDefaultAction(AccessibleControlEvent e) { } - public void get_accFocus(AccessibleControlEvent e) { + public void getFocus(AccessibleControlEvent e) { } - public void get_accRole(AccessibleControlEvent e) { + public void getRole(AccessibleControlEvent e) { } - public void get_accSelection(AccessibleControlEvent e) { + public void getSelection(AccessibleControlEvent e) { } - public void get_accState(AccessibleControlEvent e) { + public void getState(AccessibleControlEvent e) { } - public void get_accValue(AccessibleControlEvent e) { + public void getValue(AccessibleControlEvent e) { } - // May not implement - public void accDoDefaultAction(AccessibleControlEvent e) { - } - public void accSelect(AccessibleControlEvent e) { - } - public void get_accParent(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 index d6cffad..545e4b6 100644 --- 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
@@ -6,6 +6,7 @@ */ import org.eclipse.swt.internal.SWTEventObject; +import org.eclipse.swt.widgets.*; /** * Instances of this class are sent as a result of @@ -27,6 +28,7 @@ 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);
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 688ab99..30496c6 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
@@ -19,6 +19,11 @@ * 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. @@ -31,22 +36,27 @@ public void accHitTest(AccessibleControlEvent e); public void accLocation(AccessibleControlEvent e); - public void accNavigate(AccessibleControlEvent e); - public void get_accChild(AccessibleControlEvent e); - public void get_accChildCount(AccessibleControlEvent e); - public void get_accDefaultAction(AccessibleControlEvent e); - public void get_accFocus(AccessibleControlEvent e); - public void get_accRole(AccessibleControlEvent e); - public void get_accSelection(AccessibleControlEvent e); - public void get_accState(AccessibleControlEvent e); - public void get_accValue(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 not implement - public void accDoDefaultAction(AccessibleControlEvent e); - public void accSelect(AccessibleControlEvent e); - public void get_accParent(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 put_accName(AccessibleControlEvent e); - //public void put_accValue(AccessibleControlEvent e); + //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/AccessibleListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleListener.java index 3b7fdee..dd02c0b 100644 --- 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
@@ -18,6 +18,11 @@ * 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 @@ -25,11 +30,43 @@ */ public interface AccessibleListener extends SWTEventListener { - public void get_accName(AccessibleEvent e); - public void get_accHelp(AccessibleEvent e); - public void get_accKeyboardShortcut(AccessibleEvent e); - public void get_accDescription(AccessibleEvent e); + /** + * 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); - // Will not implement (Windows-specific) - //public void get_accHelpTopic(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/ACC.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/ACC.java index 16e4b98..e515f54 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/ACC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/ACC.java
@@ -24,6 +24,7 @@ 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 CO_E_OBJNOTCONNECTED = 0x800401FD; public static final int NAVDIR_UP = 0x1; public static final int NAVDIR_DOWN = 0x2;
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 799891d..37839ae 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.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 @@ private Color[] gradientColors; private int[] gradientPercents; - /** * Create a CLabel with the given border style as a child of parent. */ @@ -79,6 +82,64 @@ } }); +/* Start ACCESSIBILITY */ + getAccessibleObject().addAccessibleListener(new AccessibleAdapter() { + public void getName(AccessibleEvent e) { + if (e.childID == ACC.CHILDID_SELF) { + e.result = getText(); + } + } + + public void getHelp(AccessibleEvent e) { + if (e.childID == ACC.CHILDID_SELF) { + e.result = getToolTipText(); + } + } + + public void getDescription(AccessibleEvent e) { + if (e.childID == ACC.CHILDID_SELF) { + e.result = "This is a CLabel"; + } + } + }); + + getAccessibleObject().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) { + if (e.childID == ACC.CHILDID_SELF) { + 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) { + if (e.childID == ACC.CHILDID_SELF) { + e.code = ACC.ROLE_SYSTEM_STATICTEXT; + } + } + + public void getState(AccessibleControlEvent e) { + if (e.childID == ACC.CHILDID_SELF) { + 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 adc7314..5a5ca68 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
@@ -139,12 +139,6 @@ // tool tip private Shell tip; - -/* Start ACCESSIBILITY */ - Accessible accessible; -/* End ACCESSIBILITY */ - - /** * Construct a CTabFolder with the specified parent and style. * @param parent org.eclipse.swt.widgets.Composite @@ -217,9 +211,8 @@ /* Start ACCESSIBILITY */ - accessible = new Accessible(this); - accessible.addAccessibleListener(new AccessibleAdapter() { - public void get_accDescription(AccessibleEvent e) { + getAccessibleObject().addAccessibleListener(new AccessibleAdapter() { + public void getDescription(AccessibleEvent e) { int childID = e.childID; if (childID > items.length) return; if (childID == ACC.CHILDID_SELF) { @@ -229,7 +222,7 @@ } } - public void get_accHelp(AccessibleEvent e) { + public void getHelp(AccessibleEvent e) { int childID = e.childID; if (childID > items.length) return; if (childID == ACC.CHILDID_SELF) { @@ -240,7 +233,7 @@ } } - public void get_accKeyboardShortcut(AccessibleEvent e) { + public void getKeyboardShortcut(AccessibleEvent e) { int childID = e.childID; if (childID > items.length) return; if (childID != ACC.CHILDID_SELF) { @@ -248,7 +241,7 @@ } } - public void get_accName(AccessibleEvent e) { + public void getName(AccessibleEvent e) { int childID = e.childID; if (childID > items.length) return; if (childID == ACC.CHILDID_SELF) { @@ -260,7 +253,7 @@ } }); - accessible.addAccessibleControlListener(new AccessibleControlAdapter() { + getAccessibleObject().addAccessibleControlListener(new AccessibleControlAdapter() { public void accHitTest(AccessibleControlEvent e) { Point testPoint = toControl(new Point(e.x, e.y)); int childID = ACC.CHILDID_SELF; @@ -302,11 +295,9 @@ if (childID == ACC.CHILDID_SELF) childID = ACC.CHILDID_SELF; break; case ACC.NAVDIR_FIRSTCHILD: - if (childID != ACC.CHILDID_SELF) return; // do this check in Accessible if (items.length > 0) childID = 1; break; case ACC.NAVDIR_LASTCHILD: - if (childID != ACC.CHILDID_SELF) return; // do this check in Accessible if (items.length > 0) childID = items.length; break; case ACC.NAVDIR_LEFT: @@ -319,23 +310,15 @@ if (childID == ACC.CHILDID_SELF) childID = ACC.CHILDID_SELF; if (items.length > 0 && childID < items.length) childID = childID + 1; break; - default: return; // do this check in Accessible } + e.childID = childID; } - public void get_accChild(AccessibleControlEvent e) { - int childID = e.childID; - if (childID > items.length) return; - if (childID == ACC.CHILDID_SELF) { - e.accessible = accessible; - } - } - - public void get_accChildCount(AccessibleControlEvent e) { + public void getChildCount(AccessibleControlEvent e) { e.code = items.length; } - public void get_accDefaultAction(AccessibleControlEvent e) { + public void getDefaultAction(AccessibleControlEvent e) { int childID = e.childID; if (childID > items.length) return; if (childID != ACC.CHILDID_SELF) { @@ -343,7 +326,7 @@ } } - public void get_accRole(AccessibleControlEvent e) { + public void getRole(AccessibleControlEvent e) { int childID = e.childID; if (childID > items.length) return; if (childID == ACC.CHILDID_SELF) { @@ -353,7 +336,7 @@ } } - public void get_accSelection(AccessibleControlEvent e) { + public void getSelection(AccessibleControlEvent e) { if (selectedIndex == -1) { e.childID = ACC.CHILDID_NONE; } else { @@ -361,7 +344,7 @@ } } - public void get_accState(AccessibleControlEvent e) { + public void getState(AccessibleControlEvent e) { int childID = e.childID; if (childID > items.length) return; int state; @@ -375,6 +358,15 @@ } e.code = state; } + + // May need this for IEnumVARIANT + 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 */ }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Accessible.java similarity index 67% rename from bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java rename to bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Accessible.java index ece0d13..8a931f3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Accessible.java
@@ -1,118 +1,53 @@ -package org.eclipse.swt.accessibility; +package org.eclipse.swt.widgets; import java.util.Vector; import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.ole.win32.*; +import org.eclipse.swt.accessibility.*; import org.eclipse.swt.internal.ole.win32.*; public class Accessible { static final boolean debug = true; Control control; - int refCount = 0; - COMObject objIAccessible; + int refCount = 0, enumIndex = 0; + COMObject objIAccessible, objIEnumVARIANT; IAccessible iaccessible; Vector accessibleListeners, accessibleControlListeners; + Object[] variants; public Accessible(Control control) { this.control = control; - control.addListener(SWT.AccessAccessibility, new Listener() { - public void handleEvent(Event event) { - int lParam = ((int []) event.data)[0]; - int wParam = ((int []) event.data)[1]; - if (lParam == COM.OBJID_CLIENT) { - event.detail = ACC.LresultFromObject(COM.IIDIAccessible, wParam, objIAccessible.getAddress()); - } - } - }); - 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]); - } + 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]);} }; - int[] ppvObject = new int[1]; int result = ACC.CreateStdAccessibleObject(control.handle, COM.OBJID_CLIENT, COM.IIDIAccessible, ppvObject); if (result != COM.S_OK) @@ -120,6 +55,16 @@ iaccessible = new IAccessible(ppvObject[0]); iaccessible.AddRef(); //new TypeInfoBrowser(ppvObject[0]); + + 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 void addAccessibleListener(AccessibleListener listener) { @@ -142,9 +87,16 @@ // need removeAccessibleControlListener also + int WM_GETOBJECT (int wParam, int lParam) { + if (lParam == COM.OBJID_CLIENT) { + return ACC.LresultFromObject(COM.IIDIAccessible, wParam, objIAccessible.getAddress()); + } + return 0; + } + int QueryInterface(int arg1, int arg2) { if (debug) - System.out.println("QueryInterface"); + System.out.print("QueryInterface: "); GUID guid = new GUID(); COM.MoveMemory(guid, arg1, GUID.sizeof); @@ -170,11 +122,25 @@ 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("QI other " + result); + System.out.println("other (" + result + ")"); return result; } @@ -252,7 +218,7 @@ if (debug) System.out.println("accLocation " + pxLeft + " " + pyTop + " " + pcxWidth + " " + pcyHeight + " " + varChild_vt + " " + varChild_lVal); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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++) { @@ -271,6 +237,19 @@ System.out.println("accNavigate " + navDir + " " + varStart_vt + " " + varStart_lVal + " " + 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; @@ -310,13 +289,15 @@ if (debug) System.out.println("get_accChild " + varChild_vt + " " + varChild_lVal + " " + ppdispChild); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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.get_accChild(event); + 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); @@ -332,7 +313,7 @@ AccessibleControlEvent event = new AccessibleControlEvent(this); for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); - listener.get_accChildCount(event); + listener.getChildCount(event); } COM.MoveMemory(pcountChildren, new int[] { event.code }, 4); @@ -343,12 +324,12 @@ if (debug) System.out.println("get_accDefaultAction " + varChild_vt + " " + varChild_lVal + " " + pszDefaultAction); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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.get_accDefaultAction(event); + listener.getDefaultAction(event); } if (event.result == null) return COM.S_FALSE; char[] data = (event.result + "\0").toCharArray(); @@ -361,12 +342,12 @@ if (debug) System.out.println("get_accDescription " + varChild_vt + " " + varChild_lVal + " " + pszDescription); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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.get_accDescription(event); + listener.getDescription(event); } if (event.result == null) return COM.S_FALSE; char[] data = (event.result + "\0").toCharArray(); @@ -382,7 +363,7 @@ AccessibleControlEvent event = new AccessibleControlEvent(this); for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); - listener.get_accFocus(event); + listener.getFocus(event); } Accessible accessible = event.accessible; if (accessible != null) { @@ -409,12 +390,12 @@ if (debug) System.out.println("get_accHelp " + varChild_vt + " " + varChild_lVal + " " + pszHelp); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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.get_accHelp(event); + listener.getHelp(event); } if (event.result == null) return COM.S_FALSE; char[] data = (event.result + "\0").toCharArray(); @@ -433,12 +414,12 @@ if (debug) System.out.println("get_accKeyboardShortcut " + pszKeyboardShortcut); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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.get_accKeyboardShortcut(event); + listener.getKeyboardShortcut(event); } if (event.result == null) return COM.S_FALSE; char[] data = (event.result + "\0").toCharArray(); @@ -451,13 +432,15 @@ if (debug) System.out.println("get_accName " + varChild_vt + " " + varChild_lVal + " " + pszName); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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.get_accName(event); + 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); @@ -473,13 +456,15 @@ if (debug) System.out.println("get_accRole " + varChild_vt + " " + varChild_lVal + " " + pvarRole); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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.get_accRole(event); + 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); @@ -491,10 +476,13 @@ System.out.println("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.get_accSelection(event); + 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); @@ -526,13 +514,15 @@ if (debug) System.out.println("get_accState " + varChild_vt + " " + varChild_lVal + " " + pvarState); - if (varChild_vt != COM.VT_I4) return COM.E_INVALIDARG; + 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.get_accState(event); + 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); @@ -547,7 +537,7 @@ event.childID = varChild_lVal; for (int i = 0; i < accessibleControlListeners.size(); i++) { AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i); - listener.get_accValue(event); + listener.getValue(event); } if (event.result == null) return COM.S_FALSE; char[] data = (event.result + "\0").toCharArray(); @@ -569,4 +559,76 @@ 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/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java index 517c505..424a5cb 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
@@ -10,8 +10,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; -import org.eclipse.swt.accessibility.*; - /** * Control is the abstract superclass of all windowed user interface classes. * <p> @@ -42,6 +40,11 @@ String toolTipText; Object layoutData; +/* Start ACCESSIBILITY */ + Accessible accessible; +/* End ACCESSIBILITY */ + + /** * Prevents uninitialized instances from being created outside the package. */ @@ -569,6 +572,28 @@ return true; } +/* Start ACCESSIBILITY */ +/** + * 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> + */ +public Accessible getAccessibleObject () { + checkWidget (); + if (accessible == null) { + accessible = new Accessible(this); + } + return accessible; +} +/* End ACCESSIBILITY */ + /** * Returns the receiver's background color. * @@ -2634,7 +2659,9 @@ 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; @@ -2816,12 +2843,17 @@ return null; } +/* Start ACCESSIBILITY */ LRESULT WM_GETOBJECT (int wParam, int lParam) { - Event event = new Event (); - event.data = new int [] {lParam, wParam}; - sendEvent (SWT.AccessAccessibility, event); - return new LRESULT(event.detail); + if (accessible != null) { + int result = accessible.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;