diff options
author | Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com> | 2011-09-26 14:50:03 -0400 |
---|---|---|
committer | Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com> | 2011-09-27 10:32:43 -0400 |
commit | 7c05ea712090d921560edc39e2f8b7fcc08d357e (patch) | |
tree | 69b5c185d6d6c354bf428fccd0c2b5a4b925adc8 | |
parent | 2e7895aae8f603e283c2908229192019e2a072b7 (diff) | |
download | eclipse.platform.swt-7c05ea712090d921560edc39e2f8b7fcc08d357e.tar.gz eclipse.platform.swt-7c05ea712090d921560edc39e2f8b7fcc08d357e.tar.xz eclipse.platform.swt-7c05ea712090d921560edc39e2f8b7fcc08d357e.zip |
Bug 349978 - need Accessible.sendEvent(int event, Object eventData, int
childID)
6 files changed, 217 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java index 41b55ede69..3f1ee9351d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/carbon/org/eclipse/swt/accessibility/Accessible.java @@ -1662,6 +1662,39 @@ public class Accessible { } /** + * Sends a message with event-specific data and a childID + * to accessible clients, indicating that something has changed + * within a custom control. + * + * NOTE: This API is intended for applications that are still using childIDs. + * Moving forward, applications should use accessible objects instead of childIDs. + * + * @param event an <code>ACC</code> constant beginning with EVENT_* indicating the message to send + * @param eventData an object containing event-specific data, or null if there is no event-specific data + * (eventData is specified in the documentation for individual ACC.EVENT_* constants) + * @param childID an identifier specifying a child of the control + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> + * </ul> + * + * @see ACC#EVENT_DESCRIPTION_CHANGED + * @see ACC#EVENT_LOCATION_CHANGED + * @see ACC#EVENT_NAME_CHANGED + * @see ACC#EVENT_SELECTION_CHANGED + * @see ACC#EVENT_STATE_CHANGED + * @see ACC#EVENT_TEXT_SELECTION_CHANGED + * @see ACC#EVENT_VALUE_CHANGED + * + * @since 3.8 + */ + public void sendEvent(int event, Object eventData, int childID) { + checkWidget(); + // TODO + } + + /** * Sends a message to accessible clients that the child selection * within a custom container control has changed. * diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java index 07f67ab5bd..b44bf9d1c2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java @@ -3150,6 +3150,55 @@ public class Accessible { } /** + * Sends a message with event-specific data and a childID + * to accessible clients, indicating that something has changed + * within a custom control. + * + * NOTE: This API is intended for applications that are still using childIDs. + * Moving forward, applications should use accessible objects instead of childIDs. + * + * @param event an <code>ACC</code> constant beginning with EVENT_* indicating the message to send + * @param eventData an object containing event-specific data, or null if there is no event-specific data + * (eventData is specified in the documentation for individual ACC.EVENT_* constants) + * @param childID an identifier specifying a child of the control + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> + * </ul> + * + * @see ACC#EVENT_DESCRIPTION_CHANGED + * @see ACC#EVENT_LOCATION_CHANGED + * @see ACC#EVENT_NAME_CHANGED + * @see ACC#EVENT_SELECTION_CHANGED + * @see ACC#EVENT_STATE_CHANGED + * @see ACC#EVENT_TEXT_SELECTION_CHANGED + * @see ACC#EVENT_VALUE_CHANGED + * + * @since 3.8 + */ + public void sendEvent(int event, Object eventData, int childID) { + checkWidget(); + + id eventSource = childIDToOs(childID); + if (DEBUG) System.out.println("sendEvent: 0x" + Integer.toHexString(event) + ", data = " + eventData + ", source = " + eventSource); + + switch (event) { + case ACC.EVENT_VALUE_CHANGED: + case ACC.EVENT_STATE_CHANGED: + case ACC.EVENT_SELECTION_CHANGED: + OS.NSAccessibilityPostNotification(eventSource.id, OS.NSAccessibilitySelectedChildrenChangedNotification.id); break; + case ACC.EVENT_TEXT_SELECTION_CHANGED: + OS.NSAccessibilityPostNotification(eventSource.id, OS.NSAccessibilitySelectedTextChangedNotification.id); break; + case ACC.EVENT_LOCATION_CHANGED: + OS.NSAccessibilityPostNotification(eventSource.id, OS.NSAccessibilityMovedNotification.id); break; + case ACC.EVENT_NAME_CHANGED: + case ACC.EVENT_DESCRIPTION_CHANGED: + OS.NSAccessibilityPostNotification(eventSource.id, OS.NSAccessibilityTitleChangedNotification.id); break; + } + } + + /** * Sends a message to accessible clients that the child selection * within a custom container control has changed. * diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/emulated/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/emulated/org/eclipse/swt/accessibility/Accessible.java index 4b2952043a..8eb1c22f81 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/emulated/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/emulated/org/eclipse/swt/accessibility/Accessible.java @@ -672,6 +672,37 @@ public class Accessible { } /** + * Sends a message with event-specific data and a childID + * to accessible clients, indicating that something has changed + * within a custom control. + * + * NOTE: This API is intended for applications that are still using childIDs. + * Moving forward, applications should use accessible objects instead of childIDs. + * + * @param event an <code>ACC</code> constant beginning with EVENT_* indicating the message to send + * @param eventData an object containing event-specific data, or null if there is no event-specific data + * (eventData is specified in the documentation for individual ACC.EVENT_* constants) + * @param childID an identifier specifying a child of the control + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> + * </ul> + * + * @see ACC#EVENT_DESCRIPTION_CHANGED + * @see ACC#EVENT_LOCATION_CHANGED + * @see ACC#EVENT_NAME_CHANGED + * @see ACC#EVENT_SELECTION_CHANGED + * @see ACC#EVENT_STATE_CHANGED + * @see ACC#EVENT_TEXT_SELECTION_CHANGED + * @see ACC#EVENT_VALUE_CHANGED + * + * @since 3.8 + */ + public void sendEvent(int event, Object eventData, int childID) { + } + + /** * Sends a message to accessible clients that the child selection * within a custom container control has changed. * diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java index 73c155fbc9..0f49642983 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java @@ -877,6 +877,50 @@ public class Accessible { } /** + * Sends a message with event-specific data and a childID + * to accessible clients, indicating that something has changed + * within a custom control. + * + * NOTE: This API is intended for applications that are still using childIDs. + * Moving forward, applications should use accessible objects instead of childIDs. + * + * @param event an <code>ACC</code> constant beginning with EVENT_* indicating the message to send + * @param eventData an object containing event-specific data, or null if there is no event-specific data + * (eventData is specified in the documentation for individual ACC.EVENT_* constants) + * @param childID an identifier specifying a child of the control + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> + * </ul> + * + * @see ACC#EVENT_DESCRIPTION_CHANGED + * @see ACC#EVENT_LOCATION_CHANGED + * @see ACC#EVENT_NAME_CHANGED + * @see ACC#EVENT_SELECTION_CHANGED + * @see ACC#EVENT_STATE_CHANGED + * @see ACC#EVENT_TEXT_SELECTION_CHANGED + * @see ACC#EVENT_VALUE_CHANGED + * + * @since 3.8 + */ + public void sendEvent(int event, Object eventData, int childID) { + checkWidget(); + if (accessibleObject != null) { + switch (event) { + case ACC.EVENT_STATE_CHANGED: + case ACC.EVENT_NAME_CHANGED: + case ACC.EVENT_VALUE_CHANGED: + case ACC.EVENT_LOCATION_CHANGED: + case ACC.EVENT_SELECTION_CHANGED: + case ACC.EVENT_TEXT_SELECTION_CHANGED: + case ACC.EVENT_DESCRIPTION_CHANGED: + accessibleObject.sendEvent(event, eventData, childID); + } + } + } + + /** * Sends a message to accessible clients that the child selection * within a custom container control has changed. * diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java index 80896bd377..29f6491c2b 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 @@ -3736,6 +3736,14 @@ class AccessibleObject { } } + void sendEvent(int event, Object eventData, int childID) { + updateChildren (); + AccessibleObject accObject = getChildByID (childID); + if (accObject != null) { + accObject.sendEvent(event, eventData); + } + } + void setFocus (int childID) { updateChildren (); AccessibleObject accObject = getChildByID (childID); 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 24698a6de3..0cf345d1a9 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 @@ -1352,6 +1352,58 @@ public class Accessible { } /** + * Sends a message with event-specific data and a childID + * to accessible clients, indicating that something has changed + * within a custom control. + * + * NOTE: This API is intended for applications that are still using childIDs. + * Moving forward, applications should use accessible objects instead of childIDs. + * + * @param event an <code>ACC</code> constant beginning with EVENT_* indicating the message to send + * @param eventData an object containing event-specific data, or null if there is no event-specific data + * (eventData is specified in the documentation for individual ACC.EVENT_* constants) + * @param childID an identifier specifying a child of the control + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver's control has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver's control</li> + * </ul> + * + * @see ACC#EVENT_DESCRIPTION_CHANGED + * @see ACC#EVENT_LOCATION_CHANGED + * @see ACC#EVENT_NAME_CHANGED + * @see ACC#EVENT_SELECTION_CHANGED + * @see ACC#EVENT_STATE_CHANGED + * @see ACC#EVENT_TEXT_SELECTION_CHANGED + * @see ACC#EVENT_VALUE_CHANGED + * + * @since 3.8 + */ + public void sendEvent(int event, Object eventData, int childID) { + checkWidget(); + if (!UseIA2) return; + int osChildID = childID == ACC.CHILDID_SELF ? eventChildID() : childIDToOs(childID); + if (DEBUG) print(this + ".NotifyWinEvent " + getEventString(event) + " hwnd=" + control.handle + " childID=" + osChildID); + switch (event) { + case ACC.EVENT_STATE_CHANGED: + COM.NotifyWinEvent (COM.EVENT_OBJECT_STATECHANGE, control.handle, COM.OBJID_CLIENT, osChildID); break; + case ACC.EVENT_NAME_CHANGED: + COM.NotifyWinEvent (COM.EVENT_OBJECT_NAMECHANGE, control.handle, COM.OBJID_CLIENT, osChildID); break; + case ACC.EVENT_VALUE_CHANGED: + COM.NotifyWinEvent (COM.EVENT_OBJECT_VALUECHANGE, control.handle, COM.OBJID_CLIENT, osChildID); break; + case ACC.EVENT_LOCATION_CHANGED: + COM.NotifyWinEvent (COM.EVENT_OBJECT_LOCATIONCHANGE, control.handle, COM.OBJID_CLIENT, osChildID); break; + case ACC.EVENT_SELECTION_CHANGED: + COM.NotifyWinEvent (COM.EVENT_OBJECT_SELECTIONWITHIN, control.handle, COM.OBJID_CLIENT, osChildID); break; + case ACC.EVENT_TEXT_SELECTION_CHANGED: + COM.NotifyWinEvent (COM.EVENT_OBJECT_TEXTSELECTIONCHANGED, control.handle, COM.OBJID_CLIENT, osChildID); break; + case ACC.EVENT_DESCRIPTION_CHANGED: + COM.NotifyWinEvent (COM.EVENT_OBJECT_DESCRIPTIONCHANGE, control.handle, COM.OBJID_CLIENT, osChildID); break; + } + } + + + /** * Sends a message to accessible clients that the child selection * within a custom container control has changed. * |