summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>2013-04-26 17:23:50 -0400
committerCarolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>2013-04-26 17:23:50 -0400
commit6b3c7f0839c7bbe5167edd98f5372c12c1468362 (patch)
treed1c7ae7c358cfaa2d6bd8da41f4228cabdc09cfd
parentb22a7d19afbe2a3811a0f8aa54c1e85d92c62a2c (diff)
downloadeclipse.platform.swt-6b3c7f0839c7bbe5167edd98f5372c12c1468362.tar.gz
eclipse.platform.swt-6b3c7f0839c7bbe5167edd98f5372c12c1468362.tar.xz
eclipse.platform.swt-6b3c7f0839c7bbe5167edd98f5372c12c1468362.zip
Bug 405244 - Accessibility: There is no way to supply group position
information for IAccessible2 support
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java84
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java46
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java44
6 files changed, 161 insertions, 25 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
index 1cf770efe7..e157a2aafe 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/ACC.java
@@ -139,7 +139,8 @@ public class ACC {
*
* @see AccessibleControlListener#getChild
*
- * @since 3.6 */
+ * @since 3.6
+ */
public static final int CHILDID_CHILD_AT_INDEX = -4;
/**
@@ -147,7 +148,8 @@ public class ACC {
*
* @see AccessibleControlListener#getChild
*
- * @since 3.6 */
+ * @since 3.6
+ */
public static final int CHILDID_CHILD_INDEX = -5;
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java
index f51f7eb9b4..a96d604c82 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeAdapter.java
@@ -38,6 +38,9 @@ public class AccessibleAttributeAdapter implements AccessibleAttributeListener {
* <li>[out] justify - whether or not to justify the text</li>
* <li>[out] alignment - one of <code>SWT#LEFT</code>, <code>SWT#RIGHT</code> or <code>SWT#CENTER</code></li>
* <li>[out] indent - the indent in pixels</li>
+ * <li>[out] groupLevel - the level of this accessible in its group</li>
+ * <li>[out] groupCount - the number of similar children in this accessible's group</li>
+ * <li>[out] groupIndex - the index of this accessible in its group</li>
* <li>[out] attributes - an array of alternating key and value Strings
* which represent additional (i.e. non predefined) attributes</li>
* </ul>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java
index 87a3a08ba3..02972cc0ac 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeEvent.java
@@ -23,17 +23,96 @@ import org.eclipse.swt.internal.*;
*/
public class AccessibleAttributeEvent extends SWTEventObject {
+ /**
+ * [out] the top margin in pixels
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public int topMargin;
+
+ /**
+ * [out] the bottom margin in pixels
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public int bottomMargin;
+
+ /**
+ * [out] the left margin in pixels
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public int leftMargin;
+
+ /**
+ * [out] the right margin in pixels
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public int rightMargin;
+
+ /**
+ * [out] an array of pixel locations representing tab stops
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public int[] tabStops;
+
+ /**
+ * [out] whether or not to justify the text
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public boolean justify;
+
+ /**
+ * [out] the alignment, which is one of SWT#LEFT, SWT#RIGHT or SWT#CENTER
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public int alignment;
+
+ /**
+ * [out] the indent in pixels
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public int indent;
+
+ /**
+ * [out] the 1-based level of this accessible in its group
+ * (0 means "not applicable")
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ * @since 3.102
+ */
+ public int groupLevel;
+ /**
+ * [out] the 1-based number of similar children in this accessible's group,
+ * including this accessible (0 means "not applicable")
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ * @since 3.102
+ */
+ public int groupCount;
+ /**
+ * [out] the 1-based index of this accessible in its group
+ * (0 means "not applicable")
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ * @since 3.102
+ */
+ public int groupIndex;
+
+ /**
+ * [out] an array of alternating key and value Strings which
+ * represent additional (i.e. non predefined) attributes
+ *
+ * @see AccessibleAttributeListener#getAttributes
+ */
public String [] attributes;
- static final long serialVersionUID = 2237016128901566049L;
+ static final long serialVersionUID = -2894665777259297851L;
/**
* Constructs a new instance of this class.
@@ -60,6 +139,9 @@ public String toString () {
+ " justify=" + justify //$NON-NLS-1$
+ " alignment=" + alignment //$NON-NLS-1$
+ " indent=" + indent //$NON-NLS-1$
+ + " groupLevel=" + groupLevel //$NON-NLS-1$
+ + " groupCount=" + groupCount //$NON-NLS-1$
+ + " groupIndex=" + groupIndex //$NON-NLS-1$
+ "}"; //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java
index da725e01ff..069c0e8abf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/common/org/eclipse/swt/accessibility/AccessibleAttributeListener.java
@@ -41,6 +41,9 @@ public interface AccessibleAttributeListener extends SWTEventListener {
* <li>[out] justify - whether or not to justify the text</li>
* <li>[out] alignment - one of <code>SWT#LEFT</code>, <code>SWT#RIGHT</code> or <code>SWT#CENTER</code></li>
* <li>[out] indent - the indent in pixels</li>
+ * <li>[out] groupLevel - the level of this accessible in its group</li>
+ * <li>[out] groupCount - the number of similar children in this accessible's group</li>
+ * <li>[out] groupIndex - the index of this accessible in its group</li>
* <li>[out] attributes - an array of alternating key and value Strings
* which represent additional (i.e. non predefined) attributes</li>
* </ul>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
index 4a91178906..0a7d6e0843 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java
@@ -879,7 +879,8 @@ class AccessibleObject {
int length = size(listeners);
if (length > 0) {
AccessibleAttributeEvent event = new AccessibleAttributeEvent (accessible);
- event.topMargin = event.bottomMargin = event.leftMargin = event.rightMargin = event.alignment = event.indent = -1;
+ event.topMargin = event.bottomMargin = event.leftMargin = event.rightMargin = event.alignment
+ = event.indent = event.groupLevel = event.groupCount = event.groupIndex = -1;
for (int i = 0; i < length; i++) {
AccessibleAttributeListener listener = (AccessibleAttributeListener)listeners.elementAt (i);
listener.getAttributes (event);
@@ -940,6 +941,49 @@ class AccessibleObject {
parentResult = OS.g_slist_append(parentResult, attrPtr);
}
//TODO - tabStops
+
+ /* Check for group attributes. */
+ int level = (event.groupLevel != -1) ? event.groupLevel : 0;
+ int setsize = (event.groupCount != -1) ? event.groupCount : 0;
+ int posinset = (event.groupIndex != -1) ? event.groupIndex : 0;
+ if (setsize == 0 && posinset == 0) {
+ /* Determine position and count for radio buttons. */
+ Control control = accessible.control;
+ if (control instanceof Button && ((control.getStyle() & SWT.RADIO) != 0)) {
+ Control [] children = control.getParent().getChildren();
+ posinset = 1;
+ setsize = 1;
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (child instanceof Button && ((child.getStyle() & SWT.RADIO) != 0)) {
+ if (child == control) posinset = setsize;
+ else setsize++;
+ }
+ }
+ }
+ }
+ if (level != 0) {
+ long /*int*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof);
+ attr.name = getStringPtr ("level"); //$NON-NLS-1$
+ attr.value = getStringPtr (String.valueOf(level));
+ ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
+ parentResult = OS.g_slist_append(parentResult, attrPtr);
+ }
+ if (setsize != 0) {
+ long /*int*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof);
+ attr.name = getStringPtr ("setsize"); //$NON-NLS-1$
+ attr.value = getStringPtr (String.valueOf(setsize));
+ ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
+ parentResult = OS.g_slist_append(parentResult, attrPtr);
+ }
+ if (posinset != 0) {
+ long /*int*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof);
+ attr.name = getStringPtr ("posinset"); //$NON-NLS-1$
+ attr.value = getStringPtr (String.valueOf(posinset));
+ ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
+ parentResult = OS.g_slist_append(parentResult, attrPtr);
+ }
+
if (event.attributes != null) {
int end = event.attributes.length / 2 * 2;
for (int i = 0; i < end; i+= 2) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
index 59a5572d4b..ffad07d278 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
@@ -2952,32 +2952,34 @@ public class Accessible {
/* IAccessible2::get_groupPosition([out] pGroupLevel, [out] pSimilarItemsInGroup, [out] pPositionInGroup) */
int get_groupPosition(long /*int*/ pGroupLevel, long /*int*/ pSimilarItemsInGroup, long /*int*/ pPositionInGroup) {
- // TODO: handle where possible - maybe add AccessibleGroup later
- //get the role
- //if it has role tree, then the level is the value else 0 (for N/A)
- int groupLevel = 0;
- COM.MoveMemory(pGroupLevel, new int [] { groupLevel }, 4);
- //get the children of the parent
- //count all children with the same role, if none, then 0 (for N/A)
- //find this control's 1-based index in the same-type children of the parent (0 for N/A)
- int similarItemsInGroup = 0;
- int positionInGroup = 0;
- if (control instanceof Button && ((control.getStyle() & SWT.RADIO) != 0)) {
- /* We currently only determine position and count for radio buttons. */
- Control [] children = control.getParent().getChildren();
- positionInGroup = 1;
- similarItemsInGroup = 1;
- for (int i = 0; i < children.length; i++) {
- Control child = children[i];
- if (child instanceof Button && ((child.getStyle() & SWT.RADIO) != 0)) {
- if (child == control) positionInGroup = similarItemsInGroup;
- else similarItemsInGroup++;
+ AccessibleAttributeEvent event = new AccessibleAttributeEvent(this);
+ event.groupLevel = event.groupCount = event.groupIndex = -1;
+ for (int i = 0; i < accessibleAttributeListenersSize(); i++) {
+ AccessibleAttributeListener listener = (AccessibleAttributeListener) accessibleAttributeListeners.elementAt(i);
+ listener.getAttributes(event);
+ }
+ int groupLevel = (event.groupLevel != -1) ? event.groupLevel : 0;
+ int similarItemsInGroup = (event.groupCount != -1) ? event.groupCount : 0;
+ int positionInGroup = (event.groupIndex != -1) ? event.groupIndex : 0;
+ if (similarItemsInGroup == 0 && positionInGroup == 0) {
+ /* Determine position and count for radio buttons. */
+ if (control instanceof Button && ((control.getStyle() & SWT.RADIO) != 0)) {
+ Control [] children = control.getParent().getChildren();
+ positionInGroup = 1;
+ similarItemsInGroup = 1;
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (child instanceof Button && ((child.getStyle() & SWT.RADIO) != 0)) {
+ if (child == control) positionInGroup = similarItemsInGroup;
+ else similarItemsInGroup++;
+ }
}
}
}
+ COM.MoveMemory(pGroupLevel, new int [] { groupLevel }, 4);
COM.MoveMemory(pSimilarItemsInGroup, new int [] { similarItemsInGroup }, 4);
COM.MoveMemory(pPositionInGroup, new int [] { positionInGroup }, 4);
- if (DEBUG) print(this + ".IAccessible2::get_groupPosition() returning" + hresult(groupLevel == 0 && similarItemsInGroup == 0 && positionInGroup == 0 ? COM.S_FALSE : COM.S_OK));
+ if (DEBUG) print(this + ".IAccessible2::get_groupPosition() returning level=" + groupLevel + ", count=" + similarItemsInGroup + ", index=" + positionInGroup + hresult(groupLevel == 0 && similarItemsInGroup == 0 && positionInGroup == 0 ? COM.S_FALSE : COM.S_OK));
if (groupLevel == 0 && similarItemsInGroup == 0 && positionInGroup == 0) return COM.S_FALSE;
return COM.S_OK;
}